Compmen & Geosciences Vol. S, No. 3-4, pp. 323-334, 19~2 l~mted m Great Britain.
00~-300~12/0~323-12103.00/0 © 1 2 Perpmom Press Ltd.
A SIMPLE WAY TO CONSTRUCT INTERACTIVE PROCESSORS J. GRAHAMCOO~Y Department of Geography,Trent University, Peterboroush, Ontario, C a n ~ . KgJ 7]88 (Received 28 September 1981; revised 22 February 1982) Aimtrect--A FORTRAN program is presented which reads instruction fines entered from a timesharingterminal, and interprets them as beginningwith an instruction word and continuingwith "declarations". The instruction word and the information in the declarations are passed to a linking subroutine and thence to a set of user.supplied subroutines which act on the instruction. The program is in effect the nucleus of a processor and, when linked to a working set of subroutines, it can be made to approximateto a simple computer "language". Any number of such languagescan be builtwiththe programas a basis. A languageof this sort is unlikelyto be as powerful,as versatile,or as generalizedas FORTRAN,but it is certain to be simplerto work with in the user's particularcontext,to which it can be adjusted as nicely as programmingtime and costs permit. The program is not very useful for small or circumscribed tasks, or for applicationsalready covered by standard libraries;its value lies rather in simplifyingspecializedtasks of moderatecomplexityand diversity.A companionpaper illustratesa use of the programin a processor for handlingdata obtained with a digitizer. Key Words: Interactive, FORTRAN, Processor, Instructions, Interpretation. ~
O
N
In this article, I present a FORTRAN program which offers a simple way of constructing hi oh-level "languages" usable at a timesharing terminal. The program reads a user-typed line which consists of an "instruction word" followed by variable "declarations" in one of four "modes". A subroutine called BRIDGE links the main program with subroutines which one supplies at need, and which act on particular instructions; BRIDGE has to contain a directory of instruction words, and a set of codes to route the program flow to the right subroutine for the current instruction. The program is general. Any collection of FORTRAN subroutines can be written to be consistent with the declarations supplied by the main program, and a working ensemble of this sort amounts to an interactive processor. Such processors can be powerful, and are convenient to use. One-line instructions, or short sequences of them, can execute complicated procedures and can take the place of separate jobs. Sections of this paper describe how the program works, and how to interpret the information supplied on the instruction line, once the working subroutines are reached. A companion paper (Cogley, 1982) describes in detail a processor for digitized data which is based on this program. PR~ STRUCTUI~ The main program, called READER, begins each interactive session by calling subroutine INTRO (see Appendix 1 for a listing). The idea is to print a "Hello" message on the terminal, although other initializing operations can also be carried out at this stage. For the rest of the session, READER reads new lines as they are typed. The first four characters are treated as one word, the "instruction word"; the rest of the line is treated as a string of single characters for the moment. The word STOP will end the session automatically. All other nonblank words are checked against a directory stored in the array INSTRUCT, defined in subroutine BRIDGE and
held in the common block/COMMANDS/. Recognizable words are then assigned values of three flags: MODE, which determines how the rest of the line is to be read; PROGRAM, which will be used in BRIDGE to decide which subroutine to go to; and OPTION, which is for routing within that subroutine once it is accessed. MODE is used immediately by subroutine NEXT. NEXT takes from READER the character string which follows the instruction word, and turns it into different kinds of information depending on the value of MODE. To separate parcels of information from each other, certain characters are given special meanings, and NEXT examines the string one character at a time looking for these special characters; it knows, when it recx~i~.s one, that a new parcel is to follow. For example, the instruction word itself is deemed to end just before the first blank, comma, or colon in the character string. Thus, although the program would reco~iTe, for example, a data-grouping instruction by the word 'HIST', the instruction could be typed as any of HISTb HISTOb HISTOGRAM:b H1STOGRAMb and so on, where 'b' stands for a blank. Blanks and commas are not differentiated. Each special character reduces the freedom with which one can construct declarations, so it is best to keep their number small. "Declarations" are the parcels of information contained on the instruction line. To understand how they are deciphered we must look at each mode in turn. Mode 0 ignores the character string, making it possible, for example, to insert comments in the printed record of a session. Presumably instructions with Mode 0 do not require further information to be executed successfully. Examples might be 'PLOT', 'PROCEED', 'COUNT', or 'STATUS'. 323
32,*
J.G. CocLrv
In Mode 1, up to 12 variables can be assigned numeric or alphanumeric values. The ' = ' sign takes on a special meaning as the separator of the variable's name from its value. The name, which is not the same thing yet as the FORTRAN identifier of the variable, may be preceded or followed by blanks, and may contain commas or colons, but it must not contain an ' = ' sign. Nor may it contain an asterisk, for asterisks are regarded as optional line terminators. In general, however, the aim is to minimize these restrictions; the identity sign has no special meaning in modes 2 or 3, the instruction word proper may consist of any characters which do not add up to four blanks or 'STOP', and so on. A restriction must be imposed to decipher the value of a variable. The option of declaring either numeric or alphanumeric values is valuable, but we must be able to tell which is which. Accordingly, the first nonblank character following the ' = ' determines the type: if it is a numeral, '+', ' - ' , or decimal, the value is numeric and will be decoded as such; normally it would not be an asterisk or comma (although there is no reason why it should not be), and if it is any other character, the value is alphanumeric. Thus, the program will not accept ' AGE = 9: TRIASb', but' AGE = MTRIASb' and' AGE = -21Yo' are both acceptable, and can be used interchangeably if a lookup table is provided in a later subroutine. This is so because NEXT has three arrays into which it can store information: INAM is for the variable name (one character per word), and VALUE and IVALU are for the numeric and alphanumeric forms respectively of the value. If the value is numeric, it is stored in IVALU as characters, four to a word, and in VALUE as a number; if the value is alphanumeric, it is stored in IVALU as characters, four to a word, and VALUE is set to 0. In Mode 2, the text is regarded as a string of names. The variable is permitted to be numeric or alphanumeric, according to the rule stated previously, and if it is numeric its value is decoded into VALUE. But the character array IVALU is spare, and into it we encode the variable name, not the value, four characters to a word. The name is thus accessible later on both as an entity (a member or members of the array IVALU) and character-by-character (each character a member of the array 1NAM). An instruction such as MEASURE PH, PCO2, TDS, ALL ACTIVITIES would control the workings of a major-ion calculation; in ROTATE ARABIA, 36.5, 18.0, 1.6 the numbers would define a pole and angle of rotation, and
another, but also how to distinguish types of declaration and therefore how to parse the sentence. If the ith declaration is IF, the module expects an arithmetic relation beginning with the (i + l)th, and uses lookup tables to find the word LITHICS among others such as QUARTZ, FELDSPAR, CHERT, CARBONATE. . . . ; RAWDATA and STATS together with RATIOS, SUMS, MEANS .... ; and > or GT together with <, LT, EQ . . . . . Similarly, in a least-squares program, the module for the instruction word 'IN'DE' might regard any of INDE NUKTAK, 3,5 INDEPENDENT VARIABLES ARE IN COLUMNS 3 AND 5 OF NUKTAK INDEPENDENTS ARE IN FILE NUKTAK, COLS. 3,5 as being equivalent to each other. Here the declarations VARIABLES, IN, AND, and OF are ignored; ARE, as opposed to IS, signals that the analysis is multivariate, NUKT,MK is the name of a fie, and 3 and 5 are numbers #ving the position of the variables within the file. FILE, COLUMNS, and COLS. are recognized as entities stored by NEXT into IVALU, or by their first letters, stored by NEXT into INAM (in which ease F and C are reserved initials). Finally, REGRESS FORAMS, DIATOMS ON %CACO3 AND PLOT FORAMS IF SIZE > 20, suggests a way of putting more than one instruction on a single line: the reserved declaration AND separates the end of the first instruction 'REGRESS' from the beginning of the next ('PLOT'). In Mode 3, the information on the instruction line is encoded into IVALU, four characters at a time, after processing to preserve asterisks (those which are to remain must be typed twice, because the first lone asterisk ends the line). The information is also encoded into INAM, one character to a word, until the 96 members of INAM are used up. Mode 3 is for entering such things as titles, axis labels, and especially FORTRAN variable formats. It would be costly to check the legality of such formats exhaustively, but two common errors, failure to enter the enclosing parentheses, and unbalanced parentheses, are easily detected. The excess of left parentheses over right is stored into the first member of the numeric array VALUE, which is spare in Mode 3. If the first nonblank character is not a left parenthesis, the value of a variable called NNAM is set to 0; otherwise, NNAM is set to the position of that character (NNAM is an argument of the subroutine; in Mode 0, it is set to 0, and in Modes 1 and 2, to the number of variables or names recognized). A later module can use this information to spot and flag instructions such as
PRINT RAWDATA, STATS IF LITHICS >25 FORMAT IX,3(I2,I4,F6.1) would isolate the greywackes in a sample of sandstones. Mode 2 can thus accept instructions in simple English. In the third of these examples, the option module for 'PRINT' not only knows how to tell one declaration frorr
or
FORMAT (IX,3(I2,E12.4))).
A simple way to construct interactive processors
A natural extension of the three modes described here would be to nest Mode 2 with Mode 3, or vice versa, offering scope for instructions like MATCH CHUKOTKA (AGE = ALBN) TO KOLYMA (VERSION = 3, AGE = ALBN) or S I E V E S A M P L E = OAKR27 (WET, QUARTER, SKEW, KURT).
Such refinements would make a working program more flexible, but they would seldom be essential. Each of the examples just given makes parentheses into reserved characters, which is a cost to be set against the benefits gained. Once NEXT has converted the character string into alphanumeric and numeric information, it returns control to READER which immediately passes the information to BRIDGE. Note the change of array names: INAM becomes NAME1, and IVALU becomes NAMF_A. BRIDGE is the link between the line-reading procedure descn'bed in this paper and the working pans of the program. It consists of a directory of instructions, some useful alphanumeric material (in /SYMBOLS/), and a set of CALL statements. In this version of BRIDGE, the directory and the CALLS are those for the DIGIT processor (Cogley, 1982). The sixth instruction word, for example, is 'CALI', which is short for 'CALI~RATE'; it is read in Mode 0, and its option module is the second in the subroutine SCALE. Each processor will require a different BRIDGE, but in every situation the common blocks/COMMANDS/and/THIS/ will be essential for communication with READER. INTEgPRErATION The range of jobs performed by different modules can be as diverse as is needed for any given context. The typical problem, however, will start with decisions on what to do with information contained in the arrays NAMEI and NAME4. Let us return to an example given earlier: INDEPENDENT VARIABLES ARE IN COLUMNS 3 AND 5 OF NUKTAK The processor to which this instruction belongs is a multiple regression program; we shall look at a simple module for interpreting this and other 'INDE' instructions. We wish to (1) distinguish simple from multiple regression, (2) indicate whether the variables are stored in one of a number of arrays, or in one of a number of files, and, if the data are in a file, (3) whether they are in columns or rows, and (4) which columns or rows they are in. Data injmt, file manipulation, and the analysis itself are handled by other instructions. The module, displayed in Figure 1, asks a series of questions about each declaration in turn. For some purposes, it is convenient to look at single letters (NAMEi), while for others it is better to look at grouped letters (NAMEA). The detailed grammar of the instruction can
325
be obtained by study, but note that it is relatively flexible. Word order is not very important (although it is not immaterial): any occurrence of IS causes the program to branch to a subroutine called SIMPLE, any occurrence of initial C causes following words to be interpreted as column numbers or as the conjunction AND, until the word OF is encountered, and so on. Numeric values must not appear except following words with initial C or R, because the program would not know whether they referred to columns or to rows. If such a mistake is made the program prints a warning, gives up, and prompts for a new instruction. The task of interpreting declarations need not be burdensome or intricate; this example is certainly more complex than most, but the task is per= formed once and for all at the stage of writing the processor, and need not be faced repeatedly during roufine work. The problem of locating the data for one's regression analyses has in effect been reduced to one of typing a single line. Any module which requires information from its instruction line is likely to begin with a passage similar to that of Figure 1. The working part of the module will come after the decoding and encoding of declarations into their corresponding FORTRAN identifiers. Most of the useful programming "tricks" are illustrated in this example, although others could doubtless be thought of. In general flexibility, and some redundancy, are desirable properties. Thus, in the example of Figure I, the freedom of word ordering allows one to assemble independent variables from more than one file: INDE ARE IN C 3,5 OF KOPANOAR~R 6 OF NEKTORALIK. This was not originally intended, but neither is it a deliberately chosen ability. It arises simply from not creating restrictions until they are needed. In contrast, Sections I0 and 30 seem at first glance to duplicate each other; however, they allow one to access files not in the list of FTABLE: INDE ARE IN COL 2 OF UKALERK, COL 3 OF KUGMALLIT (the Kugmallit is one of the offshore formations penetrated by the Mackenzie Delta-Beaufort Sea wells whose names make up the table). Because schemes of data storage and retrieval have been known to turn out less versatile than planned, it is good to bear such possibilities in mind when draftiug interpretative code. Moreover, a closer approximation to "natural" English may make it easier for the less-experienced user to work with the system; the cost and the programming effort are small, and sometimes nil. CONCLU~ON
The time taken to set up variables needed by a FORTRAN program can be shortened if a generalized approach is used. The same schemes for data input, data output, and specification of options can then be made to fit several different programs. A further step is to prepare a scheme which is generalized for entering information
J. G. C~L~
326
into any program at all. READER and NEXT provide such a scheme, with a BRIDGE routine to connect them to the worklna components of each given program. It is not difficult to write these workin~g parts in the form envisaged here--collections of modules, each correspondina to an instruction and each be~nnlng with a segment to decipher the instruction. The result is a considerable improvement in the ease of work performed at the timesharing terminal. There would be no point in duplicating standard software with the material described
2 3 4 5 67 8 9 L0 11 12 1314 IS 16 17 18 1920 21 22 232526 27 2E 29'30 31 323334 35 36
3'7
DINIDI8ZON N A H E I ( 8 , 1 2 ) , N A / 4 E 4 ( 8 , 1 2 ) , V A L U E ( 1 2 ) DINI~SION I V A ( 1 0 ) , I V P ( 1 0 ) , L E T ' L ' E R ( 2 6 ) , N U M B E R ( 1 3 ) , I N P Z L E ( 3 ) DIMIRIEZOH X F ( I O 0 , 1 0 ) , X A I ( 1 0 0 ) , X A 2 ( 1 0 0 ) , X A 3 ( 1 0 0 ) , X A 4 ( 1 0 0 ) INTEGER ARRAYS/'ARRAe/,FILE/OFILE*/,AND/'AND ' I , O P / ' O F '/ INTEGER It'?ABLE(2,S)/'KOPANOAR','HUKTAK ','TARSIUT ', * *UKALERK *,*NEKTORALe/
-
CNARACTltRe8 P(~JERYeZNFILE DATA I S I N G / ' I S o/,IPLUR/,AR E w~ DATA FQUERY,INF~LE/4** */ COlU4ON /SYMBOLS/ LET'tER,NUMBER C
ASSIGN 99 TO R1
-
[)O 1 I - 1 , 1 0
IVA(I)'0 1 IVF(I)aO ICR'0 IFIL'O
-
-
3839 40 41 42 43 44 4S46 4? 4849 50 51 $2S354 5556S7 S11596061 62 -
E3 -
..
IV-O DO 100 IImlwN I-II IF(NAME4(1,I) .EO. ISING) CALL SIMPLE(R1) IP(NARE4(1,I) .EQ. ARRAYS) GO TO 20 : F ( N A N E I ( I , $ ) .EQ. LET'r'ER(24)) GO TO 25 I F ( N A N E 4 ( 1 , I ) .EQ. FILE) GO TO 30 IF(NAMEI(1,I) .NZ. LETTER(3)) GO 2'O 5 ICRm-I GO 2O 40
-
-
previously, and there would be little point in using it for minor programming tasks; the routines, after all, are not insubstantial. Their usefulness lies rather in their offering a simple framework for prosrams which aim to cover moderately complex fields of activity. In the analysis of grains of sediment, populations of microfossils, geochemical data on bulk- and trace-element composition, or raw data from a digitizer, the thlnss one wishes to do are su~cientiy diverse in type and number that the framework presented in this article is likely to be valuable.
S IF(NAMEI(1,I) .ME. LETTER(18)) ICR-~ GO TO 40 6 IF(VALUE(I) ,NE. 0) GO TO S0
GO TO 6
C
DO 10 3 - 1 , 5 IP(NANE4(I,I)
.NE. F T A B L E ( 1 , 3 ) )
GO TO 10
IFILeIFIL+I CALL F O P E N ( J , Z N F I L g ( I F I L ) , R I ) 10 CONTINUE GO TO 100 C 20
I-I+l DO 21 3 - 1 , N ZP(!ANE4(1,3) Zr(llA/qB4(lw3)
.EQ. AND) GO '1'O 21 .NE. LE't"L'BR(24)) GO TO
22
IVmIV+I DECODE(4wlOOOwNAHEI(3eJ)) IV&(IV) 21 CONTINUE GO TO 101 22
25
I-O I F ( I .GT. GO TO 1 0 0
N)
GO I'O 101
IVmIV+I
DECODE(4wl000,NAHEI(3,I)) GO TO 100
IVA(IV)
C
30 I m I + l DliCODE(8,10OI,MAN|I(1,I))
~UERY
IFFILmIFIL+I CALL FLOOK(FQUERY,ZMFZLE(IFFIL),IFFIL,R1) C 40
IsI+2
A simple way to construct interactive processors 64
-
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 8S 86 87
--
DO 41 J o I , N : 41 42
-
IP(NAlU4(1,J) .gO. OP) DltCODg(4,].000,MAME4(1,I) CORTIRUE GO TO 1 0 1
GO T O 4 2 ) IVP(IV)
l'~+l Ir(l .GE. GO TO 1 0 0
N) GO TO 101
C 50
OWFPUT' SORRY-CAN ' ' T TELL COLUNNS PROM ROWS' RETURN
99
CONTINUE
C
100 C O R T I N U g C
-
327
101
CONTINUE
C 1000
100].
P O p a ~ T ( X) PORmAT ( 8 k ]. )
C
Figure 1. The first part of a typical working module which deciphers information from 'INDE' inmuctiom.
Acknowiedgmmts--The idea for Mode 2 of subroutine NEXT, and the ~neral idea for the prosram, come from R. L. Parker's HY~ERMAP. I thank Trent University and NSERC (Canada) for financial support. Rm,lmDICE Cog]ey, J. G., 1982, DIGIT--An interactive processor for digitized data: Computers & Geosciences, v. 8, no. 4.
identifier which is to be "written" according to the FORMAT in statement 1, and J is the identifier which is to be "read". J is left uac~ by the ENCODE; it should contain characters before, and win contain characters after the operation (this is why it should be of either INTEGER or CHARACTER type). Because it is to read chara~rs, statement 1 will almost certainly contain an A-format speeiftcafion. J is filledwith blanks at the start of the ENCODE, and w.'l) probably contain characters from J after completion. In DECODE (N,1,J)F
P r o e m liztme The listing in this Appendix is of a main program and two subro~nes written in A.MS FORTRAN for a Honeywell Xerox Sit,maq, operafin8 under CP-V. Some peculiarities are discussed in the Appendix of Cogiey (19~2). CP-V AHS FORTRAN has ENCODE and DECODE statemerits which are formally identical with those of other compilers, differing possibly in matters of word lenlfth. These statements are not part of the language defined in American National Standard
Progrlltmmln~~
FORTRAN, ANSI X3.9--1978 (Ameri-
can National Standards Institute, New York, 1978), but they are
widely available. They are used freely in DIGIT (and especially in subroutine NEXT) because they make the sbnffllna and comparimn of information easy. Indeed, without them it would be impossible (in FORTRAN) to convert alphanumeric to numeric variables. Details may be obtained in language reference manuals, but consider:
J is apin the identifier to be read, and w~] be left u n c h ~ by the DECODE; statement 1, however, contains'the FORMAT in which F is to be. written, and whether F is numeric or alphanumeric will depend on the particuJar purpose of the DECODE statement. The result of the sequence INTEGER STAR/'*bbb'/,WORD/'STAR'/
INTEGER W(4)/*Sbbb','Tbbb','Abbb','Rbbb'/ ENCODE (4,1,14A) (W(I),I = 1,4) ENCODE (4,1JIA) WORD ENCODE (4,2,I4B) (W(I),I = 1,4) ENCODE (4,2,IIB) STAR I FORMAT (4AI) 2 FORMAT (A4) is to give the identifiers the following values:
ENCODE (N,I,I)J; here N is the number of characters to be encoded, I is the ]. 2 3 4 5 G 7 8 9 10 ll 12 ].3 14
-C -C -C -C -C -C - C -C -
I4A 'STAR'; IIA 'Sbbb'; I4B 'Sbbb'; IIB '*bbb'.
PROGRAR RF,ADER T H I S I S T H E DRIVING PROGRAIq FOR READING INSTRUCTION L I N E S I X T ].ST CALLS INTRO ONCE TO PRIRT A WHBLLOm MESSAGE,THEN NEXT TO INTERPRET EACH L I N g , A N D THI~I BRIDGE TO PASS THE .INPORNATZON TO THE U S E R e S SUBROUTINES.THERE A R E TWO WRgSgRVED w INSTRUCTIONS: * t (4 BLANKS) ,WHICH GENERATES THg OUTPUT wPARDON?mJAND *STOP* ,WHICH STOPS THE PROGRAN. I N T E G E R T E X T ( 1 2 8 ) , PROGRAIq e OPTT O N , B L A N K , S T O P DINERSION I N S T R U C T ( 5 0 ) , ZHODg ( S 0 ) , ZPROG ( S 0 ) , I O P T ( 5 0 ) CONIqON /CONNANDS/ZNSTRLICT e IN*DE # Z PROG e Z O P T DINENSIOR NANEI ( 8 e 2 2 ) wVALUg ( 1 2 ) eNANE4 ( 8 e 1 2 ) CONgOH /THIS/NODE e PROGRAM, OPTZOH COIOqON l I N A G E / T E X T
J. G. COG, ~Y
328
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3O 31 32 33 34 35
36 37 38 39 40 41
-
42
-
43
-
44
-
DATA BLANK,TEXT(128) CALL INTRO J'0 I00 C O N T I N U E READ (105,10000) C C C C
P R O M C H A R IS C A L L E D PROMPT CHARACTER° IF J-1
110
120
130
140
45 - 1 0 0 0 0 46 -
I
,STOP/'
STOP-'/
C
"
2 -C 3 -C 4 -C 5 -C 6 - C 7 -C 8 -C -9-C 1 0 / - "C
(J
.EO.
0)
KEY, (TEXT(I) , I - I , 1 2 7 ) ONCE,
CALL
AFTER
THE
1ST
READ,
TO CHANGE
THE TERMINAL
PROMCHAR
IF (KEY .NE. BLANK) G O TO 110 O U T P U T 'PARDON?' GO TO 100 I F (KEY . E Q . STOP) GO TO 1 4 0 DO 120 I 8 1 , 5 0 IF (KEY .EO. I N S T R U C T ( I ) ) G O TO 130 CONTINUE OUTPUT 'PARDON? * G O TO 100 M O D E - I N . D E (I) P R O G R A M - I P R O G (I ) OPTION - IOPT(I) C A L L N E X T (KEY, T E X T , M O D E , N A M E Z , V A L U E , N A M E 4 , N) CALL BRIDGE (NAMEI,VALUE,NAME4,N) GO TO 100 CONTINUE. O U T P U T ' D I G I T S I G N I N G OFF' STOP FORMAT (A4,127A1) END
SUBROUTINE BRIDGE(NAMEI,VALUE,NAME4,N) B R I D G E IS A U S E R - S U P P L I E D L I N K B E T W E E N R E A D E R A N D T H E U S E R ' S SUBROUTINES.COMMON BLOCKS /COMRANDS/(WZTH ITS A S S O C I A T E D D I M E N S I O N STATEMENT)AND /THIS/ ARE REOUIRED,AND THE ARRAYS INSTRUCT,IN.DE, I P R O G A N D l O F T M U S T BE D E F I N E D z I N S T R U C T MUST CONTAIN 4-CHARACTER INSTRUCTIONS,IN.DE MUST SPECIFY THE MODE OF EACH INrPRUCTION(AS D E F I N E D IN S U B R O U T I N E N E X T ) , A N D I P R O G A N D l O F T M A Y BE S P E C I F I E D A S T H E U S E R W I S H E S . T H E A R G U M E N T S O F B R I D G E D E P E N D ON M O D E , A N D S H O U L D BE D I M E N S I O N E D AND USED APPROPRIATELY(SEE NEXT FOR DEFINITIONS). INTEGER PROGRAM,OPTION DIMENSION INSTRUCT(S0),IMODE(S0),IPROG(S0),IOPT(50) DIMENSION NAMEI(8,12) eV&LUE(Z2)eNAME4(8,12) COMMON /COMMANDS/INSTRUCT,IMOOE,IPROG,IOPT COI~ION/THIS/ MODE,PROGRAR,OFTION DATA INSTRUCT/'INFOOUTFFILIFILOCREACALIREADSETVSTOPTITLPHINTRAN' *,'PCRESKIPPACKUNPALESSLISTMREAFORIOICALRD/ZRESENOPRCOPYSTEP', *'PCALCOMMZCOONOZCCHECFILEPROJMPROPMCA',IS*' '/ DATA IMODE/3,3,2,2,0,0,0,1,0e3,0,1,1,2,1,0,0,2,0,1,1,2,1,0,2,2,1, "0,0,0,0,1,0,0,1,15"0/ D A T A IPHOG/I,I,l,I,2,2,3,3,7,4,4,5,2,3,6,6,4,4,3,1,2,1,3,4,1,1,2, "4,1,1,4,1,3,3,2,15e0/ DATA IOPT/1,2,3,4,1,2,1,2,9,1,2,1,5,3,1,2,4,5,4,6,4,5,6,6,9,10,3, "3,7,8,9,11,1,4,6,15*0/
11 12 13 14 15 16 1"7 18 19 20 21 22 23 24
"-
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
- C - C DECLARATIONS ABOVE ARE REQUIRED;THOSE BELOW ARE USER~'/RITTEN - C INTEGER STAR/'e '/ DIMENSION NUMBER(13)wLETTER(26) COMMON / S Y M B O L S / L E T T E R e N U M B E R # DATA LETTER/'A B C D E F G H I J *'K L M N 0 P O R S T U V W 'w *'X Y Z '/ DATA NUMBER/'1 2 3 4 5 6 7 8 9 0 + */ A S S I G N 900 TO R G O TO ( 1 0 0 , 2 0 0 , 3 0 0 , 4 0 0 , 5 0 0 , 6 0 0 ) PROGRAM OUTPUT 'PARDON?' GO TO 9 0 0 100 C A L L P O R M ( O P T I O N , N A M E I , N A M E 4 , V A L U E , N , R ) 200 C A L L SCALE(OPTIONeNAMEIeMAME4e~LUE,NeR)" 300 C A L L I N P U T ( O P T I O N , N A M E I e V A L U E , N , R ) 400 C A L L O U T P U T ( O P T I O N , N A M E 1 , N A M E 4 , V A L U E , N , R )
-
.
'
329
A simple way to construct interactive processors 500 CALL TRANSF ( O P T I O N , MARE1, MARE4, VALUE, N, R) 600 CALL PACK ( O P T I O N , N A N S I , N A M E 4 , V A L U E , N , R ) 900 CONTINUE RETURN END
44 45 46 47 48 -
1
--
2 -C 3 -C 4
-C
5 -C 6 -C 7 -C 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
-C -C
-
C
-
C
- C - C -
C
-
C C C C C C C C C C C C C C C C C C C C C C C C C C
-
C
-
C C C C C C C C C
SUBROUTINE NEXT(KEY,TEXT,MODE,INAM,VALUE,IVALU,NNAN) READS A ~ORNAND OF THE FORM ' c m n d < b , ; > t e x t e' W H E R E c m n d IS A N I N S T R U C T I O N P R E V I O U S L Y R E C O G N I Z E D BY PROGRAN READER(WIIICH A L S O D E T E R M I N E S THE V A L U E OF M O D E ) . I A N D O N L Y I O F T E E S Y M B O L S IN C A R E T S M U S T A P P E A R W H E R E P R O V I D E D FOR; 'b t S T A N D S F O R O N E B L A N K . T H E F I N A L A S T E R I S K IS O P T I O N A L . C O N T I N U A T I O N LINES ARE NOT ALLOWED. t e x t M A Y BE I N T E R P R E T E D IN I OF 4 W A Y S , A S F O L L O W S . MODE 0:-IGNORE text. MODE 1:-ASSUME THAT text HAS THE FORM '[vat-value]' W H E R E v e t IS A V A R I A B L E R E C O G N I Z A B L E BY S U B R O U T I N E B R I D G E , A N D v a l u e IS ITS (ALPHA)NUMERIC V A L U E . C O D E IN B R A C K E T S M A Y BE R E P E A T E D UP T O 12 T I M E S , T O A M A X I M U M O F 127 C H A R A C T E R S . v a t N A Y BE P R E C E D E D OR F O L L O W E D BY A N Y NUMBER OF BLANKS(WHICH W I L L BE I G N O R E D ) , A N D M A Y C O N T A I N UP T O 8 C H A R A C T E R S ( N O T '*'OR's').IF ITS I S T N O N - B L A N K C H A R A C T E R IS A NUMERAL, ' + ' , ' - ' OR ' . ' , v a l u e < b , > IS A S S U M E D T O BE A N U M B E R , A N D IT M U S T O B E Y FORTRAN RULES FOR REPRESENTATION OF N U M B E R S IN G F O R M A T ; O T H E R W I S E v a l u e IS SET T O 0 ; I N ANY C A S E , T H E CHARACTERS ARE STORED 4-AT-A-TIME INTO IVALU(i,n),i-I,8). v a l u e < b , > M U S T C O N T A I N 32 C H A R A C T E R S OR L E S S ( N O T ' b ' , ' * ' , ' , ' O R ' = ' ) . N O T E T H A T v a t IS O N L Y A P R O G R A M ' D U M M Y ' ; T H E F O R T R A N P R O C E S S O R R E C O G N I Z E S IT AS D A T A , N O T AS AN I D E N T I F I E R . MODE 2:-ASSUME THAT text HAS THE FORM '[neae]' W H E R E n a m e IS S I M I L A R TO v a t IN M O D E 1 , E X C E P T T H A T '=' IS P E R M I T T E D A N D 'b' A N D ' , ' A R E N O T A L L O W E D . n a m e IS S T O R E D 4 - A T - A - T I N S I N T O I V A L U A N D I - A T - A - T I M E I N T O I N A M . I F ITS IST N O N B L A N K C H A R A C T E R IS A NUMERAL,'+','-'OR ' . ' , T H E N U M E R I C V A L U E O F n a m e IS S T O R E D I N T O VALUE;AN E R R O R W I L L O C C U R IF IT D O E S N O T C O N F O R M TO T H E R U L E S F O R G F O R M A T ( B U T N O T E T H A T IT M U S T ALSO BE L I M I T E D TO <9 C H A R A C T E R S ) . MODE 3=-ASSUME THAT text HAS THE FORM 'string' WHERE strinq IS A S T R I N G OF 0 T O 127 C H A R A C T E R S . I T MAY BE PRECEDED BY A N Y NUMBER O F B L A N K S , W H I C H W I L L BE I N C L U D E D . A N A S T E R I S K N O T F O L L O W E D BY A N A S T E R I S K W I L L BE INTERPRETED A S T H E TERMINATING ASTERISK;IT AND ALL FOLLOWING CHARACTERS WILL BE I G N O R E D . T O I N C L U D E AN A S T E R I S K IN s t r l n g , F O L L O W IT I M M E D IATELY WITH A SECOND ASTERISK(WHICH W I L L BE D E L E T E D ) . I F T H E I S T N O N B L A N K C H A R A C T E R OF s t r i n g IS N O T A L E F T P A R E N T H E S I S n IS S E T T O 0 ; O T H E R W I S E n IS S E T T O k , T H E P O S I T I O N O F T H E IST N O N B L A N K C H A R A C T E R . V A L U E ( 1 ) C O N T A I N S T H E N U M B E R OF L E F T P A R E N T H E S E S M I N U S T H E N U M B E R OF RIGHT PARENTHESES. s t r i n g IS S T O R E D 4 - A T - A - T I M E I N T O I V A L U A N D 1 - A T - A - T I M E ( U P TO T H E 9 6 T H C H A R A C T E R ) I N T O IMAM. N.B.
LOGICAL
UNIT
108
IS A T I M E S H A R I N G
TERMINAL
INTEGER BLANK,STAR,COMMA,SCOLON,RPAREN,TEXT(128) DIMENSION IVALU(8,12),INAM(8,12) DIMENSION VALUE(12),NUMBER(13) DATA HLANK,STAR,COMMA,LPAREN,HPAREN,IDENT,SCOLON/ 1 ' * , ( ) ; '/ DATA NUMBER/'I 2 3 4 5 6 7 8 9 I/ NN=127 C C C
CLEAR
I00 C C C
NUMERICS
OF
DO I00 I = I , 1 2 V~LUE(I)=0.0 IF (NODE .EO.
LOOK DO
FOR 110 IF
END
OF
PREVIOUS
0) G O
TO
INSTRUCTION
FROM
NUMERIC
0
+
-
ARRAY
790
INSTRUCTION
WORD
I=I,NN (TEXT (I ) • EO. B L A N K . OR . T E X T (I) . E0 • C O M M A .OR . T E X T (I ) . E0. S C O L O N ) G O T O 130
J. O. C0~L~
330 71 72 73 74 75 75 77 78 79 80 81 82 83 84 85 8G 87 88 89 90 91
92 93 94 95 96 97 98 99 100 101 102 103 104 105 10G 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 14'7 148 149
110 CONTINUE 120 O U T P U T 'PARDON?' RETURN 130 IF (I .GE. 124) G O TO 120 3-I IF (MODE .EQ. 3) G O TO 630 - C - C LOOK FOR T E R M I N A L ASTERISK, A N D S H I F T TEXT - C DO 140 K - I + I , M N IF (TEXT(K) .EQ. STAR) G O TO 150 ENCODE ( 4 , 7 0 0 Q 0 , T E X T ( J ) ) TEXT(K) -
-. -C - C -C
140 150
J-,J+l IF (K
.GT.
TO LEFT.
NN) K - M N
IENDmK-1 FILL O U T
mTEXT'
WITH
ELANKS
DO 160 K.~I,NN 160 ENCODE ( 4 , 7 0 0 0 0 , T E X T ( K ) ) BLANK I F (MODE . E O . 2) G O TO 470 - C - C M O D E I - 'VARtVALUE, .... ,*' - C THE M A I N LOOP IS # 3 9 0 -C IU-I NNAM-0 DO 390 I - I , I E N D Ir (TmXT(IU) .iQ. BLANK) G O TO 380 - C -C N O W WE HAVE A N O N B L A N K ; LOOK FOR AN ' s ' - C DO 170 I V m I U , I E N D IF (TEXT(IV) .EQ. IDENT) G O TO 180 170 CONTINUE o
NNANmNNAM+I GO TO 4 4 0 NNANmNNAM+I IF (NNAN .GT. 12) G O TO 460 IF (IEND-IV .LE. 0) GO TO 440
180 - C -C - C -C
ENCODE UP TO 8 C H A R A C T E R S B E T W E E N BLANK A N D BY ONES, A N D FILL IT O U T W I T H B L A N K S II-IV-IU I V l - I V -I IF (8-II . G E . 0) GO TO 190 11"8 IVImIU + 7 NEm4*II ENCODE ( N E , 7 1 0 0 0 , I N A M ( 1 , N N A M ) ) IF ( 8 - 1 1 .LE. 0 ) GO TO 210 DO 200 J s I l + l , 8 ENCODE ( 4 , 7 0 0 0 0 , 1 N A M ( J , N N A M ) ) CONTINUE
190
200 210 -C -C - C
LOOK BEYOND ' - '
230 -C -C -C
N O W WE HAVE A N O N B L A N K
1 240
250
LOOK
DO 240 IWmIV, IEND IF (TEXT(IW) .EQ. GO TO 250 CONTINUE IWsIW-I CONTINUE
BLANK)
(8-12
(TEXT(J),JmIU,IVI)
BLANK
.GE.
GO TO 220
FOR A B L A N K
BLANK
F- ( I W - I V ) / 4 . I2-,F IWI - IW
IF
INTO N A M E ARRAY,
FOR NEXT NONBLANK
IVnIV+1 DO 220 IW-IV, IEND IF (TEXT(IW) .EQ. GO TO 230 CONTINUE IW~IW-I GO TO 440 IV-IW
220
'-'
0) G O TO 260
.OR.
OR A C O M M A
TEXT(IN)
TO T E R M I N A T E
.EQ. COMMA}
VALUE
A ~mple way to construct interactive processors 150 151 152 153 154 155 156 157 158 159 1S0 161 162
~63 164 165 166 167 168 169
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
-
I2 • 8 IWI . IV C C C
OUT
260 270 C C
ENCODE
IF
VALUE
31 IS
NUMERIC
(NALP8-1)
NALPHt0 DO 270 J-1,13 IF ( T E X T ( I V )
.EO.
NUMBER(J)}
VALUE
INTO
CHARACTER
STRING
OR
NOT
NUMERIC
(NALPHa0)
NALPH=I ARRAY,
BY
FOURS
C
- C - C - C - C -
FIND
+
331
K-0 IF (I2 .LE. 0 ) GO TO 2 9 0 IBGNmIV ISTP'IV + 3 DO 280 K"I,I2 ENCODE (4,72000,1VALU(K,NNAM))(TEXT(L},L-IBGN,ISTP} IBGN~ISTP+I ISTP " ISTP ÷ 4 CONTINUE KmK-1 I F (K . G E . E) G O T O 3 6 0
280
THIS STUFF IS FOR FINISSING OFF (| O F N O N B L A N K S NOT NECESSARILY 290
TEE CIIARACTBR ARRAY AN INTEGRAL MULTIPLE
PROPERLY O F 4)
I3mlWl-(IV-l+4el2)+l GO TO ( 3 3 0 , 3 3 0 , 3 2 0 , 3 1 0 , 3 0 0 ) I3 ENCODE ( 4 , 7 2 0 0 0 , I V A L U ( K + l , N W A R ) ) ( T E X T ( L ) , L ' I W 1 - 3 , I W 1 - 1 ) , B L A N K GO TO 340 ENCODE (4,72000,IVALU(K+Z,NNAM))TEXT(IWI-2),TEXT(IWI-I}, BLANK, BLANK GO TO 340 ENCODE (4,72000,IVALU(K+l,NNAM))TEXT(IWl-1),BLANK, BLANK, BLANK GO TO 340 ENCODE (4,72000,IVALU(K+I,NNAR))BLANK,BLANK,BLANK,BLANK I F ( K + l . G E . 8) G O T O 3 6 0 DO 350 LmK+2,8 ENCODE ( 4 , 7 2 0 0 0 , I V A L U ( L , N N A M ) ) B L A N K , B L A N K , B L A N K , B L A N K IF (NALPH .E0. 0 ) GO TO 3 7 0
300 310 I 320 1 330 340
350 360
C
- C - C -
195 196 197 198
-
C
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
-
C C
IFF
VALUE
370 380
LOOK
390 C C C
410
420 430 C C C
END
NUMERIC
DECODE
". D E C O D E IUmIW IU-IU+I IF (IU
.GT.
FOR
VARIABLE
NEXT
IT
INTO
(NNANOTH
(32,73000,1VALU(I,NNAN))
IEND)
MEMBER
OF)
VALUE
VALUE(NNAM)
GO TO 4 0 0
CONTINUE
OUT THE U N U S E D
FILL
400
IS
CHARACTER
ARRAYS
WITH
BLANKS,
THEN
RETURN
I F (NNAN . E 0 * 1 2 ) GO TO 4 3 0 DO 4 1 0 3 - t ~ A R + l , 1 2 DO 410 I-1,8 ENCODE (4,70000,1NAM(I,J)) BLANK DO 420 JnNNAM+I,12 DO 420 I~i,8 ENCODE (4,70000,IVALU(I,J)) BLANK CONTINUE OF
MODE
I - NNAM
CONTAINS
# OF
VARIABLES
RECOGNIZED
RETURN C C C
CAGEOVoL8. No.
ERROR 440
450
460
OUTLETS
I F ( N N A M o G T . i) G O T O WRITE (108,21000) NNAM - NNAM - 1 GO TO 400 WRITE (10E,20000)NNAM NNRR ~ NNAM - 1 GO TO 400 OUTPUT ' WARNIMG-CAN''T NNAMmNNAM-I
450
RECOGNIZE
MORE
THAN
12
VARIABLES'
ARRAY
332
229 230 231 232 233 234 235 236 237
J. G. COCL~
-
GO TO C C C C
R O D E 2 - ' N A M E , N A M E , N A M E , o . **' T H E M A I N L O O P IS # 5 4 0 470 CONTINUE IU,,I
NNAR = 0 DO 540 I=I,IEND IF ( T E X T ( I U )
238
-
239 240 241 242 243 244 245 246 247 248 249
-
C C C C
-
•
250 251 252 253
-
NOW WE NAME
490
C C
264
-
530
S00
266 - C 267 - C 268 - C
C C C
TO TERMINATE
12)
GO TO
.OR.
IEND)
TEXT(IV).EQ.COMMA)
GO
TO 490
620
ARRAY,
BY ONES,
IVmIEND
-. 1
(IU .GT.
BACK TO
LOOK
.EQ. OF
IEND)
FOR
GO TO
550
NEXT NAME
12) G O NAME
TO
ARRAY
570 WITH
560 C C C C
560 J I N N A M + I , 1 2 DO 560 1-1,8 ENCODE (4,70O00,INAM(I,J))
BLANKS,
BY ONES
DO
BLANK
T H E C H A R A C T E R A R R A Y B E I N G ' S P A R E ' IN M O D E 2, F I L L I T S I S T 2 MEMBERS WITH THE MARE CHARACTERS BY FOURS, AND ITS LAST 6 WITH BLANKS.
C 570
580
DO
GlO J-l,12 ENCODE ( 4 , 7 2 0 0 0 , I V A L U ( 1 , 3 ) ) ENCODE ( 4 , 7 2 0 0 0 , I V A L U ( 2 , 3 ) )
D O 580 ENCODE
(INAM(I,3),I,,1,4) (IHAR(I,3),I-5,8)
1-3,8 (4,70000,IVALU(I,J))
BLANK
C C
IFF NAME DO 590 600 610
C C C
IS N U M E R I C 590
DECODE
-
C
-
C
(JtTB
MEJqBER O F
) VALUE
K,,1,13
(INAM(1,J)
GO TO 600 VALUE(J)
CONTINUE 2
-
NNAM
CONTAINS
RETURN OUTPUT ' WARNIMG-CAN''T NNAM~NNAM-I GO TO 570
C
- C
IT I N T O
.gO. N U M B E R ( K ) ) GO TO 6 1 0 DECODE ( 3 2 , 7 3 0 0 0 , I V A L U ( 1 , 3 ) ) IF
E N D OF MODE
620
-
-
IV
[PILL O U T R E S T
289 - C 290 -
-
OR A COMMA
IU-IU+l IF
GO
-
540 C O N T I N U E 550 IF ( N N A M
-
-
FOR A BLANK
I F (8-Ii .GE. 0) G O T O 5 0 0 I1-8 IV1 - IU + 7 NEm4*I1 ENCODE (NE,71000,INAM(I,NNAM)) (TEXT(J) ,JtIU,IVI) I F (8-II .LE. 0) G O T O 5 2 0 D O 510 j t I I + 1 , 8 E N C O D E (4 , 7 0 0 0 0 , I M A M (J, N N A M ) ) B L A N K IUIIV
265
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
( I V .GT.
IV1
510 520
-
530
IV',,IU,IEND
HNAM,,~INAM+I I F ( N N A q .GT.
IF
-
288
TO
IImlV-IU
-
285 286 287 -
LOOK
GO
ENCODE UP TO 8 CHARACTERS INTO NAME AND FILL IT OUT WITH BLANKI.
258 259 260 261 262 263
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
480
BLANK)
IF ( T E X T ( I V ) . S Q . B L A N K CONTINUE
480
- C - C
.EQ.
HAVE A NONBLANK;
DO
254 2SS 256 257 -
2,~,~
430
MODE 3 THE MAIN
' S T R I N G . . . e' L O O P IS # 6 8 0
630 CONTINUE NNAM" 0
# OF NAMES
RECOGNIZE
MORE
RECOGNIZED
THAN
12 N A M E S '
ARRAY
A simple way to construct interactive processors 308 309 310 311 312 313314 315 316 317 318 -
JSTAR C C C C C
650
337 33e 339
-
340 341
- C - C -
660
-
344
-
345 346 347 348 349 350
-
CONTINUE GO TO 720 6 9 0 IF (J .LE° JsNN GO TO 720
C C C
-
351 352 - C 353 - C 354 - C 355 - C 356 357 358 359 360 361 362 363 364 365 366 367 368 369
-
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
-
385
386
GO TO 690 3STAR-0
670 680
- c
342 343
680 K ~ I + I , N N IF ( T E X T ( K ) .E0. S T A R ) G O T O 6 5 0 ENCODE (4,70000,TEXT(J)) TEXT(K) 3"J+i GO TO 680 I F ( J S T A R .NE. 0) G O T O 6 7 0 JSTAR-I IF (K .EQ. ~ ) GO TO 660 I F ( T E X T ( K + I ) .EQ. S T A R ) G O T O 6 4 0 ENCODE (4,70000,TEXT(J)) BLANK 3,.,3+1
640
-
0
-
S T A R T BY F I N D I N G T H E I S T A S T E R I S K ; IF IT IS F O L L O W E D I M M E D I A T E L Y B Y ANOTHER, IGNORE THE 2ND AND LOOK FOR MORE TEXT/ OTHERWISE, STRING HAS ENDED. DO
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
333
FILL
OUT
tiN) G O T O 7 0 0
'TEXT'
WITH
BLANKS
700 DO 710 K-J,NN 710 ENCODE (4,70000,TEXT(K)) 720 JLm0 JR ~ 0
FIND
IST N O N B L A N K
730 KmI,NN IF (TEXT(K) IF ( T E X T ( K ) NNAM . K JL • 1 GO TO 740 730 CONTINUE KIK-2 740 CONTINUE
IF N E C E S S A R Y
BLANK
AND CHECK'TO
SEE
IF IT IS A L E F T
PARENTHESIS
DO
.EO. B L A N K ) O 0 T O 7 3 0 .NE. L P A R E N ) G O T O 7 4 0
KmK+l
SUN LEFT AND RIGHT PA RENTNESES MEMBER OF VALUE ARRAY DO
750 L-K,NN IF (TEXT(L)
it,
(TEXT
(L)
oE0. .E0.
LPAREN) RPAREN)
AND
PUT THEIR
DIFFERENCE
INTO
3LsJL+I JRIJR+I
750 CONTINUE V A L U E (i ) ,,JL-JR L-0 C C C
ENCODE
(IST 96 M E M B E R S
OF ) S T R I N G
BY ONES.
DO
760
760 K-I,12 DO 760 KK-l,8 L-L+I ENCODE (4,70000,1NAM(KK,K))
INTO N A M E A R R A Y
TEXT(L)
C
C C
ENCODE
STRING
IEND IBGN-1 DO 7 7 0 DO
INTO CHARACTER
ARRAY B Y F O U R S
4
K-l,4 770 KK-1,8 ENCODE (4,72000,IVALU(KK,K))
IBGNaIEND+I IEHD - IEND
+ 4
770 CONTINUE C C C
FILL
OUT CHARACTER
ARRAY
WITH
DO 780 C
780 K-5,12 DO 780 KK~I,8 ENCODE (4,70000,IVALU(KK,K))
BLANKS
BLANK
(TEXT(L),LmIBGN,IEND)
IST
334
J.G. COGLEY -C -C -C
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 40S 406 407 408
END OF MODE 3 - NNAH CONTAINS PO SI TI O N OF I S T NONBLANK UNLESS I T I S NOT A LEFT PARENTHESIS ( I N NHICH CASE NNAME - 0 ) RETURN
-C -C -C -C
MODE 0 - IGNORE * T E X T ' SIMPLY F I L L ARRAYS WITH BLANKS ?90 ~IAM-O DO 8 0 0 3 - 1 , 1 2 DO 8 0 0 l m l , 8 8 0 0 ENCODE ( 4 , ? 0 0 0 0 , I H A M ( I , 3 ) ) 8 1 0 CONTINUE DO 820 J - l w 1 2 DO 8 2 0 I - 1 , 8 8 2 0 ENCODE ( 4 . ? 0 0 0 0 , I V A L U ( I , 3 ) ) RETURN
409 410
411 412 413 414 415
-C -C -C -C -
(THO ' T E X T '
REHAINS ACCESSIBLE)
BLANK
BLANK
OUTPUT AND ENCODE/DECODE FORMATS 20000
FORMAT( e SORRY-HO VALUE FOR V A R I A B L E ' I 2 * e M U S T IGNORE I T I , * T B O S E fOLLOWING I T ' ) 2 1 0 0 0 FORMAT(' SORRY-HO VALUES SUPPLZEDwMUST IGNORE*) 70000 rORNAT(A4) 7 1 0 0 0 FORNAT(8A4) 72000 ffORNAT(4AI) 7 3 0 0 0 FoI~qAT(G) END
1 2 3 4 S 6 7 8
-
9
-
ZND
1
o
SUBROUTINE INTRO
2 3 4 S G ? 8 9
-C -C -C -
AND '
SUBROUTINE PRC~4CHAR C C C C
PRONCBAR I S CALLED ONCE BY RIULDIIR TO CEANGE PROMPT CUARACT|R PROMPT I S A HACHINE LANGUAGE SUBROUTINE INTEGER 8 T A R / ° * CALL PROMPT(STAR) RETURN
'/
IHTRO I S C A L L I " ) ONCE BY Rlh~DER,AT START OF EXECUTION OUTPUT * D I G I T SERE* OUTPUT ' T y p e ' * L I S T A L L I ' ' OUTPUT * l i s t of instructions' RETURN lmD
for*