.TITLE LOOKUP .IDENT /Y01.3/ ; ; This is derived from a (deceased) fortran program so please excuse the ; odd names of varaibles and psects. ; ; This subroutine is entered with a file open on LUN 1 ; This file must be in the specified form for a CCL command set. ; .MCALL GET$ .PSECT .$$$$.,rw,d,con,ovr,gbl ; The common data area for the three routines FIXUP LOOKUP and the MAIN proram ; PARAMS: .word 0 ;max # params to prompt for MCRL: .word 0 ;length of mcr line KEYL: .word 0 ;length of keyword MCR: .blkb 80. KEYB: .blkb 8. ;keyword text space padded P: .blkb 416 CMD: .blkb 80. PMIN: .WORD 0 ;min # of parameters allowed .PSECT $VARS,RW,D,CON,LCL LMIN: .WORD 0 ;minimum length of keyword .PSECT $CODE1,RW,I,CON,LCL ; entry to get next record for processing. ; Note the effect of null records and of records with junk in the first ; 5 columns is undefined, but unlikely to be nasty in the extreme. ; worst case is CCL could spin on incomplete data set of CCL spec. ; LOOKUP:: .1: ; 0008 ; The result of a failure to find the keyword which is presented ; in the buffer keyb..keyb+7 of length keyl bytes is to return ; a 0 ( fortran false). GET$ #FDB,#INBF,#80. BCC 1$ CLR R0 RTS PC 1$: MOV #60,R2 ;The first character of the line is checked for a "$" symbol ; if it is not that then the line is not a keyword line and can be ; bypassed in our search MOV #INBF,R0 CMPB (R0)+,#44 ;IS IT $ BNE .1 ;No, get next line ; The 4 number fields of a "$" record are now obtained with no ; checking and an enormous degree of hopefulness ; They are in turn ; length minimum match ; length max(skipped) ; parameter count minimum ; parameter count required if no params specified ; MOVB (R0)+,R1 SUB R2,R1 ;MAKE INTEGER MOVB R1,LMIN ;GET MIN LENGTH TSTB (R0)+ ;IGNORE MAX LENGTH MOVB (R0)+,R1 SUB R2,R1 MOV R1,PMIN MOVB (R0)+,R1 SUB R2,R1 MOV R1,PARAMS ;AND LAST OF THE NUMBERS. ;If the input record was shorter than 13 characters, that is ; "$abcd"+keyword of 8 chars ; pad it out with spaces until it is atleast that length so ; the comparison is easier MOV FDB+F.NRBD,R0 ;SIZE OF RECORD READ CMP R0,#13. ;MIN CHARS NEEDED BGE 2$ ;YES ADD #INBF,R0 ;POINT AT LAST CHAR MOV #13.,R4 3$: MOVB #' ,(R0)+ SOB R4,3$ ; here both keyword and item to test occupy 8 characters and ; they are both spce filled 2$: ; 0015 MOV #1,R0 ; now they must at least match up to the minimum length ; given on the keyword line L$HABO: CMPB INBF+4(R0),KEYB-1(R0) BNE .1 ; 0017 INC R0 CMP R0,LMIN BLE L$HABO ; 0018 CMP LMIN,#10 BEQ .7 ; they must also match spaces in the keyword typed, or real ; matches to characters in the keyword spec line ; for the rest of the 8 characters ; 0019 MOV LMIN,R0 INC R0 L$EBGB: ; 0020 CMPB KEYB-1(R0),INBF+4(R0) BEQ L$EBDD CMPB KEYB-1(R0),#40 BNE .1 L$EBDD: ; 0021 INC R0 CMP R0,#10 BLE L$EBGB .7: ; here they have matched to 8 characters exactly or to ; greater than LMIN and then have had the user typed keyword ; trailing space padded ; result is fortran true (-1) ; 0023 MOV #-1,R0 RTS PC .END