Previous: port Up: ../plot79.html Next: slides


Table of contents


GENERAL-INFORMATION

                         - PRETTY -
               A FORTRAN Program Prettyprinter

          PRETTY is  a program  written in  Portable  FORTRAN
 which  processes  an  input file  of  FORTRAN  routines  and
 produces an  edited output  file and  listing in  which  all
 statement numbers have been replaced by numbers in ascending
 order  with a  uniform  increment,  and DO  loops  indented.
 Facilities are  available for  changing precision  (both  in
 constants and  function calls), converting strings delimited
 by quotes (or  other specified characters) to ANSI Hollerith
 strings, conversion of  FORTRAN II I/O statements to FORTRAN
 IV  statements, and others.  Extensive  documentation may be
 found in  the PRETTY User's Guide,  available from 210 South
 Physics.


DECSYSTEM-20-INVOCATION-OF-PRETTY

          For  use  on   the  DECSYSTEM-20,  options  may  be
 provided either  interactively, or  in a  file with  default
 extension ".DEF".  Output of  PRETTY will  be on  the  files
 xxxxxx.NEW   (output  routines)   and   xxxxxx.LST   (output
 listing).   PRETTY  may  be  invoked  interactively  by  the
 command

 @PRETTY

 after which  the user  will be  queried for  file names  and
 input  options. A shorter  form is simply to  place the file
 names on the command line:

 @PRETTY oldfile,newfile,listingfile,optionfile

          The  FORTIO package  (type HELP FORTIO)  is used to
 open  the files and  access the command line.   Thus, if any
 files  are omitted,  the previous  file names,  but with the
 default extensions (.FOR, .NEW, .LST, and .DEF respectively)
 will  be assumed.  File names  may alternatively be provided
 in a file named  PRETTY.CMD, one per line. Once a convenient
 set  of input  options has  been found  which is  to be used
 repeatedly, it  will usually be convenient  if these are put
 in a file named PRETTY.DEF.  PRETTY will use that file if it
 cannot  find the  option  file  of the  specified  name.  If
 neither exist,  the  option file  will  be directed  to  the
 terminal and input prompts will be issued.

          In batch mode, the control card file should contain

 @PRETTY
 *oldfile
 *newfile
 *listingfile
 *optionfile
 *...option list if optionfile=TTY...(may use up to 10 lines)

          For  DECSYSTEM-20 use, one new  option, SEQNUM, has
 been  defined. It  defaults to .FALSE.,  indicating that the
 output  source file will  not be sequenced  in columns 73-80
 and  that trailing  blanks will  be removed  from each line.
 This   gives  a   substantial  reduction   in  disk  storage
 requirements.   Setting   SEQNUM=.TRUE.   will   result   in
 sequencing.

          PRETTY  will  NOT perform  properly  if  the  input
 source file contains TAB  characters.  These are not part of
 standard FORTRAN and will not be accepted on most computers.
 If your file has TAB  characters, they may be removed by the
 DETAB  utility.  (Type HELP  DETAB  for  more  information).
 Similarly, it will not recognize FORTRAN statements in which
 lower-case letters are used in the keywords.  Lower-case is,
 however,  perfectly  acceptable in  comments  and  character
 strings, and will be preserved in the output.

          This version of PRETTY is Release 3.0.  It replaces
 Release 2.0  which was called FOREDT on the  DEC-20 so as to
 avoid a name conflict with the local text editor.  PRETTY is
 approximately twice  as fast as FOREDT,  and works harder to
 break  continued  statements at  nice  places.   The  output
 routine  which does  this is adapted  from that  used in the
 SFTRAN3 preprocessor.

          Any  problems with,  or questions  about, should be
 communicated  to Dr.  Nelson H.F. Beebe,  226 South Physics,
 Tel: (801) 581-5254, or send MAIL to BEEBE.

          The options which  are currently  available are  as
 follows:


BLOCK

 BLOCK.......Comment statements stand out much better if they
             are  separated  from  the  FORTRAN  text  by   a
             distinctive  line.   Setting  BLOCK=.TRUE.  will
             cause the insertion of  a line of dashes  before
             and after each comment statement block.


CVTIO

 CVTIO.......FORTRAN II I/O statements READ, PRINT, and PUNCH
             are not  ANSI FORTRAN,  and though  accepted  by
             most  compilers  sometimes  cause  difficulties.
             For example,  in  CDC FORTRAN,  the  file  names
             associated  with  these   are  fixed.    Setting
             CVTIO=.TRUE.  will result  in their  replacement
             by IBM standard READ (5,etc), WRITE (6,etc), and
             WRITE (7,etc) statements.


CVTSTR

 CVTSTR......Character   strings   delineated   by    special
             characters such as  single or  double quotes  or
             asterisks are  convenient  to  code,  but  cause
             great portability  problems.  If  CVTSTR=.TRUE.,
             all  such  character  strings  surrounded  by  a
             specified delimiter character  (see MARK  below)
             will be  converted  to  ANSI-standard  Hollerith
             strings.


EJECT

 EJECT.......To suppress page ejects before each new  program
             unit, specify  EJECT=.FALSE.  A  line of  equals
             signs  will  be  printed  as  a  separator  line
             instead.


