Trailing-Edge
-
PDP-10 Archives
-
decuslib20-09
-
decus/20-34/rebig.for
There are 3 other files named rebig.for in the archive. Click here to see a list.
C RENBR(REBIG/CHANGE SIZES OF ARRAYS IN RENBR)
C
C DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C THIS PROGRAM CAN BE USED TO CHANGE THE MAXIMUM SIZE OF AN
C INDIVIDUAL MAIN PROGRAM OR ROUTINE WHICH CAN BE LISTED BY
C RENBR. FOR LARGE PROGRAMS, IF THIS IS OOT DOOE, THEO THE
C LISTINGS WILL BE INTERRUPTED BY PARTIAL STATEMENT NUMBER
C TABLES OR CROSS REFERENCE TABLES WHENEVER THE ARRAYS USED
C TO STORE THESE FILL. THIS PROGRAM ASKS FOR THE VARIOUS
C MAXIMUM NUMBERS OF ITEMS WHICH MUST BE ALLOWED FOR IN
C LISTING A PROGRAM, AND CALCULATES THE DIMENSIONS FROM THESE
C ANSWERS. BOTH THE RENBR MAIN PROGRAM, ALL OF ITS ROUTINES,
C AND THE VERSION OF THE REUSER ROUTINE BEING USED, MUST BE
C PROCESSED USING THE SAME ANSWERS TO THE QUESTIONS. TO SAVE
C EFFORT, THE RENBR MAIN PROGRAM, ITS ROUTINES AND THE REUSER
C ROUTINE CAN ALL BE APPENDED INTO A SINGLE FILE BEFORE BEING
C PROCESSED. THE RESULTING VERSION OF THE RENBR MAIN
C PROGRAM, ITS ROUTINES AND THE REUSER ROUTINE SHOULD NOT
C SUBSEQUENTLY BE PROCESSED AGAIN, SINCE THE STRINGS BEING
C SEARCHED FOR INCLUDE THE ORIGINAL ARRAY SIZES. IF THE
C ARRAY SIZES SUBSEQUENTLY MUST BE INCREASED, THEN THE
C ORIGINAL VERSION OF THE RENBR MAIN PROGRAM, ITS ROUTINES,
C AND REUSER SHOULD BE PROCESSED AGAIN. EVEN WITHOUT
C CHANGING THE SIZES OF THE ARRAYS, RENBR CAN RENUMBER ANY
C INDIVIDUAL MAIN PROGRAM OR ROUTINE CONTAINING UP TO 1000
C NUMBERED STATEMENTS.
C
DIMENSION LTR001(11),LTR002(11),LTR003( 9),
1LTR004(10),LTR005(10),LTR006(11),LTR007(12),
2LTR008(11),LTR009(12),LTR010(11),LTR011(12),
3LTR012(10),LTR013( 9),LTR014( 7)
DIMENSION LTRBFR(72),LTRDGT(10)
DIMENSION LOCBGN(14),LOCEND(14),LOCLNG(14)
C
CHARACTER*1 LTR001,LTR002,LTR003,LTR004,LTR005,
1LTR006,LTR007,LTR008,LTR009,LTR010,LTR011,
2LTR012,LTR013,LTR014
CHARACTER*1 LTRBFR,LTRDGT
CHARACTER*1 LTRSPA
CHARACTER*10 FILINP,FILOUT
C
C LTR001 LTRTOC(168)
C LTR002 NUMTOC(112)
C LTR003 INITOC=28
C LTR004 NOLD(1000)
C LTR005 NNEW(1000)
C LTR006 IHIHDO=1000
C LTR007 LTRSPL(2000)
C LTR008 MAXSPL=2000
C LTR009 NUMPNT(5000)
C LTR010 MAXPNT=5000
C LTR011 LTRBIG(2211)
C LTR012 INRSTR(21)
C LTR013 MAXLIN=20
C LTR014 MID=891
C
C MAXKND = NUMBER OF DIFFERENT PHRASES TO BE RECOGNIZED
C
DATA MAXKND/14/
C
C LOCBGN = POSITION OF START OF NUMBER
C LOCEND = POSITION OF END OF NUMBER
C LOCLNG = LENGTH OF ENTIRE STRING TO BE SEARCHED FOR
C
DATA LOCBGN/ 8, 8, 8, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 5/
DATA LOCEND/10,10, 9, 9, 9,11,11,11,11,11,11, 9, 9, 7/
DATA LOCLNG/11,11, 9,10,10,11,12,11,12,11,12,10, 9, 7/
C
DATA LTR001/'L','T','R','T','O','C','(','1','6','8',')'/
DATA LTR002/'N','U','M','T','O','C','(','1','1','2',')'/
DATA LTR003/'I','N','I','T','O','C','=','2','8'/
DATA LTR004/'N','O','L','D','(','1','0','0','0',')'/
DATA LTR005/'N','N','E','W','(','1','0','0','0',')'/
DATA LTR006/'I','H','I','H','D','O','=','1','0','0','0'/
DATA LTR007/'L','T','R','S','P','L','(','2','0','0','0',')'/
DATA LTR008/'M','A','X','S','P','L','=','2','0','0','0'/
DATA LTR009/'N','U','M','P','N','T','(','5','0','0','0',')'/
DATA LTR010/'M','A','X','P','N','T','=','5','0','0','0'/
DATA LTR011/'L','T','R','B','I','G','(','2','2','1','1',')'/
DATA LTR012/'I','N','R','S','T','R','(','2','1',')'/
DATA LTR013/'M','A','X','L','I','N','=','2','0'/
DATA LTR014/'M','I','D','=','8','9','1'/
C
DATA LTRDGT/'0','1','2','3','4','5','6','7','8','9'/
C
DATA LTRSPA/' '/
C
DATA ITTY,IDISK,JDISK/5,1,20/
C
C OPEN INPUT AND OUTPUT FILES
WRITE(ITTY,1)
1 FORMAT(' REBIG'/
1' CHANGES SIZE OF ARRAYS IN RENBR'//
2' PLEASE NOTE THAT BOTH RENBR AND REUSER MUST BE PROCESSED'/)
WRITE(ITTY,2)
2 FORMAT(' NAME OF FILE TO BE PROCESSED? ',$)
READ(ITTY,3)FILINP
3 FORMAT(1A10)
OPEN(UNIT=IDISK,FILE=FILINP,ACCESS='SEQIN')
WRITE(ITTY,4)
4 FORMAT(' NAME OF RESULTING FILE? ',$)
READ(ITTY,3)FILOUT
OPEN(UNIT=JDISK,FILE=FILOUT,ACCESS='SEQOUT')
C
C GET NEW VALUES
WRITE(ITTY,5)
WRITE(ITTY,6)
READ(ITTY,13)MAXTOC
WRITE(ITTY,7)
READ(ITTY,13)MAXNUM
WRITE(ITTY,8)
READ(ITTY,13)MAXREF
WRITE(ITTY,9)
READ(ITTY,13)MAXSPL
WRITE(ITTY,10)
READ(ITTY,13)MAXWRD
WRITE(ITTY,11)
READ(ITTY,13)MAXUSE
WRITE(ITTY,12)
READ(ITTY,13)MAXLIN
5 FORMAT(/
1' THE NUMBERS IN PARENTHESES ARE THE CURRENT VALUE AND A'/
2' SUGGESTED VALUE LARGE ENOUGH FOR MOST WORST CASES.'/
3' THE LARGE VALUE IS NOT AN UPPER LIMIT HOWEVER.'/)
6 FORMAT(' MAXIMUM NUMBER OF NAMES IN TABLE OF CONTENTS ',
1'(28/560)? ',$)
7 FORMAT(' MAXIMUM NUMBER OF NUMBERED STATEMENTS ',
1'(300/1000)? ',$)
8 FORMAT(' MAXIMUM NUMBER OF REFERENCES OF NUMBERED STATEMENTS ',
1'(640/2000)? ',$)
9 FORMAT(' MAXIMUM LETTERS IN NAMES OF DIFFERENT WORDS AND',
1' CONSTANTS ',
2'(1800/5000)? ',$)
10 FORMAT(' MAXIMUM NUMBER OF DIFFERENT WORDS AND CONSTANTS ',
1'(600/1100)? ',$)
11 FORMAT(' MAXIMUM TOTAL APPEARANCES OF ALL WORDS AND CONSTANTS ',
1'(1400/8100)? ',$)
12 FORMAT(' MAXIMUM NUMBER OF LINES IN SINGLE STATEMENT ',
1'(20/30)? ',$)
13 FORMAT(I)
C
C SUPPLY DEFAULT VALUES IF USER TYPES NOTHING
IF(MAXTOC.LE.0)MAXTOC=28
IF(MAXNUM.LE.0)MAXNUM=300
IF(MAXREF.LE.0)MAXREF=640
IF(MAXSPL.LE.0)MAXSPL=1800
IF(MAXWRD.LE.0)MAXWRD=600
IF(MAXUSE.LE.0)MAXUSE=1400
IF(MAXLIN.LE.0)MAXLIN=20
C
C CALCULATE NEW DIMENSIONS AND LIMITS FROM NUMBERS TYPED BY USER
MAX168=6*MAXTOC
MAX112=4*MAXTOC
MAX028=MAXTOC
MAX01K=MAXNUM+MAXREF
MAX02K=MAXSPL
MAX05K=3*MAXWRD+2*MAXUSE
C LIST OF 1 DIGIT NUMBERS SUCH AS 1,2,3 CAN INCREASE BY 44
C CHARACTERS FOR EACH LINE IN BECOMING 10001,10002,10003
MAX891=11+((2*66*MAXLIN)/3)
C TOTAL LENGTH OF ARRAY HAS TO ALLOW FOR 66 CHARACTERS IN EACH
C NEW LINE PLUS THE 44 THAT A LIST LIKE 1,2,3 CAN EXPAND
MA2211=MAX891+(66*MAXLIN)
MAX021=MAXLIN+1
MAX020=MAXLIN
C
C ADJUST DIMENSIONS FOR ESTIMATE OF AMOUNT NEEDED FOR NEXT PAGE
MAX01K=MAX01K+60
MAX05K=MAX05K+400
MAX02K=MAX02K+200
C
C REPORT RESULTING ARRAY SIZES
I=2211+168+2000
J=MA2211+MAX168+MAX02K
WRITE(ITTY,14)I,J,MA2211,MAX168,MAX02K
14 FORMAT(/' CHARACTER*1 ARRAY SPACE REQUIRED'/
1' WAS',1I6,' LOCATIONS'/
2' NOW',1I6,' LOCATIONS'//
3' LTRBIG(2211) becomes LTRBIG(',1I5,') for old + new statement'/
4' LTRTOC( 168) becomes LTRTOC(',1I5,') words in table contents'/
5' LTRSPL(2000) becomes LTRSPL(',1I5,') words in index'/)
I=1000+1000+112+5000+21
J=MAX01K+MAX01K+MAX112+MAX05K+MAX021
WRITE(ITTY,15)I,J,MAX021,MAX01K,MAX01K,MAX112,MAX05K
15 FORMAT(' NUMERIC ARRAY SPACE REQUIRED'/
1' WAS',1I6,' LOCATIONS'/
2' NOW',1I6,' LOCATIONS'//
3' INRSTR( 21) becomes INRSTR(',1I5,') loctn of inline comments'/
4' NOLD(1000) becomes NOLD(',1I5,') old statement numbers'/
5' NNEW(1000) becomes NNEW(',1I5,') new statement numbers'/
6' NUMTOC( 112) becomes NUMTOC(',1I5,') values in table contents'/
7' NUMPNT(5000) becomes NUMPNT(',1I5,') values in index'/)
C
C READ NEXT LINE TO BE COPIED
KNTMOD=0
KNTLIN=0
16 READ(IDISK,17,END=45)LTRBFR
17 FORMAT(72A1)
MAXBFR=72
18 IF(LTRBFR(MAXBFR).NE.LTRSPA)GO TO 19
MAXBFR=MAXBFR-1
IF(MAXBFR.GT.0)GO TO 18
GO TO 16
19 CONTINUE
C
C CHECK FOR ANYTHING TO BE REPLACED
MODIFY=0
INIBFR=1
20 IF(INIBFR.GT.MAXBFR)GO TO 43
DO 42 LOOP=1,MAXKND
IF((INIBFR+LOCLNG(LOOP)-1).GT.MAXBFR)GO TO 42
NOWBFR=INIBFR
LIMIT=LOCLNG(LOOP)
DO 35 INDEX=1,LIMIT
GO TO(21,22,23,24,25,26,27,28,29,30,
1 31,32,33,34),LOOP
21 IF(LTRBFR(NOWBFR).EQ.LTR001(INDEX))GO TO 35
GO TO 42
22 IF(LTRBFR(NOWBFR).EQ.LTR002(INDEX))GO TO 35
GO TO 42
23 IF(LTRBFR(NOWBFR).EQ.LTR003(INDEX))GO TO 35
GO TO 42
24 IF(LTRBFR(NOWBFR).EQ.LTR004(INDEX))GO TO 35
GO TO 42
25 IF(LTRBFR(NOWBFR).EQ.LTR005(INDEX))GO TO 35
GO TO 42
26 IF(LTRBFR(NOWBFR).EQ.LTR006(INDEX))GO TO 35
GO TO 42
27 IF(LTRBFR(NOWBFR).EQ.LTR007(INDEX))GO TO 35
GO TO 42
28 IF(LTRBFR(NOWBFR).EQ.LTR008(INDEX))GO TO 35
GO TO 42
29 IF(LTRBFR(NOWBFR).EQ.LTR009(INDEX))GO TO 35
GO TO 42
30 IF(LTRBFR(NOWBFR).EQ.LTR010(INDEX))GO TO 35
GO TO 42
31 IF(LTRBFR(NOWBFR).EQ.LTR011(INDEX))GO TO 35
GO TO 42
32 IF(LTRBFR(NOWBFR).EQ.LTR012(INDEX))GO TO 35
GO TO 42
33 IF(LTRBFR(NOWBFR).EQ.LTR013(INDEX))GO TO 35
GO TO 42
34 IF(LTRBFR(NOWBFR).EQ.LTR014(INDEX))GO TO 35
GO TO 42
35 NOWBFR=NOWBFR+1
MODIFY=1
C
C OBTAIN VALUE AND LENGTH OF NEW NUMBER
IF(LOOP.EQ. 1)NUMBER=MAX168
IF(LOOP.EQ. 2)NUMBER=MAX112
IF(LOOP.EQ. 3)NUMBER=MAX028
IF(LOOP.EQ. 4)NUMBER=MAX01K
IF(LOOP.EQ. 5)NUMBER=MAX01K
IF(LOOP.EQ. 6)NUMBER=MAX01K
IF(LOOP.EQ. 7)NUMBER=MAX02K
IF(LOOP.EQ. 8)NUMBER=MAX02K
IF(LOOP.EQ. 9)NUMBER=MAX05K
IF(LOOP.EQ.10)NUMBER=MAX05K
IF(LOOP.EQ.11)NUMBER=MA2211
IF(LOOP.EQ.12)NUMBER=MAX021
IF(LOOP.EQ.13)NUMBER=MAX020
IF(LOOP.EQ.14)NUMBER=MAX891
C
C CALCULATE NEW AND OLD LENGTHS OF NUMBERS
L=NUMBER
NEEDED=0
36 NEEDED=NEEDED+1
L=L/10
IF(L.GT.0)GO TO 36
IHAVE=LOCEND(LOOP)-LOCBGN(LOOP)+1
C
C MOVE CURRENT CONTENTS OF LINE TO MAKE ROOM FOR INSERTION
IF(IHAVE.EQ.NEEDED)GO TO 40
IF(IHAVE.GT.NEEDED)GO TO 38
C OLD NUMBER IS SHORTER
M=MAXBFR
MAXBFR=MAXBFR+NEEDED-IHAVE
N=MAXBFR
37 IF(M.LE.(INIBFR+LOCEND(LOOP)-1))GO TO 40
LTRBFR(N)=LTRBFR(M)
M=M-1
N=N-1
GO TO 37
C OLD NUMBER IS LONGER
38 N=INIBFR+LOCBGN(LOOP)+NEEDED-1
M=N+IHAVE-NEEDED
MAXBFR=MAXBFR+NEEDED-IHAVE
39 IF(N.GT.MAXBFR)GO TO 40
LTRBFR(N)=LTRBFR(M)
M=M+1
N=N+1
GO TO 39
40 CONTINUE
C
C INSERT THE NEW NUMBER
L=NUMBER
M=INIBFR+LOCBGN(LOOP)-1+NEEDED-1
41 I=L
L=L/10
I=I-(10*L)+1
LTRBFR(M)=LTRDGT(I)
M=M-1
IF(L.GT.0)GO TO 41
42 CONTINUE
INIBFR=INIBFR+1
GO TO 20
C
C ALL DONE WITH THIS LINE
43 WRITE(JDISK,17)(LTRBFR(I),I=1,MAXBFR)
IF(MODIFY.NE.0)WRITE(ITTY,44)(LTRBFR(I),I=1,MAXBFR)
44 FORMAT(1X,72A1)
KNTMOD=KNTMOD+MODIFY
KNTLIN=KNTLIN+1
GO TO 16
45 WRITE(ITTY,46)KNTMOD,KNTLIN
46 FORMAT(/' MODIFIED',1I6,' LINES OUT OF A TOTAL OF',1I6)
STOP
END