home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / indent.zip / INDENT.DOC < prev    next >
Text File  |  1987-08-18  |  7KB  |  230 lines

  1.                                      INDENT.EXE
  2.                                   Indent a Program
  3.                                    August 17, 1987
  4.                                  (Terse Instructions)
  5.  
  6.  
  7.           DESCRIPTION
  8.           ------------
  9.  
  10.           INDENT is a program which performs indentation on source code
  11.           listings.  It has been used primarily with dBASE and C --
  12.           generally to re-indent programs created by someone using a
  13.           nonstandard (i.e. illegible for me) method of indentation.
  14.  
  15.           Since INDENT will work for more than one language, it must use a
  16.           language style file to tell it how to perform indentation. 
  17.           Two such style files are included with the program -- one for
  18.           dBASE and one for C.  It shouldn't be too difficult to create an
  19.           indentation file for other languages, such as PASCAL or
  20.           un-numbered BASIC.
  21.  
  22.           INDENT uses tabs or a variable number of spaces to indent
  23.           files.  Existing indentation is stripped automatically before
  24.           re-indentation is performed.
  25.  
  26.           INDENT is released with the usual restrictions, i.e. you may use
  27.           the program, transfer it to others, etc.  You may not sell the
  28.           program or modify the copyright notice.  If you like it, please
  29.           tell me so, but don't send any money.  Of course, the author
  30.           assumes no liability for the program's use or misuse.
  31.  
  32.           INDENT was created using DeSmet C.  The source code is available
  33.           to interested parties for customization or whatever.  I would
  34.           appreciate hearing comments, suggestions, or bug reports.
  35.  
  36.           Author:        Scott A. Clawson
  37.                          Spinnaker Data Systems
  38.                          1344 South 1900 East
  39.                          Salt Lake City, Utah 84108
  40.                          Phone: (801)975-0409
  41.  
  42.  
  43.  
  44.           USAGE
  45.           -----
  46.  
  47.           Synopsis:      indent filename.ext [s=stylefile][+replace]
  48.  
  49.           Options:       s=stylefile
  50.                          INDENT normally looks for a style file called
  51.                          "INDENT.STY" in the default directory.  If you are
  52.                          only using INDENT for a single language, rename
  53.  
  54.  
  55.  
  56.  
  57.           INDENT.DOC                                                 Page 1
  58.                          the appropriate style file "INDENT.STY", and you
  59.                          won't need this option.  If your normal style file
  60.                          is for dBASE and you wish to indent a C program,
  61.                          you might include "s=c.sty" on the command line to
  62.                          tell INDENT to use the C.STY style file instead of
  63.                          INDENT.STY.
  64.  
  65.                          +replace
  66.                          INDENT normally creates an indented file called
  67.                          filename.IND, where filename is the original name
  68.                          of the file.  If you specify +r on the command
  69.                          line, INDENT will replace the original file with
  70.                          the indented version.
  71.  
  72.  
  73.  
  74.           EXAMPLES:
  75.           ---------
  76.  
  77.           1. To re-indent a dBASE program called "STUFF.PRG", assuming that
  78.           DBASE.STY has been renamed INDENT.STY and exists in the default
  79.           directory:
  80.  
  81.           C>indent stuff.prg <Return>
  82.  
  83.           2. To re-indent a C program called "FOO.C" using the C style file
  84.           located in the root directory.  Existing file will be replaced by
  85.           the indented version:
  86.  
  87.           C>indent foo.c s=\c.sty +r
  88.  
  89.  
  90.           STYLE FILES:
  91.           ------------
  92.  
  93.           Style files govern the way INDENT performs indentation.  They
  94.           basically define words which begin and end indentation.
  95.  
  96.           Comments such as these may be included in the style file, as long
  97.           as they are preceded by "C" language comment starts at the
  98.           beginning of each line.
  99.  
  100.           Each line should consist of a character or string which starts
  101.           indentation, followed by a character or string which stops
  102.           indentation, followed by either the character 'Y' or 'N', which
  103.           tells the computer whether to indent the final line of an
  104.           indentation.  These three items should be separated by tabs or
  105.           spaces.
  106.  
  107.           For example:
  108.           {         }/n
  109.  
  110.  
  111.  
  112.  
  113.  
  114.           INDENT.DOC                                                 Page 2
  115.           tells INDENT to begin indentation when encountering a brace, and
  116.           to continue until a closing brace is encountered.  The final 'N'
  117.           tells INDENT to not indent the final closing brace.  Some styles
  118.           of "C" indentation prefer to leave the final brace indented, so
  119.           the 'N' would be changed to a 'Y'.
  120.  
  121.           Options which may be set from within a style file are: -c which
  122.           turns off case sensitivity;  -tn which tells INDENT to use n
  123.           spaces instead of a TAB character when performing indents; and
  124.           c=string(tab)string1 which tells INDENT that comments in the
  125.           source code begin with "string" and end with "string1".
  126.  
  127.           The following characters have a special meaning to INDENT:
  128.           ^    Matches the beginning of a line.
  129.           _    Matches a space
  130.           |    Signifies "or"
  131.  
  132.           Following are the style files for dBASE and C with appropriate
  133.           comments:
  134.  
  135.           DBASE.STY - dBASE style file
  136.  
  137.           /*   dBASE III style file for INDENT.EXE
  138.           /*   Turn off case sensitivity
  139.           -c
  140.           /*   Use 4 spaces instead of TAB characters
  141.           -t4
  142.           /*   dBASE comments begin with * and end with a CR
  143.           c=*
  144.           /*   Begin with IF and end with either ENDI OR ELSE
  145.           ^if_ ^endi|^else
  146.           /*   Begin with ELSE and end with ENDI
  147.           ^else     ^endi
  148.           /*   Begin with DO WHIL and end with ENDD
  149.           ^do_whil       ^endd
  150.           /*   Begin with DO CASE and end with ENDC
  151.           ^do_case       ^endc
  152.  
  153.  
  154.           C.STY - C style file
  155.  
  156.           /*   C Style File for INDENT.EXE
  157.           /*   Comments begin with /* and end with */
  158.           c=/*      */
  159.           /*   Begin with { and end with }, no trailing indent
  160.           {         }/n
  161.           /*   Begin with if and end with ; or {
  162.           ^if       ;/y|{/y
  163.           /*   The indentation is stopped with a '{' to avoid double
  164.           /*   indentation, since '{' also starts indentation.
  165.           else      ;/y|{/y
  166.           ^switch   ;/y|{/y
  167.  
  168.  
  169.  
  170.  
  171.           INDENT.DOC                                                 Page 3
  172.           ^case_    case_/n|default/n|}/n
  173.           ^default  }/n|;/y
  174.           ^while    {/y|;/y
  175.           ^for      ;/y|{/y
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.           INDENT.DOC                                                 Page 4
  229.  
  230.