\COMMENT RENUM.DOC/TRS file #Abstract RENUM is intended to provide two useful services for the FORTRAN programmer: (1) replace the existing statement numbers in a FORTRAN program with a new (an equivalent) series of sequential statement numbers, and (2) produce a cross-refer- enced table of all variable names used in the source code showing the line numbers where all references to each variable name occur. The line number used for cross-referencing agree with those on a compiler-generated listing. Either or both of these services, along with a listing of the source code, can be produced; the two functions are completely independent. Control is by means of terminal-entered command strings follow- ing the standard RT-11 rules. Input files (up to six per command line) can be on any disk device, and output files can be directed to any device. When renumbering, a new disk file (by the original name) is created for the renumbered source code, and the original file is changed to .OLD. RENUM version 4 adds several useful features including: the ability to specify the starting new statement number and the increment between new statement numbers; a reformatted source listing; flagging the range of DO loops; and improved variable name scanning, especially in logical IF statements. RENUM runs only under RT-11 version 2B or 2C, and requires SYSLIB. \test 80, #RENUM (Remember FORTRAN Source Modules), Version 4 RENUM is intended to aid FORTRAN program documentation and maintenance by replacing the existng FORTRAN statement numbers with a new (an equivalent) series of statement numbers in sequential order; and by providing a cross-referenced table of all variable name usage and the line numbers on which each variable reference occurs. The FORTRAN source code can be created either by the editor or it can be in card image format (but may not include sequence numbers in columns 73-80). RENUM always assumes that the source code is valid FORTRAN. Although the default is to both renumber and cross-refer- ence, the two functions are entirely independent and either can be used without the other by specifying an appropriate combina- tion of output files and command line switches. The line numbers used in the cross-referenced table agree with those on a compiler-generated listing, so that if a compiler listing is available, RENUM need only generate a cross-referenced table. RENUM runs only under RT-11 version 2B or 2C (including SYSLIB) and is designed to process RT-11 FORTRAN source code files. The command line syntax and its defaults are similar to the FORTRAN compiler because RENUM uses the RT-11 CSI. As distributed, RENUM will handle program modules which contain up to 499 statement numbers (which can be in the range 1 to 99999). It can also handle up to 4200 references to variable names (140 variable names with up to 30 references each). If more than 30 references are made to any specific variable, another entry for that variable is made in the cross-referenced table and 30 more references can be accommodated. The core required to run RENUM can easily be changed by adjusting the variable table size as noted in the code for RENUM, XREF1, and XREF2. When run, RENUM will respond with a asterisk and wait for a standard command line input, including a optional output file, and an optional listing file, separated from up to six input files, optionally followed by one of the following switches. The command line switches may appear anywhere in the command line and apply to all input or output files. They are as follows: /S (Short) causes the FORTRAN source code not to be list on the listing device (if one is specified). Only the cross-refer- enced table will be listed (if cross-referencing is done and a listing device is specified). /R (Renumber) do renumbering only, not cross-referencing. A permanent file containing the renumbered code will not be available unless an output file specification is also included in the command line. /X (Xref) do cross-referencing only, and print the cross-refer- enced table on the listing device (if one is specified). /B!n (Begin) make the first new statement number in the renumbered source code "n". The default is to make the first statement number the same as the increment between statement numbers. /I!n (Increment) make the increment between successive new statement numbers "n". The default is /I!2. /D (Debug) treat debug lines (D in column one) as valid code. Otherwise, treat debug lines as comments and do not renumber or cross-reference them. /H (Help) or /? print a summary of the instructions on the console and return for another command line. If no switch is specified, the default is to both re- number and cross-reference (assuming that the appropriate output file specification and listing file specification are included on the command line). Although a single listing file is created, a separate output file of renumbered source code is created for each input file. The output file specification in the command line is a _dummy and is used _only to indicate the user's desire for a permanent renumbered source code output file. The _actual output file(s) _always has the same name(s) as the original input file(s), but are on the specified output device (DK: is the default device). If a permanent renumbered output file is created by RENUM, the original source code file is renamed with an extention of .OLD. The new file is given the name of the original file _regardless of any output file name specified in the command line (but on the output device if one is included in the output file specification). Any device can be specified for the listing file; however the input file and the renumbered output files must be on a disk. FORTRAN source code modules being renumbered can not have statement numbers which are broken in the middle by the end of a line and continued on a continuation line. Nor can there be statement numbers on continuation lines except in IF, GOTO, and any statement following a logical IF. The FORTRAN keyword, and certain syntax element must be on a single line (this would be the first line, except perhaps after a logical IF). This puts some limits on the unreasonable use of embedded blanks, that will present no problems for reasonably formatted code. If the first line of a source code module contain "C**\" in columns one through four, this line will be printed as a header at the top of each page of output in the RENUM listing file. Multiple source code modules in a single input file are treated as essentially a single block of code and will be renumbered and cross-referenced as such. Duplicate statement numbers within the input file are not allowed. Each module may begin with a header line ("C**\"); the listing for each module will start a new page. RENUM will abort with an appropriate error message on a console if it finds duplicate statement numbers within a single input file. It will also abort, with an appropriate error message, if the maximum allowable number of statement numbers (499) is exceeded in a single input file. If an input file contains more variable references than can be accomodated by the cross-referenced table, RENUM discards the excessive variable references and flags the cross-referenced table with a note that some references have been lost. If RENUM cannot understand the syntax of a particular line of input source code, it will add an error message in the form of an FORTRAN comment line to the output file indicating that there may be a statement number converison error on the next line. If renum- bering causes a line to extend past column 72, RENUM moves the overflow onto the next line if that next line is a continuation or creeates a new continuation line for it. The number of lines printed on each page of the listing file can be changed by changing the variable MAXLIN in RENUM. The size of the cross-referenced table can be changed by changing the size of several arrays in RENUM, XREF1, XREF2. In addition, one statement in XREF1 must be changed. RENUM is distributed as five separate files, each contain- ing several FORTRAN program modules and a BATCH stream file (RENUM.BAT) which compiles and links the standard, overlayed version of RENUM. Those not wishing to use the BATCH stream directly should manually enter the compiler and linker commands as documented in the BATCH stream file provided (which assumes that all files have been PIPed to device DK:). The five source code files and there contents are as follows: FILE: CONTAINS: RENUM.FOR RENUM | MOVEB | CHARB | BLANKB | NUMOLD | COMPAR | OLDNUM RENUM1.FOR RENUM1 | HELPR RENUM2.FOR RENUM2 | PUTIT | NEWNUM XREF1.FOR XREF1 XREF2.FOR XREF2 | SORTB \test 80,