home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / fortran / tidy64.zip / TIDY.MAN < prev    next >
Text File  |  1994-02-05  |  22KB  |  595 lines

  1.  
  2.  
  3.  
  4.                                                                         1
  5.  
  6.  
  7.  
  8.                                         TIDY
  9.  
  10.                     A Computer Code for Renumbering and Editing
  11.                               FORTRAN Source Programs
  12.                             Version 6.4  - February 1994
  13.  
  14.             by:
  15.  
  16.             Harry M. Murphy, Jr.
  17.             Air Force Weapons Laboratory
  18.             Kirtland AFB, New Mexico
  19.  
  20.             FORTRAN-77 Conversion by:
  21.             Alan G. Stangenberger
  22.             Dept. of Forestry & Resource Management
  23.             University of California
  24.             Berkeley, CA  94720
  25.             (forags@nature.berkeley.edu)
  26.  
  27.  
  28.  
  29.             Copyright (C) 1989, The Regents of the University of
  30.             California All Rights Reserved
  31.             THE REGENTS OF THE UNIVERSITY OF CALIFORNIA MAKE NO
  32.             REPRESENTATION OR WARRANTIES WITH RESPECT TO THE CONTENTS
  33.             HEREOF AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF
  34.             MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.
  35.             Further, the Regents of the University of California reserve
  36.             the right to revise this software and/or documentation and
  37.             to make changes from time to time in the content hereof
  38.             without obligation of the Regents of the University of
  39.             California to notify any person of such revision or change.
  40.  
  41.             PERMISSION TO COPY AND DISTRIBUTE THIS PROGRAM, AND TO MAKE
  42.             DERIVATIVE WORKS FROM IT, IS GRANTED PROVIDED THAT THIS
  43.             COPYRIGHT NOTICE IS RETAINED IN ALL SOURCE CODE AND USER
  44.             MANUALS.
  45.  
  46.  
  47.  
  48.             I.  Introduction
  49.  
  50.             The TIDY program renumbers and otherwise cleans up old and
  51.             tired FORTRAN source programs.  TIDY accepts ANSI FORTRAN
  52.             with 19 continuation cards as well as some IBM and CDC
  53.             dialect FORTRAN statements. It is designed to work with ANSI
  54.             FORTRAN-77, and will also accept FORTRAN II and FORTRAN IV
  55.             statements. Certain FORTRAN II statements (such as READ
  56.             INPUT TAPE) are automatically translated to their FORTRAN IV
  57.             equivalents.  All lower case alphabetic characters are
  58.             normally translated to upper case except for those in
  59.             strings, Hollerith constants, and comment statements.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                                         2
  71.  
  72.  
  73.             Although this manual is oriented to MS-DOS computers, this
  74.             version of TIDY has been successfully installed under the
  75.             UNIX (4.3 BSD) and IBM VM/CMS operating systems.
  76.  
  77.             I.1  Modifications
  78.  
  79.             Version 4.0:
  80.             The statement continuation character can be set to a single
  81.             character instead of sequential numbers 1, 2, ... if
  82.             desired.
  83.  
  84.             Automatic generation of an END card at the end of the output
  85.             file can be suppressed if desired.  This allows an INCLUDE
  86.             file to be processed without automatically adding an END
  87.             card to it.
  88.  
  89.             Hollerith constants (nHf) are normally converted to strings
  90.             delimited by apostrophes.  Optionally, the CDC variants nLf
  91.             and nRf can also be translated.  These features can be
  92.             disabled if desired.
  93.  
  94.             Strings delimited by a character other than an apostrophe
  95.             can be recognized and, optionally, translated to apostrophe-
  96.             delimited strings.
  97.  
  98.             Strings delimited by asterisks (an old CDC feature) are no
  99.             longer automatically recognized.  They can still be
  100.             processed by the new "alternate delimiter" feature noted
  101.             above.
  102.  
  103.             Version 5.0 - none
  104.  
  105.             Version 6.0:
  106.             The character used to denote alternate return addresses in
  107.             CALL statements can now be changed.  The ANSI standard is *,
  108.             but other possibilities exist (IBM Fortran IV used &).
  109.             Also, this character can be translated if desired.  NOTE
  110.             THAT THE DEFAULT IS NOW *. EARLIER TIDY VERSIONS USED & (IBM
  111.             Fortran IV form).
  112.  
  113.             Version 6.22: *FSPL, *BLAN, *HLOG options added. Non-ANSI
  114.             warning for REAL*8 etc.
  115.  
  116.             Version 6.3: DO - ENDDO loops automatically translated to
  117.             standard Fortran-77.
  118.  
  119.             Version 6.32: added *CASE option;  Handle DO 10,I=1,N;
  120.             Limited DO WHILE support.
  121.  
  122.             Version 6.4: changed case translation to control-card option
  123.             so special recompilation for lower-case translation not
  124.             necessary.  Added ability to retain DO-ENDDO loops.  Fixed
  125.             bug in *LEFT/*RIGHT controls.  Added fatal error for
  126.             comments within continued statements.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                                         3
  137.  
  138.  
  139.  
  140.             I.2  Limitations:
  141.  
  142.             The only vendor extension to ANSI Fortran-77 which is
  143.             supported is DO-ENDDO loops.  All other extensions are not
  144.             supported.
  145.  
  146.             II.  TIDY Control Cards:
  147.  
  148.             TIDY has certain commands which control the program's
  149.             operation and output file formats. These commands may occur
  150.             in the user control file, or anywhere in the FORTRAN source
  151.             file, and may be used to negate a previous command. Default
  152.             settings are listed where meaningful.
  153.  
  154.             TIDY commands must begin with an asterisk in column 1.  The
  155.             remainder of the command consists of a four-letter keyword
  156.             and possibly an equal sign followed by a numeric or
  157.             alphabetic argument.  Commands are negated by prefacing the
  158.             keyword with the letters NO.
  159.  
  160.             The commands which control statement numbering, indentation,
  161.             and serial numbering are grouped separately, followed by
  162.             miscellaneous commands.
  163.  
  164.             II.1.  Statement number control:
  165.  
  166.             TIDY numbers all statements in increasing order.  The user
  167.             can specify the starting number for each routine, and the
  168.             increment between statement numbers.  Additionally, the
  169.             statement numbers can be left- or right-justified as
  170.             desired.  The commands controlling statement numbering are:
  171.  
  172.             Command        Description
  173.             *******        ***********
  174.  
  175.             *LEFT=n. /     Left adjust statement numbers to column n.
  176.             *RIGHT=n.      *RIGHT right adjusts statement numbers to end
  177.                            in column n. Default is *LEFT=2.
  178.  
  179.             *BASE=n. /     Initializes counter for statement label
  180.             *NOBASE        numbers to n for each program unit.  *NOBASE
  181.                            is equivalent to *BASE=0.  Default is
  182.                            *NOBASE.
  183.  
  184.             *STAT=n.       Set the increment for statement numbers to n.
  185.                            Default is *STAT=10.
  186.  
  187.             *REFE /        Make a cross-reference table between new
  188.             *NOREFE        labels and old labels. *NOREFE suppresses the
  189.                            cross-reference table. Default is *NOREFE.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                                         4
  203.  
  204.  
  205.  
  206.             II.2.  Indentation:
  207.             TIDY controls the starting column for FORTRAN statements
  208.             with the *COLUMN option.  The default starting column is 7.
  209.             If desired, the *INDENT option may be used to automatically
  210.             indent the contents of DO-loops and IF-blocks.  The commands
  211.             which control statement positioning are:
  212.  
  213.  
  214.             Command        Description
  215.             *******        ***********
  216.  
  217.             *COLU=n./      Start FORTRAN statements in column n. *NOCOLU
  218.             *NOCOLU        leaves the first letter of the FORTRAN
  219.                            statement in place. Default is *COLU=7.
  220.  
  221.             *INDEN=n.      Indents statements within DO-loops and IF-
  222.             *NOINDEN       blocks. Maximum value for n is 10.  *NOINDEN
  223.                            turns this option off.  Default is *NOINDEN.
  224.  
  225.             *FSPL /        This option controls the treatment of strings
  226.             *NOFSPL        in FORMAT statements when indentation is used
  227.                            and the FORMAT statements are not collected
  228.                            at the end of each routine.  If *FSPL is
  229.                            selected, a string which spans two cards will
  230.                            be broken into two strings, and the
  231.                            continuation card will be indented under the
  232.                            FORMAT statement.  If *NOFSPL is selected,
  233.                            the string will not be split into two parts,
  234.                            and the continuation card's text will begin
  235.                            in column 7. Since splitting strings in a
  236.                            FORMAT statement may adversely affect
  237.                            readability, the default is *NOFSPL.
  238.  
  239.             II.3.  Serialization control:
  240.  
  241.             Serialization consists of a 1-3 letter code in columns 73-
  242.             75, a 4-digit serial number in columns 76-79, and a minus
  243.             sign in column 80 of the END card.  The *SERIAL card is the
  244.             master card which must be used to enable any of the
  245.             serialization options.
  246.  
  247.             The label field can either be copied from columns 73-75 of
  248.             each FUNCTION, SUBROUTINE, or PROGRAM card (*LABEL option),
  249.             or it can be generated automatically (*NOLABEL option).  The
  250.             automatic label sequence is A, B, ... , Z, AA, AB, ... .
  251.             The user can choose where to start in this sequence with the
  252.             *ROUT= card.
  253.  
  254.             To prepare a deck with serial numbers in columns 76-79, but
  255.             with no label, use the *LABE option and leave columns 73-75
  256.             of each FUNCTION, SUBROUTINE, or PROGRAM card blank.
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                                                         5
  269.  
  270.  
  271.             Command        Description
  272.             *******        ***********
  273.  
  274.             *SERI /        Begin or restore the punching of
  275.             *NOSERI        serialization in columns 73-79. *NOSERI
  276.                            cancels all labelling in columns 73-80.
  277.                            Default is *NOSERI.
  278.  
  279.             *ROUT=xy       Reset the alphabetic label in columns 73 - 80
  280.                            to the characters xy.
  281.  
  282.             *LABE /        Use the labelling from columns 73-75 of the
  283.             *NOLABE        current FUNCTION, SUBROUTINE or PROGRAM card
  284.                            for the sequencing in columns 73-80. *NOLABE
  285.                            turns this option off.  Default is *NOLABE.
  286.  
  287.             *IDST=n. /     Set the serial number increment. *IDST and
  288.             *IDIN=n.       *IDIN are identical. This option works only
  289.                            when *SERI is in effect. Default is *IDST=1.
  290.  
  291.             II.4.  String translation:
  292.  
  293.             Since the Hollerith constant (nHf) is being phased out as a
  294.             way to define strings, this version of TIDY can translate
  295.             Hollerith constants to strings delimited by apostrophes.
  296.             Any apostrophes embedded in such strings will be doubled
  297.             (e.g. 1H' becomes '''').
  298.  
  299.             The following options control this process:
  300.  
  301.             Command        Description
  302.             *******        ***********
  303.  
  304.             *HTRAN=n./     Selects types of Hollerith constants to be
  305.             *NOHTRAN       changed to apostrophe-delimited strings.  1 =
  306.                            Hollerith constants only, 2 = nLf and nRf
  307.                            (CDC variants) only, 3 = all types.  *NOHTRAN
  308.                            turns this option off. Default is *HTRAN=1.
  309.  
  310.             *HLOG /        As an aid to identifying variables which
  311.             *NOHLOG        should be typed as CHARACTER in Fortran-77,
  312.                            executable statements in which Hollerith
  313.                            constants have been converted to delimited
  314.                            strings can be identified in the listing
  315.                            file. Default is *NOHLOG.
  316.  
  317.             *DEL1=x        Defines the primary character used to delimit
  318.                            strings.  Default is apostrophe.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                                         6
  335.  
  336.  
  337.             *DEL2=x /      Defines an alternate character used to
  338.             *NODEL2        delimit strings. These strings may be
  339.                            translated by the *DTRAN option.  *NODEL2
  340.                            means no alternate string delimiter is
  341.                            defined.  Default is *NODEL2.
  342.  
  343.             *DTRAN /       Causes strings delimited by a second type of
  344.             *NODTRAN       delimiter (for example an asterisk) to be
  345.                            changed to strings delimited by the primary
  346.                            delimiter (normally an apostrophe).  Any
  347.                            occurrences of the primary delimiter within
  348.                            such strings will be properly duplicated (for
  349.                            example *'* becomes ''''). *NODTRAN turns
  350.                            this option off.  Default is *NODTRAN.
  351.  
  352.             II.5.  Miscellaneous commands:
  353.  
  354.  
  355.             Command        Description
  356.             *******        ***********
  357.  
  358.             *ANSI /        Issue warning messages for statements which
  359.             *NOANSI        are not part of ANSI Standard FORTRAN-77.
  360.                            *NOANSI suppresses such messages.  Default is
  361.                            *ANSI.
  362.  
  363.             *ARET=x        The character used to denote alternate return
  364.                            addresses in CALL statements (e.g. CALL F
  365.                            (*1,*2) ) is set to x.  Default is * (ANSI
  366.                            standard).
  367.  
  368.             *ARTRAN=x /    On output, the character used to denote
  369.             *NOARTRAN      alternate return addresses in CALL statements
  370.                            (see *ARET above) will be changed to x.
  371.                            *NOARTRAN prevents this translation.  Default
  372.                            is *NOARTRAN.
  373.  
  374.             *CARD /        Produce a punch file (file containing TIDY'd
  375.             *NOCARD        code). *NOCARD suppresses the creation of the
  376.                            punch file.  Default is *CARD.
  377.  
  378.             *UCASE /       Translate all characters which are not in
  379.             *LCASE /       strings or comment statements to upper case
  380.             *NOCASE        (*UCASE), or to lower case(*LCASE).  *NOCASE
  381.                            suppresses case translation, thus allowing
  382.                            mixed-case statements (such as Total=0).
  383.                            Default is *UCASE.
  384.  
  385.             *CCHR=x /      Use the character specified as x as the
  386.             *NOCCHR        continuation character for all continuation
  387.                            lines of a statement.  Default (*NOCCHR) is
  388.                            to number continuation lines as (1, 2, ... 9,
  389.                            X).
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                                         7
  401.  
  402.  
  403.             *COLL /        Collect format statements at the end of the
  404.             *NOCOLL        routine.  *NOCOLL leaves the format
  405.                            statements in place. Default is *NOCOLL.
  406.  
  407.             *COMM /        Transmit comments to the output.  *NOCOMM
  408.             *NOCOMM        deletes comments from output files. Default
  409.                            is *COMM.
  410.  
  411.             *BLAN /        Retain blank lines in output files.  *NOBLAN
  412.             *NOBLAN        deletes blank lines.  Default is *BLAN.
  413.  
  414.             *CONT /        Leave GOTO's and labeled CONTINUE's which are
  415.             *NOCONT        not DO-loop terminators in the code. *NOCONT
  416.                            deletes such CONTINUE's and re-routes GOTO's,
  417.                            unless they are within an IF-block. Default
  418.                            is *NOCONT.
  419.  
  420.             *ENDO /        Leave DO-END DO loops in the code.  *NOENDO
  421.             *NOENDO        causes these loops to be converted to
  422.                            conventional numbered DO-loops which
  423.                            terminate with CONTINUE statements. Default
  424.                            is *NOENDO.
  425.  
  426.             *EXEM /        Exempt non-executable statements from
  427.             *NOEXEM        processing. *NOEXEM forces processing of all
  428.                            statements. Default is *NOEXEM.
  429.  
  430.             *FEND /        *FEND forces an END statement to be written
  431.             *NOFEND        at the end of each routine.  *NOFEND prevents
  432.                            forcing an END statement if one is not needed
  433.                            (such as in an INCLUDE file).  Default is
  434.                            *FEND.
  435.  
  436.             *LIST /        Write original source to the TIDY listing
  437.             *NOLIST        file. *NOLIST suppresses inclusion of the
  438.                            original source. Default is *LIST.
  439.  
  440.             *LIST = 2. /   Write out TIDY'd code to listing file.
  441.             *NOLIST = 2.   *NOLIST=2 suppresses the TIDY'd listing.
  442.                            Default is LIST=2.
  443.  
  444.             *NEWRO         Reset everything to starting values.
  445.  
  446.             *SKIP          Skip processing to the end of the current
  447.                            routine.
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                                         8
  467.  
  468.  
  469.  
  470.             III.  Files
  471.  
  472.             TIDY uses the following files:
  473.  
  474.             Unit Name        Description
  475.  
  476.             3    USRCON      User control file (optional).  This file,
  477.                              if it exists, is processed before the
  478.                              source file, and can only contain TIDY
  479.                              commands.  It can be used to avoid having
  480.                              to edit the same TIDY commands into every
  481.                              file to be processed.
  482.  
  483.             4    INFILE      The FORTRAN source file to be processed.
  484.                              May also contain TIDY commands as needed.
  485.  
  486.             6    OUTFIL      List output file.  Normally contains
  487.                              listing of the source file, TIDY
  488.                              diagnostics, and a listing of the TIDY-
  489.                              generated FORTRAN program.
  490.  
  491.             8    PUNFIL      The TIDY-generated FORTRAN program.
  492.  
  493.             Scratch and system files (no user prompting):
  494.  
  495.             1    SCFIL1      Scratch file used internally by TIDY.
  496.  
  497.             2    SCFIL2      Scratch file used internally by TIDY.
  498.  
  499.             0    STDERR      Console output (interactive systems only),
  500.                              used to ask user to enter file names.
  501.  
  502.             0*   STDIN       Console input (interactive systems only),
  503.                              used to interactively enter file names. *
  504.                              On UNIX systems, set STDIN to 5.
  505.  
  506.             IV.  Input Statement Format
  507.  
  508.             TIDY accepts standard FORTRAN statements with statement
  509.             numbers in columns 1-5, continuation code in column 6, and
  510.             instructions in columns 7-72.
  511.  
  512.             TIDY also accepts statements in which a horizontal tab
  513.             character in any of columns 1-6 means that the next
  514.             character is in column 7.  Statements with an ampersand (&)
  515.             in column 1 are interpreted as continuation lines.
  516.  
  517.  
  518.             V.  Usage (MS-DOS Version)
  519.  
  520.             On an MS-DOS system, TIDY is executed by the command TIDY.
  521.             All file definitions are handled interactively in the order
  522.             listed above.  For the scratch files, the user only
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                                         9
  533.  
  534.  
  535.             specifies the disk drive letter on which these files are to
  536.             be written (it can be a RAM-disk if desired).  The scratch
  537.             files are normally deleted at program termination.
  538.             The TIDY.EXE file compiled under Professional Fortran
  539.             requires a math coprocessor.  Error 4001 is returned if no
  540.             coprocessor is found.
  541.  
  542.             VI.   Bugs
  543.  
  544.             Problems will arise if strings are delimited by asterisks
  545.             and if the alternate return character in CALL statements is
  546.             also an asterisk.
  547.  
  548.             TIDY will not properly process statements which have
  549.             continuation cards and have comment statements within the
  550.             continued statement;  starting with version 6.4 this is an
  551.             immediately fatal error.
  552.  
  553.             VII.  Acknowledgments
  554.  
  555.             Many programmers have worked on TIDY and its documentation
  556.             since it was first published by Harry Murphy in 1966.  Among
  557.             them are Gerry Tool (Lawrence Berkeley Laboratory), Alice
  558.             Barlow (NASA Ames Research Center), and Roger Chaffee
  559.             (Stanford Linear Accelerator Center).
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.