Trailing-Edge
-
PDP-10 Archives
-
decuslib10-08
-
43,50476/dalead.for
There are 2 other files named dalead.for in the archive. Click here to see a list.
SUBROUTINE DALEAD(INITYP,NXTTYP,ITRAIL,KWRDLO,KWRDHI,
1 KWORD ,KCNTLO,KCNTHI,KCOUNT,NUMTYP,LWRDLO,LWRDHI,
2 LWORD ,LCNTLO,LCNTHI,LCOUNT,IBUFFR,MAXBFR,LOWBFR,
3 KIND ,KOMAND,KWRDID,KCNTID,LOCAL ,LWRDID,LCNTID,
4 INITAL,IVALUE,VALUE ,IFLOAT)
C RENBR(/RETURN COMMAND AND NUMERIC OR WORD ARGUMENT)
C
C DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C ROUTINE TO IDENTIFY A COMMAND WORD AND A FOLLOWING
C ASSOCIATED WORD, ASSOCIATED NUMBER OR ASSOCIATED TEXT
C STRING WHICH IS MARKED AT BOTH ENDS BY APOSTROPHES.
C
C THE FOLLOWING ARGUMENTS ARE USED FOR INPUT ONLY, AND
C ARE RETURNED UNCHANGED.
C
C INITYP = IF REPRESENTATION OF NUMBER IS FOUND OUTSIDE
C RANGE OF COMMAND, THEN INITYP SPECIFIES
C WHETHER VALUE IS TO BE RETURNED AS INTEGER
C ARGUMENT IVALUE OR AS REAL ARGUMENT VALUE.
C NUMBER CAN BE TYPED WITH DECIMAL POINT
C AND/OR EXPONENT REGARDLESS OF VALUE OF
C INITYP.
C = -2, IF REPRESENTATION OF NUMBER IS FOUND
C OUTSIDE RANGE OF COMMAND, THEN IT IS TREATED
C AS UNKNOWN SEQUENCE OF CHARACTERS, AND KIND
C IS RETURNED CONTAINING VALUE 7.
C = -1, VALUE IS CALCULATED AS OCTAL INTEGER AND
C RETURNED AS ARGUMENT IVALUE. HOWEVER,
C NUMBER FOLLOWING LETTER E OF EXPONENT IS
C EVALUATED IN DECIMAL.
C = 0, VALUE IS CALCULATED AS DECIMAL INTEGER
C AND IS RETURNED AS ARGUMENT IVALUE.
C = 1 OR GREATER, VALUE IS RETURNED AS REAL
C ARGUMENT VALUE. IF POSSIBLE, REAL NUMBER
C WILL BE ACCUMULATED AS INTEGER, THEN BE
C CONVERTED TO REAL AND SHIFTED AS NECESSARY.
C INITYP IS MAXIMUM NUMBER OF DIGITS IN
C INTEGER.
C NXTTYP = IF REPRESENTATION OF NUMBER IS FOUND WITHIN
C RANGE OF COMMAND, THEN NXTTYP SPECIFIES
C WHETHER VALUE IS TO BE RETURNED AS INTEGER
C ARGUMENT IVALUE OR AS REAL ARGUMENT VALUE.
C NUMBER CAN BE TYPED WITH DECIMAL POINT
C AND/OR EXPONENT REGARDLESS OF VALUE OF
C NXTTYP.
C = -3, WHETHER NUMBER IS INTERPRETED AS OCTAL
C INTEGER OR AS DECIMAL INTEGER OR AS DECIMAL
C REAL, AND WHETHER VALUE IS RETURNED IN
C ARGUMENT IVALUE OR VALUE IS SPECIFIED BY
C NUMTYP ARRAY ENTRY HAVING SAME SUBSCRIPT AS
C KCOUNT ARRAY ENTRY CONTAINING NUMBER OF
C CHARACTERS IN COMMAND. CALLING PROGRAM MUST
C NOT CHANGE VALUE OF KCNTID RETURNED BY
C PREVIOUS CALL TO THIS ROUTINE IF NXTTYP IS
C SET TO -3.
C = -2, IF REPRESENTATION OF NUMBER IS FOUND
C WITHIN RANGE OF COMMAND, THEN IT IS TREATED
C AS UNKNOWN SEQUENCE OF CHARACTERS, AND KIND
C IS RETURNED CONTAINING VALUE 7 OR 14
C DEPENDING UPON WHETHER COMMAND WORD WAS
C FOUND BY CURRENT CALL TO THIS ROUTINE.
C = -1, VALUE IS CALCULATED AS OCTAL INTEGER AND
C RETURNED AS ARGUMENT IVALUE. HOWEVER,
C NUMBER FOLLOWING LETTER E OF EXPONENT IS
C EVALUATED IN DECIMAL.
C = 0, VALUE IS CALCULATED AS DECIMAL INTEGER
C AND IS RETURNED AS ARGUMENT IVALUE.
C = 1 OR GREATER, VALUE IS RETURNED AS REAL
C ARGUMENT VALUE. IF POSSIBLE, REAL NUMBER
C WILL BE ACCUMULATED AS INTEGER, THEN BE
C CONVERTED TO REAL AND SHIFTED AS NECESSARY.
C NXTTYP IS MAXIMUM NUMBER OF DIGITS IN
C INTEGER.
C ITRAIL = SELECTS WHETHER EXPONENTS ARE TO BE
C RECOGNIZED. IF NOT, THEN EACH NUMBER WILL
C TERMINATE PRIOR TO EXPONENT, AND LOWBFR WILL
C BE RETURNED POINTING TO LETTER STARTING
C EXPONENT.
C = -1, EXPONENTS EXPRESSED IN E NOTATION ARE TO
C BE RECOGNIZED, BUT PERCENT SIGN AND LETTERS
C K AND M ARE TO BE TREATED SAME AS ANY OTHER
C ALPHABETIC CHARACTERS.
C = 0, NO EXPONENTS ARE TO BE RECOGNIZED.
C NUMBERS WILL BE TERMINATED PRIOR TO PERCENT
C SIGNS OR TO LETTERS E OR K OR M.
C = 1, PERCENT SIGNS, LETTERS K AND M, AND
C EXPONENTS EXPRESSED IN E NOTATION ARE ALL TO
C BE RECOGNIZED.
C KWRDLO = SUBSCRIPT OF LOCATION IN KWORD ARRAY
C CONTAINING FIRST CHARACTER OF FIRST COMMAND
C WORD WHICH CAN BE RECOGNIZED.
C KWRDHI = SUBSCRIPT OF LOCATION IN KWORD ARRAY
C CONTAINING FINAL CHARACTER OF FINAL COMMAND
C WORD WHICH CAN BE RECOGNIZED.
C KWORD = ARRAY CONTAINING CHARACTERS OF COMMAND WORDS
C WHICH CAN BE RECOGNIZED, 1 CHARACTER PER
C ARRAY LOCATION AS THOUGH READ BY MULTIPLE OF
C A1 FORMAT OR DEFINED BY SEVERAL 1H FIELDS.
C KCNTLO = SUBSCRIPT OF LOCATION IN KCOUNT ARRAY
C CONTAINING NUMBER OF CHARACTERS IN FIRST
C COMMAND WORD WHICH CAN BE RECOGNIZED. IF
C KCNTLO IS GREATER THAN KCNTHI, THEN NO
C COMMAND WORDS CAN BE RECOGNIZED, CAUSING
C KIND TO ALWAYS BE RETURNED CONTAINING 7 OR
C LESS.
C KCNTHI = SUBSCRIPT OF LOCATION IN KCOUNT ARRAY
C CONTAINING NUMBER OF CHARACTERS IN FINAL
C COMMAND WORD WHICH CAN BE RECOGNIZED.
C KCOUNT = ARRAY CONTAINING IN LOCATIONS KCOUNT(KCNTLO)
C THROUGH AND INCLUDING KCOUNT(KCNTHI) NUMBERS
C OF CHARACTERS IN EACH OF SEVERAL COMMAND
C WORDS WHICH CAN BE RECOGNIZED. NEGATIVE
C ENTRY IN KCOUNT ARRAY CAUSES NUMBER OF
C CHARACTERS INDICATED BY ABSOLUTE VALUE OF
C NEGATIVE NUMBER TO BE SKIPPED OVER IN KWORD
C ARRAY WITHOUT FORMING RECOGNIZABLE WORD.
C NUMTYP = SPECIFIES MANNER IN WHICH NUMBER IS
C EVALUATED IF NUMBER IS WITHIN RANGE OF
C COMMAND AND IF NXTTYP=-3. WHETHER NUMBER IS
C INTERPRETED AS OCTAL INTEGER OR AS DECIMAL
C INTEGER OR AS DECIMAL REAL, AND WHETHER
C VALUE IS RETURNED IN ARGUMENT IVALUE OR
C VALUE IS SPECIFIED BY NUMTYP ARRAY ENTRY
C HAVING SAME SUBSCRIPT AS KCOUNT ARRAY ENTRY
C CONTAINING NUMBER OF CHARACTERS IN COMMAND.
C IF NXTTYP IS GREATER THAN -3, THEN NUMTYP
C ARRAY IS IGNORED. VALUES OF INDIVIDUAL
C ENTRIES WITHIN NUMTYP ARRAY ARE DEFINED
C SIMILARLY TO THOSE OF NONDIMENSIONED
C ARGUMENT NXTTYP (OTHER THAN NXTTYP=-3) AND
C ARE AS FOLLOW
C = -2, IF REPRESENTATION OF NUMBER IS FOUND
C WITHIN RANGE OF COMMAND, THEN IT IS TREATED
C AS UNKNOWN SEQUENCE OF CHARACTERS, AND KIND
C IS RETURNED CONTAINING VALUE 7 OR 14
C DEPENDING UPON WHETHER COMMAND WORD WAS
C FOUND BY CURRENT CALL TO THIS ROUTINE.
C = -1, VALUE IS CALCULATED AS OCTAL INTEGER AND
C RETURNED AS ARGUMENT IVALUE. HOWEVER,
C NUMBER FOLLOWING LETTER E OF EXPONENT IS
C EVALUATED IN DECIMAL.
C = 0, VALUE IS CALCULATED AS DECIMAL INTEGER
C AND IS RETURNED AS ARGUMENT IVALUE.
C = 1 OR GREATER, VALUE IS RETURNED AS REAL
C ARGUMENT VALUE. IF POSSIBLE, REAL NUMBER
C WILL BE ACCUMULATED AS INTEGER, THEN BE
C CONVERTED TO REAL AND SHIFTED AS NECESSARY.
C NUMTYP(KCNTID) IS MAXIMUM NUMBER OF DIGITS
C IN INTEGER.
C LWRDLO = SUBSCRIPT OF LOCATION IN LWORD ARRAY
C CONTAINING FIRST CHARACTER OF FIRST
C ASSOCIATED WORD WHICH CAN BE RECOGNIZED.
C LWRDHI = SUBSCRIPT OF LOCATION IN LWORD ARRAY
C CONTAINING FINAL CHARACTER OF FINAL
C ASSOCIATED WORD WHICH CAN BE RECOGNIZED.
C LWORD = ARRAY CONTAINING CHARACTERS OF ASSOCIATED
C WORDS WHICH CAN BE RECOGNIZED, 1 CHARACTER
C PER ARRAY LOCATION AS THOUGH READ BY
C MULTIPLE OF A1 FORMAT OR DEFINED BY SEVERAL
C 1H FIELDS.
C LCNTLO = SUBSCRIPT OF LOCATION IN LCOUNT ARRAY
C CONTAINING NUMBER OF CHARACTERS IN FIRST
C ASSOCIATED WORD WHICH CAN BE RECOGNIZED. IF
C LCNTLO IS GREATER THAN LCNTHI, THEN NO
C ASSOCIATED WORDS CAN BE RECOGNIZED SO THAT
C KIND CANNOT BE RETURNED WITH EITHER OF
C VALUES 4 OR 11.
C LCNTHI = SUBSCRIPT OF LOCATION IN LCOUNT ARRAY
C CONTAINING NUMBER OF CHARACTERS IN FINAL
C ASSOCIATED WORD WHICH CAN BE RECOGNIZED.
C LCOUNT = ARRAY CONTAINING IN LOCATIONS LCOUNT(LCNTLO)
C THROUGH AND INCLUDING LCOUNT(LCNTHI) NUMBERS
C OF CHARACTERS IN EACH OF SEVERAL ASSOCIATED
C WORDS WHICH CAN BE RECOGNIZED. NEGATIVE
C ENTRY IN LCOUNT ARRAY CAUSES NUMBER OF
C CHARACTERS INDICATED BY ABSOLUTE VALUE OF
C NEGATIVE NUMBER TO BE SKIPPED OVER IN LWORD
C ARRAY WITHOUT FORMING RECOGNIZABLE WORD.
C IBUFFR = INPUT BUFFER ARRAY, CONTAINING CHARACTERS
C TYPED BY USER AND READ BY MULTIPLE OF A1
C FORMAT, WHICH IS TO BE SEARCHED FOR KNOWN
C COMMAND WORDS, KNOWN ASSOCIATED WORDS,
C NUMBERS AND QUOTED TEXT STRINGS. IBUFFR
C THEN CONTAINS 1 CHARACTER PER COMPUTER
C STORAGE LOCATION.
C MAXBFR = SUBSCRIPT OF FINAL (RIGHTMOST) LOCATION IN
C IBUFFR ARRAY WHICH CAN BE SEARCHED FOR KNOWN
C WORDS, NUMBERS AND QUOTED TEXT STRINGS.
C
C THE FOLLOWING ARGUMENTS MUST BE SET BY CALLING
C PROGRAM BEFORE THIS ROUTINE IS FIRST CALLED, THEN ARE
C RETURNED BY THIS ROUTINE CONTAINING INFORMATION TO BE
C USED BY CALLING PROGRAM AND, USUALLY, TO BE PASSED
C UNCHANGED TO SUBSEQUENT CALL TO THIS ROUTINE.
C
C LOWBFR = SHOULD BE INPUT CONTAINING SUBSCRIPT WITHIN
C IBUFFR ARRAY OF FIRST (LEFTMOST) CHARACTER
C WHICH CAN BE SCANNED FOR KNOWN WORDS AND
C NUMBERS AND QUOTED TEXT STRINGS. LOWBFR IS
C RETURNED CONTAINING SUBSCRIPT OF IBUFFR
C ARRAY LOCATION TO RIGHT OF RIGHTMOST
C CHARACTER OF RIGHTMOST IDENTIFIED ITEM.
C KIND = INPUT CONTAINING 0, THIS ROUTINE HAS NOT YET
C BEEN CALLED DURING EXECUTION OF CURRENT
C LOGICAL SECTION OF CALLING PROGRAM. THIS
C ROUTINE IS TO BEGIN EVALUATION OF CONTENTS
C OF INPUT TEXT BUFFER, NOT CONTINUE RANGE OF
C COMMAND WORD IDENTIFIED BY PREVIOUS CALL TO
C THIS ROUTINE. THE FOLLOWING VALUES OF KIND
C ARE RETURNED TO CALLING PROGRAM DESCRIBING
C TYPE OF ITEM OR ITEMS LOCATED IN IBUFFR
C ARRAY. EXCEPT WHERE MENTIONED BELOW, THESE
C VALUES ARE USUALLY PASSED UNCHANGED TO
C SUBSEQUENT CALL TO THIS ROUTINE.
C = 1, EITHER INPUT BUFFER WAS EMPTY, OR ELSE
C NEXT PRINTING CHARACTER AT OR TO RIGHT OF
C IBUFFR(LOWBFR), IGNORING COMMAS, WAS
C EXCLAMATION POINT. LOWBFR IS RETURNED
C POINTING BEYOND END OF BUFFER. IT IS
C EXPECTED THAT CALLING PROGRAM WILL READ NEW
C TEXT INTO INPUT BUFFER AND RESET LOWBFR TO
C POINT TO FIRST CHARACTER IN BUFFER BEFORE
C AGAIN CALLING THIS ROUTINE. UNLESS KIND IS
C CHANGED TO 3 BY CALLING PROGRAM, SUBSEQUENT
C CALL TO THIS ROUTINE WILL RETURN KOMAND
C ZEROED IF NEW COMMAND WORD IS NOT
C IDENTIFIED.
C = 2, NEXT PRINTING CHARACTER AT OR TO RIGHT OF
C IBUFFR(LOWBFR), IGNORING COMMAS, WAS
C SEMICOLON. LOWBFR IS RETURNED POINTING TO
C CHARACTER TO RIGHT OF SEMICOLON. THE
C SUBSEQUENT CALL TO THIS ROUTINE WILL RETURN
C KOMAND ZEROED IF NEW COMMAND WORD IS NOT
C IDENTIFIED.
C = 3, NEXT PRINTING CHARACTER AT OR TO RIGHT OF
C IBUFFR(LOWBFR), IGNORING COMMAS, WAS
C AMPERSAND. LOWBFR IS RETURNED CONTAINING
C MAXBFR+1. IT IS EXPECTED THAT CALLING
C PROGRAM WILL READ NEW TEXT INTO INPUT BUFFER
C AND RESET LOWBFR TO POINT TO FIRST CHARACTER
C IN BUFFER BEFORE AGAIN CALLING THIS ROUTINE.
C UNLESS KIND IS CHANGED TO 1 BY CALLING
C PROGRAM, SUBSEQUENT CALL TO THIS ROUTINE
C WILL RETURN VALUES OF KOMAND, KWRDID AND
C KCNTID UNCHANGED IF NEW COMMAND WORD IS NOT
C IDENTIFIED.
C = 4, NEXT PRINTING CHARACTERS AT OR TO RIGHT
C OF IBUFFR(LOWBFR), IGNORING COMMAS EXCEPT
C FOR THEIR USE AS WORD SEPARATORS, UNIQUELY
C IDENTIFIED ASSOCIATED WORD IN DICTIONARY
C CONTAINED IN LWORD AND LCOUNT ARRAYS.
C INITAL IS RETURNED CONTAINING SUBSCRIPT OF
C IBUFFR ARRAY LOCATION WHICH CONTAINS FIRST
C CHARACTER OF ASSOCIATED WORD OR ABBREVIATION
C OF ASSOCIATED WORD. LOWBFR IS RETURNED
C POINTING TO CHARACTER TO RIGHT OF WORD OR
C WORD ABBREVIATION. THE SUBSEQUENT CALL TO
C THIS ROUTINE WILL RETURN VALUES OF KOMAND,
C KWRDID AND KCNTID UNCHANGED IF NEW COMMAND
C WORD IS NOT IDENTIFIED.
C = 5, NEXT PRINTING CHARACTERS AT OR TO RIGHT
C OF IBUFFR(LOWBFR), IGNORING COMMAS EXCEPT
C FOR THEIR USE AS NUMBER SEPARATORS, FORMED
C NUMBER. THE VALUE OF NUMBER IS RETURNED IN
C ARGUMENT IVALUE IF RETURNED AS INTEGER OR IN
C ARGUMENT VALUE IF RETURNED AS REAL NUMBER.
C INITAL IS RETURNED CONTAINING SUBSCRIPT OF
C IBUFFR ARRAY LOCATION WHICH CONTAINS FIRST
C CHARACTER OF NUMBER. LOWBFR IS RETURNED
C POINTING TO CHARACTER TO RIGHT OF NUMBER.
C THE SUBSEQUENT CALL TO THIS ROUTINE WILL
C RETURN VALUES OF KOMAND, KWRDID AND KCNTID
C UNCHANGED IF NEW COMMAND WORD IS NOT
C IDENTIFIED.
C = 6, NEXT PRINTING CHARACTER AT OR TO RIGHT OF
C IBUFFR(LOWBFR), IGNORING LEADING COMMAS, WAS
C APOSTROPHE WHICH IS POINTED TO BY RETURNED
C VALUE OF INITAL. LOWBFR IS RETURNED
C POINTING TO CHARACTER TO RIGHT OF RIGHTMOST
C CHARACTER WITHIN QUOTED TEXT STRING. IF
C QUOTED TEXT STRING IS NOT TERMINATED BY
C UNPAIRED APOSTROPHE, THEN LOWBFR IS RETURNED
C POINTING TO CHARACTER TO RIGHT OF RIGHTMOST
C PRINTING CHARACTER IN BUFFER. IF QUOTED
C TEXT STRING IS TERMINATED BY UNPAIRED
C APOSTROPHE, THEN THIS APOSTROPHE IS CHANGED
C TO SPACE POINTED TO BY RETURNED VALUE OF
C LOWBFR. IF PAIR OF ADJACENT APOSTROPHES IS
C FOUND WITHIN QUOTED TEXT STRING, THEN
C PORTION OF QUOTED TEXT STRING TO RIGHT OF
C PAIR OF APOSTROPHES IS MOVED TO LEFT
C OVERWRITING SECOND APOSTROPHE OF PAIR, AND
C LOWBFR IS RETURNED POINTING TO CHARACTER TO
C RIGHT OF RIGHTMOST CHARACTER OF QUOTED TEXT
C STRING IN ITS NEW LOCATION. THE LOCATION
C VACATED BY RIGHTMOST CHARACTER IS FILLED
C WITH SPACE AFTER SHIFT IS COMPLETE.
C = 7, NEXT PRINTING CHARACTERS AT OR TO RIGHT
C OF IBUFFR(LOWBFR), IGNORING COMMAS EXCEPT
C FOR THEIR USE AS CHARACTER SEQUENCE
C SEPARATORS, FORMED UNKNOWN SEQUENCE. THIS
C VALUE OF KIND IS RETURNED ALSO IF WORD OR
C WORD ABBREVIATION IS NOT UNIQUE ACROSS BOTH
C DICTIONARIES, OR IF COMMAND WORD OR ITS
C ABBREVIATION OR ASSOCIATED WORD OR ITS
C ABBREVIATION IS FOLLOWED BY ANY CHARACTER
C OTHER THAN SPACE, TAB, COMMA, APOSTROPHE,
C SEMICOLON, EXCLAMATION POINT OR AMPERSAND.
C INITAL IS RETURNED CONTAINING SUBSCRIPT OF
C IBUFFR ARRAY LOCATION WHICH CONTAINS FIRST
C CHARACTER OF UNKNOWN SEQUENCE OR OF WORD OR
C ABBREVIATION WHICH IS FOLLOWED BY UNKNOWN
C SEQUENCE. LOWBFR IS RETURNED POINTING TO
C FOLLOWING SPACE, TAB, COMMA, APOSTROPHE,
C SEMICOLON, EXCLAMATION POINT OR AMPERSAND OR
C BEYOND END OF LINE IF UNKNOWN PRINTING
C CHARACTERS EXTEND THROUGH END OF LINE. THE
C SUBSEQUENT CALL TO THIS ROUTINE WILL RETURN
C VALUES OF KOMAND, KWRDID AND KCNTID
C UNCHANGED IF NEW COMMAND WORD IS NOT
C IDENTIFIED.
C = 8 THROUGH 14, SAME AS KIND VALUES 1 THROUGH
C 7 RESPECTIVELY EXCEPT THAT COMMAND WORD OR
C ABBREVATION WAS RECOGNIZED PRIOR TO END OF
C LINE (8), SEMICOLON (9), AMPERSAND (10),
C ASSOCIATED WORD (11), NUMBER (12), QUOTED
C TEXT STRING (13) OR UNKNOWN SEQUENCE (14).
C = 8, COMMAND WORD EXTENDED THROUGH RIGHTMOST
C PRINTING CHARACTERS IN LINE, OR ELSE NEXT
C PRINTING CHARACTER TO RIGHT OF COMMAND WORD,
C IGNORING COMMAS EXCEPT FOR THEIR USE AS WORD
C SEPARATORS, WAS EXCLAMATION POINT. UNLESS
C KIND IS CHANGED TO 10 BY CALLING PROGRAM,
C SUBSEQUENT CALL TO THIS ROUTINE WILL RETURN
C KOMAND ZEROED UNLESS NEW COMMAND IS FOUND.
C = 10, NEXT PRINTING CHARACTER TO RIGHT OF
C COMMAND WORD, IGNORING COMMAS EXCEPT FOR
C THEIR USE AS WORD SEPARATORS, WAS AMPERSAND.
C THE CALLING PROGRAM SHOULD READ NEW TEXT
C INTO INPUT BUFFER AND SUBSEQUENT CALL TO
C THIS ROUTINE IS THEN TO CONTINUE
C INTERPRETATION OF NEW TEXT AS THOUGH THIS
C COMMAND WORD APPEARED AT START OF NEW
C CONTENTS OF BUFFER. UNLESS KIND IS CHANGED
C TO 8 BY CALLING PROGRAM, SUBSEQUENT CALL TO
C THIS ROUTINE WILL RETURN KOMAND, KWRDID AND
C KCNTID UNCHANGED AND WILL RETURN KIND
C GREATER THAN 7.
C = 15, IGNORING COMMAS EXCEPT FOR THEIR USE AS
C WORD TERMINATORS, COMMAND WORD OR ITS
C ABBREVIATION WAS FOLLOWED BY SPACES AND/OR
C TABS AND/OR COMMAS AND THEN BY SECOND
C COMMAND WORD OR ITS ABBREVIATION. THE FIRST
C COMMAND IS IDENTIFIED BY RETURNED VALUES OF
C KOMAND, KWRDID AND KCNTID. LOWBFR IS
C RETURNED POINTING TO FIRST CHARACTER OF
C SECOND COMMAND WORD WHICH WILL IN TURN BE
C IDENTIFIED BY SUBSEQUENT CALL TO THIS
C ROUTINE. IF KIND WAS INPUT CONTAINING VALUE
C 10, THEN SECOND COMMAND WORD IS OF COURSE
C ACTUALLY FIRST TO APPEAR IN CURRENT CONTENTS
C OF BUFFER.
C
C THE FOLLOWING ARGUMENTS ARE RETURNED TO CALLING
C PROGRAM IDENTIFYING COMMAND WORD FOUND BY THIS
C ROUTINE OR WHICH IS STILL IN EFFECT FROM PREVIOUS
C CALL TO THIS ROUTINE.
C
C KOMAND = RETURNED CONTAINING SEQUENCE NUMBER OF
C CURRENT COMMAND WORD AMONG ALL POSSIBLE
C COMMAND WORDS. THE SEQUENCE NUMBER DOES NOT
C INCLUDE LETTERS SKIPPED OVER BY VALUE OF
C KWRDLO BEING GREATER THAN 1, AND DOES NOT
C INCLUDE LETTERS SKIPPED OVER BY NEGATIVE
C VALUES ENCOUNTERED IN KCOUNT ARRAY. KOMAND
C IS NUMBER OF VALUES IN KCOUNT ARRAY WHICH
C ARE GREATER THAN ZERO STARTING AT
C KCOUNT(KCNTLO) UP TO AND INCLUDING KCOUNT
C ARRAY LOCATION WHICH CONTAINS NUMBER OF
C LETTERS IN COMMAND WORD WHICH IS
C SUCCESSFULLY MATCHED. KOMAND IS RETURNED
C CONTAINING ZERO IF KIND IS INPUT CONTAINING
C 0, 1, 2, 8 OR 9 INDICATING THAT RANGE OF
C PREVIOUS COMMAND IS BEING TERMINATED, AND IF
C KIND IS RETURNED LESS THAN OR EQUAL TO 7
C INDICATING THAT NO NEW COMMAND WAS FOUND.
C KOMAND IS RETURNED UNCHANGED IF KIND IS
C INPUT CONTAINING VALUE OTHER THAN 0, 1, 2, 8
C OR 9, AND IF KIND IS RETURNED LESS THAN OR
C EQUAL TO 7.
C KWRDID = RETURNED CONTAINING SUBSCRIPT OF KWORD ARRAY
C LOCATION WHICH CONTAINS FIRST CHARACTER OF
C MATCHED COMMAND WORD. KWRDID IS RETURNED
C UNCHANGED IF COMMAND IDENTIFIED BY PREVIOUS
C CALL TO THIS ROUTINE IS STILL IN EFFECT.
C KCNTID = RETURNED CONTAINING SUBSCRIPT OF KCOUNT
C ARRAY LOCATION WHICH CONTAINS NUMBER OF
C CHARACTERS IN MATCHED COMMAND WORD. KCNTID
C IS RETURNED UNCHANGED IF COMMAND IDENTIFIED
C BY PREVIOUS CALL TO THIS ROUTINE IS STILL IN
C EFFECT.
C
C THE FOLLOWING ARGUMENTS ARE RETURNED TO CALLING
C PROGRAM IDENTIFYING ASSOCIATED WORD FOUND IF KIND IS
C RETURNED CONTAINING EITHER 4 OR 11. THESE ARGUMENTS
C ARE RETURNED UNCHANGED IF KIND IS RETURNED WITH ANY
C VALUE OTHER THAN 4 OR 11.
C
C LOCAL = RETURNED CONTAINING SEQUENCE NUMBER OF
C ASSOCIATED WORD AMONG ALL POSSIBLE
C ASSOCIATED WORDS. THE SEQUENCE NUMBER DOES
C NOT INCLUDE LETTERS SKIPPED OVER BY VALUE OF
C LWRDLO BEING GREATER THAN 1, AND DOES NOT
C INCLUDE LETTERS SKIPPED OVER BY NEGATIVE
C VALUES ENCOUNTERED IN LCOUNT ARRAY. LOCAL
C IS NUMBER OF VALUES IN LCOUNT ARRAY WHICH
C ARE GREATER THAN ZERO STARTING AT
C LCOUNT(LCNTLO) UP TO AND INCLUDING LCOUNT
C ARRAY LOCATION WHICH CONTAINS NUMBER OF
C LETTERS IN ASSOCIATED WORD WHICH IS
C SUCCESSFULLY MATCHED.
C LWRDID = RETURNED CONTAINING SUBSCRIPT OF LWORD ARRAY
C LOCATION WHICH CONTAINS FIRST CHARACTER OF
C MATCHED ASSOCIATED WORD.
C LCNTID = RETURNED CONTAINING SUBSCRIPT OF LCOUNT
C ARRAY LOCATION WHICH CONTAINS NUMBER OF
C CHARACTERS IN MATCHED ASSOCIATED WORD.
C
C THE FOLLOWING ARGUMENTS ARE USED ONLY FOR OUTPUT.
C THEIR INPUT VALUES ARE IGNORED.
C
C INITAL = RETURNED CONTAINING SUBSCRIPT OF IBUFFR
C ARRAY LOCATION WHICH CONTAINS FIRST
C CHARACTER OF ASSOCIATED WORD (KIND RETURNED
C AS 4 OR 11), OF NUMBER (KIND RETURNED AS 5
C OR 12), OR OF UNKNOWN SEQUENCE OF CHARACTERS
C (KIND RETURNED AS 7 OR 14). IF QUOTED TEXT
C STRING IS FOUND (KIND RETURNED CONTAINING 6
C OR 13), THEN INITAL IS RETURNED POINTING TO
C APOSTROPHE AT LEFT END OF STRING.
C IVALUE = RETURNED CONTAINING VALUE IF NUMBER IS FOUND
C (KIND BEING RETURNED CONTAINING 5 OR 12) AND
C IF NUMBER IS EVALUATED AS OCTAL INTEGER OR
C AS DECIMAL INTEGER.
C VALUE = RETURNED CONTAINING VALUE IF NUMBER IS FOUND
C (KIND BEING RETURNED CONTAINING 5 OR 12) AND
C IF NUMBER IS EVALUATED AS DECIMAL REAL.
C IFLOAT = SPECIFIES HOW NUMBER WAS EVALUATED. IFLOAT
C IS RETURNED SET EQUAL TO INITYP IF NUMBER IS
C OUTSIDE RANGE OF COMMAND, OR SET EQUAL TO
C NXTTYP IF NUMBER IS WITHIN RANGE OF COMMAND
C AND NXTTYP HAS VALUE GREATER THAN -3, OR SET
C EQUAL TO ENTRY IN NUMTYP ARRAY HAVING SAME
C SUBSCRIPT AS KCOUNT ARRAY ENTRY WHICH
C SPECIFIES NUMBER OF CHARACTERS IN COMMAND IF
C NXTTYP=-3. IFLOAT IS RETURNED UNDEFINED,
C BUT PROBABLY CHANGED, IF KIND IS RETURNED
C WITH VALUE OTHER THAN 5 OR 12.
C = -1, NUMBER WAS EVALUATED AS OCTAL INTEGER
C AND ITS VALUE IS RETURNED IN IVALUE.
C = 0, NUMBER WAS EVALUATED AS DECIMAL INTEGER
C AND ITS VALUE IS RETURNED IN IVALUE.
C = 1 OR GREATER, NUMBER WAS EVALUATED AS
C DECIMAL REAL AND ITS VALUE IS RETURNED IN
C ARGUMENT NAMED VALUE.
C
DIMENSION KWORD(KWRDHI),KCOUNT(KCNTHI),
1NUMTYP(KCNTHI),LWORD(LWRDHI),LCOUNT(LCNTHI),
2IBUFFR(MAXBFR)
DATA KOMENT,IEND,IAND,KOMMA,IQUOTE,IBLANK,ITAB/
11H!,1H;,1H&,1H,,1H',1H ,1H /
C
C SET INITIAL CONSTANTS
IF(KIND.EQ.10)GO TO 15
IF(KIND.LE.2)GO TO 1
IF(KIND.EQ.8)GO TO 1
IF(KIND.NE.9)GO TO 2
1 KOMAND=0
2 KIND=1
GO TO 4
C
C LOOK FOR NEXT NONBLANK CHARACTERS
3 LOWBFR=LOWBFR+1
4 IF(LOWBFR.GT.MAXBFR)GO TO 26
LETTER=IBUFFR(LOWBFR)
IF(LETTER.EQ.IBLANK)GO TO 3
IF(LETTER.EQ.ITAB)GO TO 3
IF(LETTER.EQ.KOMMA)GO TO 3
IF(LETTER.EQ.IEND)GO TO 25
IF(LETTER.EQ.IAND)GO TO 23
IF(LETTER.EQ.KOMENT)GO TO 24
INITAL=LOWBFR
IF(LETTER.EQ.IQUOTE)GO TO 18
LEGAL=0
C
C TEST IF PRINTING CHARACTERS FORM A COMMAND WORD
CALL DAVERB(KWRDLO,KWRDHI,KWORD,KCNTLO,KCNTHI,
1KCOUNT,IBUFFR,MAXBFR,LOWBFR,ITYPE,IMATCH,IWRDID,
2ICNTID,LCNBFR)
C
C TEST IF PRINTING CHARACTERS FORM AN ARGUMENT WORD
JPOINT=INITAL
CALL DAVERB(LWRDLO,LWRDHI,LWORD,LCNTLO,LCNTHI,
1LCOUNT,IBUFFR,MAXBFR,JPOINT,JTYPE,JMATCH,JWRDID,
2JCNTID,LCNBFR)
C
C IF WORD MATCHES FROM BOTH DICTIONARIES, DECIDE ACTION
IF(LOWBFR.LT.JPOINT)GO TO 6
IF(LOWBFR.GT.JPOINT)GO TO 5
IF(ITYPE.LE.2)GO TO 8
IF(ITYPE.EQ.JTYPE)GO TO 12
IF(JTYPE.EQ.3)GO TO 7
IF(ITYPE.NE.3)GO TO 12
5 IF(ITYPE.NE.5)LEGAL=-1
GO TO 12
6 LOWBFR=JPOINT
7 IF(JTYPE.NE.5)LEGAL=1
GO TO 12
C
C CHECK FOR NUMBER
8 IF(KOMAND.LE.0)GO TO 10
IF(NXTTYP.GE.-2)GO TO 9
IFLOAT=NUMTYP(KCNTID)
GO TO 11
9 IFLOAT=NXTTYP
GO TO 11
10 IFLOAT=INITYP
11 CALL DAHEFT(IFLOAT,ITRAIL,0,IBUFFR,MAXBFR,
1LOWBFR,ITYPE,ISHIFT,JSHIFT,KSHIFT,LSHIFT,IVALUE,
2VALUE)
IF(ITYPE.LE.2)GO TO 12
KIND=KIND+4
GO TO 26
C
C CHECK FOLLOWING CHARACTERS
12 IF(LOWBFR.GT.MAXBFR)GO TO 13
LETTER=IBUFFR(LOWBFR)
IF(LETTER.EQ.IBLANK)GO TO 13
IF(LETTER.EQ.ITAB)GO TO 13
IF(LETTER.EQ.KOMMA)GO TO 13
IF(LETTER.EQ.IEND)GO TO 13
IF(LETTER.EQ.IAND)GO TO 13
IF(LETTER.EQ.KOMENT)GO TO 13
IF(LETTER.EQ.IQUOTE)GO TO 13
LOWBFR=LOWBFR+1
LEGAL=0
GO TO 12
13 IF(LEGAL.LT.0)GO TO 14
IF(LEGAL.GT.0)GO TO 17
KIND=KIND+6
GO TO 26
14 IF(KIND.NE.1)GO TO 16
KOMAND=IMATCH
KCNTID=ICNTID
KWRDID=IWRDID
15 KIND=8
GO TO 4
16 KIND=15
LOWBFR=INITAL
GO TO 26
17 LOCAL=JMATCH
LCNTID=JCNTID
LWRDID=JWRDID
KIND=KIND+3
GO TO 26
C
C APOSTROPHE FOUND
18 KIND=KIND+5
I=LOWBFR
J=LOWBFR
19 IF(I.GE.MAXBFR)GO TO 20
I=I+1
J=J+1
IBUFFR(J)=IBUFFR(I)
IF(IBUFFR(I).EQ.IBLANK)GO TO 19
IF(IBUFFR(I).EQ.ITAB)GO TO 19
LOWBFR=J
IF(IBUFFR(I).NE.IQUOTE)GO TO 19
IF(I.GE.MAXBFR)GO TO 22
IF(IBUFFR(I+1).NE.IQUOTE)GO TO 22
I=I+1
GO TO 19
20 LOWBFR=LOWBFR+1
21 IF(J.GE.I)GO TO 26
J=J+1
22 IBUFFR(J)=IBLANK
GO TO 21
C
C AMPERSAND FOUND
23 KIND=KIND+2
24 LOWBFR=MAXBFR+1
GO TO 26
C
C SEMICOLON FOUND
25 KIND=KIND+1
LOWBFR=LOWBFR+1
C
C RETURN TO CALLING PROGRAM
26 RETURN
C842625025196!;&'
END