home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
indent.zip
/
INDENT.DOC
< prev
next >
Wrap
Text File
|
1987-08-18
|
7KB
|
230 lines
INDENT.EXE
Indent a Program
August 17, 1987
(Terse Instructions)
DESCRIPTION
------------
INDENT is a program which performs indentation on source code
listings. It has been used primarily with dBASE and C --
generally to re-indent programs created by someone using a
nonstandard (i.e. illegible for me) method of indentation.
Since INDENT will work for more than one language, it must use a
language style file to tell it how to perform indentation.
Two such style files are included with the program -- one for
dBASE and one for C. It shouldn't be too difficult to create an
indentation file for other languages, such as PASCAL or
un-numbered BASIC.
INDENT uses tabs or a variable number of spaces to indent
files. Existing indentation is stripped automatically before
re-indentation is performed.
INDENT is released with the usual restrictions, i.e. you may use
the program, transfer it to others, etc. You may not sell the
program or modify the copyright notice. If you like it, please
tell me so, but don't send any money. Of course, the author
assumes no liability for the program's use or misuse.
INDENT was created using DeSmet C. The source code is available
to interested parties for customization or whatever. I would
appreciate hearing comments, suggestions, or bug reports.
Author: Scott A. Clawson
Spinnaker Data Systems
1344 South 1900 East
Salt Lake City, Utah 84108
Phone: (801)975-0409
USAGE
-----
Synopsis: indent filename.ext [s=stylefile][+replace]
Options: s=stylefile
INDENT normally looks for a style file called
"INDENT.STY" in the default directory. If you are
only using INDENT for a single language, rename
INDENT.DOC Page 1
the appropriate style file "INDENT.STY", and you
won't need this option. If your normal style file
is for dBASE and you wish to indent a C program,
you might include "s=c.sty" on the command line to
tell INDENT to use the C.STY style file instead of
INDENT.STY.
+replace
INDENT normally creates an indented file called
filename.IND, where filename is the original name
of the file. If you specify +r on the command
line, INDENT will replace the original file with
the indented version.
EXAMPLES:
---------
1. To re-indent a dBASE program called "STUFF.PRG", assuming that
DBASE.STY has been renamed INDENT.STY and exists in the default
directory:
C>indent stuff.prg <Return>
2. To re-indent a C program called "FOO.C" using the C style file
located in the root directory. Existing file will be replaced by
the indented version:
C>indent foo.c s=\c.sty +r
STYLE FILES:
------------
Style files govern the way INDENT performs indentation. They
basically define words which begin and end indentation.
Comments such as these may be included in the style file, as long
as they are preceded by "C" language comment starts at the
beginning of each line.
Each line should consist of a character or string which starts
indentation, followed by a character or string which stops
indentation, followed by either the character 'Y' or 'N', which
tells the computer whether to indent the final line of an
indentation. These three items should be separated by tabs or
spaces.
For example:
{ }/n
INDENT.DOC Page 2
tells INDENT to begin indentation when encountering a brace, and
to continue until a closing brace is encountered. The final 'N'
tells INDENT to not indent the final closing brace. Some styles
of "C" indentation prefer to leave the final brace indented, so
the 'N' would be changed to a 'Y'.
Options which may be set from within a style file are: -c which
turns off case sensitivity; -tn which tells INDENT to use n
spaces instead of a TAB character when performing indents; and
c=string(tab)string1 which tells INDENT that comments in the
source code begin with "string" and end with "string1".
The following characters have a special meaning to INDENT:
^ Matches the beginning of a line.
_ Matches a space
| Signifies "or"
Following are the style files for dBASE and C with appropriate
comments:
DBASE.STY - dBASE style file
/* dBASE III style file for INDENT.EXE
/* Turn off case sensitivity
-c
/* Use 4 spaces instead of TAB characters
-t4
/* dBASE comments begin with * and end with a CR
c=*
/* Begin with IF and end with either ENDI OR ELSE
^if_ ^endi|^else
/* Begin with ELSE and end with ENDI
^else ^endi
/* Begin with DO WHIL and end with ENDD
^do_whil ^endd
/* Begin with DO CASE and end with ENDC
^do_case ^endc
C.STY - C style file
/* C Style File for INDENT.EXE
/* Comments begin with /* and end with */
c=/* */
/* Begin with { and end with }, no trailing indent
{ }/n
/* Begin with if and end with ; or {
^if ;/y|{/y
/* The indentation is stopped with a '{' to avoid double
/* indentation, since '{' also starts indentation.
else ;/y|{/y
^switch ;/y|{/y
INDENT.DOC Page 3
^case_ case_/n|default/n|}/n
^default }/n|;/y
^while {/y|;/y
^for ;/y|{/y
INDENT.DOC Page 4