home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d528
/
simsmart.lha
/
SimSmart
/
SimSmart.doc
< prev
next >
Wrap
Text File
|
1991-08-05
|
13KB
|
511 lines
=============================================================================
SIMSMART version 2.10 for the Amiga
c 1989 D A Simon
=============================================================================
-----------------
1 - INTRODUCTION
-----------------
WHAT IS SIMSMART ?
------------------
SIMSMART is a general-purpose utility that will allow you to print
the program source code of almost any language, so that (for example) the
keywords are emboldened and underlined, and the comments are italicized.
These features are adjustable by the user, to suit individual taste.
Tabbing is also adjustable, to harmonize with the nesting depth of a
particular program. Output may be either on the printer, the screen, or
to another file.
SIMSMART may easily be extended by the user to deal with extra
languages. In this release, it comes already configured for .....
C
C++
Modula-2
Pascal
68000 Assembler
PostScript
Ada
Amiga BASIC
SIMSMART is ShareWare! If you actually like it, find it of
positive value, and use it regularly, you are asked to send a small
contribution to promote the development of ShareWare (by helping the
author to purchase more tools for his trade) .... But enough of that for
the moment ... please see Section 6 at the end of this file, later on.
HOW DOES IT WORK ?
------------------
SIMSMART is intended to be installed on a WorkBench version 1.3
or later, as it makes extensive use of the ALIASing mechanism of the
AmigaDos Shell. This allows for a very simple way of printing your program
code, for (almost) ANY source language. For example, you may print your
C program on the printer simply by saying ....
CPRT MYPROG.C
or perhaps just examine the neat output on the screen with ....
CSHOW MYPROG.C
The SIMSMART program itself should be placed in the C: directory
of your boot-up disk. The accompanying ..keys and ..com files
should be copied to the S: directory of that disk.
The AmigaDos SHELL is the successor to the old CLI ( Command Line
Interface ). Whenever you call a shell-window, the file S:SHELL-STARTUP
is examined, in order to set up aliases, and so on.
The file S:SHELL-STARTUP should be amended to include suitable
aliases. These aliases will then be ready to use whenever you wish to
print a C or C++ or Modula-2 or Pascal or Ada or PostScript or ... file.
THE PRINTER ( IMPORTANT ! )
---------------------------
Note that your printer should be capable of printing BOLD, ITALIC
and UNDERLINE.
Your WorkBench disk should be correctly configured to use your
printer ...
-- the correct printer driver should be in devs:printers/
-- Preferences should be set correctly for your printer
( If you do not know how to do this, you should read the
Amiga Manual and other Amiga literature ... ).
=============================================================================
-------------------
2 - USING SIMSMART
-------------------
GETTING STARTED
---------------
1) Call a Shell-Window.
2) Change to the directory containing the program file that you wish to
print.
3) EXAMPLE: printing a C program file
( The defaults used here will print your program with EMBOLDENED
RESERVED WORDS and ITALICIZED COMMENTS.
We will consider how to modify these defaults a little later. )
To examine myprog.c on the SCREEN ...
CSHOW myprog.c
To send myprog.c to the PRINTER ...
CPRT myprog.c
To save the neat output in the file NEATPROG.C ...
CSHOW >NEATPROG.C myprog.c
4) ALIASES for OTHER LANGUAGES
In a similar fashion .....
C++PRT/C++SHOW are used for C++ files
MODPRT/MODSHOW are used for Modula-2 files
PASPRT/PASSHOW are used for Pascal files whose COMMENTS are delimited
either by { and } or by (* and *)
AMBPRT/AMBSHOW are used for AmigaBASIC files
ASSEMPRT/ASSEMSHOW are used for 68000-Assembler files
PSPRT/PSSHOW are used for PostScript files
ADAPRT/ADASHOW are used for Ada files
FILES NEEDED TO DESCRIBE A LANGUAGE
-----------------------------------
For SimSmart to be able to handle a particular language, TWO files
must be present to describe the characteristics of the particular language.
These two files are named as ..KEYS and ..COM files; they are usually
placed in the S: directory of the boot-up disk. The SimSmart program itself
should be in the C: directory of the boot-up disk.
The ..KEYS file contains a list of the RESERVED WORDS for the
language. The ..COM file describes the nature of COMMENTS in the
language. The exact format of these files will be considered later.
Each language has a distinct pair of such files. You CAN (if you
wish) make a raw call to SimSmart with the specific command line options to
be described later on. However, the most usual ( and simplest ) way
of calling SimSmart for a particular language will be by means of an ALIAS
that has been set up for that language. This can be effected by editing
the file Shell-Startup (found in the S: directory).
This release already contains files for eight languages. These
aliases should appear in the S:shell-startup file ...
alias cprt SimSmart >prt: -Ks:ckeys -Cs:ccom []
alias cshow SimSmart -Ks:ckeys -Cs:ccom []
alias c++prt SimSmart >prt: -Ks:c++keys -Cs:c++com []
alias c++show SimSmart -Ks:c++keys -Cs:c++com []
alias modprt SimSmart >prt: -Ks:modkeys -Cs:modcom []
alias modshow SimSmart -Ks:modkeys -Cs:modcom []
alias ambprt SimSmart >prt: -Ks:ambkeys -Cs:ambcom []
alias ambshow SimSmart -Ks:ambkeys -Cs:ambcom []
alias pasprt SimSmart >prt: -Ks:paskeys -Cs:pascom []
alias passhow SimSmart -Ks:paskeys -Cs:pascom []
alias psprt SimSmart >prt: -Ks:pskeys -Cs:pscom []
alias psshow SimSmart -Ks:pskeys -Cs:pscom []
alias assemprt SimSmart >prt: -Ks:assemkeys -Cs:assemcom []
alias assemshow SimSmart -Ks:assemkeys -Cs:assemcom []
alias adaprt SimSmart >prt: -Ks:adakeys -Cs:adacom []
alias adashow SimSmart -Ks:adakeys -Cs:adacom []
The defaults used here will print your program with EMBOLDENED
Reserved Words and ITALICIZED Comments.
ARGUMENTS USED when calling SimSmart
------------------------------------
SIMSMART [ >prt: ] -K<keywordfile> -C<commentfile>
[-tnn] [ -r[b][i][u] ] [ -q[s][d][b][i][u] ] <filename>
(A) The ESSENTIAL Command-Line Arguments
The minimum call is as follows ...
SimSmart -K<keywordfile> -C<commentfile> <filename>
<keywordfile> is the FULL PATH to the name of the keyword file.
<commentfile> is the FULL PATH to the name of the comment file.
This comment file contains three lines of text
only -- these three lines describe the
comment-start-string, the comment-end-string,
and how comments are to be displayed
( viz BOLD | ITALIC | UNDERLINE ) .
<filename> is the name of the file to be printed.
(B) The OPTIONAL Command-Line Arguments
-tnn set tabstops to nn spaces.
The default setting is -t4.
A setting of -t0 will switch off detabbing.
-r[b][i][u] set the style of the RESERVED WORDS of this
language ( viz those listed in <keywordfile> )
The default is BOLD.
For example, -rbui
will display Reserved Words in BOLD and ITALIC
and UNDERLINE.
-r ALONE will switch off special treatment of
Reserved Words.
-q Anything enclosed in quotes (either single or
double ) is NORMALLY NOT emboldened or italicized
or underlined.
The -q flag, however, gives you the choice of
highlighting anything enclosed in quotes. This
might be useful perhaps during debugging.
For example ...
-qsbu will highlight with BOLD UNDERLINE everything
that is enclosed in SINGLE quotes
-qdi will ITALICIZE everything that is enclosed
in DOUBLE quotes
-qbiu will highlight with BOLD ITALIC UNDERLINE
everything in SINGLE and DOUBLE quotes
-qsdbiu ... same as -qbiu
>prt: Send output to the printer ( assuming that you have
used Preferences to install the correct printer-
driver for your particular printer -- see Amiga
Manuals )
=============================================================================
-------------------
3 - FILE FORMATS
-------------------
1) The Format of the ..KEYS files
----------------------------------
These files are found in the S: directory. There is one for EACH
LANGUAGE. The file contains a list of Reserved Words for that language,
ONE PER LINE.
If the language can accept either lower case or upper case Reserved
Words, then each word must have TWO entries in the ..KEYS file ( one for
each case ) ... see the file PASKEYS for an example.
Each word should be on a SEPARATE line, with NO LEADING OR TRAILING
WHITE SPACE.
2) The Format of the ..COM files
---------------------------------
These files are found in the S: directory. There is one for EACH
LANGUAGE. The file describes the nature of COMMENTS in that language.
Most ..COM files consists of THREE LINES only.
LINE 1 shows the COMMENT-START string
LINE 2 shows the COMMENT-END string
( or the string "newline" if the comment extends only
to the end-of-line in this particular language )
LINE 3 shows any combination of b|i|u
This line determines the APPEARANCE OF COMMENTS for the
language.
Examples
--------
The file CCOM consists of these three lines ...
/*
*/
i
The file MODCOM consists of these three lines ...
(*
*)
i
The file ASSEMCOM consists of these three lines ...
;
newline
i
HOWEVER -- some languages ( such as Pascal and C++ ) allow MORE THAN
ONE COMMENT STYLE. For these languages the format of the ..COM file
allows for this in the following way ...
LINE 1 consists of ~~ followed by the NUMBER OF DISTINCT
COMMENT STYLES N
( For both Pascal and C++, line 1 is ~~2 )
N PAIRS OF LINES -- where each pair shows the COMMENT-START string
and the COMMENT-END string, as previously.
LAST LINE shows any combination of b|i|u
This line determines the APPEARANCE OF COMMENTS for the
language.
Examples
--------
The file PASCOM consists of these six lines ...
~~2
{
}
(*
*)
i
The file C++COM consists of these six lines ...
~~2
//
newline
/*
*/
i
=============================================================================
----------------------------------
4 - ALTERING THE DEFAULT SETTINGS
----------------------------------
The default settings are for
* ITALICIZED COMMENTS
* EMBOLDENED RESERVED WORDS
The two following examples show how to change the defaults for CPRT.
You can do this by editing the files S:shell-startup and S:ccom
with any ordinary text editor ( such as ED or STEVIE ).
Obviously, you can change the defaults for ANY OTHER ALIAS in the same way.
EXAMPLE 1 : to print C files with EMBOLDENED ITALICIZED Comments
and EMBOLDENED UNDERLINED Reserved Words
First edit the file s:ccom, and change the LAST LINE only,
so that the file will now appear thus ...
/*
*/
bi
Now edit the file s:shell-startup. Change the alias for CPRT
so that it will now appear as follows ...
alias cprt SimSmart >prt: -Ks:ckeys -Cs:ccom -rbu []
EXAMPLE 2 : to print C files with EMBOLDENED UNDERLINED Comments
and ITALICIZED Reserved Words, and with
TWO spaces per tab
First edit the file s:ccom, and change the LAST LINE only,
so that the file will now appear thus ...
/*
*/
bu
Now edit the file s:shell-startup. Change the alias for CPRT
so that it will now appear as follows ...
alias cprt SimSmart >prt: -Ks:ckeys -Cs:ccom -ri -t2 []
=============================================================================
------------------------------------------
5 - EXTENDING SIMSMART FOR OTHER LANGUAGES
------------------------------------------
The manner of setting up the correct ..KEYS and ..COM files
should be obvious from the previous information.
Then merely set up the required aliases in S:shell-startup.
=============================================================================
-------------
6 - SHAREWARE
-------------
This program is ShareWare.
If you use it regularly and find it useful, please send a small
contribution to the author at the address given below.
=============================================================================
Please send any reports, complaints, or manifestations of your munificence
to ...
David Simon
Department of Computer Science
University College of Swansea
SWANSEA SA2 8PP
United Kingdom
Electronic Mail: csdavid@uk.ac.swan.pyr
=============================================================================