home *** CD-ROM | disk | FTP | other *** search
- &TRACE OFF
- *
- ************************************************************************
- *
- * The exec TIDY renumbers and otherwise cleans up old and tired FORTRAN
- * source program. TIDY accepts ASA FORTRAN with 19 continuation cards
- * as well as some IBM and CDC dialect FORTRAN statements. To invoke the
- * the exec, type
- *
- * TIDY filename filetype filemode
- *
- * where
- *
- * filename is the name of the file containing the FORTRAN
- * source
- *
- * filetype is the type of the file containing the FORTRAN
- * source
- *
- * filemode is the mode of the file containing the FORTRAN
- * source
- *
- * TIDY produces 2 files:
- *
- * filename TIDYLIST filemode containing a diagnostic listing
- * from the TIDY run
- *
- * filename TIDYFORT filemode containing the cleaned up FORTRAN
- * source from the TIDY run
- *
- * TIDY uses 2 scratch file which are deleted at the end of the run:
- *
- * $SCRTCH1 TIDYFILE filemode
- * $SCRTCH2 TIDYFILE filemode
- *
- *
- ************************************************************************
- *
- *
- ************************************************************************
- *
- * If the keyword $TRACE appears on the command line &POSITION OF $TRACE
- * will set &$TRACE to the number of the argument in which $TRACE appears.
- &$TRACE = &POSITION OF $TRACE &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24
- * save $TRACE parameter for passing to other execs
- &IF &$TRACE EQ 0 &TRCFLG = &BLANK
- &IF &$TRACE EQ 0 &GOTO -CONT
- * Argument that contained keyword $TRACE is set to blank.
- &&$TRACE = &BLANK
- * The sequence of arguments is restored, less the keywords, by stacking
- &STACK LIFO &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24 &25 &26 &27 &28 &29 &30
- * then reading the arguments.
- &READ ARGS
- &STACK LIFO &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24 &25 &26 &27 &28 &29 &30
- &READ STRING &ARGSTRING
- * &TRACE is set to ALL if &$TRACE is greater than 0
- &TRACE ALL
- * save $TRACE parameter for passing to other execs
- &TRCFLG = $TRACE
- -CONT
- *
- *************************************************************************
- *
- * CHECK FOR EXISTENCE OF FILE AND R/W ACCESS TO DISK
- *
- &STACK LIFO
- &WRTFLG = 0
- &DISKAD =
- LISTFILE &1 &2 &3 (LIFO
- *
- * FILE PROBABLY NOT FOUND
- *
- &IF &RETCODE NE 0 &EXIT &RETCODE
- &READ VARS &F1 &F2 &F3
- &LOOP -LP UNTIL .&F1 EQ .
- &F3 = &PIECE OF &F3 1 1
- QUERY DISK &F3 (STACK LIFO
- &READ VARS &D1 &D2 &D3 &D4
- &READ VARS
- &IF .&D4 NE .R/W &SKIP 2
- &WRTFLG = 1
- &DISKAD = &D3
- &READ VARS &F1 &F2 &F3
- -LP
- *
- * FILE NOT ON R/W DISK
- *
- &IF &WRTFLG NE 0 &SKIP 4
- &TYPE
- &TYPE FILE &1 &2 &3 IS NOT ON A DISK WITH WRITE ACCESS
- &TYPE
- &EXIT 888
- *
- * SET UP FILEDEF'S FOR ALL FILES
- *
- FILEDEF 3 DISK PROFILE TIDY &DISKAD (RECFM FB LRECL 80 BLOCK 800
- FILEDEF 4 DISK &1 &2 &DISKAD (RECFM FB LRECL 80 BLOCK 800
- FILEDEF 6 DISK &1 TIDYLIST &DISKAD (RECFM FBA LRECL 132 BLOCK 1320
- FILEDEF 8 DISK &1 TIDYFORT &DISKAD (RECFM FB LRECL 80 BLOCK 800
- FILEDEF 1 DISK $SCRTCH1 TIDYFILE &DISKAD (RECFM V LRECL 1024 BLOCK 4096
- FILEDEF 2 DISK $SCRTCH2 TIDYFILE &DISKAD (RECFM V LRECL 1024 BLOCK 4096
- *
- * LET USER KNOW WHAT'S GOING ON
- *
- &TYPE TIDY &1 &2 &DISKAD
- *
- * INVOKE TIDY
- *
- TIDY
- &RTCDE = &RETCODE
- *
- * GET RID OF SCRATCH FILES
- *
- ERASE $SCRTCH1 TIDYFILE &DISKAD
- ERASE $SCRTCH2 TIDYFILE &DISKAD
- &EXIT &RTCDE