.TITLE LOAD_PARSE_TABLES .IDENT "Ver 1.0" ; ; .PSECT LOAD_PARSE_IMPURE, WRT, NOEXE ; $TPADEF ; COMMA = 44 ; TPARSE_BLOCK: .LONG TPA$K_COUNT0 .LONG TPA$M_ABBREV .BLKB TPA$K_LENGTH0-8 ; START_RECORD: .BLKL 1 END_RECORD: .BLKL 1 COUNT_RECORD: .BLKL 1 OUT_NUMBER: .BLKL 1 ; ; .PSECT LOAD_PARSE_CODE, EXE, NOWRT ; LOAD_RECORD_PARSE:: .WORD ^M ; ; 4(AP) - Address of parse input string descriptor ; 8(AP) - Address of longword to contain START_RECORD ; 12(AP) - Address of longword to contain END_RECORD ; 16(AP) - Address of longword to contain COUNT_RECORD ; MOVL 4(AP), R2 MOVW (R2), TPARSE_BLOCK+TPA$L_STRINGCNT MOVL 4(R2), TPARSE_BLOCK+TPA$L_STRINGPTR ; CLRL START_RECORD CLRL END_RECORD CLRL COUNT_RECORD ; PUSHAL REC_KEY PUSHAL REC_STATE PUSHAL TPARSE_BLOCK CALLS #3, G^LIB$TPARSE BLBC R0, FAILURE ; ADDL2 START_RECORD, @8(AP) ADDL2 END_RECORD, @12(AP) ADDL2 COUNT_RECORD, @16(AP) RET ; LOAD_NUMBER_PARSE:: .WORD ^M ; ; 4(AP) - Address of parse input string descriptor ; 8(AP) - Address of longword to contain NUMBER ; MOVL 4(AP), R2 MOVW (R2), TPARSE_BLOCK+TPA$L_STRINGCNT MOVL 4(R2), TPARSE_BLOCK+TPA$L_STRINGPTR ; PUSHAL NUM_KEY PUSHAL NUM_STATE PUSHAL TPARSE_BLOCK CALLS #3, G^LIB$TPARSE BLBC R0, FAILURE ; MOVL OUT_NUMBER, @8(AP) RET ; FAILURE: RET ; ; This state table is used to check the syntax of the qualifier /RECORD ; to the command LOAD. The syntax is as follows: ; ; START:n, END:m, COUNT:o ; $INIT_STATE REC_STATE, REC_KEY ; $STATE NEXT_LIMIT $TRAN 'START',ST_REC $TRAN 'END', ED_REC $TRAN 'COUNT',CT_REC ; $STATE ST_REC $TRAN ':' $TRAN '=' ; $STATE ST_NUM $TRAN TPA$_DECIMAL,END_LIMIT,,,START_RECORD ; $STATE ED_REC $TRAN ':' $TRAN '=' ; $STATE ED_NUM $TRAN TPA$_DECIMAL,END_LIMIT,,,END_RECORD ; $STATE CT_REC $TRAN ':' $TRAN '=' ; $STATE CT_NUM $TRAN TPA$_DECIMAL,END_LIMIT,,,COUNT_RECORD ; $STATE END_LIMIT $TRAN COMMA, NEXT_LIMIT $TRAN TPA$_EOS, TPA$_EXIT ; $END_STATE ; ; This state table is used to check that the input string is a decimal ; number and that that string is converted into an integer. ; $INIT_STATE NUM_STATE, NUM_KEY ; $STATE NUM $TRAN TPA$_DECIMAL, TPA$_EXIT,,,OUT_NUMBER ; $END_STATE ; .END