IN

 IN..........FORTRAN unit number for the data set  containing
             the input FORTRAN source text.


INCONT

 INCONT......Number of columns  to indent continuation  lines
             from the first line of the statement.


INCR

 INCR........Sequence number increment for columns 73..80.


INCFMT

 INCFMT......FORMAT statement number increment.  This will be
             adjusted downward if necessary.


INCST

 INCST.......Statement  number  increment.    This  will   be
             adjusted downward if necessary.


INDENT

 INDENT......Number of  columns to  indent successive  nested
             DO-loops.


IOFILE

 IOFILE......FORTRAN unit number for first scratch file.


IOPRNT

 IOPRNT......FORTRAN  unit  number  for  the  printed  output
             listing.


IOREAD

 IOREAD......FORTRAN  unit   number   for  the   input   file
             containing  control  options.   If  options  are
             provided through the job control language,  this
             file will  not be  used.  It  must be  different
             from IN.


IPREC

 IPREC.......Because IBM compilers  interpret floating  point
             constants  without   an   exponent   as   single
             precision, it is desirable to be able to add  an
             appropriate exponent if a different precision is
             required.  Setting IPREC = 1, 2, or 3 will cause
             the conversion of _all_ floating-point constants
             to single, double, or quadruple precision by the
             addition or changing of exponents to E, D, or  Q
             type.   At  the  same  time  as   floating-point
             constants  are  converted,  all  ANSI  and   IBM
             FORTRAN built-in function  names are changed  to
             the specified  precision.   Any other  value  of
             IPREC will suppress such changes, and since  the
             scan required is reasonably time-consuming, this
             option is disabled by default.


LC

 LC..........Number of lines/page for printed output.


MARK

 MARK........Character string delimiter  character. To  allow
             for NAMELIST  input  on machines  which  do  not
             permit character strings in NAMELISTs, MARK  may
             be set to 1 for a single apostrophe ('), 2 for a
             double apostrophe ("), 3 for an asterisk (*), or
             4 for a dollar sign  ($).  Any other value  will
             be assumed  to represent  a Hollerith  character
             stored in A1  format.  If MARK  is an  asterisk,
             substitutions  will  be  restricted  to   FORMAT
             statements to conform to CDC FORTRAN use.


MAXNUM

 MAXNUM......Printing  of  the  prettyprinted  text  for  any
             single program  unit  will be  suppressed  after
             MAXNUM lines have  been output  for the  program
             unit.   For  example,   MAXNUM=20  would   allow
             printing of  only the  first  20 lines  of  each
             routine processed.


NEWFMT

 NEWFMT......Initial FORMAT statement number.


NEWST

 NEWST.......Initial text  statement  number.   It  must  not
             exceed NEWFMT  since all  FORMAT statements  are
             output immediately before the END statement.


NEWTXT

 NEWTXT......FORTRAN unit number for the data set  containing
             the output prettyprinted FORTRAN text.


NUFILE

 NUFILE......FORTRAN unit number for second scratch file.


NUMBER

 NUMBER......Initial sequence number for columns 73..80.


PAD

 PAD.........To  improve   readability   of   text,   setting
             PAD=.TRUE. will cause  the insertion of  padding
             blanks around  equals signs  as well  as  around
             logical and relational operators.


PURGE

 PURGE.......PRETTY normally makes  two passes  over the  old
             code,  once  to  collect  labels,  and  once  to
             substitute labels.  It is  not until all  labels
             have been  substituted that  it is  possible  to
             detect   whether   or   not   any   labels   are
             unreferenced.  The PURGE option requests a third
             pass  in  which   unreferenced  labels  can   be
             deleted.   PURGE=0  suppresses  label  deletion.
             PURGE=1 requests unreferenced label deletion  on
             non-FORMAT   statements.     PURGE=2    requests
             deletion  of  unreferenced  FORMAT   statements.
             PURGE=3 combines  options 1  and 2.   Any  other
             value is equivalent to PURGE=0.  A second run of
             _PRETTY_ should later be  made to resequence  in
             order to fill up the gaps where labels have been
             deleted.


SEQNUM

 SEQNUM......If .TRUE, sequence numbers are placed in  output
             lines in columns  73..80.  If .FALSE.,  sequence
             numbers are  omitted,  and trailing  blanks  are
             trimmed.


DEFAULT-OPTION-SETTINGS

 Defaults for these have been  selected on the basis of  long
 experience, and  it  is  highly  recommended  that  they  be
 adhered to.  The current list of defaults is as follows:

 BLOCK=F,         CVTIO=F,         CVTSTR=F,
 EJECT=T,         IN=8,            INCONT=5,
 INCR=100,        INCFMT=10000,    INCST=100,
 INDENT=5,        IOFILE=2,        IOPRNT=6,
 IOREAD=5,        IPREC=0,         LC=80,
 MARK=1,          MAXNUM=99999999, NEWFMT=10000,
 NEWST=100,       NEWTXT=1,        NUFILE=3,
 NUMBER=100,      PAD=F,           PURGE=0,
 SEQNUM=F