.MCALL .MODULE .MODULE UCLTAB,00,Comment= ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only 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 except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL State Table For UCL Command Line ;+ ; The following state table will be used to parser a UCL command line ; when trying to define a command. ; ; The following command lines are taken: ; ;- .NLIST ME .GLOBL START ; Initalize state table. ISTAT$ UCLSTB,UCLKTB ; Start the table. ; Obtain command string or partial command string. STATE$ START TRAN$ $STRNG,,CMDSUB ; An asterisk for unambigious commands or the colon should follow. STATE$ TRAN$ <':>,FNDEQU TRAN$ '* ; If underscore, we need the rest of the command string. STATE$ TRAN$ $STRNG,,CMDAPE ; The colon should follow. STATE$ TRAN$ <':> ; Two equals should follow the colon. STATE$ FNDEQU TRAN$ '= STATE$ TRAN$ '= ; The KMON string or strings will follow. Multiple strings are separated ; by backslashes, a double backslash indicates the end of the command. ;;;*** First command state ***;;; ; The first state could be an empty string in which case we will be ; finish. It meant that the user was trying to delete the command. ; Indirect command file support added (@) but does not work due to ; Kmon restrictions at this point. STATE$ TRAN$ $EOS,$EXIT,FDELET TRAN$ $STRNG,PACMAN,FSTRN TRAN$ $ANY,PACMAN,FCHAR STATE$ PACMAN TRAN$ '\,NEX1,PUTNUL TRAN$ $EOS,$EXIT,ADJST TRAN$ $BLANK,PACMAN,PUTSPC TRAN$ $STRNG,PACMAN,PROSTR TRAN$ $ANY,PACMAN,PROCHR ;;;*** Second command state ***;;; STATE$ NEX1 TRAN$ '\,$EXIT,ADJST TRAN$ $BLANK,NEX1 TRAN$ $STRNG,CURLY,PROSTR TRAN$ $ANY,CURLY,PROCHR STATE$ CURLY TRAN$ '\,NEX2,PUTNUL TRAN$ $BLANK,CURLY,PUTSPC TRAN$ $STRNG,CURLY,PROSTR TRAN$ $ANY,CURLY,PROCHR ;;;*** Third command state ***;;; STATE$ NEX2 TRAN$ '\,$EXIT,ADJST TRAN$ $BLANK,NEX2 TRAN$ $STRNG,INKI,PROSTR TRAN$ $ANY,INKI,PROCHR STATE$ INKI TRAN$ '\,NEX3,PUTNUL TRAN$ $BLANK,INKI,PUTSPC TRAN$ $STRNG,INKI,PROSTR TRAN$ $ANY,INKI,PROCHR ;;;*** Fourth command state ***;;; STATE$ NEX3 TRAN$ '\,$EXIT,ADJST TRAN$ $BLANK,NEX3 TRAN$ $STRNG,INKI,PROSTR TRAN$ $ANY,INKI,PROCHR STATE$ .SBTTL ACTION ROUTINES ;+ ; CMDSUB - The command string being defined is stored here. This ; string could be just the unambigious part if an asterisk ; follows the string. NEWCMD will contain the string and ; LENEW will contain the size. ;- .ENABL LSB .PSECT ACTION CMDSUB:: MOV #NEWCMD,R1 ; R1 -> STORE COMMAND HERE MOV .PSTCN,R0 ; R0 = COUNT OF CHARACTERS MOV R0,LENEW ; STORE THIS COUNT MOV .PSTPT,R2 ; R2 -> STRING MATCH 10$: MOVB (R2)+,(R1)+ ; STORE CHARACTERS DEC R0 ; ARE WE FINISH? BNE 10$ ; NO, REPEAT MOV R1,PTR.CH ; STORE POINTER RTS PC ; RETURN .DSABL LSB ;+ ; CMDAPE - When a command is entered with an asterisk it means that ; some characters have to be appended. The old lenght from ; the CMDSUB becomes the size of the un-ambigious part, the ; rest of the string is appended to NEWCMD and the new lenght ; is calculated. ;- .ENABL LSB CMDAPE:: MOV PTR.CH,R1 ; RESTORE POINTER MOV LENEW,LENAMB ; SAVE LENGHT OF VALID PART MOV .PSTCN,R0 ; LENGHT OF CURRENT STRING ADD R0,LENEW ; ADD TO EXISTING SIZE INC LENEW ; ALLOW FOR "*" MOV .PSTPT,R2 ; R2 -> STRING MATCH MOVB #52,(R1)+ ; MOVE A "*" 10$: MOVB (R2)+,(R1)+ ; STORE CHARACTERS DEC R0 ; ARE WE FINISH? BNE 10$ ; NO REPEAT RTS PC ; RETURN .DSABL LSB ;+ ; FDELET - Flag delete is set when the user defines a command to a null ; string. (COMMAND :== ). ;- FDELET:: INC DELETE ; MAKE NON-ZERO RTS PC ; RETURN ;+ ; FSTRN - First command string. The first command string will initialize ; the pointer to start storing the equivalent command. This pointer ; Ptr.ch is saved as other characters and strings are stored. The ; size of the string will be calculated as characters are stored, ; LENKMO. The variables returned to the action routines by Tparse ; are, ; .PSTCN = Lenght of match charactes ; .PSTPT -> match characters. ;- .ENABL LSB FSTRN:: BISB #1,.PFLAG ; PARSE BLANKS MOV #KMOCMD,R1 ; R1 -> STORED KMON COMMAND HERE MOV .PSTCN,R0 ; R0 = LENGHT OF STRING MOV R0,LENKMO ; STORE LENGHT OF KMON BR 10$ ; MERGE CODE ;;;*** Entry point for subsequent strings ***;;; PROSTR:: MOV PTR.CH,R1 ; RESTORE POINTER MOV .PSTCN,R0 ; R0 = LENGHT ADD R0,LENKMO ; ADD LENGHT TO EXISTING 10$: MOV .PSTPT,R2 ; R2 -> MATCH STRING 20$: MOVB (R2)+,(R1)+ ; STORE CHARACTERS DEC R0 ; ARE WE FINISH? BNE 20$ ; NO, REPEAT MOV R1,PTR.CH ; UPDATE POINTER RTS PC .DSABL LSB .ENABL LSB ;;;*** First character entry point $ANY case. ***;;; FCHAR:: CLR LENKMO ; INITIALIZE SIZE BISB #1,.PFLAG ; ALLOW BLANKS MOV #KMOCMD,R1 ; R1 -> STORE HERE BR 10$ ; MERGE PUTSPC::MOVB #40,.PCHAR ; STORE SPACE BR PROCHR ; MERGE WITH CHARACTER CODE ;;;*** A null is put for separation of multiple commands PUTNUL::MOVB #0,.PCHAR ; STORE NULL PROCHR:: MOV PTR.CH,R1 ; RESTORE POINTER 10$: MOVB .PCHAR,(R1)+ ; STORE CHARACTER INC LENKMO ; COUNT IT 20$: MOV R1,PTR.CH ; RESTORE POINTER RTS PC .DSABL LSB ;+ ; ADJST - Eliminate null at the end of multiple commands ;- ADJST:: DEC LENKMO ; DECREMENT LENGHT BNE 2$ ; BRANCH IF SOMETHING THERE INC DELETE ; SET DELETE FLAG 2$: RTS PC .END