.TITLE AUXPAR - AUX Table Parser. .IDENT /1.0/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: AUXPAR.MAC ; Author: Robin Miller ; Date: July 23, 1985 ; ; Description: ; ; Table parser for the AUX program. ; ;- .ENABL AMA .NLIST BEX ; .MCALL ISTAT$, STATE$, TRAN$ .MCALL ISTAT$, STATE$ ;+ ; ; The following patches from the MULTI-TASKER Volume 16, Number 3, allow ; unlimited keywords in TPARS. The artical was submitted by Ken Cross of ; Perceptics Corporation (thank-you Ken, this limitation was been a pain). ; ; >LBR TRANS.ORG=LB:[1,1]RSXMAC.SML/EX:TRAN$ ; >SLP @TRANS.COR ; ; TRANS.COR contents: ; ; TRANS.MAC=TRANS.ORG ; -29,37 ; .MACRO $$$TYP ; .BYTE 200 ; .ENDM $$$TYP ; $$$KEY = $$$KEY+1 ; $$$FLG = $$$FLG!1 ; .MACRO $$$EXT ; .WORD $$$TMP ; .ENDM ; / ; ; >LBR LB:[1,1]RSXMAC.SML=TRANS.MAC/RP ; ; The patch to TPARS changes five words using the ZAP utility: ; ; >LBR TPARS.OBJ=LB:[1,1]SYSLIB/EX:.TPARS ; >ZAP ; ZAP>TPARS.OBJ/AB ; Location Change To ; -------- ------ -- ; 2:202/ 042700 16500 ; 2:204/ 177700 1 ; 2:206/ 006300 240 ; 2:210/ 061600 240 ; 2:212/ 011000 240 ; 1:16/ 146400 146401 ; ; The last word changes the version from V0122 to V0122A. The revised ; module can then be replaced in SYSLIB if desried. ; ;- ; Modified version of TRAN$ macro. .MACRO TRAN$ TYPE,LABEL,ACTION,MASK,ADDR .PSECT $STATE MTRAN$ DBGTP$ .IF NB ACTION $$$FLG = $$$FLG!2 .MACRO $$$ACT .WORD ACTION .ENDM $$$ACT .ENDC .IF NB MASK $$$FLG = $$$FLG!30 .IF B ADDR .ERROR "MASK ADDRESS NOT PRESENT" .ENDC .MACRO $$$BIT .WORD MASK,ADDR .ENDM $$$BIT .ENDC .IF NB LABEL $$$FLG = $$$FLG!4 $$$STA = LABEL .ENDC .IRPC $$$$$X, .IF IDN <$$$$$X>,<"> .PSECT $KSTR $$$TMP = . .ASCII TYPE<377> .MACRO $$$TYP ;**NEW** .BYTE 200 ;**NEW** .ENDM $$$TYP ;**NEW** $$$KEY = $$$KEY+1 ;**NEW** $$$FLG = $$$FLG!1 ;**NEW** .MACRO $$$EXT ;**NEW** .WORD $$$TMP ;**NEW** .ENDM ;**NEW** .MEXIT ;**-9 .ENDC .IF IDN <$$$$$X>, $$$FLG = $$$FLG!1 .MACRO $$$EXT .WORD 0'TYPE .ENDM $$$EXT .MACRO $$$TYP .BYTE $SUBXP .ENDM $$$TYP .MEXIT .ENDC .MACRO $$$TYP .BYTE TYPE .ENDM $$$TYP .MEXIT .ENDM .PSECT .ENDM TRAN$ ; Define start of state and keyword tables. ISTAT$ STATE, KEYWRD ; Now define the actual state table. .GLOBL START ;****************************************************************************** ; ; The next state is where parsing starts. ; ; TRAN$ key_word,next_state,action_routine,bit,status_word STATE$ START ; If not an internal command, spawn the command line. TRAN$ '!,CMDSTA,CVTUPP,B.ICMD,STATUS TRAN$ $EOS,$EXIT TRAN$ $LAMDA,$EXIT,SPNCMD ;*** TRAN$ !CHKNEG,CMDSTA,SETNEG ;*** TRAN$ '+,CMDSTA,SETPLU ;*** TRAN$ $LAMDA,,SETPOS ; Parse the internal commands. STATE$ CMDSTA TRAN$ $DNUMB,$EXIT,RCLCMD TRAN$ "ADVANCE",$EXIT,ADVCMD TRAN$ "BACKUP",$EXIT,BCKCMD TRAN$ "BOL",$EXIT,BOLCMD TRAN$ "CLEAR",$EXIT,CLRCMD TRAN$ "DELETE",DELSTA TRAN$ "EOL",$EXIT,EOLCMD TRAN$ "EXIT",$EXIT,EXICMD,B.EXIT,STATUS TRAN$ "LEFT",$EXIT,LEFCMD TRAN$ "NARROW",$EXIT,NARCMD TRAN$ "NEXT",$EXIT,NXTCMD TRAN$ "PREVIOUS",$EXIT,PRVCMD TRAN$ "RECALL",$EXIT,RECALL TRAN$ "REFRESH",$EXIT,REFCMD TRAN$ "RIGHT",$EXIT,RIGCMD TRAN$ "SET",SETSTA TRAN$ "SHOW",SHOSTA TRAN$ "SKIP",SKPSTA TRAN$ "TOGGLE",TGLSTA TRAN$ "UNDELETE",UNDSTA TRAN$ "WIDE",$EXIT,WIDCMD ;****************************************************************************** ; Check for negation of a command (either - or NO). STATE$ CHKNEG TRAN$ '-,$EXIT TRAN$ 'N STATE$ TRAN$ 'O,$EXIT ;****************************************************************************** ; Check for another command to parse. STATE$ AUXNXT TRAN$ $EOS,$EXIT TRAN$ $LAMDA,CMDSTA ;****************************************************************************** ; Parse the valid DELETE keywords. STATE$ DELSTA TRAN$ $EOS,$EXIT,DELCMD TRAN$ "BLINE",$EXIT,DELBOL TRAN$ "BWORD",$EXIT,DBWCMD TRAN$ "CHARACTER",$EXIT,DELCHR TRAN$ "ELINE",$EXIT,DELEOL TRAN$ "LINE",$EXIT,DELLIN TRAN$ "WORD",$EXIT,DELWRD ;****************************************************************************** ; Parse the valid SET keywords. STATE$ SETSTA TRAN$ !CHKNEG,SETNXT,SETNEG TRAN$ $LAMDA,,SETPOS STATE$ SETNXT TRAN$ "AVO",$EXIT,,B.AVO,SWMASK ;****************************************************************************** ; Parse the valid SHOW keywords. STATE$ SHOSTA TRAN$ "CONTROL",$EXIT,SHOCTR TRAN$ "KEYPAD",$EXIT,SHOPAD TRAN$ "STATUS",$EXIT,SHOSTS TRAN$ "VERSION",$EXIT,SHOVER ;****************************************************************************** ; Parse the valid SKIP keywords. STATE$ SKPSTA TRAN$ "BACKWARD",$EXIT,SKBCMD TRAN$ "FORWARD",$EXIT,SKFCMD TRAN$ "WORD",$EXIT,SKPWRD ;****************************************************************************** ; Parse tge valid TOGGLE keywords. STATE$ TGLSTA TRAN$ "MODE",$EXIT,TGLMOD TRAN$ "WIDTH",$EXIT,TGLWID ;****************************************************************************** ; Parse the valid UNDELETE keywords. STATE$ UNDSTA TRAN$ "CHARACTER",$EXIT,UNDCHR TRAN$ "LINE",$EXIT,UNDLIN TRAN$ "WORD",$EXIT,UNDWRD ;****************************************************************************** ; The next STATE$ is needed for the end of the table. STATE$ ; Action routines for TPARS. ; Registers R0, R1, and R2 may be used by the action routines. ; All other registers must be preserved. ;****************************************************************************** ; Tell TPARS to ignore blanks during parse. ; This is used to ignore blanks in the options. IBLANK::CLRB .PFLAG ; Ignore blanks. RETURN ; Action routine to tell TPARS to pass blanks. ; This is used to pass blanks in the message. PBLANK::MOVB #1,.PFLAG ; Pass blanks. RETURN ;****************************************************************************** ; Action routines to set the negate flag true or false. SETNEG: MOV #-1,NEGFLG ; Show command is being negated. RETURN SETPLU: MOV #-1,PLUFLG ; Show a plus sign was specified. CLR NEGFLG ; Reset the negation flag. RETURN SETPOS: CLR NEGFLG ; Reset the negation flag CLR PLUFLG ; and the plus sign flag. RETURN ;****************************************************************************** ; Convert the keyword to upper case. CVTUPP: MOV R4,R0 ; Copy the string buffer address. JMP CUPPER ; Convert to uppercase and return. ;****************************************************************************** ; Enable or disable narrow screen display. NARCMD: MOV #B.NAR,R0 ; Set the NARROW bit number. CALL DOSWM ; Turn the bit on or off. ; /NARROW does a /WIDE and /-NARROW does a /WIDE. MOV #B.WIDE,R0 ; Set the WIDE bit number. COM NEGFLG ; Reverse the negate flag. CALL DOSWM ; Turn the bit on or off. CALL CHKOPE ; Is an input file open ? BCC 10$ ; If CC, no (presume startup option). ;*** JMP REFCMD ; Else, refresh the screen. 10$: RETURN ;****************************************************************************** ; Enable or disable wide screen display. WIDCMD: MOV #B.WIDE,R0 ; Set the WIDE bit number. CALL DOSWM ; Turn the bit on or off. ; /WIDE does a /-NARROW and /-WIDE does a /NARROW. MOV #B.NAR,R0 ; Set the NARROW bit number. COM NEGFLG ; Reverse the negate flag. CALL DOSWM ; Turn the bit on or off. CALL CHKOPE ; Is an input file open ? BCC 10$ ; If CC, no (presume startup option). ;*** JMP REFCMD ; Else, refresh the screen. 10$: RETURN .SBTTL Copy the input or output file name(s) ;****************************************************************************** ; Save the input file name(s). SIFILE::MOV INPTR,R0 ; Copy address to store file names. CALL CPYFIL ; Now, copy the file specification. BCS FAIL ; If CS, the buffer was exceeded. MOV R0,INPTR ; Save the updated buffer address. RETURN ;****************************************************************************** ; Toggle the current mode. TGLMOD: BIT #B.IMOD,SWMASK ; Are we currently in insert mode ? BNE 10$ ; If NE, yes (set to overprint mode). BIS #B.IMOD,SWMASK ; No, set to insert mode. BR 100$ ; Use common return ... 10$: BIC #B.IMOD,SWMASK ; Set us to overprint mode. 100$: RETURN ;****************************************************************************** ; Toggle the terminal width. TGLWID: BIT #B.132,STATUS ; Is the current screen wide ? BNE 10$ ; If NE, yes. BIS #B.132,STATUS ; No, toggle to a wide screen. CALL SETWID ; Set to a wide screen. BR 20$ ; Use common code. 10$: BIC #B.132,STATUS ; Toggle to a narrow screen. CALL SETNAR ; Set to a narrow screen. 20$: CALL SEWDTH ; Set the terminal width. JMP REFCMD ; Refresh the command line. ;****************************************************************************** ; Return failure to the table parser. FAIL:: ADD #2,(SP) ; Return failure to .TPARS. RETURN .SBTTL CHKOPE - Check for an open file. ;+ ; ; CHKOPE - Check for an open file. ; ; This routine is used to pass back a status as to whether an input file ; is open when executing a common command. If a file is not open, we ; presume we're parsing the switches on the command line, otherwise we ; presume we're currently listing a file. ; ; Inputs: ; None. ; ; Outputs: ; C bit clear/set = not open/file open. ; R2 = The file entry address. ; ; All other registers are preserved. ; ;- CHKOPE::MOV IENTRY,R2 ; Copy the file entry address. JSR R2,$SAVVR ; Save R0 - R2. (01) MOV O.FDB(R2),R0 ; Copy the FDB address. TST F.BDB(R0) ; Is an input file open ? BEQ 10$ ; If EQ, no (C bit clear). SEC ; Show the file is open. 10$: RETURN .SBTTL CPYFIL - Copy the file specification. ;+ ; ; CPYFIL - Copy the file specification. ; ; This routine is called by action routines to copy the file name strings ; from the input string being parsed. Syntax checking of the file name is ; done by the CSI routines called when opening a file. ; ; Inputs: ; R0 = The file name buffer address. ; R3 = The remaining input string byte count. ; R4 = The input string buffer address. ; ; Implicit inputs: ; .PCHAR = The character matched by the $ANY transition. ; ; Outputs: ; C bit clear/set = success/failure. ; ; R0 = The updated buffer address. ; R3 = The adjusted input string byte count. ; R4 = The updated input string buffer address. ; ;- CPYFIL::MOVB .PCHAR,(R0)+ ; Copy the first character. 10$: TST R3 ; Is there any count left ? BEQ 100$ ; If EQ, no (end of string). ; A slash, space, or horizontal tab stops the file copy. CMPB (R4),#'/ ; Encountering a switch ? BEQ 100$ ; If EQ, yes. CMPB (R4),#SPACE ; Encountering a delimiter ? BEQ 100$ ; If EQ, yes. CMPB (R4),#HT ; Encountering a delimiter ? BEQ 100$ ; If EQ, yes. TSTB (R0) ; Are we at end of the buffer ? BMI 90$ ; If MI, yes (file name too big). MOVB (R4)+,(R0)+ ; Else, copy the character. SOB R3,10$ ; Adjust the count and loop. BR 100$ ; Use common return ... 90$: SEC ; Show failure ... RETURN 100$: CLRB (R0) ; Terminate the file name. RETURN .SBTTL DOSWM - Change a switch mask status bit. ;+ ; ; DOSWM - Change a switch mask status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; C bit clear/set = status bit set/cleared. ; ; All registers are preserved. ; ;- DOSWM:: BIS R0,SWMASK ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes. BIC R0,SWMASK ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .SBTTL DOSWS - Change a status bit. ;+ ; ; DOSWS - Change a status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; C bit clear/set = status bit set/cleared. ; ; All registers are preserved. ; ;- DOSWS:: BIS R0,STATUS ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes. BIC R0,STATUS ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .SBTTL DOSWT - Change a table entry status bit. ;+ ; ; DOSWT - Change a table entry status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; R2 = The file entry address. ; ; C bit clear/set = status bit set/cleared. ; ;- DOSWT:: MOV IENTRY,R2 ; Copy the file entry address. BIS R0,(R2) ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes (C bit is cleared). BIC R0,(R2) ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .END