.MCALL .MODULE .MODULE ICSI,VERSION=07,COMMENT=,IDENT=No,LIB=Yes ; 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. ;++ ; ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 01-OCT-90 Use standard introductory ; comments. Use SOB if EIS. ; Correct description of optional ; arguments in calling sequence. ;-- ;+ ;COND ; EIS$I (0) use SOB macro ; 1 use SOB instruction ; ; SLIB$M (0) Generate standard SYSLIB routine ; SLIB$M 1 Generate U mode part of Supervisor library ; SLIB$M 2 Generate S mode part of Supervisor library ; ; SLIB$M values are referenced using symbols of the form *PART ; in conditional statements. ; ; If SLIB$M <> 0, EIS$I is forced to 1 ;- .IIF NDF EIS$I EIS$I=0 .IIF NDF SLIB$M SLIB$M=0 .IIF NE SLIB$M EIS$I=1 OPART = SLIB$M ;0 = generate if building old library UPART = SLIB$M-1 ;0 = generate if building User part SPART = SLIB$M-2 ;0 = generate if building Supy part OSPART = OPART*SPART ;0 = generate ... old or Supy OUPART = OPART*UPART ;0 = generate ... old or User ;+ ; RT-11 SYSTEM LIBRARY (SYSLIB) SUBROUTINE ; ; CALLABLE ENTRIES: ICSI ; ; FUNCTIONAL DESCRIPTION: ; The ICSI function calls the RT-11 Command String Interpreter in ; special mode to parse a command string and return file descriptors ; and options to the calling program. ; ; This routine can be used by any job running in a single-job ; or multi-job environment, but cannot be called from a ; completion or interrupt service routine. It uses "TRAP" to ; provide error processing. ; ; CALLING SEQUENCE: ; ; I = ICSI(FILSPC,DEFTYP,[CSTRING],[OPTION,N]) ; ; ; PASSED ARGUMENTS: ; ; FILSPC - 39 element INTEGER*2 ARRAY to return the file ; specifications ; DEFTYP - 4 element INTEGER*2 table of default RAD50 file types ; CSTRING - optional ASCII command string to be interpreted: ; must end in a zero byte! ; OPTION - optional INTEGER*2 array dimensioned (4,N), where ; N represents the number of options defined to the program. ; N - optional INTEGER*2 number of options defined ; ; RETURNED ARGUMENT VALUES: ; ; FILSPC - File Specifications returned ; ; FUNCTION RETURN VALUE: ; ; 0 - no error parsing command string ; 1 - illegal command string; no data was returned ; 2 - illegal device specification in command string ; 3 - illegal option specified in command string, or given option ; was specified more times than allowed in 'option' array ; ; EXTERNAL REFERENCES: ; ; $ERRPO, $NXADR, $NXVAL ; ; MACRO REFERENCES: ; ; .CSISPC, SOB ;- .SBTTL ICSI - FORTRAN-callable system subroutine .GLOBL $SYSLB, $NXADR .WEAK $MSARG .IIF EQ EIS$I .MCALL SOB .MCALL .CSISPC .PSECT SYS$S,D SPSAVE: .BLKW 1 ; Temporary to hold stack pointer (needed ; since CSISPC returns parameters on stack). .PSECT SYS$I,I CSI:: ICSI:: MOV SP,SPSAVE ; Save ICSI's entry-time stack pointer MOV (R5)+,R4 ; R4 <- argument count CALL $NXADR ; Get -> 'filspc' argument BCS ERR ; If CS, error - 'filspc' wasn't supplied MOV R0,R3 ; R3 <- address of file descriptor storage CALL $NXADR ; Get -> 'deftyp' argument BCS ERR ; If CS, error - 'deftyp' wasn't supplied MOV R0,R2 ; R2 <- address of default file type table CLR R0 ; Default 'cstring' to 0, in case it's omitted CALL $NXADR ; Get 'cstring' argument; it's returned in R0 .CSISPC R3,R2,R0 ; Parse user's command string using CSI CALL $ERRP0 ; Get and convert any errors (status in R0) BNE 100$ ; If NE, error parsing user's command string ; (R0 = 0) ; CLR R0 ; Default 'option' to 0 - in case it's omitted CALL $NXADR ; Get -> 'option' argument MOV R0,R3 ; R3 <- address of command string option array BEQ 90$ ; If no options, forget about 'n' CALL $NXVAL ; Get 'n' argument; it's returned in R0 BCS 90$ ; If CS, 'n' argument wasn't supplied BEQ 90$ ; If 0, no entries in option array 10$: MOV R0,R2 ; R2 = no. of entries in options array MOV R2,R4 ; R4 = no. of entries in options array MOV R3,R5 ; R5 = address of command string option array 20$: TST (R5)+ ; Skip command string option character CLR (R5)+ ; Initialize an entry in passed CLR (R5)+ ; command string option array CLR (R5)+ ; SOB R4,20$ ; BR if another entry in OPTION to be init'ed. 30$: MOV (SP)+,R0 ; R0 <- no. of options entered in cmd string BEQ 100$ ; If EQ, branch - no options in cmd string 40$: MOV R2,R4 ; R4 <- no. of entries in options array MOV R3,R5 ; R5 <- address of command string option array 50$: CMPB @R5,@SP ; Option match this entry in option array? BNE 70$ ; If NE, no match - check next entry in array TST 2(R5) ; Is this entry in option array already used? BNE 70$ ; If NE, yes - check next entry in array INC 2(R5) ; Indicate that option occurred in cmd string MOV (SP)+,R1 ; R1 <- file no. & value flag of option BPL 60$ ; If PL, option didn't have associated value INC 2(R5) ; Indicate that option had a value MOV (SP)+,6(R5) ; Store option's value in option array entry 60$: SWAB R1 ; R1 <- isolated file no. of option BIC #177600,R1 ; MOV R1,4(R5) ; Store option's file no. in option entry SOB R0,40$ ; BR if another CSTRING option to process. BR 100$ ; Return to caller with status, R0 = 0 70$: ADD #8.,R5 ; R5 <- address of next entry in option array DEC R4 ; Any more entries in option array to check? BGT 50$ ; If GT, loop until all have been checked 80$: MOV #3,R0 ; Error - invalid option specified, BR 100$ ; or option was specified more times than ; allowed in 'option' array 90$: MOV (SP)+,R0 ; Any options specified? BNE 80$ ; Error - option(s) entered but none asked for 100$: MOV SPSAVE,SP ; Purge stack of all remaining CSI parameters RETURN ; Return to caller with error status in R0 ERR: MOV SPSAVE,SP ; Purge stack of all CSI return parameters TRAP $MSARG ; Handle any missing arguments in call RETURN .END