.ENABL LC ;============================================================================ ; .TITLE CMDLIN .IDENT /110282/ ; ; T V ATKINSON ; DEPARTMENT OF CHEMISTRY ; MICHIGAN STATE UNIVERSITY ; EAST LANSING, MI 48824 ; ; DATE: 02-NOV-82 ; ;--------------------------------------------------------------------------- ; ; CALLING SEQUENCE: ; ; CALL CMDLIN(IERR,STRING,LSTRNG,PROMPT,LPRMPT) ; ; IERR O 3L*1 ; Error and status return ; STRING O 80L*1 ; Buffer for CMD line ; LSTRNG O I*2 ; # Bytes returned in STRING ; PROMPT I nL*1 ; Prompt string ; LPRMPT I I*2 ; # Bytes in prompt ; ;--------------------------------------------------------------------------- ; ; ABSTRACT: This routine provides a FORTRAN interface to the get ; command line (GCML$) facility. This facility allows input to be ; driven with the indirect command processor. ; ; To utilize this routine the following global definition and LUN ; definition must be done at task build time. In this example ; LUN 8 is used for the input done by the GCML$ facility. ; ; / ; UNITS=8 ; GBLDEF=GCMLUN:10 ; ASG=TI:8 ; // ; ;============================================================================ ; .PAGE .MCALL GCML$,GCMLB$,GCMLD$ GCMLD$ ; Define symbols ; ;-------------------------------------------------------------------------- ; ; Define Offsets ; ;-------------------------------------------------------------------------- ; O.ERR=2 ; IERR O.STR=4 ; STRING O.LST=6 ; LSTRNG O.PRM=10 ; PROMPT O.LPR=12 ; LPRMPT ; ;-------------------------------------------------------------------------- ; ; Enumerate errors to be reported in IERR(1) ; ;-------------------------------------------------------------------------- ; E.1=GE.IOR ; I/O error during command line input EEE=-E.1 ; (377 = -1) E.2=GE.OPR ; Error opening command file ERR=-E.2 ; (376 = -2) E.3=GE.BIF ; Syntax error in command file spec ERR=-E.3 ; (375 = -3) E.4=GE.MDE ; Illegal nesting level ERR=-E.4 ; (374 = -4) E.5=GE.RBG ; Command line longer than buffer. ERR=-E.5 ; (330 = -40) E.6=GE.EOF ; EOF encountered ERR=-E.6 ; (366 = -10) ; ;-------------------------------------------------------------------------- ; ; Enumerate status bits to be found in IERR(2) ; ;-------------------------------------------------------------------------- ; ERR=GE.IND ; =1: "@" line indirect command file spec ERR=GE.CLO ; =1: Close indirect command file between reads ERR=GE.COM ; =0: Return "; " lines to calling program ERR=GE.CON ; =1: Continuation allowed ERR=GE.LC ; =1: Pass lower case to calling program ERR=200 ; =1: Input originated from invocation of task ; ;-------------------------------------------------------------------------- ; ; Enumerate status bits to be found in IERR(3) ; ;-------------------------------------------------------------------------- ; FD.TTY=4 ; =1: Command source was terminal C.INVO=1 ; =1: Input originated from invocation of task .PAGE .GLOBL CMDLIN,GCMLUN .PSECT CMDLIN ; ;-------------------------------------------------------------------------- ; ; Entry Point ; ;-------------------------------------------------------------------------- ; CMDLIN: MOV R0,-(SP) ; SAVE THE RESISTERS MOV R1,-(SP) MOV R2,-(SP) MOV R3,-(SP) MOV R4,-(SP) ; ; Get the command line ; R0 -> GCMDL$ Block ; GCML$ #GCMBLK,O.PRM(R5),@O.LPR(R5) ; Get the line MOV O.ERR(R5),R4 ; R4 -> Errror/Status array MOVB F.RCTL(R0),R3 ; Get source indicator BIC #^CFD.TTY,R3 ; Clear all but indicator MOVB G.ERR(R0),(R4)+ ; Return the error report MOVB G.ERR+1(R0),(R4)+ ; Return status byte BPL 2$ ; Bit 7 set? No, branch BIS #C.INVO,R3 ; Yes, set bit 0 2$: MOVB R3,(R4) ; Return source indicator ; ; Return the command line if possible MOV G.CMLD(R0),R3 ; R3 <<<< byte count MOV R3,@O.LST(R5) ; Return byte count BEQ EXIT ; Exit on zero length string MOV G.CMLD+2(R0),R1 ; R1 -> Command line MOV O.STR(R5),R2 ; R2 -> Receiving buffer ; 1$: MOVB (R1)+,(R2)+ ; Move the string SOB R3,1$ ; Loop until done ; ;---------------------------------------------------------------------------- ; ; Return ; ;---------------------------------------------------------------------------- ; EXIT: MOV (SP)+,R4 ; Restore registers MOV (SP)+,R3 MOV (SP)+,R2 MOV (SP)+,R1 MOV (SP)+,R0 RETURN .PAGE ; ;--------------------------------------------------------------------------- ; ; Tables ; ;--------------------------------------------------------------------------- ; GCMBLK: GCMLB$ 2,,,GCMLUN ; GCML$ block NEXT=. .=GCMBLK+G.MODE ; Set pointer to MODE byte ; ; GE.IND - SET ; GE.CLO - SET ; GE.COM - CLEAR ; GE.CON - CLEAR ; GE.LC - SET ; .BYTE GE.IND!GE.CLO!GE.LC&^CGE.COM&^CGE.CON .END