MODULE X36 ( IDENT = 'X00.05' %TITLE 'TOPS-10/TOPS-20-specific XPORT Routines' %BLISS16( ,OLDBLISS='EIS' ) %BLISS32( ,ADDRESSING_MODE( EXTERNAL=LONG_RELATIVE ) ) %BLISS36( , ENTRY( X36$SEQ_INFO, X36$GET_FILE ),OTS='' ) ) = BEGIN ! ! COPYRIGHT (c) 1980 BY ! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. ! ! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED ! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE ! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER ! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY ! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY ! TRANSFERRED. ! ! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT ! CORPORATION. ! ! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS ! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. ! !++ ! ! FACILITY: BLISS Library ! ! ABSTRACT: ! ! This module contains all XPORT routines which are specific to TOPS-10/TOPS-20. ! ! ENVIRONMENT: User mode ! ! AUTHOR: Ward Clark, CREATION DATE: 27 April 1979 ! Linda Duffell ! !-- ! ! INCLUDE FILES: ! LIBRARY 'XPORT' ; ! Public XPORT control block and macro definitions LIBRARY 'XPOSYS' ; ! Internal XPORT macro definitions $XPO_SYS_TEST( $TOPS10, $TOPS20 ) %IF $TOPS10 %THEN REQUIRE 'XT10' ; ! TOPS-10 I/O interface macros %FI %IF $TOPS20 %THEN REQUIRE 'XT20' ; ! TOPS-20 I/O interface macros %FI ! ! TABLE OF CONTENTS: ! FORWARD ROUTINE X36$SEQ_INFO, ! Page/sequence number processing X36$GET_FILE; ! TOPS-10/TOPS-20 disk file read routine ! ! MACROS: ! ! ! EQUATED SYMBOLS: ! ! ! PSECT DECLARATIONS: ! $XPO_PSECTS ! Declare XPORT PSECT names and attributes ! ! OWN STORAGE: ! ! ! EXTERNAL REFERENCES: ! %IF $TOPS20 %THEN EXTERNAL ROUTINE X20$IN; ! TOPS-20 input routine. %FI GLOBAL ROUTINE X36$SEQ_INFO( iob ) = !++ ! ! FUNCTIONAL DESCRIPTION: ! ! This routine processes SOS page marks and line numbers, updating ! the appropriate IOB fields. ! ! FORMAL PARAMETERS: ! ! iob - address of XPORT IOB ! ! IMPLICIT INPUTS: ! ! None ! ! IMPLICIT OUTPUTS: ! ! The following IOB fields are updated: ! IOB$H_PAGE_NUMB - may be incremented ! IOB$G_SEQ_NUMB - set to sequence number or record number ! IOB$G_COMP_CODE - may be set to XPO$_NEW_PAGE success code, ! IOB$G_COMP_CODE - also set for error conditions other than XPO$_END_FILE ( see below ) ! IOB$G_2ND_CODE - set for certain error conditons ! ! COMPLETION CODES: ! ! XPO$_NORMAL - page mark and/or sequence number successfully processed ! XPO$_END_FILE - end-of-file reached ! XPO$_BAD_RECORD - invalid data in file ! failure completion codes from X36$GET_FILE ! ! SIDE EFFECTS: ! ! None ! !-- BEGIN MAP iob : REF $XPO_IOB(); ! Redefine the IOB parameter BIND buffer_cb = .iob[IOB$A_BUFFER_CB] : VECTOR; ! TOPS-10/TOPS-20 buffer control block LOCAL status, ! Temporary routine completion code character; ! Single ASCII character MACRO GET_CHARACTER = BEGIN status = X36$GET_FILE( .iob, character ); IF NOT .status THEN RETURN .status; END %, SKIP_CHARACTER( value ) = BEGIN GET_CHARACTER; IF .character NEQ value THEN $XPO_RETURN (BAD_RECORD); END %; ! ! Advance to the next word boundary in the system input buffer. ! WHILE .BLOCK[buffer_cb[$BFPTR],0,30,6,0] GTR 1 DO ! Loop to the next word boundary, SKIP_CHARACTER( null ); ! bypassing characters which must be nulls. ! ! Page Mark processing. ! DO ! Bypass any nulls which precede a potential page mark. GET_CHARACTER ! UNTIL .character NEQ null; ! IF NOT .(.buffer_cb[$BFPTR]) ! If the low bit (bit 35) of the current word of THEN ! the input buffer is not 1, $XPO_RETURN (BAD_RECORD); ! return an error code to the caller. IF .character EQL space ! Test for the beginning of a page mark. THEN BEGIN INCR count FROM 1 TO 4 DO ! Bypass the following required characters: SKIP_CHARACTER( space ); ! 4 spaces SKIP_CHARACTER( cr ); ! a single carriage return iob[IOB$H_PAGE_NUMB] = .iob[IOB$H_PAGE_NUMB]+1; ! Increment the IOB page counter iob[IOB$G_COMP_CODE] = XPO$_NEW_PAGE; ! and update current success completion code. RETURN XPO$_NORMAL; ! Return to let caller read the form feed which follows. END; ! ! Sequence number processing. ! WHILE .character EQL null DO ! Bypass any nulls which precede a sequence number. GET_CHARACTER; ! IF NOT .(.buffer_cb[$BFPTR]) ! If the low bit (bit 35) of the current word of THEN ! the input buffer is not 1, $XPO_RETURN (BAD_RECORD); ! return an error code to the caller. iob[IOB$G_SEQ_NUMB] = 0; ! Start the sequence number at zero. INCR count FROM 1 TO 5 DO ! Loop to convert 5 characters to binary. BEGIN IF .character LSS %C'0' OR .character GTR %C'9' ! If the character is not a decimal digit, THEN ! $XPO_RETURN (BAD_RECORD); ! return an error code to the caller. iob[IOB$G_SEQ_NUMB] = 10 * .iob[IOB$G_SEQ_NUMB] ! Shift the current sequence value + (.character - %C'0'); ! and add in the new digit. GET_CHARACTER; ! Pickup the next character. END; IF .character NEQ ht ! If a tab does not follow the sequence number, THEN ! $XPO_RETURN (BAD_RECORD); ! return an error code to the caller. ! ! Return to the caller. ! RETURN XPO$_NORMAL ! Return a success code to the caller. END; GLOBAL ROUTINE X36$GET_FILE( iob, value_pointer ) = !++ ! ! FUNCTIONAL DESCRIPTION: ! ! This routine read a single character or binary value from ! a disk file and returns this character/value to the caller. ! ! FORMAL PARAMETERS: ! ! iob - address of XPORT IOB ! value_pointer - address of character/value deposit area ! ! IMPLICIT INPUTS: ! ! None ! ! IMPLICIT OUTPUTS: ! ! For certain error conditions, other than XPO$_END_FILE, the following IOB fields are set: ! iob[IOB$G_COMP_CODE] ! iob[IOB$G_2ND_CODE] ! ! COMPLETION CODES: ! ! XPO$_NORMAL - character/value successfully read ! XPO$_END_FILE - end-of-file reached ! XPO$_IO_ERROR - I/O error (TOPS-10) ! failure completion codes from X20$IN (TOPS-20) ! ! SIDE EFFECTS: ! ! None ! !-- BEGIN MAP iob : REF $XPO_IOB(); ! Redefine the IOB parameter BIND buffer_cb = .iob[IOB$A_BUFFER_CB] : VECTOR; ! TOPS-10/TOPS-20 buffer control block ! ! Fill the system input buffer if necessary. ! buffer_cb[$BFCTR] = .buffer_cb[$BFCTR] - 1; ! Decrement the input buffer count. IF .buffer_cb[$BFCTR] LSS 0 ! If the buffer was empty, THEN ! %IF $TOPS10 %THEN IF $T10_IN( .iob[IOB$H_CHANNEL] ) ! fill the next TOPS-10 system buffer. THEN buffer_cb[$BFCTR] = .buffer_cb[$BFCTR] - 1 ! Then decrement the new buffer count. ELSE BEGIN IF ($T10_GETSTS(.iob[IOB$H_CHANNEL]) AND ! If the file status indicates end-of-file, IO$EOF) NEQ 0 ! THEN ! RETURN XPO$_END_FILE ! return an EOF code to the caller. ELSE $XPO_RETURN( IO_ERROR ); ! Otherwise, return an I/O error code to the caller. END; %FI ! End of TOPS-10 specific code %IF $TOPS20 %THEN SELECTONE X20$IN( .iob ) OF ! Fill the next TOPS-20 input buffer. SET [ XPO$_NORMAL ] : ! Successful input: buffer_cb[$BFCTR] = ! Decrement the new byte count. .buffer_cb[$BFCTR] -1; [ XPO$_END_FILE ]: ! End-of-file: RETURN XPO$_END_FILE; ! Return error to caller. [ OTHERWISE ]: ! All other error conditions: RETURN .iob[IOB$G_COMP_CODE]; ! Return the final completion code to the caller. TES; %FI ! End of TOPS-20 specific code ! ! Pass a single character or value back to the caller. ! .value_pointer = CH$RCHAR_A( buffer_cb[$BFPTR] ); ! Pass back a character/value. ! ! Return to the caller ! RETURN XPO$_NORMAL ! Return a success code to the caller. END; END ELUDOM