home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / library / tidy621 / tidy6.doc < prev    next >
Text File  |  1990-09-25  |  17KB  |  416 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                          TIDY
  11.  
  12.                      A Computer Code for Renumbering and Editing
  13.  
  14.                                FORTRAN Source Programs
  15.  
  16.  
  17.                           Version 6.21 - September 21, 1990
  18.  
  19.  
  20.           by:
  21.  
  22.           Harry M. Murphy, Jr.
  23.           Air Force Weapons Laboratory
  24.           Kirtland AFB, New Mexico
  25.  
  26.  
  27.           FORTRAN-77 Conversion by:
  28.  
  29.           Alan G. Stangenberger
  30.           Dept. of Forestry & Resource Management
  31.           University of California
  32.           Berkeley, CA  94720
  33.  
  34.  
  35.           Copyright (C) 1989, The Regents of the University of California
  36.                               All Rights Reserved
  37.  
  38.           THE REGENTS OF THE UNIVERSITY OF CALIFORNIA MAKE NO
  39.           REPRESENTATION OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF
  40.           AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF
  41.           MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.
  42.  
  43.           Further, the Regents of the University of California reserve the
  44.           right to revise this software and/or documentation and to make
  45.           changes from time to time in the content hereof without
  46.           obligation of the Regents of the University of California to
  47.           notify any person of such revision or change.
  48.  
  49.  
  50.           PERMISSION TO COPY AND DISTRIBUTE THIS PROGRAM, AND TO MAKE
  51.           DERIVATIVE WORKS FROM IT, IS GRANTED PROVIDED THAT THIS COPY-
  52.           RIGHT NOTICE IS RETAINED IN ALL SOURCE CODE AND USER MANUALS.
  53.  
  54.  
  55.  
  56.                                         -2-
  57.  
  58.  
  59.  
  60.           I.  Introduction
  61.  
  62.           The TIDY program renumbers and otherwise cleans up old and tired
  63.           FORTRAN source programs.  TIDY accepts ANSI FORTRAN with 19
  64.           continuation cards as well as some IBM and CDC dialect FORTRAN
  65.           statements. It is designed to work with ANSI FORTRAN-77, and will
  66.           also accept FORTRAN II and FORTRAN IV statements. Certain
  67.           FORTRAN II statements (such as READ INPUT TAPE) are automatically
  68.           translated to their FORTRAN IV equivalents.  All lower case
  69.           alphabetic characters are translated to upper case except for
  70.           those in strings, Hollerith constants, and comment statements.
  71.  
  72.           Although this manual is oriented to MS-DOS computers, this
  73.           version of TIDY has been successfully installed under the UNIX
  74.           (4.3 BSD) and IBM VM/CMS operating systems.
  75.  
  76.           I.1  Modifications
  77.  
  78.           Version 4.0:
  79.  
  80.           The statement continuation character can be set to a single
  81.           character instead of sequential numbers 1, 2, ... if desired.
  82.  
  83.           Automatic generation of an END card at the end of the output
  84.           file can be suppressed if desired.  This allows an INCLUDE file
  85.           to be processed without automatically adding an END card to it.
  86.  
  87.           Hollerith constants (nHf) are normally converted to strings
  88.           delimited by apostrophes.  Optionally, the CDC variants nLf and
  89.           nRf can also be translated.  These features can be disabled if
  90.           desired.
  91.  
  92.           Strings delimited by a character other than an apostrophe can
  93.           be recognized and, optionally, translated to apostrophe-delimited
  94.           strings.
  95.  
  96.           Strings delimited by asterisks (an old CDC feature) are no longer
  97.           automatically recognized.  They can still be processed by the
  98.           new "alternate delimiter" feature noted above.
  99.  
  100.           Version 5.0 - none
  101.  
  102.           Version 6.0:
  103.  
  104.           The character used to denote alternate return addresses in CALL
  105.           statements can now be changed.  The ANSI standard is *, but other
  106.           possibilities exist (IBM Fortran IV used &).  Also, this character
  107.           can be translated if desired.  NOTE THAT THE DEFAULT IS NOW *.
  108.           EARLIER TIDY VERSIONS USED & (IBM Fortran IV form).
  109.  
  110.           I.2  Limitations:
  111.  
  112.           Vendor extensions to ANSI Fortran-77 are not supported.
  113.  
  114.  
  115.  
  116.                                         -3-
  117.  
  118.  
  119.  
  120.           II.  TIDY Control Cards:
  121.  
  122.           TIDY has certain commands which control the program's operation
  123.           and output file formats. These commands may occur in the user
  124.           control file, or anywhere in the FORTRAN source file, and may be
  125.           used to negate a previous command. Default settings are listed
  126.           where meaningful.
  127.  
  128.           TIDY commands must begin with an asterisk in column 1.  The
  129.           remainder of the command consists of a four-letter keyword and
  130.           possibly an equal sign followed by a numeric or alphabetic
  131.           argument.  Commands are negated by prefacing the keyword with the
  132.           letters NO.
  133.  
  134.           The commands which control statement numbering, indentation, and
  135.           serial numbering are grouped separately, followed by
  136.           miscellaneous commands.
  137.  
  138.           II.1.  Statement number control:
  139.  
  140.           TIDY numbers all statements in increasing order.  The user can
  141.           specify the starting number for each routine, and the increment
  142.           between statement numbers.  Additionally, the statement numbers
  143.           can be left- or right-justified as desired.  The commands
  144.           controlling statement numbering are:
  145.  
  146.           Command                         Description
  147.           *******                         ***********
  148.           *LEFT=n.        Left adjust statement numbers to column n. *RIGHT
  149.           *RIGHT=n.       right adjusts statement numbers to end in column
  150.                           n. Default is *LEFT=2.
  151.  
  152.           *BASE=n./       Initializes counter for statement label numbers
  153.           *NOBASE         to n for each program unit.  *NOBASE is
  154.                           equivalent to *BASE=0.  Default is *NOBASE.
  155.  
  156.           *STAT=n.        Set the increment for statement numbers to n.
  157.                           Default is *STAT=10.
  158.  
  159.           *REFE/          Make a cross-reference table between new labels
  160.           *NOREFE         and old labels. *NOREFE suppresses the cross-
  161.                           reference table. Default is *NOREFE.
  162.  
  163.  
  164.  
  165.                                         -4-
  166.  
  167.  
  168.  
  169.           II.2.  Indentation:
  170.  
  171.           TIDY controls the starting column for FORTRAN statements with the
  172.           *COLUMN option.  The default starting column is 7.  If desired,
  173.           the *INDENT option may be used to automatically indent the
  174.           contents of DO-loops and IF-blocks.  The commands which control
  175.           statement positioning are:
  176.  
  177.           Command                         Description
  178.           *******                         ***********
  179.           *COLU=n./       Start FORTRAN statements in column n. *NOCOLU
  180.           *NOCOLU         leaves the first letter of the FORTRAN statement
  181.                           in place. Default is *COLU=7.
  182.  
  183.           *INDEN=n.       Indents statements within DO-loops and IF-blocks.
  184.           *NOINDEN        Maximum value for n is 10.  *NOINDEN turns this
  185.                           option off.  Default is *NOINDEN.
  186.  
  187.  
  188.           II.3.  Serialization control:
  189.  
  190.           Serialization consists of a 1-3 letter code in columns 73-75, a
  191.           4-digit serial number in columns 76-79, and a minus sign in
  192.           column 80 of the END card.  The *SERIAL card is the master card
  193.           which must be used to enable any of the serialization options.
  194.  
  195.           The label field can either be copied from columns 73-75 of each
  196.           FUNCTION, SUBROUTINE, or PROGRAM card (*LABEL option), or it can
  197.           be generated automatically (*NOLABEL option).  The automatic
  198.           label sequence is A, B, ... , Z, AA, AB, ... .  The user can choose
  199.           where to start in this sequence with the *ROUT= card.
  200.  
  201.           To prepare a deck with serial numbers in columns 76-79, but with
  202.           no label, use the *LABE option and leave columns 73-75 of each
  203.           FUNCTION, SUBROUTINE, or PROGRAM card blank.
  204.  
  205.           Command                         Description
  206.           *******                         ***********
  207.           *SERI/          Begin or restore the punching of serialization in
  208.           *NOSERI         columns 73-79. *NOSERI cancels all labelling in
  209.                           columns 73-80. Default is *NOSERI.
  210.  
  211.  
  212.           *ROUT=xy        Reset the alphabetic label in columns 73 - 80 to
  213.                           the characters xy.
  214.  
  215.           *LABE/          Use the labelling from columns 73-75 of the
  216.           *NOLABE         current FUNCTION, SUBROUTINE or PROGRAM card for
  217.                           the sequencing in columns 73-80. *NOLABE turns
  218.                           this option off.  Default is *NOLABE.
  219.  
  220.           *IDST=n.        Set the serial number increment. *IDST and *IDIN
  221.           *IDIN=n.        are identical. This option works only when *SERI
  222.                           is in effect. Default is *IDST=1.
  223.  
  224.  
  225.  
  226.                                         -5-
  227.  
  228.  
  229.           II.4.  String translation:
  230.  
  231.           Since the Hollerith constant (nHf) is being phased out as a way
  232.           to define strings, this version of TIDY can translate Hollerith
  233.           constants to strings delimited by apostrophes.  Any apostrophes
  234.           embedded in such strings will be doubled (e.g. 1H' becomes '''').
  235.           The following options control this process:
  236.  
  237.           *HTRAN=n./      Selects types of Hollerith constants to be changed
  238.           *NOHTRAN        to apostrophe-delimited strings.  1 = Hollerith
  239.                           constants only, 2 = nLf and nRf (CDC variants) only,
  240.                           3 = all types.  *NOHTRAN turns this option off.
  241.                           Default is *HTRAN=1.
  242.  
  243.           *DEL1=x         Defines the primary character used to delimit
  244.                           strings.  Default is apostrophe.
  245.  
  246.           *DEL2=x /       Defines an alternate character used to delimit
  247.           *NODEL2         strings. These strings may be translated by the
  248.                           *DTRAN option.  *NODEL2 means no alternate string
  249.                           delimiter is defined.  Default is *NODEL2.
  250.  
  251.           *DTRAN/         Causes strings delimited by a second type of
  252.           *NODTRAN        delimiter (for example an asterisk) to be changed
  253.                           to strings delimited by the primary delimiter
  254.                           (normally an apostrophe).  Any occurrences of the
  255.                           primary delimiter within such strings will be
  256.                           properly duplicated (for example *'* becomes '''').
  257.                           *NODTRAN turns this option off.  Default is
  258.                           *NODTRAN.
  259.  
  260.           II.5.  Miscellaneous commands:
  261.  
  262.           Command                         Description
  263.           *******                         ***********
  264.           *ANSI/          Issue warning messages for statements which are
  265.           *NOANSI         not part of ANSI Standard FORTRAN-77.  *NOANSI
  266.                           suppresses such messages.  Default is *ANSI.
  267.  
  268.           *ARET=x         The character used to denote alternate return
  269.                           addresses in CALL statements (e.g. CALL F (*1,*2) )
  270.                           is set to x.  Default is * (ANSI standard).
  271.  
  272.           *ARTRAN=x /     On output, the character used to denote alternate
  273.           *NOARTRAN       return addresses in CALL statements (see *ARET
  274.                           above) will be changed to x.  *NOARTRAN prevents
  275.                           this translation.  Default is *NOARTRAN.
  276.  
  277.           *CARD/          Produce a punch file (file containing TIDY'd
  278.           *NOCARD         code). *NOCARD suppresses the creation of the
  279.                           punch file.  Default is *CARD.
  280.  
  281.  
  282.  
  283.                                         -6-
  284.  
  285.  
  286.  
  287.           *CCHR=x/        Use the character specified as x as the continu-
  288.           *NOCCHR         ation character for all continuation lines of a
  289.                           statement.  Default (*NOCCHR) is to number
  290.                           continuation lines as (1, 2, ... 9, X).
  291.  
  292.           *COLL/          Collect format statements at the end of the
  293.           *NOCOLL         routine.  *NOCOLL leaves the format statements in
  294.                           place. Default is *NOCOLL.
  295.  
  296.           *COMM/          Transmit comments to the output.  *NOCOMM deletes
  297.           *NOCOMM         comments from output files. Default is *COMM.
  298.  
  299.           *CONT/          Leave GOTO's and labeled CONTINUE's which are
  300.           *NOCONT         not DO-loop terminators in the code. *NOCONT
  301.                           deletes such CONTINUE's and re-routes GOTO's,
  302.                           unless they are within an IF-block. Default is
  303.                           *NOCONT.
  304.  
  305.           *EXEM/          Exempt non-executable statements from processing.
  306.           *NOEXEM         *NOEXEM forces processing of all statements.
  307.                           Default is *NOEXEM.
  308.  
  309.           *FEND/          *FEND forces an END statement to be written at the
  310.           *NOFEND         end of each routine.  *NOFEND prevents forcing an
  311.                           END statement if one is not needed (such as in an
  312.                           INCLUDE file).  Default is *FEND.
  313.  
  314.           *LAST           This card marks the end of the data to be
  315.           *STOP           processed. *STOP works identically to *LAST. This
  316.                           card is not needed if processing to the end of
  317.                           file.
  318.  
  319.           *LIST/          Write original source to the TIDY listing file.
  320.           *NOLIST         *NOLIST suppresses inclusion of the original
  321.                           source. Default is *LIST.
  322.  
  323.           *LIST = 2./     Write out TIDY'd code to listing file. *NOLIST=2
  324.           *NOLIST = 2.    suppresses the TIDY'd listing. Default is LIST=2.
  325.  
  326.           *NEWRO          Reset everything to starting values.
  327.  
  328.           *SKIP           Skip processing to the end of the current
  329.                           routine.
  330.  
  331.  
  332.  
  333.                                         -7-
  334.  
  335.  
  336.  
  337.           III.  Files
  338.  
  339.           TIDY uses the following files:
  340.  
  341.           Unit    Name    Description
  342.  
  343.             3     USRCON  User control file (optional).  This file, if it
  344.                           exists, is processed before the source file, and
  345.                           can only contain TIDY commands.  It can be used
  346.                           to avoid having to edit the same TIDY commands
  347.                           into every file to be processed.
  348.  
  349.             4     INFILE  The FORTRAN source file to be processed.  May
  350.                           also contain TIDY commands as needed.
  351.  
  352.             6     OUTFIL  List output file.  Normally contains listing of
  353.                           the source file, TIDY diagnostics, and a listing
  354.                           of the TIDY-generated FORTRAN program.
  355.  
  356.             8     PUNFIL  The TIDY-generated FORTRAN program.
  357.  
  358.  
  359.           Scratch and system files (no user prompting):
  360.  
  361.             1     SCFIL1  Scratch files used internally by TIDY.
  362.             2     SCFIL2
  363.  
  364.             0     STDERR  Console output (interactive systems only), used
  365.                           to ask user to enter file names.
  366.  
  367.             0*    STDIN   Console input (interactive systems only), used to
  368.                           interactively enter file names.
  369.                           * On UNIX systems, set STDIN to 5.
  370.  
  371.           IV.  Input Statement Format
  372.  
  373.           TIDY accepts standard FORTRAN statements with statement numbers in
  374.           columns 1-5, continuation code in column 6, and instructions in
  375.           columns 7-72.
  376.  
  377.           TIDY also accepts statements in which a horizontal tab character
  378.           in any of columns 1-6 means that the next character is in column
  379.           7.  Statements with an ampersand (&) in column 1 are interpreted
  380.           as continuation lines.
  381.  
  382.  
  383.  
  384.                                         -8-
  385.  
  386.  
  387.  
  388.  
  389.           V.  Usage
  390.           (MS-DOS Version)
  391.  
  392.           On an MS-DOS system, TIDY is executed by the command TIDY.  All
  393.           file definitions are handled interactively in the order listed
  394.           above.  For the scratch files, the user only specifies the disk
  395.           drive letter on which these files are to be written (it can be a
  396.           RAM-disk if desired).  The scratch files are normally deleted at
  397.           program termination.
  398.  
  399.           The TIDY.EXE file compiled under Professional Fortran requires
  400.           a math coprocessor.  Error 4001 is returned if no coprocessor
  401.           is found.
  402.  
  403.           VI.   Bugs
  404.  
  405.           Problems will arise if strings are delimited by asterisks and if
  406.           the alternate return character in CALL statements is also an
  407.           asterisk.
  408.  
  409.           VII.  Acknowledgments
  410.  
  411.           Many programmers have worked on TIDY and its documentation since
  412.           it was first published by Harry Murphy in 1966.  Among them are
  413.           Gerry Tool (Lawrence Berkeley Laboratory), Alice Barlow (NASA
  414.           Ames), and Roger Chaffee (Stanford Linear Accelerator Center).
  415.  
  416.