MODULE RNORSX ( IDENT = 'X00.08', %TITLE 'RSX RUNOFF Command Interface Module' MAIN = RNORSX ) = 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-16 Library ! ! ABSTRACT: ! ! This module is the RUNOFF RSX Command Line interface module. ! ! ENVIRONMENT: User Mode ! ! AUTHOR: Ward Clark, CREATION DATE: 23 August 1978 ! !-- ! ! TABLE OF CONTENTS: ! FORWARD ROUTINE rnorsx; ! RUNOFF RSX command interface routine ! ! INCLUDE FILES: ! LIBRARY 'XPORT'; ! XPORT macro and field definitions LIBRARY 'SYS$LIBRARY:RSX11M' ; ! RSX-11M system interface definitions LIBRARY 'FCS11' ; ! FCS-11 interface definitions REQUIRE 'RNOMAC'; ! RUNOFF macro and field definitions ! ! MACROS: ! ! ! EQUATED SYMBOLS: ! LITERAL yes = 1, ! Used to turn indicators on and off no = 0, indirect_depth = 2, ! Maximum indirect command file depth max_file_spec = 5 + 9 + 8 + 4 + 3, ! Maximum length of an RSX file-specification ! (device + directory + file name + file type + version) pages_length = 80, ! Maximum length of a /pages_RANGE value string variant_length = 80, ! Maximum length of a /VARIANT value string $XPO$MASK_SET( RNO$V_, OPTION1, ! Define RUNOFF command block option masks BACKSPACE, CHANGE, DEB_COND, DEB_CONT, DEB_FILES, DEB_INDEX, MSG_OUT, MSG_USER, OVERPRINT, PAUSE, SEQUENCE, SIMULATE ), $XPO$MASK_SET( RNO$V_, OPTION2, UNDERLINE, UND_SEPAR, UND_NONSP ); LITERAL rno$m_debug = rno$m_deb_cond + rno$m_deb_cont + rno$m_deb_files + rno$m_deb_index; ! ! OWN STORAGE: ! OWN command_block : $RNO_CMD, ! RUNOFF command information block exit_flag : INITIAL( 0 ); ! /EXIT switch indicator GCMLB$( ! Get Command Line (GCML) control block: gcml_list, ! name of generated control block indirect_depth, ! maximum indirect command file depth 'RNO',, ! prompt string 0 ) ! no GCML logical unit number CSIBLK$( csi_block ) ! Command String Interpreter (CSI) control block OWN bold_value : CSI$SV( DECIMAL, command_block[RNO$H_BOLD], 2 ), bold_end : CSI$ND, change_char, change_value : CSI$SV( OCTAL, change_char, 2 ), change_end : CSI$ND, down_value : CSI$SV( DECIMAL, command_block[RNO$H_DOWN], 2 ), down_end : CSI$ND, form_value : CSI$SV( DECIMAL, command_block[RNO$H_FORM_SIZE], 2 ), form_end : CSI$ND, pages_string : VECTOR[ pages_length, BYTE ], pages_value : CSI$SV( ASCII, pages_string, pages_length ), pages_end : CSI$ND, right_value : CSI$SV( DECIMAL, command_block[RNO$H_RIGHT], 2 ), right_end : CSI$ND, underline_char, underline_value : CSI$SV( OCTAL, underline_char, 2 ), underline_end : CSI$ND, variant_string : VECTOR[ variant_length, BYTE ], variant_value : CSI$SV( ASCII, variant_string, variant_length ), variant_end : CSI$ND; MACRO switch_table = backspace_switch %; ! CSI switch table OWN backspace_switch : CSI$SW( BA, rno$m_backspace, command_block[RNO$V_OPTION1], SET, NEG ), bold_switch : CSI$SW( BO, 0, , , , bold_value ), change_switch : CSI$SW( CH, rno$m_change, command_block[RNO$V_OPTION1], SET, NEG, change_value ), debug_switch : CSI$SW( DE, rno$m_debug, command_block[RNO$V_OPTION1], SET, NEG ), down_switch : CSI$SW( DO, 0, , , , down_value ), exit_switch : CSI$SW( EX, 1, exit_flag, SET ), form_switch : CSI$SW( FO, 0, , , , form_value ), nonspacing_switch : CSI$SW( NON, rno$m_und_nonsp, command_block[RNO$V_OPTION2], SET, , , LONG ), output_switch : CSI$SW( OU, rno$m_msg_out, command_block[RNO$V_OPTION1], SET, NEG ), over_switch : CSI$SW( OV, rno$m_overprint, command_block[RNO$V_OPTION1], SET, NEG ), pages_switch : CSI$SW( PAG, 0, , , , pages_value, LONG ), pause_switch : CSI$SW( PAU, rno$m_pause, command_block[RNO$V_OPTION1], SET, NEG, , LONG ), right_switch : CSI$SW( RI, 0, , , , right_value ), separate_switch : CSI$SW( SEP, rno$m_und_separ, command_block[RNO$V_OPTION2], SET, , , LONG ), sequence_switch : CSI$SW( SEQ, rno$m_sequence, command_block[RNO$V_OPTION1], SET, NEG, , LONG ), simulate_switch : CSI$SW( SI, rno$m_simulate, command_block[RNO$V_OPTION1], SET, NEG ), underline_switch : CSI$SW( UN, rno$m_underline, command_block[RNO$V_OPTION2], SET, NEG, underline_value ), user_switch : CSI$SW( US, rno$m_msg_user, command_block[RNO$V_OPTION1], SET, NEG ), variant_switch : CSI$SW( VA, 0, , , , variant_value ), switch_end : CSI$ND; ! ! EXTERNAL REFERENCES: ! EXTERNAL ROUTINE XRSX$ASSIGN_LUN, ! XPORT LUN assignment routine XRSX$FILE_SPEC, ! XPORT CSI file specification decoder RUNOFF; ! Transportable RUNOFF entry point GLOBAL ROUTINE rnorsx = !++ ! ! FUNCTIONAL DESCRIPTION: ! ! This routine uses the RSX GCML and CSI routine to obtain command ! line information which is in turn passed to the RUNOFF application ! in a transportable manner. ! ! FORMAL PARAMETERS: ! ! None ! ! IMPLICIT INPUTS: ! ! None ! ! IMPLICIT OUTPUTS: ! ! None ! ! COMPLETION CODES: ! ! None - the routine exits back to the system ! ! SIDE EFFECTS: ! ! None ! ! NOTE: ! ! CH$PTR notation is not used in this routine since this code ! is specific to the PDP-11. ! !-- BEGIN LABEL cmd_line; ! Declare block label ! ! Initialize the RSX Get Command Line (GCML) facility. ! GCMLB$INIT; ! Initialize the GCML control block. gcml_list[F$LUN] = XRSX$ASSIGN_LUN(); ! Select a LUN for GCML to use. ALUN$S( .gcml_list[F$LUN], 'TI', 0 ); ! Force the assigned LUN to refer to "TI:". ! ! Process a single command line. ! WHILE 1 DO ! Setup to process multiple commands. BEGIN GCML$( gcml_list ); ! Get a single command line. IF .gcml_list[G$ERR] EQL GE$EOF ! If there is no further command, THEN ! EXITLOOP; ! terminate the command line loop. IF .gcml_list[G$ERR] NEQ 0 THEN BEGIN $XPO_PUT_MSG( STRING = $STR_CONCAT( 'GCML error: ', $STR_ASCII(.gcml_list[G$ERR]) ) ); IF .gcml_list[G$ERR] EQL GE$IOR OR .gcml_list[G$ERR] EQL GE$OPR THEN $XPO_PUT_MSG( STRING = $STR_CONCAT( 'FCS-11 error: ', $STR_ASCII(.gcml_list[F$ERR]) ) ); EXITLOOP; END; ! ! Initialize CSI and prepare the command line for parsing. ! cmd_line: BEGIN IF NOT CSI$1( csi_block, .gcml_list[G$CMLD$A], .gcml_list[G$CMLD$L] ) THEN BEGIN $XPO_PUT_MSG( STRING = $STR_CONCAT( 'syntax error near "', ( .csi_block[C$FILD$L], .csi_block[C$FILD$A] ), '"' ) ); LEAVE cmd_line; END; ! ! Initialize the RUNOFF command block (RNOCMD) and related areas. ! INCR index FROM 0 ! Zero the RUNOFF command block one element at a time. TO RNO$K_CMD_LEN / %UPVAL DO BEGIN BIND rno_cmd = command_block : VECTOR; rno_cmd[ .index ] = 0; END; command_block[RNO$V_OVERPRINT] = yes; ! Establish default options. command_block[RNO$V_UNDERLINE] = yes; change_char = 0; ! Clear (zero) the /CHANGE and /UNDERLINE underline_char = 0; ! character value areas. CH$FILL( 0, pages_length, ! Clear (zero) the /PAGES and /VARIANT CH$PTR(pages_string) ); ! string value areas. CH$FILL( 0, variant_length, CH$PTR(variant_string) ); ! ! Call CSI to parse the output file specifications and associated switches. ! INCR index FROM 0 TO 2 DO ! Allow up to 3 output file specifications. BEGIN BIND output_desc = command_block[RNO$T_OUTPUT] : BLOCKVECTOR[ 3, STR$K_D_BLN ]; IF NOT CSI$2( csi_block, OUTPUT, ! Parse a single output file-spec and switches. switch_table ) THEN BEGIN $XPO_PUT_MSG( STRING = $STR_CONCAT( 'syntax error in output portion of "', ( .csi_block[C$CMLD$L], .csi_block[C$CMLD$A] ), '"' ) ); LEAVE cmd_line; END; XRSX$FILE_SPEC( csi_block, ! Recreate an output file specification. output_desc[ .index, $BASE ] ); IF NOT .csi_block[CS$MOR$M] ! If there are no more output file specifications, THEN ! EXITLOOP; ! exit the output file-spec loop. IF .index EQL 2 ! Check for extraneous output file-specs. THEN BEGIN $XPO_PUT_MSG( STRING = 'too many output file specifications' ); LEAVE cmd_line; END; END; ! ! Call CSI to parse the input file specifications and associated switches. ! DO ! Loop to the end of the input file-spec list. BEGIN IF NOT CSI$2( csi_block, INPUT, ! Parse a single input file-spec and switches. switch_table ) THEN BEGIN $XPO_PUT_MSG( STRING = $STR_CONCAT( 'syntax error in input portion of "', ( .csi_block[C$CMLD$L], .csi_block[C$CMLD$A] ), '"' ) ); LEAVE cmd_line; END; XRSX$FILE_SPEC( csi_block, ! Recreate a single input file specification. command_block[RNO$T_INPUT] ); END WHILE .csi_block[CS$MOR$M]; ! ! Complete the RUNOFF command block (RNOCMD). ! command_block[RNO$C_CHANGE] = .change_char; command_block[RNO$V_CHNG_CHAR] = .command_block[RNO$C_CHANGE] NEQ 0; command_block[RNO$C_UNDERLINE] = .underline_char; command_block[RNO$V_UND_CHAR] = .command_block[RNO$C_UNDERLINE] NEQ 0; command_block[RNO$V_CONTENTS] = .command_block[$SUB_FIELD(RNO$T_CONTENTS,STR$B_DTYPE)] NEQ 0; command_block[RNO$V_INDEX] = .command_block[$SUB_FIELD(RNO$T_INDEX,STR$B_DTYPE)] NEQ 0; $STR_DESC_INIT( ! Initialize the /PAGES string descriptor. DESCRIPTOR = command_block[RNO$T_PAGES], STRING = ( 0, pages_string ) ); DECR index FROM pages_length-1 TO 0 DO ! Calculate the /PAGES string length. IF .pages_string[.index] NEQ 0 THEN BEGIN command_block[RNO$H_PAGES] = .index + 1; EXITLOOP; END; $STR_DESC_INIT( ! Initialize the /VARIANT string descriptor. DESCRIPTOR = command_block[RNO$T_VARIANT], STRING = ( 0, variant_string ) ); DECR index FROM variant_length-1 TO 0 DO ! Calculate the /VARIANT string length. IF .variant_string[.index] NEQ 0 THEN BEGIN command_block[RNO$H_VARIANT] = .index + 1; EXITLOOP; END; ! ! Call the RUNOFF application to process a single command line. ! BEGIN LOCAL status; status = RUNOFF( command_block ); ! Pass the RUNOFF application the address ! of the complete command information block. IF NOT .status OR .exit_flag ! If RUNOFF returns a failure code or /EXIT was specified, THEN ! terminate RUNOFF processing rather than EXITLOOP; ! trying another command. END; END; ! End of processing an actual (non-null) command. END; ! End of processing any command line. ! ! Return to the system. ! EXIT$S() ! Return to the system. END; END ELUDOM