.TITLE GETLIN - INPUT NEXT LINE .SBTTL GETLIN - TITLE PAGE .IDENT /V01.00/ .ENABL LC ; ; Input next line from file. ; ; Version: V01.00 ; ; Author: R.W. Stamerjohn ; ; Modification history: ; ; V01.00 RWS 14-Oct-1984 Initial version .SBTTL GETLIN - DECLARATIONS .DSABL GBL .DSABL CRF ; ; Macro library calls: ; .MCALL FDOF$L ;Define FCS offsets FDOF$L .MCALL GET$ ;Define record input ; ; Global declarations: ; .GLOBL GETLIN ;Entry point ; ; Global references: ; .GLOBL INPFDB ;Input FDB .ENABL CRF .SBTTL GETLIN * INPUT NEXT LINE ; ;+ ; This routine inputs the next line from the current file. It has special ; support for the internal file (lun 0), where records are just ASCIZ ; strings. ; ; Call by: JSR PC,GETLIN ; ; File open on input lun. ; ; Exit with: CC = Line found, R4 = address, R3 = length. ; CS = Error on input. ;- GETLIN:: ;Ref. label TSTB INPFDB+F.LUN ;Is this internal file. BEQ 1000$ ; If EQ - yes, scan for ASCIZ ; ; Read real record. ; GET$ #INPFDB ;Input next record MOV INPFDB+F.NRBD,R3 ;Get record length MOV INPFDB+F.NRBD+2,R4 ;Get record address BR 9999$ ; and return (carry set from GET$). ; ; Simulate a read by scanning for ASCIZ records. ; 1000$: MOV INPFDB+F.URBD+2,R4 ;Get start of last record ADD INPFDB+F.URBD,R4 ;Position to next record TSTB (R4) ;Is next record an EOF? SEC ;Preset error return BEQ 9999$ ; If EQ - yes, signal error MOV R4,R3 ;Copy record pointer 1100$: TSTB (R3)+ ;Scan for end of string? BNE 1100$ ; If NE - not found SUB R4,R3 ;Get length of record (with 0) MOV R3,INPFDB+F.URBD ;Store record length MOV R4,INPFDB+F.URBD+2 ;Store start of next record DEC R3 ;Get real length of record MOV R3,INPFDB+F.NRBD ;Store as return value MOV R4,INPFDB+F.NRBD+2 ;Store start of record CLC ;Flag success 9999$: RETURN ;Return to caller .END