Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50202/renbr.rnd
There are 2 other files named renbr.rnd in the archive. Click here to see a list.
.title ^^RENBR, the FORTRAN Renumbering and Listing Program
.left margin 0
.nofill
.spacing 1
RRRRRRR EEEEEEEEE NNN NN BBBBBBB RRRRRRR
RRR RRR EEE NNNN NN BBB BBB RRR RRR
RRR RRR EEE NNNNN NN BBB BBB RRR RRR
RRR RRR EEE NNNNNN NN BBB BBB RRR RRR
RRRRRRR EEEEEEEEE NN NNNN NN BBBBBBB RRRRRRR
RRR RRR EEE NN NNNNNN BBB BBB RRR RRR
RRR RRR EEE NN NNNNN BBB BBB RRR RRR
RRR RRR EEE NN NNNN BBB BBB RRR RRR
RRR RRR EEEEEEEEE NN NNN BBBBBBB RRR RRR
RRRR RR EE NNNNN NN BBBBB RRRR
RRRR RR EEEEEEEE NNNN NN BBB BBB RRRR
RRR RRR EEEEEEEE NNN NN BBBB BB RRR
RR RRRR EEEEEEEE NN NN BBB BBB RR
RRRRR EE N N NN BBBBB
RRR RRR EEEEEEEE NN NN BBB BBB RRR
RRRR RR EEEEEEEE NNN NN BBBB BB RRRR
RRR RRR EEEEEEEE NNNN NN BBB BBB RRR
RRRRR EE NNNNN NN BBBBB
.skip
26 May 1979
.skip
.fill
.spacing 1
.nofill
.center
RENBR, the FORTRAN Renumbering and Listing Program
.center
------ --- ------- ----------- --- ------- -------
.skip
.fill
RENBR is a program which sequentially statement numbers and/or forms
cross-referenced listings of FORTRAN programs. RENBR is itself
written in FORTRAN. Although RENBR accepts user commands containing
DECsystem-10 (PDP-10) file specifications, the routines which
support this file notation can easily be removed or replaced if
RENBR is to be used on other computers.
.skip
RENBR can process programs and routines written in 1966 standard
FORTRAN or in some dialects of the older FORTRAN-II. RENBR can also
process programs and routines which use the FORTRAN language
extensions allowed by the DECsystem-10 F40 compiler and by version 5
of the DECsystem-10 FORTRAN-10 compiler.
.skip
RENBR will treat an alphameric string consisting either of a leading
decimal number followed by the letter H and then by the string, or
else enclosed within matching apostrophes as a single unit similar
to a variable name. RENBR would recognize that the 56's and the
57's, but not the 55's, are statement numbers in statements such as
.test page 3
.nofill
IF(A.EQ.10H)GO TO 55;)GO TO 56;GO TO 57
or
IF(A.EQ.')GO TO 55;')GO TO 56;GO TO 57
.fill
where the first ; on each line is part of an alphameric string but
the second ; on each line is a DECsystem-10 FORTRAN convention
indicating that another statement follows on the same line. RENBR
can also detect when a FORTRAN key word is instead being used as a
variable or array name. RENBR would recognize that the variable
named DO55I and the array location READ(5,10) are being assigned
values in the following statements.
.nofill
.test page 6
DO 55 I=12
DO 55 I='5,10'
DO 55 I=4H5,10
DO 55 I=READ(5,10)
and
READ(5,10)=DO55I
.fill
.skip
Prior to renumbering a program for the first time, the user should
check that no space character which is at the end of a line is a
part of an alphameric string (a string of characters enclosed
between apostrophes or following a decimal number and the character
H). Such strings can be split onto the continuation line after a
printing character, or can be enclosed in apostrophes if previously
in H notation, or if in a FORMAT statement can be broken into 2
separate strings. RENBR cannot distinguish whether a terminal space
was in the original file or was simulated by the FORTRAN operating
system's input routines.
.skip 2
.test page 5
.center
Instructions for Use of RENBR on the DECsystem-10 Computer
.center
------------ --- --- -- ----- -- --- --------- -- --------
.skip
On the DECsystem-10 computer, FORTRAN programs can be written either
in conventional column form having the statement text in columns 7
through 72, or in tab form in which an optional left justified
statement number is separated by a tab character from an optional
nonzero continuation digit and up to 66 characters of text. The tab
character is a nonprinting character which advances the location of
the next character to the next column beyond the next multiple of 8
columns from the left margin. RENBR can process programs written in
either column or tab form, or in a mixture of these forms, and will
produce as output whichever form is selected by the user. RENBR can
also, on request, convert tab characters in comment lines into
spaces filling to the tab stops. Such tab to space conversion is
often necessary when readying programs for compilation on other
computer systems which do not recognize the tab character.
.skip
This program can process a series of input files. A single input
file can contain many programs and/or routines, but a program or
routine, or even a statement, can also be continued from one input
file to the next. Each input file must, however, start a new line.
If, in addition to statement numbers, any input file contains the
line sequence numbers used by line oriented editors on the
DECsystem-10 computer, then these line sequence numbers must be
removed before the file can be processed by RENBR since line
sequence numbers cannot be identified as such by programs written in
FORTRAN. Line sequence numbers can be removed by selecting the /N
switch when using the PIP cusp to copy the file.
.skip
When started, RENBR will suggest that the user type /H to obtain a
help message, and then will wait for the user to type a command. A
maximum of 72 characters is allowed in each line forming the
command, but the command can be continued on a subsequent line if
the current line ends with either a rightmost comma or with an _&
(ampersand) character. However, a single file specification cannot
be continued on the following line. The command can be read from a
file if the user types the name of this file either preceded
directly by an @ (at) character or followed directly by an @
character. If the command is read from a file, then the names of the
input files can appear on separate lines without the use of _&
characters at the ends of the preceding lines. The file can contain
several commands to be processed separately only if these are
separated by _; (semicolon) characters. All characters following an
! (exclamation point) character, following an _& character or
following the file specification with which the @ character appears
are ignored.
.skip
The command which is typed by the user or which is read from a
command file can consist of the name of the output renumbered file
and/or the name of the output listing file, followed by an =
character and a list of one or more input source files separated by
commas. If both output files are specified, then a comma should
separate these, and a switch must appear with at least one of these
file specifications to imply its use since either type of output
file can be specified first. If either one or no output file is
specified, and if no switch implies that a listing is desired, then
a renumbered output file is produced instead. A title which is to be
included at the top of each page in the output listing file can be
specified between apostrophes. A pair of apostrophes can be typed at
any location at which the title is to itself include a single
apostrophe. If such a title is specified to the left of the =
character, then the file with which it is associated is implied to
be the output listing file.
.skip
A single file specification can consist of a device name followed by
a colon, followed by the file name. If no device name is specified
for the output listing file, then the output listing file is written
to logical device LPT:. Any other file for which no device is
specified is assumed to be on or to be written to logical device
DSK:. The directory or path upon which the file is located can be
specified before the device name, between the device name and the
file name, or after the file name. The directory specification can
consist of an octal project number, an octal programmer number, and
a single subfile directory (SFD) name separated by commas and
enclosed between left and right square brackets. If either a
programmer number or an SFD name is being specified, then all items
to its left must also be supplied. The user's local directory is
assumed if none is specified. However, once the user has specified
either a device name or a directory for an input source file, then
this device name or this directory continues to be used for all
subsequent input source files for which these items are not specified.
.skip
Each file name can consist of up to 6 characters followed by a
period and then by an extension which can consist of up to 3
characters. The file name extensions _.NEW, _.LPT, _.FOR and _.RNB
are used as defaults for the output renumbered file, for the output
listing file, for the input source files, and for the command file
if extensions are not specified for the names of these files. If a
file name is to have a null extension consisting of 3 spaces, then a
period must be typed following the first part of the file name. The
first part of the name of the first input source file is used as the
first part of the name of an output file if the first part of the
name of this output file is not specified. If the first part of the
name of a command file is missing, then the default name RENBR is
assumed.
.skip
For example, the command
.indent 5
DACOPY
.break
is identical to the command
.indent 5
DSK:DACOPY.NEW/I=DSK:DACOPY.FOR
.break
where the /I is a switch described below which implies renumbering.
.skip
Either of the commands
.indent 5
DACOPY'this is a title
.break
or
.indent 5
'this is a title'DACOPY
.break
is identical to the command
.indent 5
'this is a title'LPT:DACOPY.LPT=DSK:DACOPY.FOR
.break
where the text to the right of the apostrophe or between the
apostrophes is a title for the listing.
.skip
Each of the commands
.nofill
.left margin 5
DACOPY/I'title
DACOPY'title'/I
/I DACOPY'title
'title'DACOPY/I
/I'title'DACOPY
.indent -5
and
'title'/I DACOPY
.fill
.left margin 0
is equavalent to the command
.indent 5
LPT:DACOPY.LPT'title',/I DSK:DACOPY.NEW=DSK:DACOPY.FOR
.skip
The command
.indent 5
PRVI:.LST='title'DAHEST,DSKB:DAHEFT.F4[22,56],DAVERB
.break
is equivalent to the command
.indent 5
PRVI:DAHEST.LST'title'=DSK:DAHEST.FOR_&
.indent 5
DSKB:[22,56]DAHEFT.F4,[22,56]DSKB:DAVERB.FOR
.break
and would generate a single listing on device PRVI_: of the 3 files
DAHEST.FOR, DAHEFT.F4 and DAVERB.FOR, the latter 2 being read from
area [22,56] on device DSKB:.
.skip
.test page 3
The command
.indent 5
@[35,56,SAMPLE]
.break
is equivalent to the command
.indent 5
@[35,56,SAMPLE]RENBR.RNB
.break
and would cause the command to be read from the RENBR.RNB file in
the [35,56,SAMPLE] area. If This file contains
.left margin 4
.nofill
.test page 6
#.FOR=ONE;
#.FOR=TWO;.FOR=THREE
#;.FOR=FOUR
#;'title'ONE
#TWO,THREE
#FOUR
.left margin 0
.fill
then the files ONE.FOR, TWO.FOR, THREE.FOR and FOUR.FOR in the
user's local area would be replaced by renumbered versions having
the same names, following which a single listing of all of these
renumbered files would be generated.
.skip 2
.test page 5
.center
Switches Typed by User to Control Renumbering and/or Listing
.center
-------- ----- -- ---- -- ------- ----------- --- -- -------
.skip
The switches which are described below have the general form
.indent 5
/letter:number:number
.break
where the letter can be in either upper or lower case. Some switches
do not accept following numbers. Standard default values are assumed
for numbers which are missing.
.skip
.left margin 3
.indent -3
/A#followed by the number of extra spaces which are to be added to
the left of each statement inside a DO loop or inside an IF block in
the renumbered output or in the listing. When DO loops or IF blocks
are embedded, the range of each additional loop or block is indented
further. Either /A without a following number or /A:0 implies /A:1.
.skip
Shown below is an example of the application of this switch to
multiply embedded DO loops. In this and the next 2 examples, the
unindented FORTRAN statements are shown at the left and the indented
FORTRAN statements resulting from the application of /A:5 are shown
at the right.
.skip
.nofill
.test page 13
a=0 a=0
do 2 b=1,10 do 2 b=1,10
c=0 c=0
do 1 d=1,10 do 1 d=1,10
e=0 e=0
do 1 f=1,10 do 1 f=1,10
g=0 g=0
1 continue 1 continue
h=0 h=0
do 2 i=1,10 do 2 i=1,10
j=0 j=0
2 continue 2 continue
k=0 k=0
.skip
.fill
Shown below is an example of the application of this switch to
multiply embedded IF blocks.
.skip
.nofill
.test page 21
A=0 A=0
IF(B.EQ.0)THEN IF(B.EQ.0)THEN
C=0 C=0
IF(D.EQ.0)THEN IF(D.EQ.0)THEN
E=0 E=0
END IF END IF
F=0 F=0
ELSE IF(G.EQ.0)THEN ELSE IF(G.EQ.0)THEN
H=0 H=0
IF(I.EQ.0)THEN IF(I.EQ.0)THEN
J=0 J=0
END IF END IF
K=0 K=0
ELSE ELSE
L=0 L=0
IF(M.EQ.0)THEN IF(M.EQ.0)THEN
N=0 N=0
END IF END IF
O=0 O=0
END IF END IF
P=0 P=0
.skip
.fill
Shown below is an example of the application of this switch to DO
loops inside IF blocks and of IF blocks inside DO loops.
.skip
.nofill
.test page 17
A=0 A=0
IF(B.EQ.0)THEN IF(B.EQ.0)THEN
C=0 C=0
DO 2 D=1,10 DO 2 D=1,10
E=0 E=0
IF(F.EQ.0)THEN IF(F.EQ.0)THEN
G=0 G=0
DO 1 H=1,10 DO 1 H=1,10
I=0 I=0
1 CONTINUE 1 CONTINUE
J=0 J=0
END IF END IF
K=0 K=0
2 CONTINUE 2 CONTINUE
L=0 L=0
END IF END IF
M=0 M=0
.skip
.fill
Except for the addition of the extra spaces within the range of DO
loops and of IF blocks, the first printing character within the
statement field of a FORTRAN statement will be either in column 7 if
column form is selected, or following the tab character if tab form
is selected regardless of the original indentation of the first line
of the statement. The original indentation of each continuation line
is preserved if possible.
.skip
.indent -3
/B#followed by the smallest statement number which is to appear in
each program and routine in the renumbered output. If a /I switch is
given but a /B switch is not given, then the absolute value of the
number appearing after the /I switch will be used as the smallest
statement number. A /B switch appearing on a CRENBR command line
(see later description of this) within a particular program or
routine can for that program or routine supersede the smallest
statement number selected by the user.
.skip
If the /B switch is issued without a following number, and if the /I
switch has not been issued, then it is assumed that the user meant
to type /I:1 instead of /B. Values specified by the user's typing of
the /B switch and/or the /I switch can be modified by a CRENBR
command line (see later description of this) locally for the routine
in which this command line appears. If a nonzero value of the lowest
statement number has not been specified either by the user or by a
CRENBR command line within the routine, then the value of the lowest
statement number in a routine after renumbering will be the absolute
value of the statement number increment used to renumber the
routine. This allows the production of reasonable statement numbers
even if the statement number increment, but not the smallest
statement number, is specified. On the other hand, the lowest
statement number can be specified by the user for all routines
except for those in which it is specified internally by a CRENBR
command line.
.skip
.indent -3
/C#the renumbered output will be produced in column form such that
the text of the initial line of each statement which is not within
the range of a DO loop or IF block will start in column 7. The
rightmost digit of the statement number, if any, will be in column
5. A digit in the range 1 through 9 will be used in column 6 to
indicate a continuation line. Although the renumbered output is
generated in column form, the original programs and routines can be
in either column or tab forms, or in any mixture of these.
.skip
The following 3 examples resulted from renumbering the same sequence
of FORTRAN statements with the /C, /U, and /T switches respectively.
Although the /U and /T switches appear to produce similar results,
the /U switch causes spaces to be inserted between the statement
number and the following text to force the first character of the
statement to be in column 7, while the /T switch causes a single tab
character to appear between the statement number and the following
text.
.skip
.nofill
.test page 9
applying /C applying /U applying /T
.skip
C234567890123456 C234567890123456 C234567890123456
8 DO 9 I=1,2 8 DO 9 I=1,2 8 DO 9 I=1,2
DO 9 J=1,5 DO 9 J=1,5 DO 9 J=1,5
9 IJ=IJ+ 9 IJ=IJ+ 9 IJ=IJ+
1LOC(I,J) 1LOC(I,J) 1LOC(I,J)
10 TYPE 11,IJ 10 TYPE 11,IJ 10 TYPE 11,IJ
11 FORMAT(I5) 11 FORMAT(I5) 11 FORMAT(I5)
.fill
.skip
.indent -3
/E#followed by the number of extra tables of contents which are to
be included at the end of the listing. Extra tables of contents
might be necessary if a long listing is to be bound as several
volumes. /E without a following number or /E:0 implies /E:1.
.skip
.indent -3
/F#the device upon which the listing is to be generated can eject a
page of paper when a form feed character is encountered. Line feeds
do not then have to be used in the listing to simulate form feeds.
The pages in the listing will be separated by form feeds if the
output is being sent either to device LPT (the default) or to device
TTY. The character 1 (the digit one) will appear in column 1 where a
form feed is needed if the listing is written to any other device.
/F can be followed by the number of lines which are printable per
page not including those lines skipped over automatically at the
page boundaries. /F without a following number or /F:0 implies /F:60.
.skip
.indent -3
/G#followed by the number of blank lines which are to be included in
the listing between consecutive FORTRAN statements. No extra blank
lines are inserted between comment lines or between the continuation
lines of a single statement. /G without a following number or /G:0
implies /G:1.
.skip
.indent -3
/H#types a summary of the switches which are accepted by RENBR. Any
file specifications which have already been typed by the user are
ignored.
.skip
.indent -3
/I#followed by the increment which is to be used between statement
numbers in the renumbered output. A negative increment, such as
would be specified by /I:-1, would cause the smallest number to be
at the end of the program rather than at the beginning. The smallest
number will be the absolute value of the statement number increment
unless /B is issued and is followed by a number which is greater
than zero. Either /I without a following number or /I:0 implies /I:1.
.skip
.indent -3
/J#followed by the number of blank lines which are to appear in the
listing at the top of the 1st page, at the bottom of the 2nd page,
at the top of the 3rd page, and so on. This number can be followed
by the number of blank lines which are to appear at the bottom of
the 1st page, at the top of the 2nd page, at the bottom of the 3rd
page, and so on. These blank lines could be inserted to allow top
binding of unburst fanfold paper and must be included in the maximum
number of printable lines specified by the number following a /F
switch or by the first number following a /L switch. /J:6 or /J:6:0
would skip 6 lines at the top of the 1st page, both before and after
the separation between pages 2 and 3, between pages 4 and 5, and so
on. /J:0:6 or /J::6 would skip 6 lines both before and after the
separation between pages 1 and 2, between pages 3 and 4, and so on.
.skip
.indent -3
/K#long lines are to be kept intact in the listing. The /S switch
can be issued instead to select the point at which long lines are to
be wrapped around to give narrower listings.
.skip
.indent -3
/L#the pages in the listing must be separated by counted line feeds.
The /L switch can be followed by the number of lines which are
printable per page not including those lines which are to be skipped
over at the page boundaries by the printing of extra empty lines.
This number can be followed by the total number of lines per page
including those lines which are to be skipped over at the page
boundaries by the printing of extra empty lines. /S:0 is assumed if
a /S switch has not already been selected. If the /K switch is
desired, then it must be issued after the /L switch. /L without a
following number or /L:0 implies /L:60:66.
.skip
.indent -3
/M#if issued without a following number, then the original statement
numbers will be retained in all programs and routines which are
processed. It should be noted that the /M switch without following
numbers has a different meaning when included on a CRENBR command
line within a program or routine being processed.
.skip
If the /M switch is issued with 2 following numbers, then these
numbers are the the lowest and highest original statement numbers
which will be modified in all programs and routines which are
processed. All original statement numbers which are either less than
the first number or greater than the second number will be retained.
The first number following the /M switch is assumed to be 1 if it is
missing but the second number is specified. The second number is
assumed to be 99999 if it is missing but the first number is
specified. The /M switch could be used to identify a section of a
program or routine which is to be modified and then grafted back
into the original program or routine since all references within the
section to statements outside the section would remain correct.
.skip
If a /M switch, either with or without following numbers, is issued
by the user, then all /B, /I, /M, /N and /O switches issued on
CRENBR command lines within the programs and routines being
processed will be ignored.
.skip
.indent -3
/P#followed by the number which is to appear as a page number at the
upper right corner of the first page in the listing. Issuing the /P
switch with a number greater than 1 does not suppress any portion of
the listing. /P without a following number or /P:0 implies /P:1.
.skip
.indent -3
/S#followed by the number of characters which can be printed beyond
the normal right margin. Excess characters are right justified on
the following line. 120 characters are allowed in each line of a
comment section introduced by either a RENBRSTART or a RENBRTITLE
line (see later descriptions of these) so a larger number in the
range of the /S switch might be appropriate for such comment sections.
.skip
If the /S or /S:0 switch is issued then the listings will have at
most 69 characters per line (or 70 if the FORTRAN carriage control
character is counted). The right margin is then 1 inch wide on 8 1/2
inch wide paper (assuming 10 characters per inch), and FORTRAN lines
containing over 59 characters will be split in the listing. (In
addition to statement text, each line printed in the listing
contains the carriage control character and 10 characters in the
line number and margin left of the statement number field.) If wider
paper is to be cut down to 8 1/2 inch width, and if the printer can
print more characters, then a narrower right margin can be obtained
by following the /S switch with the number of additional characters
to be allowed before the line is split.
.skip
If the /S is followed by a number which has a value of 69 or
greater, then this number is assumed to be maximum number of
characters which can be written on a single line in the listing.
Thus, /S:0 and /S:69 are equivalent. Either /S:13 or /S:82 would
give the same result as /K when FORTRAN programs and/or routines are
being listed, unless a /C switch has also been issued on a CRENBR
command line in the program or routine being listed to cause more
than 72 characters to be retained in each FORTRAN comment line.
.skip
The following example is a portion of a listing which was generated
using /S:0, although the width of each line has been reduced
somewhat to fit this document. In place of a line number at the left
edge of the listing, each overflow line is indicated by the number
of leading spaces in parentheses if the excess text starts with a
space, or by minus signs otherwise. The page number on the top line
of each page always extends to the normal right margin.
.skip
.nofill
.test page 9
SAMPLE TITLE Page 12
MAIN PROGRAM
.skip
98 48 KM=IN-1
99 IF(LINES.EQ.0)WRITE(ILPT,49)INDEX,IGROUP,NUMPRS
---- (KM),
99 1NMBTWO,LTRTWO
100 49 FORMAT(1H ,1I4,2H (,1I3,1H ,1I4,13X,1I2,2I4,2H
( 1) ,5A1)
.fill
.skip
.indent -3
/T#the renumbered output will be produced in tab form such that a
tab character will appear between the optional statement number and
the statement text. A digit in the range 1 through 9 to the
immediate right of the tab will be used to indicate a continuation
line. Although the renumbered output is generated in tab form, the
original programs and/or routines can be in either column or tab
forms, or in any mixture of these. If a listing is also being
generated, then the statement numbers will be left justified in the
listing, but the rest of each statement will be shown in column form
in the listing.
.skip
.indent -3
/U#the renumbered output will be produced in column form with the
statement numbers beginning in column 1 rather than ending in column
5 as would be produced by /C.
.skip
.indent -3
/V#the listing is to be viewed on the local terminal. If the /L
switch is also issued, then the user will be asked to position the
paper to the next top of page before the program proceeds.
.skip
.indent -3
/W#followed by the width of the tab stop columns which are to be
used when converting tab characters to spaces in the comment lines
for either the listing or the renumbered output. If a /W switch is
not issued, then tab characters in comment lines are converted to
spaces using a column width of 8 for the listing, but are not
converted to spaces in the renumbered output. Tab characters in
FORTRAN statements are never converted to spaces by this program. /W
without a following number or /W:0 implies /W:8.
.skip
.left margin 0
.test page 5
Short descriptions of each of these switches with typical arguments
are listed below.
.skip
.nofill
/A:5 add 5 spaces to left of DO loops and IF blocks
/B:100 base statement number is 100
/C column format (see /T and /U)
/E:1 1 extra table of contents
/F:60 form feeds every 60 lines (see /L)
/G:1 gap of 1 line between each statement in listing
/H help message is to be typed
/I:5 increment between statement numbers is 5
/J:0:4 jump 0 lines at top and 4 at bottom of first page
/K keep lines intact (see /S)
/L:60:66 60 lines can be printed on pages 66 lines high
/M maintain original statement numbers
/M:1:9 modify only statement numbers in range 1 through 9
/P:1 page numbering is to start with 1
/S:9 split lines 9 characters beyond right margin
/T tab format
/U uniform left justification of statement numbers
/V view listing on controlling terminal
/W:8 width of tab stops is 8
.fill
.skip
.left margin 0
A title enclosed in apostrophes, or any of the switches /E, /F, /G,
/J, /K, /L, /P, /S or /V, specifies that a listing is to be
produced. The default options for listings are initial page number
1, form feeds, intact long lines, single spacing, and 1 table of
contents. The default number of printable lines per page is 60. The
default total number of lines per page, including the blank lines
used to simulate form feeds at the page boundaries if the /L switch
is issued, is 66. These default values could also be selected by
typing the following switches
.test page 3
.indent 5
/F:60
.break
or
.indent 5
/L:60:66
.skip
Any of the switches /B, /C, /I, /M, /T or /U specifies that a new
renumbered version of the source file is to be produced. The default
options for renumbering are smallest statement number 1, increment 1
and column form.
.skip
The switches /A and /W can be used for either listing or renumbering.
.skip 2
.left margin 0
.test page 5
.center
Input File Conventions and Restrictions
.center
----- ---- ----------- --- ------------
.skip
The input source file can contain tab characters if the FORTRAN
compiler and operating system allow these. If the compiler and/or
operating system do not allow tabs but the input program contains
tabs, then these tabs should be converted to 6 or more spaces or
else be converted to sufficient spaces to fill to the normal tab
stops if the left tab stop is in, or to the right of, column 7
before the input source file is processed by RENBR. Lines in which
initial tabs have been converted to spaces will be treated properly
by RENBR since RENBR recognizes any line in which the first printing
character in or to the right of column 6 is a digit to be a
continuation line. The tab character is used in FORTRAN programs on
the DECsystem-10 to separate statement number field from statement
text.
.skip
RENBR can process programs and routines written in 1966 standard
FORTRAN or in some dialects of the older FORTRAN-II. RENBR can also
process programs and routines which use the FORTRAN language
extensions allowed by the DECsystem-10 F40 compiler and by version 5
of the DECsystem-10 FORTRAN-10 compiler. Unrecognizable statements
are copied into the renumbered output unchanged and will be correct
if these statements do not reference statement numbers.
.skip
The alphabetic letters appearing in FORTRAN statements processed by
RENBR can be in either upper or lower case, or in a mixture of these.
.skip
RENBR allows semicolons between statements which appear on the same
line and allows exclamation points before comments on the same lines
as statements. These special characters are recognized only when
they appear within the portion of the line which can contain
statement text. If more than one statement appears on a line, then
only the first statement can bear a statement number since the text
of the next statement is assumed to start immediately after the
semicolon. There can not be more than 19 consecutive continuation
lines even if these represent more than one statement. The END
statement can bear a comment to its right, but must not appear on
the same line as any other statement. Comments which appear inside
statement numbers as in the statement
.nofill
GO TO 5!COMMENT INSIDE THE STATEMENT NUMBER 56
16
.fill
are discarded although the statement number is itself treated
properly. Only 2 DATA statement definitions would need to be changed
within the RENBR BLOCK DATA routine to allow different characters to
be used between statements or to mark comments. To completely
deactivate the support of nonstandard features such as these (or the
tab form or the extra relational operators <, > and _#) which depend
upon the recognition of special characters, it is only necessary in
RENBR's BLOCK DATA routine to redefine the variables containing
these characters to instead contain spaces. RENBR tests explicitly
for a space and transfers if a space is found before testing for the
special characters, so the tests against the redefined characters
cannot succeed.
.skip
.test page 3
Restriction
.break
RENBR detects the end of the input file by end-of-file tests in its
READ statements. If the end-of-file test feature is not available,
then the input file should be terminated by an extra END statement
which will not appear in the output. It will not be possible,
however, to have a single program or routine be split across two or
more input source files if end-of-file tests cannot be used in READ
statements.
.skip
.test page 3
Restriction
.break
The input source file must not contain line sequence numbers left of
the statement number field. If present, such line sequence numbers
must be removed before the file is processed by RENBR.
.skip
.spacing 1
.test page 3
Restriction
.break
Continuation lines following a comment line beginning with an
initial * (asterisk) or letter C (either upper or lower case) are
taken as a continuation of the comment and are written into the
output unchanged. For this reason, comment lines beginning with an
initial * or letter C can separate statements, but cannot appear
within a single statement.
.skip
.test page 3
Restriction
.break
A line with a non-space non-tab non-digit character other than an *
or the letter C (which would indicate a comment) in column 1
followed by a tab, or by a number (formed of no more than 4 digits)
and a tab, or by 4 characters formed of any combination of spaces
(also known as the blank character) and/or digits will be taken as a
legal FORTRAN statement. If the line begins a new statement, then
the initial character will appear in the output at the start of each
line of the statement including all continuation lines (whether or
not the character originally appeared at the start of these
continuation lines). Some compilers require B, D or I in column 1 to
specify variable type.
.skip
DECsystem-10 FORTRAN allows D in column 1 to indicate a debugging
line the compilation of which is optional. RENBR places the letter D
in column 1 on each line of the copied statement if and only if the
letter D appeared in column 1 on the first line of the original
statement, although the original statement could have the letter D
in column 1 on a continuation line but not on the initial line, or
on the initial line but not on the continuation line. How seriously
this can change the portion of a program which is optionally
executable depends upon which DECsystem-10 compiler is used. The F40
compiler treats a continuation line after the line bearing the
letter D in column 1 as a continuation of a comment while the
FORTRAN-10 compiler treats such a continuation line as a
continuation of the previous statement.
.skip
Statement numbers in obsolete statements, which have been changed to
comment lines by addition of an * or the letter C to the start of
the statements, become incorrect when programs containing them are
renumbered. Some compilers ignore lines which begin with certain
other characters, but RENBR treates such lines as FORTRAN statements
and maintains the initial characters. In DECsystem-10 FORTRAN, a $
(dollar sign) or / (slash) character in column 1 indicates a command
for another computer, so an obsolete line can become a comment which
is to be treated by RENBR as a FORTRAN statement if the character in
column 1 of a statement written in column form is replaced by a $ or
/ character, or if a $ or / character is added to the start of a
statement written in tab form. (See also the description of the /R
switch in the CRENBR command line.)
.skip
.test page 3
Restriction
.break
Spaces are trimmed from the right end of lines prior to output
regardless of syntax. If alphameric strings are specified as the
number of characters followed by the letter H and the characters of
the string, then lines which end in alphameric strings containing
terminal spaces will have these spaces removed. Therefore, unless
the output is written onto cards, a statement such as
.break
.indent 4
A=1H
.break
should instead be written as
.break
.indent 4
A=(1H#)
.break
or
.break
.indent 4
A='#'
.break
This deletion of terminal spaces can also occur in FORMAT statements
in which alphameric strings extend across continuation line
boundaries. Any alphameric string in which a space appears at the
right end of a line should be rewritten manually before the program
is processed by RENBR.
.skip
.test page 3
Restriction
.break
A single statement can be continued on no more than 19 lines. Unless
the dimensions of the storage arrays within the RENBR program are
increased, a single main program or routine being renumbered can
contain at most 1000 numbered statements (or 25 less than this if a
listing is also being made). There is no restriction on the number
of statement number references within a single main program or
routine.
.skip
.test page 3
Restriction
.break
The END statement which terminates a program or a routine must
appear on a single line, although the letters of the word END can be
preceded by or be separated by spaces or tabs. The END statement can
have a statement number to its left and can be followed by an
exclamation point and a comment to its right, but the END statement
must not appear on the same line as any other statement. The input
source files can contain any number of programs or routines, each
with its own END statement. If the end-of-file test in a READ
statement is not available, then an additional END statement, after
the final program or routine in the input source file, can be used
to force a normal exit which includes printing of the table of
contents.
.skip
.test page 3
Restriction
.break
A line beginning a new statement must have one of the following
formats.
.left margin 4
.indent -4
A)##A line beginning with a non-tab character other than an * or the
letter C followed by 4 spaces and/or digits followed in column 6 by
a space or by a zero. It is possible for the character in column 1
to be a space or a digit of the statement number.
.indent -4
B)##A line beginning with a tab followed by the first character of
the statement which cannot be a digit.
.indent -4
C)##A line beginning with a non-tab non-space non-digit character
other than an * or the letter C followed by a tab followed by the
first character of the statement.
.indent -4
D)##A line beginning with a digit or digits of the statement number
followed by a tab followed by the first character of the statement.
.indent -4
E)##A line beginning with a non-tab non-space non-digit character
other than an * or the letter C followed by the digit or digits of
the statement number followed by a tab followed by the first
character of the statement.
.break
.left margin 0
If (SPACE) represents a space, (TAB) represents a tab and (TEXT)
represents the text of the statement, then the following are typical
lines which start new statements. Of course, the text of the
statement can itself begin with one or more spaces or tabs.
.break
.nofill
(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)(TEXT)
(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)0(TEXT)
D(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)(TEXT)
D(SPACE)(SPACE)(SPACE)(SPACE)0(TEXT)
(SPACE)(SPACE)(SPACE)22(SPACE)(TEXT)
(SPACE)(SPACE)(SPACE)220(TEXT)
D(SPACE)(SPACE)22(SPACE)(TEXT)
D(SPACE)(SPACE)220(TEXT)
22(SPACE)(SPACE)(SPACE)(SPACE)(TEXT)
22(SPACE)(SPACE)(SPACE)0(TEXT)
D22(SPACE)(SPACE)(SPACE)(TEXT)
D22(SPACE)(SPACE)0(TEXT)
(TAB)(TEXT)
D(TAB)(TEXT)
22(TAB)(TEXT)
D22(TAB)(TEXT)
.skip
.fill
.left margin 0
.test page 3
Restriction
.break
A continuation line must have one of the following formats.
.left margin 4
.indent -4
A)##A line beginning with a non-tab non-digit character other than
an * or the letter C followed by 4 spaces followed by a non-space
non-tab non-zero character which is ignored. The initial character
can, of course, be a space.
.indent -4
B)##A line beginning with a tab (or with 5 or more spaces) followed
by a non-zero digit which is ignored.
.indent -4
C)##A line beginning with a non-tab non-space non-digit character
other than an * or the letter C followed by a tab (or by 4 or more
spaces) followed by a non-zero digit which is ignored.
.left margin 0
The following are typical continuation lines.
.break
.nofill
(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)2(TEXT)
(SPACE)(SPACE)(SPACE)(SPACE)(SPACE)A(TEXT)
D(SPACE)(SPACE)(SPACE)(SPACE)2(TEXT)
D(SPACE)(SPACE)(SPACE)(SPACE)A(TEXT)
(TAB)2(TEXT)
D(TAB)2(TEXT)
.fill
.left margin 0
.skip 2
.test page 5
.center
Maintaining Logical Blocks of Statement Numbers
.center
----------- ------- ------ -- --------- -------
.skip
Some programmers select statement numbers used within a logical
section of a program from a different range than those used
elsewhere within the same program. RENBR can maintain these regions
when renumbering. However, since a single normal renumbering would
destroy such regions, a command line within the program is used to
specify the size of the range of statement numbers in each section
rather than querying the user for this information. This command
line is a comment line with an * or the letter C in column 1
followed by the word RENBR and those switches for which values are
being specified. A typical command line would be
.break
CRENBR/I:-10/B:10(NAME/SUBTITLE FOR LISTING) O 200 N 400
.break
where slashes can appear before the single letter switches and
colons can appear between the single letter switches and the
following numbers, but are not necessary.
.skip
The switches which can be used on the CRENBR command line are listed
below.
.skip
.left margin 3
.indent -3
/B#specifies the smallest statement number. The number following
this switch will be the smallest generated statement number which
will appear within the renumbered program or routine. Normally this
would be the first statement number in the renumbered program, but
if the increment between generated statement numbers is specified to
be negative, then the base number will be the number of the final
numbered statement within the program. If the /B switch does not
appear on the CRENBR command line, then the value used as the base
number will be that specified by the user when RENBR was started, or
will be the absolute value of the statement number increment if the
user did not specify a base number when RENBR was started.
.skip
.indent -3
/C#specifies that more than 72 characters are to be retained in each
of the subsequent FORTRAN comment lines in the current program or
routine. The number following this switch is the maximum number of
characters, in addition to the 72 characters usually processed,
which are to be read and written in each FORTRAN comment line. If
this number has a value of 72 or greater, then this number is
instead assumed to be the total number of characters which are to be
retained in each FORTRAN comment line. Either a /C:8 or a /C:80
switch would cause up to 80 characters to be included in each
FORTRAN comment line. Unlike the other switches which can appear on
the CRENBR command line, the /C switch does not apply to the
preceding FORTRAN comment lines or to the CRENBR command line in
which it appears. Although a previous CRENBR command line can change
the number of characters retained in the current CRENBR command
line, only the first 72 characters are ever evaluated on any CRENBR
command line. The maximum value which can appear with the /C switch
is 120.
.skip
.indent -3
/I#specifies the statement number increment. The number following
this switch will be the increment between generated statement
numbers. If the /I switch does not appear on the CRENBR command
line, then the value used as the increment will be that specified by
the user when RENBR was started, or will be 1 if the user did not
specify a statement number increment when RENBR was started.
.skip
.indent -3
/M#if issued without a following number, then the statement number
regions which are to be maintained during renumbering can be mixed,
rather than separated into logical blocks. An example of the use of
the /M switch is given in a later section of this instruction
manual. The /M switch must not be issued if logical blocks are to be
maintained as described in this section of the manual.
.skip
If the /M switch is follow by 2 numbers, then these numbers are the
the lowest and highest original statement numbers which will be
modified. All original statement numbers which are either less than
the first number or greater than the second number will be retained.
The first number following the /M switch is assumed to be 1 if it is
missing but the second number is specified. The second number is
assumed to be 99999 if it is missing but the first number is
specified. The /M switch could be used to identify a section of a
program or routine which is to be modified and then grafted back
into the original program or routine since all references within the
section to statements outside the section would remain correct. For
example, the switch /M:100:200 or M100#200 would cause only those
statement numbers which are in the range 100 through and including
200 to be renumbered.
.skip
If the /M switch is followed by a single number, then the second
number is assumed to have the value 99999 so that all statement
numbers which are greater than or equal to the specified number will
be renumbered. The /M switch might be used with a single number to
prevent the accidental renumbering of a routine, or to allow the
renumbering of only the more recent changes to a routine if an
earlier version of the routine is being retained for comparison.
.skip
If a number or pair of numbers follows the /M switch then the
statement number base and increment can be selected by the /B and /I
switches, but the /N and /O switches will be ignored if issued.
.skip
.indent -3
/N#specifies the new region size. The number following this switch
specifies the jump in generated statement numbers from the start of
one region to the next in the renumbered program or routine. To
prevent erroneous scaling of the statement numbers during a
subsequent renumbering of the program or routine which contains the
CRENBR command line, a /O (old region size) switch is removed when
renumbering is performed if the /O switch has been preceded within
the current program or routine by a /N switch, and each /N switch is
converted to a /O switch. If the /N switch does not appear on any
CRENBR command line in the program or routine, then the old region
size as specified by the /O switch is also used as the new region
size. If neither the /N switch nor the /O switch appears on any
CRENBR command line in the program, then the regions of statement
numbers are not preserved.
.skip
.indent -3
/O#specifies the old region size. The number following this switch
specifies the jump in the original statement numbers from the start
of one region to the next in the program which is being renumbered.
To prevent erroneous scaling of the statement numbers during a
subsequent renumbering of the program or routine which contains the
CRENBR command line, a /O switch is removed when renumbering is
performed if the /O switch has been preceded within the current
program or routine by a /N (new region size) switch, and each /N
switch is converted to a /O switch. If the /O switch does not appear
on any CRENBR command line in the program or routine, then the new
region size as specified by the /N switch is also used as the old
region size. If neither the /N switch nor the /O switch appears on
any CRENBR command line in the program, then the regions of
statement numbers are not preserved.
.skip
.indent -3
/R#specifies how statement number references are to be indicated in
comment lines. The first printing (neither a space nor a tab)
character following the R switch will be scanned for on all comment
lines and, whenever this character is found followed by a number,
then this number will be taken as a statement number reference. If a
colon follows the /R switch, then colons will mark statement numbers
which appear on comment lines. If renumbering is being performed,
then the number marked by this character will be replaced by the new
value of the referenced statement number. If a listing is being
produced, then the number marked by this character will be placed
into the list of statement number references with the associated
line number being that of the FORTRAN statement which precedes the
comment in which the number is located. If more than 1 statement
number reference appears on a single comment line, then each must be
preceded by the character. The character is scanned for only on
comment lines having an * or the letter C in column 1. Spaces and/or
tabs can appear on the comment line between the key character and
the following statement number but are not required. Spaces or tabs
cannot appear between the digits of a single statement number on a
comment line.
.skip
.indent -3
#(#specifies the routine name. The printing characters which follow
the ( switch, through the end of the line, or up to the next
appearance of a right parenthesis or slash character on the line,
are to be used as the routine name in the table of contents, and in
the listing page titles. Only the first 6 printing characters will
be used if more than 6 printing characters are specified in the
name. If the ( switch is not issued or does not specify a name, then
the routine name will be that read from the SUBROUTINE, FUNCTION,
BLOCK DATA or PROGRAM statement. The ( switch can be used to label
main programs even though these would not usually have names.
.skip
If the slash character / appears after the ( switch or after the
routine name following the ( switch, then the characters which
follow the / character, through the end of the line, or to the next
appearance of a matching right parenthesis on the line, will be used
as the subtitle in the listing. Such a subtitle can consist of at
most 44 characters and can include spaces and balanced parentheses.
The subtitle is not changed if the / character does not appear after
the ( switch or after the routine name following the ( switch. The
subtitle will be blank if it is not specified anywhere in the
program or routine.
.skip
The CRENBR command line containing the ( switch should be issued at
the start of a program or immediately following the first statement
of a routine since the ( switch cannot change the routine name or
subtitle in that portion of the listing preceding its use if
renumbering is not being performed. (If renumbering is being
performed, then the CRENBR command line is interpreted on the first
pass through the input program, and the listing is produced on the
second pass. However, if renumbering is not being performed, then
the listing is produced in a single pass.)
.skip
.left margin 0
The switches can appear in any order on the CRENBR command line.
Only the /I switch will accept a negative value. Although the
initial * or letter C must be in column 1, spaces and tabs can
appear anywhere else on the CRENBR command line except within numbers.
.skip
The values specified by the CRENBR command line apply to all
statement numbers within a single program or routine, but the CRENBR
command line can appear anywhere in the program or routine before
the terminal END statement. If multiple CRENBR command lines appear
within a single program or routine, then the values which are used
are the final values specified for each switch. The CRENBR command
line applies only to the program or routine in which it appears. The
default values of the switches (set by the user when RENBR was
started) are restored for the next program or routine read. In the
case of the N and /O switches, these defaults are to not preserve
regions.
.skip
The CRENBR command line
.break
CRENBR I-10 B 10 O 200 N 400
.break
would specify that original regions 1-199, 200-399, 400-599 etc.
would be translated to regions such as 1-399, 400-799 and 800-1199.
The actual translation would depend on the relative placement of the
original regions. For example, using the above CRENBR command line
(note the negative increment), the statement number sequence (with
270 at the start of the routine)
.break
.indent 4
270##350##260##351###15####2####6##150###99#1600#1622
.break
would be translated to the following sequence
.break
.indent 4
830##820##810##800##440##430##420##410##400###20###10
.skip
To allow the insertion of new statements into a region, statement
numbers which would normally be outside the region are taken as part
of the surrounding region if statement numbers both before and after
the insertion are within the region. Therefore, the statement number
sequence
.break
.indent 4
270#8350#4260##351###15####2####6##150###99#1600#1622
.break
would be renumbered to produce the same sequence as was given before.
.spacing 1
.skip 2
.spacing 1
.test page 5
.center
Bootstrapping Logical Blocks of Statement Numbers
.center
------------- ------- ------ -- --------- -------
.skip
If the CRENBR command line has specified that logical blocks of
statement numbers are to be preserved, then RENBR, when assigning
new statement numbers, will terminate each logical block of
statement numbers at the final statement number which is within the
range defined by the first statement number of the block. New
statements, which bear statement numbers outside the logical block
ranges found elsewhere in the program, can be inserted at the start
and end of each consecutive logical region of statements to force
conversion of statement numbers within these regions into
consecutively higher ranges. There should, as a result, be a
temporary statement at both the start and end of the program and 2
temporary statements between consecutive regions. Since statements
which temporarily define logical blocks should be removed during or
after renumbering, these statements need not be written in legal
FORTRAN. If these temporary statements consist only of statement
numbers and not statement text, then RENBR will remove these
statement numbers when the program or routine is renumbered.
Following the bootstrapping, a statement number will be missing from
the lower end of each region until the program is next renumbered.
.skip 2
.test page 5
.center
Maintaining Number Regions Keyed to Statement Types
.center
----------- ------ ------- ----- -- --------- -----
.skip
Many programmers use statement number size to indicate the type of
statement. In particular, FORMAT statements and the statements at
the ends of DO loops are often assigned large numbers. Use of the M
switch without a following number on the CRENBR command line allows
the resulting mixed statement number regions to be maintained during
renumbering. The new statement numbers are based on the order in
which they appear within their respective regions. The high order or
leftmost digits (relative to the original region size) of the
statement numbers are maintained unless an expanding region
overflows into the next higher region in which case the higher
region must be offset to prevent duplication of the new statement
numbers.
.skip
For example, the command line
.break
C#####RENBR O1000 M I10
.break
would cause the statement number sequence
.break
.indent 5
.nofill
35 20 4200 350 360 4090 2561 2009 4010 55 65
.break
to be renumbered to
.break
.indent 5
10 20 4000 30 40 4010 2000 2010 4020 50 60
.skip
Similarly, the command line
.break
C#####RENBR O1000 M I-10
.break
would renumber the same original sequence to
.break
.indent
60 50 4020 40 30 4010 2010 2000 4000 20 10
.skip
.fill
When using the /M switch without a following number, the scaling of
the leftmost digits of the statement numbers changes if the values
appearing with the /N and /O switches are not equal. For example,
the command line
.break
CRENBR/N:500/O:1000/M
.break
would be converted to
.break
CRENBR/O:500/######/M
.break
and would change the statement number sequence
.nofill
14440 30000 5700 15124 5207 14003 15123
into
7000 15000 2500 7500 2501 7001 7501
.fill
.skip 2
.test page 5
.center
Inclusion of NonFORTRAN Text in the Input File
.center
--------- -- ---------- ---- -- --- ----- ----
.skip
The first line of the first input source file, and the first line
following each FORTRAN END statement, are scanned for the appearance
of the letters RENBRSTART anywhere on the line. The letters
RENBRSTART can be preceded by any other characters and can be
separated by spaces or tabs. If the letters RENBRSTART are found,
then the current line and all following lines through the end of the
final input source file or up to the next CRENBR command line will
be treated as comment lines. The name to be associated with the
current comment section, and a subtitle for the listing, can appear
to the right of the letters RENBRSTART in the format in which this
information could appear on a CRENBR command line. The name and
subtitle will be blank in the listing if these are not specified by
the RENBRSTART command line. Additional RENBRSTART command lines can
appear within the comment section to force the printing of a new
page with new name and new subtitle. If the comment section is
terminated by a CRENBR command line, then this CRENBR command line
is considered to be a part of the following FORTRAN program or
routine.
.skip
The ability to include comment sections within the input file allows
assembly language routines, command files and data to be listed with
the FORTRAN programs with which these are used. If renumbering is
being performed, then the comment sections are copied into the
output file unchanged. If a listing is being produced, then a line
sequence number is printed beside each line within the comment
section, and the comment section name and the total number of lines
within the comment section are included in the table of contents,
but the words and numbers appearing in the comment section are not
indexed.
.skip
A RENBRTITLE command line can be used for much the same purpose as a
RENBRSTART command line. These 2 types of command lines are
identical if encountered at the start of the first input source file
or after a FORTRAN END statement. The only difference between these
2 types of command lines is that, when encountered within an already
established comment section, the RENBRTITLE command line does not
force the printing of a new page and, if the RENBRTITLE command line
does not specify a subtitle, then the subtitle previously specified
for the comment section will remain unchanged. The RENBRTITLE
command line is used to enter an additional comment section name,
and comment section line total, into the table of contents without
starting a new page in the listing. If the storage used for the
table of contents is already full, then the current table of
contents will have to be printed before the new name can be added,
so under these conditions even the RENBRTITLE command line would
force printing of a new page after the table of contents.
.skip
A typical sequence of FORTRAN programs and comment sections would be
.nofill
.left margin 10
.test page 9
text of FORTRAN program or routine
END
any charactersRENBRSTART(NAME/SUBTITLE)
comment section text
any charactersRENBRTITLE(NAME/SUBTITLE)
additional comment section text
CRENBR(NAME/SUBTITLE)
text of another FORTRAN program or routine
END
.fill
.left margin 0
It should be noted that if the FORTRAN system does not allow
end-of-file tests in READ statements, then the sequence CRENBR, END,
END must appear at the end of the input source file to force the
printing of the table of contents if no other FORTRAN routines
follow a comment section.
.skip 2
.test page 5
.center
Statement Types Recognized by RENBR
.center
--------- ----- ---------- -- -----
.skip
RENBR can recognize statement numbers contained in the following
types of FORTRAN-II and FORTRAN-IV statements. In these examples,
the number 20 has been used to represent any FORTRAN statement
number and the number 10 has been used to represent a number which
is not a statement number. The key words which identify these
statements can also be used as variable names or as array names
without causing any difficulties. The ability to handle statement
numbers in other types of statements can be easily added.
.skip
.nofill
ACCEPT 20
ACCEPT 20,LIST OF VARIABLES
ACCEPT TAPE 20
ACCEPT TAPE 20,LIST OF VARIABLES
ASSIGN 20 TO INTEGER VARIABLE
CALL ROUTINE(OPTIONAL ARGUMENTS,*20,OPTIONAL ARGUMENTS)
CALL ROUTINE(OPTIONAL ARGUMENTS,$20,OPTIONAL ARGUMENTS)
CALL ROUTINE(OPTIONAL ARGUMENTS,_&20,OPTIONAL ARGUMENTS)
CLOSE(OPTIONAL SPECIFICATIONS,ERR=20,OPTIONALSPECIFICATIONS)
DECODE(10,20,VARIABLE)LIST OF VARIABLES
DECODE(10,20,VARIABLE,ERR=20)LIST OF VARIABLES
DO 20 INTEGER VARIABLE=EXPRESSION,EXPRESSION
DO 20,INTEGER VARIABLE=EXPRESSION,EXPRESSION
DO 20 INTEGER VARIABLE=EXPRESSION,EXPRESSION,EXPRESSION
DO 20,INTEGER VARIABLE=EXPRESSION,EXPRESSION,EXPRESSION
ENCODE(10,20,VARIABLE)LIST OF VARIABLES
ENCODE(10,20,VARIABLE,ERR=20)LIST OF VARIABLES
FREQUENCY 20(OPTIONAL NUMBERS), ... ,20(OPTIONAL NUMBERS)
FREQUENCY 20(10,10,10),20,20(10),20(10,10) !FOR EXAMPLE
GO TO 20
GO TO INTEGER VARIABLE(20, ... ,20)
GO TO INTEGER VARIABLE,(20, ... ,20)
GO TO (20, ... ,20)INTEGER VARIABLE
GO TO (20, ... ,20),INTEGER VARIABLE
IF(EXPRESSION)20,20
IF(EXPRESSION)20,20,20
IF(EXPRESSION)STATEMENT
IF ACCUMULATOR OVERFLOW 20,20
IF ACCUMULATOR OVERFLOW 20,20,20
IF DIVIDE CHECK 20,20
IF DIVIDE CHECK 20,20,20
IF QUOTIENT OVERFLOW 20,20
IF QUOTIENT OVERFLOW 20,20,20
OPEN(OPTIONAL SPECIFICATIONS,ERR=20,OPTIONAL SPECIFICATIONS)
PRINT 20
PRINT 20,LIST OF VARIABLES
PUNCH 20
PUNCH 20,LIST OF VARIABLES
PUNCH TAPE 20
PUNCH TAPE 20,LIST OF VARIABLES
READ 20
READ(10,20)
READ(10,20,END=20)
READ(10,20,ERR=20)
READ(10,20,ERR=20,END=20)
READ(10,20,END=20,ERR=20)
READ(10,FORMAT,END=20)
READ(10,FORMAT,ERR=20)
READ(10,FORMAT,ERR=20,END=20)
READ(10,FORMAT,END=20,ERR=20)
READ(10'10,20,ERR=20,END=20)
READ(10_#10,20,ERR=20,END=20)
READ 20,LIST OF VARIABLES
READ(10,20)LIST OF VARIABLES
READ(10,20,END=20)LIST OF VARIABLES
READ(10,20,ERR=20)LIST OF VARIABLES
READ(10,20,ERR=20,END=20)LIST OF VARIABLES
READ(10,20,END=20,ERR=20)LIST OF VARIABLES
READ(10,FORMAT,END=20)LIST OF VARIABLES
READ(10,FORMAT,ERR=20)LIST OF VARIABLES
READ(10,FORMAT,ERR=20,END=20)LIST OF VARIABLES
READ(10,FORMAT,END=20,ERR=20)LIST OF VARIABLES
READ(10'10,20,ERR=20,END=20)LIST OF VARIABLES
READ(10_#10,20,ERR=20,END=20)LIST OF VARIABLES
READ INPUT TAPE 10,20
READ INPUT TAPE 10,20,LIST OF VARIABLES
REREAD 20
REREAD 20,LIST OF VARIABLES
TYPE 20
TYPE 20,LIST OF VARIABLES
WRITE 20
WRITE(10,20)
WRITE(10'10,20)
WRITE(10_#10,20)
WRITE 20,LIST OF VARIABLES
WRITE(10,20)LIST OF VARIABLES
WRITE(10'10,20)LIST OF VARIABLES
WRITE(10_#10,20)LIST OF VARIABLES
WRITE OUTPUT TAPE 10,20
WRITE OUTPUT TAPE 10,20,LIST OF VARIABLES
.fill
.left margin 0
.skip
In addition to the above, the following statement types are
recognized although these do not contain statement number references.
.left margin 5
.skip
.indent -5
FIND statements of the form FIND(10'10) or FIND(10_#10) are
recognized so that the unit and record numbers can be separated
before being entered into the index.
.skip
.indent -5
DATA and FORMAT statements are recognized so that items following
these keywords are not indexed.
.skip
.indent -5
IF(expression)THEN, ELSE IF(expression)THEN, ELSE, and END IF
statements are recognized to allow optional indentation of
statements within their ranges.
.skip
.indent -5
BLOCK DATA, PROGRAM, SUBROUTINE, ENTRY and FUNCTION statements are
recognized so that program and routine names can be obtained from
these.
.left margin 0
.skip
The FORTRAN operators and delimiters shown below are recognized.
This list does not include operators such as ** (exponentiation) and
// (concatenation) which can be considered to be a series of shorter
operators.
.skip
.test page 3
.nofill
_.LT. .EQ. .GT. .AND. .OR. .EQV.
_.LE. .NE. .GE. .NOT. .XOR. .NEQV.
( ) = + - * / , < > _# :
.fill
.skip
RENBR handles as single units alphameric strings which either are
preceded by the decimal number of characters and the letter H or
else are preceded and followed by apostrophes. It is likely that no
harm will result if programs containing other alphameric string
designations are renumbered. If some character other than the
apostrophe is used as the delimiting character in programs or
routines which are to be renumbered, then the only situation likely
to give trouble will be when IF statements are used to test
character data against alphameric strings containing either left or
right parentheses. RENBR was used for several years before the
ability to handle alphameric strings as single units was even added
to it.
.skip
Statement numbers appearing in CALL statements can be preceded
either by an asterisk, by a dollar sign or by an ampersand. DATA
statements in the RENBR program must be changed if some other
character is used to indicate such statement numbers in CALL
statements.
.skip 2
.test page 5
.center
Format of Statements in the Output File
.center
------ -- ---------- -- --- ------ ----
.skip
The text of statements in the renumbered output file begins in
column 7 if column form has been selected, or else following the tab
which separates the statement number field from the statement text
field. Original indentation in the form of additional spaces or tabs
is not preserved. In a continuation line the original number of
spaces separating the statement continuation character from the text
of the continued statement is maintained if possible. All other
spacings are left unchanged.
.skip 2
.test page 5
.center
Description of the Listing Produced by RENBR
.center
----------- -- --- ------- -------- -- -----
.skip
RENBR can, at the user's request, produce a listing of the source
programs. The listing of each separate main program or routine is
begun on a new page. In the upper right corner of each page are
printed both the current page number and the name of the program or
routine. To the left of each non-comment statement is printed the
count or sequence number of the statement within the current program
or routine. If a statement must be split to keep it within the
margins of the listing, then the extra characters are right
justified on the next line and minus signs are placed in the
statement count field if the right justified extra text does not
begin with a space character. If there is a space at the start of
the right justified extra text, then the number of initial spaces is
printed within parentheses in the statement count field instead.
.skip
Following the listing of the program or routine is a list of
statement numbers and of the sequence numbers of the statements in
which these statement numbers are referenced. If renumbering is not
being performed, then this list will also include as negative
numbers the sequence numbers of the numbered statements themselves.
These negative numbers are not included in the list of statement
number references if renumbering is being performed, since then the
resulting statement numbers will be in order so that it is assumed
that further assistance is not needed to locate them.
.skip
After the list of statement number references is a list of all key
words, variable names and constants used in the program or routine
and of the sequence numbers of the statements in which these are
used. A sequence number is given as negative if the referenced
variable or array is defined in the statement by the equals sign
operator. Key words such as GO TO are considered to be single words
in the index, but spaces and tabs are otherwise used as word
separators. Format specifications within FORMAT statements, and
values assigned by DATA statements, are not included in the list.
.skip 2
.test page 5
.center
Changing Length of Uninterrupted Listing
.center
-------- ------ -- ------------- -------
.fill
.skip
The tables of statement number references and the indexes are
printed at the end of each program or routine, or when the necessary
storage fills. As supplied, RENBR will produce uninterrupted
listings of FORTRAN routines of approximately 800 non-comment lines
(dependent on programmer style). This requires 2 arrays each
dimensioned at 1000 locations to store the statement references, an
array dimensioned at 2000 locations to store the characters forming
the words in the symbol dictionary, and an array dimensioned at 5000
locations to store the numeric information which is to be included
in the symbol dictionary. Directions for changing the sizes of these
arrays are included as comments in the RENBR program. If the storage
necessary to run RENBR is reduced, then the tables and indexes will
be dumped after processing of fewer lines, but the listings will
still be correct.
.skip
Two arrays are used to store the textual and numeric information
concerning at most 28 items which can be included in the table of
contents which is printed at the end of the processing, or whenever
these arrays are full at the end of a program or routine. The items
in the table of contents are printed both by order of appearance and
by alphabetical order within the current page of the table of
contents. The sizes of these arrays can be increased if the items
within more than a single page of the table of contents are to be
printed together in alphabetical order. Directions for changing the
sizes of these arrays are included as comments in the RENBR program.
.skip 2
.test page 3
The current version of RENBR was written at the Aiken Computation
Laboratory of Harvard University, and at the Harvard Business School
by Donald E_. Barth, who can be reached at the following address.
.nofill
.skip
Baker Library 21
Graduate School of Business Administration
Harvard#University
Soldiers Field
Boston, Massachusetts 02163
.fill
.subtitle Appendix A:#List of Files Forming this Package
.page
.center
Appendix A:#List of Files Forming This Package
.center
--------#-##---- -- ----- ------- ---- -------
.fill
.skip
.fill
.left margin 12
.indent -12
RENBR.FOR###Source of the entire FORTRAN renumbering program with
the exception of the machine dependent routines REUSER, RETEMP and
RECLOS which process the commands typed by the user and open and
close all files. On the DECsystem-10 computer, RENBR.FOR can be
compiled with the FORTRAN-10 compiler with optimization.
.skip
.indent -12
REUSR1.FOR##Sources of the REUSER routine, and of several routines
which are called by REUSER, for use on the DECsystem-10. This
version of these routines accepts a single line command which
consists of the names of the output files and associated switches,
followed by an equal sign and the list of input files. This version
of these routines should be compiled with the FORTRAN-10 compiler,
version 5 or greater, with optimization. The ERR= transfers will
have to be removed from the OPEN statements if this version of these
routines is compiled using the F40 compiler or with earlier versions
of the FORTRAN-10 compiler. Before the routines in the REUSR1.FOR
file can be compiled with the F40 compiler, the DATA statements
which define the left and right square brackets will have to be
commented out of two of these routines and be replaced by the octal
notation DATA statements which are currently commented out.
.skip
.indent -12
REUSR2.FOR##Source of a simple version of the REUSER routine for use
on the DECsystem-10. This version of the REUSER routine accepts a
single line command which consists only of switches, and then asks
on subsequent lines for the names of the output and input files.
This version of the REUSER routine will probably be easier to
convert for use on other computer systems than that in REUSR1.FOR.
.skip
.indent -12
REUSR3.FOR##Source of a very simple version of the REUSER routine
for use on the DECsystem-10. This version of the REUSER routine
merely asks for the output and input file names.
.skip
.indent -12
RETMP1.FOR##Sources of the RETEMP routine which opens and closes the
scratch file and of the RECLOS routine which closes the output files
for use on the DECsystem-10. This file must be compiled and loaded
together with RENBR.FOR and either REUSR1.FOR, REUSR2.FOR or
REUSR3.FOR.
.skip
.indent -12
REUSR4.FOR##Sources of the REUSER routine, of the RETEMP routine, of
the RECLOS routine, and of several routines which are called by
REUSER, for use on the Digital Equipment Corporation VAX-11
computer. A single line command is accepted which consists of the
names of the output files and associated switches, followed by an
equal sign and the list of input files. Full VAX-11 file
specifications are supported, including nodes and version numbers.
Percent signs have replaced semicolons as command separators since
semicolons can precede version numbers in VAX-11 file
specifications. The default filetype (or extension) for the
renumbered output file has been changed to _.FOR since the default
version number prevents destruction of the original file. These
VAX-11 routines were developed on a DECsystem-10, but testing on a
VAX-11 showed that the author had neglected to include
carriagecontrol= specifications in the OPEN statements. Patches to
correct this oversight have been inserted, but these patches have
not been tested.
.skip
.indent -12
RETEST.FOR##Test data for RENBR. The programs and routines in this
file are not meant to be compiled. Directions for use are given as
comments at the start of the file.
.skip
.indent -12
RENBR.DOC###This document.
.skip
.indent -12
RENBR.RND###File which generates this document when processed by the
DECsystem-10 text justifier program RUNOFF.
.skip
.indent -12
REFMT.FOR###FORTRAN program which reorders the items in the arrays
which control the recognition by RENBR of FORTRAN syntax. Directions
for the use of this program are given as comments at the start of
the file.
.skip
.indent -12
REOPR.FOR###FORTRAN program which constructs the DATA statements
which define the arrays used by RENBR in the recognition of FORTRAN
operators. Directions for the use of this program are given as
comments at the start of the file.
.subtitle Appendix B:#RENBR Development History
.page
.left margin 0
.center
Appendix B:#RENBR Development History
.center
-------- -##----- ----------- -------
.skip
RENBR is based upon a 418 statement FORTRAN program of unknown
origin which was in use at Yale University in 1965 or shortly
thereafter. The present version of the program consists of 10 times
that many statements. The general construction of the table which
drives the statement number recognition process is still based upon
that in the original program. However, the statements which perform
the binary search of sorted statement numbers are all that remain
from the original program.
.skip
The features which have been added to the program by the current
author are listed below.
.skip
.left margin 4
.test page 3
.indent -4
June#1970
.indent -3
1.#Extension. Listing of each program or routine includes statement
number reference table and word reference table.
.skip
.test page 3
.indent -4
March#1971
.indent -3
1.#Extension. FORTRAN operators such as .EQ. and .LT. separate
components of statements.
.indent -3
2.#Extension. Alphameric string following leading number and letter
H or enclosed between apostrophes is treated as single component of
statement.
.indent -3
3.#Extension. Program or routine name and type are printed at upper
right corner of each page of listing.
.indent -3
4.#Extension. REFMT program reorders items in the arrays which
direct the syntax recognition process.
.skip
.test page 3
.indent -4
May#1971
.indent -3
1.#Correction. DATA statement generator used by the REFMT program
did not correctly handle the 2 negative numbers having largest
absolute value and the largest positive number.
.skip
.test page 3
.indent -4
June#1972
.indent -3
1.#Extension. Program being renumbered can contain mixture of column
form and tab form statements. Output can be selected in either form.
.break
.indent -3
2.#Extension. When there is a change in the number of digits in a
statement number in the statement text, spaces are added or removed
at the end of the line, if possible, to cause the position of
following continuation lines to remain unchanged.
.break
.indent -3
3.#Correction. Spaces and tabs were not allowed between the number
of characters and the letter H preceding an alphameric string.
.skip
.test page 3
.indent -4
July#1972
.indent -3
1.#Correction. END statement could not be in tab form.
.skip
.test page 3
.indent -4
February#1973
.indent -3
1.#Correction.Continuation column contained non-digit characters in
listing if renumbering was not being performed.
.skip
.test page 3
.indent -4
January#1975
.indent -3
1.#Extension. Logical blocks of statement numbers can be maintained.
.indent -3
2.#Extension. Specification of options by single characters instead
of by answers to dialog questions.
.indent -3
3.#Extension.Optional specification by the CRENBR command of the
statement number increment, base and blocks to be maintained.
.indent -3
4.#Extension. Indication in listing of names appearing on left side
of equals signs.
.indent -3
5.#Extension. Optional specification by the user of the number of
lines to be printed per page in the listing.
.indent -3
6.#Extension. Optional insertion of counted line feeds between pages
of listing.
.indent -3
7.#Extension. Optional splitting of long lines in listing. This is
necessary if counted line feeds are used on a narrow width listing
device.
.indent -3
8.#Extension. Conversion of tab characters in comment lines to
multiple spaces so as to fill to the proper tab stops in the
listing. This allows comment lines listed by RENBR to be spaced the
same as if the programs had been listed left justified. Unless
otherwise specified by the W option, the width of the tab stop
columns is assumed to be 8 characters.
.indent -3
9.#Extension. Optional conversion of tab characters in comment lines
to multiple spaces so as to fill to the proper tab stops in the
renumbered output. Conversion of tab characters in comment lines to
spaces in the renumbered output is helpful when converting programs
for computer systems which do not recognize the tab character.
Unless the /W switch is selected, tab characters in comment lines
are left intact when copied into the renumbered output. It must be
noted that tab characters within FORTRAN statements are left intact
by RENBR unless such tab characters separate the digits of a
statement number.
.indent -4
10.#Extension. Optional recognition of marked statement number
references in comment lines. Such marked statement numbers in
comment lines are included in the table of statement number
references, and can be renumbered.
.indent -4
11.#Extension. Optional specification by the CRENBR command of the
routine name and subtitle for use in the listing.
.indent -4
12.#Extension. Optional multiple copies of table of contents.
.indent -4
13.#Extension. Ability to include nonFORTRAN comment sections in
input file. This is signalled by the letters RENBRSTART or
RENBRTITLE appearing in the first line of the file or after a
FORTRAN END statement.
.indent -4
14.#Extension. ENTRY statements are included in table of contents.
.indent -4
15.#Extension. Table of contents is ordered both serially and
alphabetically. Only serial ordering was provided previously.
.indent -4
16.#Extension. Optional insertion of blank lines between FORTRAN
statements in the listing. Blank lines are not inserted between
comment lines, nor between the start of a statement and its
continuation lines.
.indent -4
17.#Extension. Optional indentation of statements within the range
of DO loops.
.skip
.test page 3
.indent -4
January#1979
.indent -3
1.#Extension. Optional insertion of extra empty lines into the
bottom and top of consecutive pages of the listing so that
fan-folded paper can be bound at the top.
.indent -3
2.#Extension. Program name established by PROGRAM statement is used
as name of a main program.
.indent -3
3.#Extension. Semicolon can appear between pair of statements on
same line.
.indent -3
4.#Extension. Exclamation point followed by a comment can appear to
the right of a statement.
.indent -3
5.#Extension. Statements can be written in a mixture of upper and
lower cases.
.indent -3
6.#Extension. Colon can appear between letter identifying switch and
the following number on CRENBR command line.
.indent -3
7.#Extension. Numbers on CRENBR command line can have leading plus
sign.
.indent -3
8.#Extension. Single characters <, > and _# are relational
operators. Single character _: is a subscript separator. _.NEQV_. is
a logical operator.
.indent -3
9.#Extension. /M switch typed by user or on CRENBR command line can
be followed by values of lowest and highest statement numbers which
can be changed while renumbering.
.indent -4
10.#Extension. Instructions to RENBR program are given in form
OUTPUT FILES=LIST OF INPUT FILES in which switches identify purposes
of output files.
.indent -4
11.#Extension. Optional left justification of statement numbers when
column form is selected.
.indent -4
12.#Extension. /N switch in CRENBR command line is output as /O
switch. /O switch in CRENBR command line is removed if a /N switch
has already been found.
.indent -4
13.#Extension. Lower case letters appearing outside alphameric
strings are converted to upper case when indexed.
.indent -4
14.#Extension. Optional indentation of statements within the range
of IF(expression)THEN and ELSE statements.
.indent -4
15.#Extension. To support FORTRAN77 standards, asterisk in column 1
indicates comment.
.indent -4
16.#Extension. REOPR program constructs DATA statements which define
arrays which control the recognition of operators such as +, - and
_.NOT.
.indent -4
17.#Extension. /C switch on CRENBR command line can cause comment
lines to be longer than 72 characters.
.indent -4
18.#Extension. Summary of storage utilization for the listing is
shown to user only if the user types the /Z switch or if one of the
tables overflows. Previously, this summary was always shown to the
user.
.indent -4
19.#Extension. Programs and routines having a great many statement
numbers (over 1000 with arrays dimensioned as supplied) can be
processed although the old statement numbers are retained.
Previously, such programs and routines could be listed, but not
processed. Listings produced whenever the old statement numbers are
being retained, whether due to an error being found in the first
pass or to the user issuing a /M switch without following numbers,
include in the tables of statement references the line numbers of
the statements bearing these statement numbers. Previously, the line
numbers of the statements bearing the statement numbers were
included in the tables of statement number references only if the
programs and routines were not being processed.
.indent -4
20.#Modification. Character information has been separated from
numeric information in storage of index and of table of contents to
ease future conversion to FORTRAN77 standards. All variables and
arrays which contain a single character in each logical location
which can be addressed by subscript have names beginning with the
letters LTR for variables and arrays which can contain either upper
or lower case, and LWR for variables and arrays which can contain
only lower case and for which there are also corresponding named
variables or arrays which contain only upper case. All variables and
arrays which contain more than a single character in each logical
location have names beginning with letters such as LA4 (for 4
characters on VAX-11 computer) or LA5 for 5 characters on
DECsystem-10 computer) and are used only in the file opening and
closing routines which are hardware dependent anyway. All variables
and arrays which contain character information and which are needed
by more than just a single routine are stored in labeled COMMON
blocks which contain no numeric information. These are the only
places where the letter sequences LTR, LWR, LA4 and LA5 are used in
the RENBR program.
.indent -4
21.#Modification. Main program only controls the execution of
several subroutines. Previously, the main program also initialized
the variables in common and read the programs and routines the first
time to locate the statement numbers. The structure of the program
was modified in this manner to make overlaying easier. If the
program is overlaid, however, then the contents of the COMMON blocks
in the REUSER routine and in the REOPEN routine which is called by
some versions of the REUSER routine will have to be preserved.
.indent -4
22.#Correction. Leading non-numeric character was not repeated on
continuation lines of a statement being generated in column form.
.indent -4
23.#Correction. Exponent is included in index with numbers written
in E or D notation. Previously, signed exponents were indexed
separately.
.subtitle Appendix C:#Sample Table of Contents and Listing
.page
.fill
.left margin 0
.center
Appendix C:#Sample Table of Contents and Listing
.center
--------#-##------ ----- -- -------- --- -------
.skip
The pages which follow form a listing of one of the routines in the
RENBR package and were produced when RENBR was used to list an
earlier version of the RENBR package. The width of these pages has
been reduced slightly (by 3 characters) to fit into the current
document. The table of contents produced by RENBR for the total
listing which included the following pages is shown below. The
second line at the top of the table of contents lists the total
number of FORTRAN statements, the total number of comment lines
appearing within FORTRAN programs and routines, and the total number
of lines in comment sections which were designated by either
RENBRSTART or RENBRTITLE command lines. The third line lists the
average number of consecutive FORTRAN statements which were not
separated by comment lines or by the end of programs or routines,
and the average number of consecutive FORTRAN comment lines which
were not separated by FORTRAN statements. The left 2 columns in the
table of contents show the location in the listing of each of the
programs and routines, sorted alphabetically by name. The right 3
columns show the number of FORTRAN statements in and the location in
the listing of each of the programs and routines, sorted by page
numbers.
.skip
.nofill
APPENDIX: SAMPLE TABLE OF CONTENTS AND LISTING TABLE OF
STATEMENTS 2288, COMMENTS 2355, NONFORTRAN 0 CONTENTS
(AVG GROUP) 12, 14
PAGE LENGTH PAGE
#
DASORT SUBROUTINE 152 RENBR BLOCK DATA 18 1
#
RECMND SUBROUTINE 126 RENBR MAIN PROGRAM 331 18
#
REINDX SUBROUTINE 111 REPACK SUBROUTINE 243 51
#
RENBR BLOCK DATA 1 REPLAC SUBROUTINE 334 63
#
RENBR MAIN PROGRAM 18 REOUT SUBROUTINE 287 79
#
RENEXT SUBROUTINE 146 RENUMB SUBROUTINE 49 92
#
RENUMB SUBROUTINE 92 REUNIT SUBROUTINE 230 98
#
REOUT SUBROUTINE 79 REINDX SUBROUTINE 308 111
#
REPACK SUBROUTINE 51 RECMND SUBROUTINE 171 126
#
REPLAC SUBROUTINE 63 RETITL SUBROUTINE 204 135
#
RETITL SUBROUTINE 135 RENEXT SUBROUTINE 67 146
#
REUNIT SUBROUTINE 98 DASORT SUBROUTINE 46 152
.page
APPENDIX: SAMPLE TABLE OF CONTENTS AND LISTING PAGE 152
BUBBLE SORT ROUTINE DASORT SUBROUTINE
#
1 SUBROUTINE DASORT(IARRAY,ILOWER,IUPPER,JARRAY)
C RENBR(/BUBBLE SORT ROUTINE)
C
C DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C REGIONS CONTAINING INITIAL ORDERING ARE SWAPPED BY
C THREADING ITEMS BEING MOVED INTO NEW LOCATIONS.
C
C IARRAY = THE ARRAY TO BE SORTED.
C ILOWER = LOWEST SUBSCRIPT OF REGION TO BE SORTED.
C IUPPER = HIGHEST SUBSCRIPT OF REGION TO BE SORTED.
C JARRAY = ARRAY TO BE HELD PARALLEL TO IARRAY.
C
2 DIMENSION IARRAY(1),JARRAY(1)
C
C FIND UPPER END OF LOWER REGION TO BE SWAPPED
3 IPNTR=ILOWER
4 1 MID=IPNTR
5 IPNTR=IPNTR+1
6 2 IF(IPNTR.GT.IUPPER)GO TO 12
7 IF(IARRAY(IPNTR).GE.IARRAY(MID))GO TO 1
C
C FIND LOWER END OF LOWER REGION TO BE SWAPPED
8 ITEST=IARRAY(IPNTR)
9 LOW=ILOWER
10 3 IF(ITEST.LT.IARRAY(LOW))GO TO 4
11 LOW=LOW+1
12 GO TO 3
C
C FIND UPPER END OF UPPER REGION TO BE SWAPPED
13 4 JTEST=IARRAY(LOW)
14 5 MAX=IPNTR
15 IPNTR=IPNTR+1
16 IF(IPNTR.GT.IUPPER)GO TO 6
17 ITEST=IARRAY(IPNTR)
18 IF(ITEST.LT.IARRAY(MAX))GO TO 6
19 IF(ITEST.LT.JTEST)GO TO 5
C
C PERFORM THE THREADED SWAP OF ORDERED REGIONS
C
C IF THERE WERE SEVERAL PARALLEL ARRAYS, IT MIGHT
C BE CONVENIENT TO REPLACE THE FOLLOWING SECTION BY
C CALLS TO THE SWAPPING ROUTINE DASWAP SIMILAR TO
C
C CALL DASWAP(IARRAY,LOW,MID,MAX)
C CALL DASWAP(JARRAY,LOW,MID,MAX)
C
20 6 ITEST=LOW-MAX-1
21 LAST=MAX
22 LOW=LOW-MID-1
23 JTEST=MAX-MID
.page
APPENDIX: SAMPLE TABLE OF CONTENTS AND LISTING PAGE 153
BUBBLE SORT ROUTINE DASORT SUBROUTINE
#
24 7 INDEX=LAST+LOW
25 IKEEP=IARRAY(LAST)
26 JKEEP=JARRAY(LAST)
27 8 ITEST=ITEST+1
28 INEW=IARRAY(INDEX)
29 JNEW=JARRAY(INDEX)
30 IARRAY(INDEX)=IKEEP
31 JARRAY(INDEX)=JKEEP
32 IKEEP=INEW
33 JKEEP=JNEW
34 IF(INDEX.GT.MID)GO TO 9
35 INDEX=INDEX+JTEST
36 GO TO 8
37 9 IF(INDEX.EQ.LAST)GO TO 10
38 INDEX=INDEX+LOW
39 GO TO 8
40 10 IF(ITEST.EQ.0)GO TO 11
41 LAST=LAST-1
42 GO TO 7
C
C PREPARE TO FIND NEXT ORDERED REGION
43 11 MID=MAX
44 GO TO 2
45 12 RETURN
46 END
.page
APPENDIX: SAMPLE TABLE OF CONTENTS AND LISTING PAGE 154
BUBBLE SORT ROUTINE DASORT SUBROUTINE
#
STATEMENT
NUMBER REFERENCED BY
#
1 -4 7
2 -6 44
3 -10 12
4 10 -13
5 -14 19
6 16 18 -20
7 -24 42
8 -27 36 39
9 34 -37
10 37 -40
11 40 -43
12 6 -45
.page
APPENDIX: SAMPLE TABLE OF CONTENTS AND LISTING PAGE 155
BUBBLE SORT ROUTINE DASORT SUBROUTINE
#
WORD CONTAINED IN
#
DASORT 1
DIMENSION 2
END 46
GOTO 6 7 10 12 16 18 19 34 36
37 39 40 42 44
IARRAY 1 2 7 8 10 13 17 18 25
28 -30
IF 6 7 10 16 18 19 34 37 40
IKEEP -25 30 -32
ILOWER 1 3 9
INDEX -24 28 29 30 31 34 -35 37 -38
INEW -28 32
IPNTR -3 4 -5 6 7 8 14 -15 16
17
ITEST -8 10 -17 18 19 -20 -27 40
IUPPER 1 6 16
JARRAY 1 2 26 29 -31
JKEEP -26 31 -33
JNEW -29 33
JTEST -13 19 -23 35
LAST -21 24 25 26 37 -41
LOW -9 10 -11 13 20 -22 24 38
MAX -14 18 20 21 23 43
MID -4 7 22 23 34 -43
RETURN 45
SUBROUTINE 1
0 40
1 2 5 11 15 20 22 27 41