! SVLIN.BAS
! WRIITEN BY JAMES A. JARBOE IV GR/AM
! TO TEST SVLIN.SBR
!
! UPDATED 01-31-88 FIXES POSIBILITY OF FINDING MORE THAN TWO
! CHR$(1) IN HEADER INFORMATION IN SV FILE
!
! USES: SVLIN.SBR - GETS INPUT FROM SUPERVUE FILE
!
! All special characters that SuperVue uses such as soft spaces, soft page
! breaks etc are the responsibility of the programmer to check for.
! SVLIN gets fills the BUFFER with data until it reaches a CR, then returns
! to basic with that information in the variable BUFFER.
!
! UPDATE - 01/27/88 JAJ
! Make sure HEADER is an unformatted variable so that it can contain
! Chr$(0) if it finds one in SuperVues Header information
! If HEADER is a String variable it will drop all characters after a Chr$(0)
!
MAP1 HEADER,X,200 ! to trap header info (ADDED)
MAP1 OPTION,F,6 ! 1=open 2=read 3=close
MAP1 AREA,X,616 ! DDB area do not change
MAP1 BUFFER,S,200 ! make sure size is compatable with line length of
! file read
MAP1 FILE$,S,24 ! filename
MAP1 LENGTH,F ! length of line returned here to check for eof
MAP1 SAV'FILE$,S,24
? TAB(-1,0);"Testing SVLIN.SBR Routine"
? TAB(3,1);"INPUTS A LINE FROM A SUPERVUE FILE"
? TAB(5,1);:INPUT LINE "Enter Name of SUPERVUE file ",FILE$
DOT=INSTR(1,FILE$,".")
IF DOT<1 THEN FILE$=FILE$+".T"
SAV'FILE$=FILE$
?
! open file
OPTION=1 ! 1 = open a file status
? "Opening ";FILE$
XCALL SVLIN,OPTION,AREA,FILE$
OPTION=2 ! 2 = read a file status
ONE:
? "Reading ";FILE$
?
CALL HEADER'CHECK
GOTO PRINTIT
PROCESS:
CALL IN ! get next line
IF LENGTH=0 THEN GOTO CLOSE ! if end of file then close it
PRINTIT:
? BUFFER[1,LENGTH] ! print it out
GOTO PROCESS
HEADER'CHECK:
!
! sv header information begins with chr$(1)
! and ends with chr$(1) if the header is there.
! It also may contain chr$(0) or another chr$(1) in the Header information
! so be sure to check header with an unformatted variable
OPTION=2 ! read option
XCALL SVLIN,OPTION,AREA,HEADER,LENGTH
IF HEADER[1,1]#CHR$(1) THEN BUFFER=HEADER:RETURN
HEADTST:
HEAD=INSTR(2,HEADER,CHR$(1)) ! check for end of header info
HEAD2=INSTR(HEAD+1,CHR$(1)) ! check for the real end
IF HEAD2>0 THEN HEAD=HEAD2 ! if there are more than two CHR$(1)
BUFFER=HEADER[HEAD+1,LENGTH] ! take out header info
LENGTH=LENGTH-HEAD ! make LENGTH = -header data
RETURN