FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00001 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00001 00000 C;+ 00002 00000 C.ENTRY CSI 00003 00000 C - C S I S U B R O U T I N E S 00004 00000 C****NAME: SUBROUTINES CSI, CSISW, CSIVAL, CSIGO 00005 00000 C IDENT: /861031/ 00006 00000 C FILE: CSI.FLX, CSISW.FLX, CSIVAL.FLX, CSIGO.FLX, CSICOM.INC 00007 00000 C 00008 00000 C****PURPOSE: Implement parsing of the standard PDP11 input line 00009 00000 C on the VAX. Such a line looks like: 00010 00000 C 00011 00000 C FILE/SW,FILE/SW,...=FILE/SW,FILE/SW,... 00012 00000 C 00013 00000 C where FILE is a standard file specifier and /SW is zero 00014 00000 C or more switches with zero or more values. Any and all 00015 00000 C parts of the line are optional. See notes for examples. 00016 00000 C 00017 00000 C****RESTRICTIONS: 00018 00000 C 00019 00000 C SYSTEM: VAX/VMS 3.1 00020 00000 C LANGUAGE: FLECS/F77/MACRO 00021 00000 C AUTHOR: M. OOTHOUDT 00022 00000 C DATE: 10-AUG-79 00023 00000 C;- 00024 00000 C REVISIONS: 00025 00000 C 03/14/83 GTA Allow VMS directory syntax as well as UIC syntax. 00026 00000 C 2-FEB-84 (JFA) INCREASE MAX NO OF SWITCH VALUES FROM 30 TO 100 00027 00000 C 850327mao Document that some variables must be VOLITILE for FOR4.0. 00028 00000 C 850809mao Update documentation; mention VAX file specs ok. 00029 00000 C 861031mao Allow node name in file spec. Support I*1, I*4, R*4, and 00030 00000 C R*8 switch values. Support hex integers. 00031 00000 C;+ 00032 00000 C 00033 00000 C****CALLING SEQUENCE: See individual routines. Note that CSI 00034 00000 C must be called before any of the other 00035 00000 C CSI subroutines. 00036 00000 C 00037 00000 C INPUT: Command line 00038 00000 C 00039 00000 C OUTPUT: Pointers to parts of line, flags indicating 00040 00000 C presence or absence of switches and switch 00041 00000 C values. 00042 00000 C 00043 00000 C****NOTES: 00044 00000 C 1. The CSI subroutines allow parsing of input lines, ie. 00045 00000 C analyzing the line for correct structure (syntax) and contents 00046 00000 C (semantics) and returning to the user items to allow simple retrieval 00047 00000 C of various parts of the line. The most general line that can be 00048 00000 C parsed consists of a set of output specifiers separated by commas and 00049 00000 C a set of input specifiers separated by commas; the input and output 00050 00000 C specifiers are separated by an equal sign. Full VAX file specifiers 00051 00000 C are supported; the most general form for a specifier is: 00052 00000 C 00053 00000 C NODE::DEV:[DIR]FILENAME.EXT;VERSION/SW1/SW2/SW3... 00054 00000 C 00055 00000 C where NODE:: is the name of the DECNET node the file is on, FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00002 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00056 00000 C e.g. MPX0::, BOSTON"account password"::; 00057 00000 C DEV: is a device name, e.g., DK3:, TTA4:, SYS$DISK:; 00058 00000 C [DIR] is a directory name, e.g., [200,200] or [MP1GTA.TEST]; 00059 00000 C FILENAME is the name of a file, e.g., HPLDAT; 00060 00000 C EXT is the file type or extension, e.g., DAT or FOR; 00061 00000 C VERSION is the version number of the file, e.g., 96; 00062 00000 C /SWn is 0 or more switches with 0 or more values (see note 2). 00063 00000 C 00064 00000 C Any or all of the parts of the specifier may be ommitted and CSI will 00065 00000 C return appropriate defaults. However, the parts that are given must 00066 00000 C be given in the order shown with the correct punctuation; e.g., 00067 00000 C "DK1:[MP1Q]" is OK, but "[MP1Q]DK1:" will cause syntax errors. 00068 00000 C 00069 00000 C 2. Switches allow the user to specify optional information. 00070 00000 C The most general switch format consists of a slash followed by one or 00071 00000 C two alphanumeric characters followed by 0 or more values separated 00072 00000 C by colons, e.g., 00073 00000 C 00074 00000 C /X:-300:900 00075 00000 C /DI 00076 00000 C /SE:X:100:200::500 00077 00000 C /Z:1000.:1.E9 00078 00000 C 00079 00000 C (The case of two consecutive colons would result in a numeric value 00080 00000 C of zero or an ASCII string containing all nulls.) These switches 00081 00000 C and switch values are defined using the routines CSISW and CSIVAL. 00082 00000 C Note that the switch name in the input line can contain more than 00083 00000 C 2 characters for 2 character names. The routines only check the 00084 00000 C first 2 characters. Eg. the following 2 lines will work the same: 00085 00000 C "HIST5/CL" 00086 00000 C "HIST5/CLEAR THIS HISTOGRAM BY ZEROING ALL BINS" 00087 00000 C 00088 00000 C 3. Some examples of possible lines the CSI routines might parse: 00089 00000 C 00090 00000 C "DK1:[37,1]FILE.TMP/DE" 00091 00000 C "DK1:=DK2:*.*;*" 00092 00000 C "TI:$FU/SH=[MP1GTA]HIST5/-X,DP1:RU0123.HSV/AN:CU/PP:I/LO/Y:-3200:-5" 00093 00000 C "DK:=DRA1:FILE1.TMP,SYS$DISK:FILE2.TMP,[MP1GTA.DATA.TEMP]FILE3.TMP," 00094 00000 C 00095 00000 C Note that the CSI routines will return enough information for the 00096 00000 C calling routine to determine what information is in the input line; 00097 00000 C however the calling routine must determine what to do with the 00098 00000 C information. Eg. CSI will tell you that a device was not given in the 00099 00000 C specifier but you must decide if this is an error or, if not an error, 00100 00000 C what device to default to. Eg. CSI makes no attempt to translate 00101 00000 C any logical names in a file spec. 00102 00000 C;- FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00003 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00103 00000 .PAGE 00104 00000 C;+ 00105 00000 C - C S I 00106 00000 C****NAME: SUBROUTINE CSI 00107 00000 C IDENT: /861031/ 00108 00000 C FILE: CSI.FLX 00109 00000 C 00110 00000 C****PURPOSE: Initialize the CSI package and save addresses of 00111 00000 C variables into which the desired data is to be 00112 00000 C returned when the line is actually processed. 00113 00000 C 00114 00000 C****RESTRICTIONS: This routine must be called before any of the 00115 00000 C other CSI routines even if no arguments are 00116 00000 C given in the call to CSI. 00117 00000 C If variables NODIND, DEVIND, UICIND, FILIND, 00118 00000 C MORE, WILD, and/or EQUAL are given, they MUST 00119 00000 C be put into a COMMON block or made VOLATILE; 00120 00000 C see note 4. 00121 00000 C 00122 00000 C SYSTEM: VAX/VMS 1.5 00123 00000 C LANGUAGE: FLECS/F4P 00124 00000 C AUTHOR: M. OOTHOUDT 00125 00000 C DATE: 10-AUG-79 00126 00000 C;- 00127 00000 C REVISIONS: 00128 00000 C 03/14/83 GTA Allow VMS directory syntax in place of UIC. 00129 00000 C 850327mao Document need to VOLATIZE variables. 00130 00000 C 850809mao Use .IMP NONE & .INCLUDE. 00131 00000 C 861031mao Add NODIND argument. 00132 00000 C;+ 00133 00000 C 00134 00000 C****CALLING SEQUENCE: 00135 00000 C 00136 00000 C CALL CSI([DEVIND],[UICIND],[FILIND],[MORE],[WILD],[EQUAL], 00137 00000 C [LUN],[NODIND]) 00138 00000 C 00139 00000 C INPUT: (See notes 1 , 2, and 4.) 00140 00000 C 00141 00000 C DEVIND=(2I*2) Array to receive indicies of any device string in the 00142 00000 C specifier processed. The string pointed to does not 00143 00000 C include the colon. See note 4. 00144 00000 C 00145 00000 C UICIND=(2I*2) Array to receive indicies of any UIC or directory string 00146 00000 C in the specifier processed. The string pointed to does 00147 00000 C include the brackets. See note 4. 00148 00000 C 00149 00000 C FILIND=(2I*2) Array to receive indicies of file description string 00150 00000 C including name, type and version plus all delimiters 00151 00000 C ("." and/or ";"). See note 4. 00152 00000 C 00153 00000 C MORE =(L*2) Set to .TRUE. if the string just processed ended in a 00154 00000 C comma; set .FALSE. otherwise. The argument MORE must 00155 00000 C be present in the call to CSI if more than one 00156 00000 C specifier is to be processed on either side of an equal 00157 00000 C sign. If present, MORE must be .FALSE. any time FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00004 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00158 00000 C CSIGO is called with a new command line. See note 4. 00159 00000 C 00160 00000 C WILD =(L*2) Set to .TRUE. if the UIC or FILE descriptor contains 00161 00000 C wildcard(s). See note 4. 00162 00000 C 00163 00000 C EQUAL =(L*2) Set to .TRUE. if an equal sign appears in the line, 00164 00000 C signifying that both input and output strings are 00165 00000 C present in the input line. See note 4. 00166 00000 C 00167 00000 C LUN =(I*2) Argument not used on VAX. 00168 00000 C 00169 00000 C NODIND=(2I*2) Array to receive indicies of any node name and account 00170 00000 C string in the specifier processed. The string pointed 00171 00000 C to does not include the ::, but does include the "". 00172 00000 C See note 4. 00173 00000 C 00174 00000 C OUTPUT: (See notes 1 and 2.) 00175 00000 C 00176 00000 C MORE =(L*2) Set .FALSE. whenever CSI is called (if given in argument 00177 00000 C list). 00178 00000 C 00179 00000 C CMN BLOCK I/O: /CSI_DATA_BASE__/ 00180 00000 C 00181 00000 C RESOURCES: 00182 00000 C LIBRARIES: QLIB:ARGS 00183 00000 C OTHER SUBR: NONE 00184 00000 C DISK FILES: NONE 00185 00000 C DEVICES: NONE 00186 00000 C SGAS: NONE 00187 00000 C EVENT FLAGS: NONE 00188 00000 C SYSTEM DIR: NONE 00189 00000 C 00190 00000 C****NOTES: 00191 00000 C 1. All the arguments in the call to this routine are optional. 00192 00000 C However, even if no arguments are given in the call, CSI must be 00193 00000 C called before any of the other CSI subroutines so that the CSI data 00194 00000 C base can be properly initialized. 00195 00000 C 00196 00000 C 2. Note that none of the variables except MORE are changed in 00197 00000 C any way by CSI. However, when CSIGO is called values are put into 00198 00000 C NODIND, DEVIND, UICIND, FILIND, MORE, WILD and EQUAL if they were 00199 00000 C given in the call to CSI. 00200 00000 C 00201 00000 C 3. The NODIND, DEVIND, UICIND, and FILIND arguments receive 00202 00000 C indicies of their respective data relative to the beginning of the 00203 00000 C line. The first character is 1, not 0. Eg. the following line 00204 00000 C 00205 00000 C "DK1:CSI.MAC;*" 00206 00000 C 00207 00000 C would produce when CSIGO is called 00208 00000 C 00209 00000 C NODIND(1)=0, NODIND(2)=0 00210 00000 C DEVIND(1)=1, DEVIND(2)=3 00211 00000 C UICIND(1)=0, UICIND(2)=0 00212 00000 C FILIND(1)=5, FILIND(2)=13 FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00005 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00213 00000 C MORE=.FALSE. 00214 00000 C WILD=.TRUE. 00215 00000 C EQUAL=.FALSE. 00216 00000 C 00217 00000 C 4. Under VMS V4.0 and later all arguments whose addresses are 00218 00000 C saved by this subroutine for filling in by CSIGO MUST be made 00219 00000 C VOLATILE or be in a COMMON block in the calling routine. Since the 00220 00000 C VOLATILE statement is incompatible with all other FORTRANs, putting 00221 00000 C the variables in COMMON is best. The variables that must be treated 00222 00000 C this way in the CSI call are NODIND, DEVIND, UICIND, FILIND, MORE, 00223 00000 C WILD, and EQUAL. 00224 00000 C;- FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00006 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00225 00000 .PAGE 00226 00001 SUBROUTINE CSI(DEVIND,UICIND,FILIND,MORE,WILD,EQUAL,LUN, 00227 00002 1 NODIND) !861031 00228 00002 C 00229 00002 C GLOBAL CSI DECLARATIONS 00230 00002 C 00231 00004 .IMPLICIT NONE 00232 00004 .INCLUDE CSICOM.INC *00233 00004 C *00234 00004 C CSICOM.INC *00235 00004 C *00236 00004 C THIS FILE IS USED BY CSI ROUTINES VIA AN INCLUDE STATEMENT. *00237 00004 C *00238 00004 C *****NEVER DELETE THIS FILE ******** *00239 00004 C *00240 00004 C REVISIONS: *00241 00004 C 2-FEB-84 (JFA) - INCREASE MAX NO SWITCH VALUES FROM 30 TO 100 *00242 00004 C 850809mao Put file into standard format; convert L*1 variables to I*2. *00243 00004 C 861031mao Add NODIND_ADDR variable. *00244 00004 C *00245 00005 INTEGER*2 MAX_NUM_SW *00246 00006 INTEGER*2 MAX_NUM_VAL *00247 00006 *00248 00007 PARAMETER (MAX_NUM_SW=20) !Max number of switches *00249 00008 PARAMETER (MAX_NUM_VAL=100) !Max number of switch values *00250 00008 C *00251 00009 INTEGER*4 DEVIND_ADDR !Address to return device indicies *00252 00010 INTEGER*4 EQUAL_ADDR !Address to return equal status *00253 00011 INTEGER*4 FILIND_ADDR !Address to return file spec indicies *00254 00012 INTEGER*2 LINE_POINTER(2) !Position in input line after last *00255 00012 C ! CSIGO call; one pointer *00256 00012 C ! for each side of equal sign. *00257 00013 INTEGER*4 MORE_ADDR !Address to return more status *00258 00014 INTEGER*4 NODIND_ADDR !Address to return Node indicies!861031 *00259 00015 INTEGER*2 NUM_SW_DFN !Number of switches defined *00260 00016 INTEGER*2 NUM_SW_VAL_DFN !Number of switch values defined *00261 00017 BYTE SW_NAME(2,MAX_NUM_SW) !ASCII switch names *00262 00018 INTEGER*4 SW_STATE_ADDR(MAX_NUM_SW) !Addr to return sw status *00263 00019 INTEGER*2 SW_STATE_DFLT(MAX_NUM_SW) !Default for sw status *00264 00020 INTEGER*4 SW_VALUE_ADDR(MAX_NUM_VAL) !Addr to return sw value *00265 00021 INTEGER*2 SW_VALUE_CHAIN(2,MAX_NUM_SW) !Pointers to 1st & last sw *00266 00021 C value for a given sw in *00267 00021 C arrays. =(0,0) if no values *00268 00021 C for sw. *00269 00022 INTEGER*2 SW_VALUE_LENGTH(MAX_NUM_VAL) *00270 00022 C >0-->ASCII string, it's max length in bytes *00271 00022 C =0-->Decimal I*2 *00272 00022 C =-1-->Octal I*2 *00273 00022 C =-2-->Hex I*2 *00274 00022 C =-10-->Decimal I*1 *00275 00022 C =-11-->Octal I*1 *00276 00022 C =-12-->Hex I*1 *00277 00022 C =-20-->Decimal I*4 *00278 00022 C =-21-->Octal I*4 *00279 00022 C =-22-->Hex I*4 FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00007 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT *00280 00022 C =-30-->Real*4 (F floating) *00281 00022 C =-40-->Real*8 (D floating) *00282 00023 INTEGER*4 UICIND_ADDR !Address to return directory indicies *00283 00024 INTEGER*4 WILD_ADDR !Address to return WILD status *00284 00024 C *00285 00025 COMMON/CSI_DATA_BASE__/LINE_POINTER, *00286 00026 1 NUM_SW_DFN,NUM_SW_VAL_DFN,NODIND_ADDR,DEVIND_ADDR,UICIND_ADDR, *00287 00027 2 FILIND_ADDR,MORE_ADDR,WILD_ADDR,EQUAL_ADDR,SW_NAME, *00288 00028 3 SW_STATE_ADDR,SW_STATE_DFLT,SW_VALUE_ADDR,SW_VALUE_LENGTH, *00289 00029 4 SW_VALUE_CHAIN *00290 00029 C *00291 00029 C END OF FILE 00292 00029 C 00293 00029 C LOCAL DECLARATIONS 00294 00029 C 00295 00030 INTEGER*2 NARGS,MAP,DEVIND(2),UICIND(2),FILIND(2),LUN 00296 00031 INTEGER*2 NODIND(2) !861031 00297 00032 LOGICAL*2 MORE,WILD,EQUAL FLECS VERSION 860214 15-JUN-87 09:32:50 PAGE 00008 CSI.FOR,CSI.FLL/-SP=CSI.FLX/CO:GLBOPT 00298 00032 .PAGE 00299 00032 C 00300 00032 C INITIALIZE DATA BASE 00301 00032 C 00302 00033 LINE_POINTER(1)=0 00303 00034 LINE_POINTER(2)=0 00304 00035 NUM_SW_DFN=0 00305 00036 NUM_SW_VAL_DFN=0 00306 00036 C 00307 00036 C SET INTERNAL VALUES AS IF NO ARGUMENTS IN CALL TO CSI 00308 00036 C 00309 00037 NODIND_ADDR=0 !861031 00310 00038 DEVIND_ADDR=0 00311 00039 UICIND_ADDR=0 00312 00040 FILIND_ADDR=0 00313 00041 MORE_ADDR=0 00314 00042 WILD_ADDR=0 00315 00043 EQUAL_ADDR=0 00316 00043 C 00317 00043 C NOW CHECK ARGUMENT LIST 00318 00043 C 00319 00044 CALL ARGS(NARGS,MAP) 00320 00045 IF((NARGS.GE.1).AND.((MAP.AND."1).NE.0))DEVIND_ADDR=%LOC(DEVIND) 00321 00046 IF((NARGS.GE.3).AND.((MAP.AND."2).NE.0))UICIND_ADDR=%LOC(UICIND) 00322 00047 IF((NARGS.GE.3).AND.((MAP.AND."4).NE.0))FILIND_ADDR=%LOC(FILIND) 00323 00048 IF((NARGS.GE.4).AND.((MAP.AND."10).NE.0)) 00324 00049 . MORE_ADDR=%LOC(MORE) 00325 00050 . MORE=.FALSE. 00326 00050 ...FIN 00327 00052 IF((NARGS.GE.5).AND.((MAP.AND."20).NE.0))WILD_ADDR=%LOC(WILD) 00328 00053 IF((NARGS.GE.6).AND.((MAP.AND."40).NE.0))EQUAL_ADDR=%LOC(EQUAL) 00329 00053 C NOTE LUN IS NOT USED BY VAX CSI ROUTINES 00330 00054 IF ((NARGS.GE.8).AND.((MAP.AND."200).NE.0)) THEN !861031 00331 00055 . NODIND_ADDR=%LOC(NODIND) !861031 00332 00056 ENDIF !861031 00333 00056 00334 00057 RETURN 00335 00058 END (FLECS VERSION 22.38) CSI 15-Jun-1987 09:32:53 VAX FORTRAN V4.5-219 Page 2 15-Jun-1987 09:32:50 $1$DUA11:[MP1Q.FLEALECOM.QLIB]CSI.FOR;1 PROGRAM SECTIONS Name Bytes Attributes 0 $CODE 224 PIC CON REL LCL SHR EXE RD NOWRT LONG 2 $LOCAL 96 PIC CON REL LCL NOSHR NOEXE RD WRT LONG 3 CSI_DATA_BASE__ 876 PIC OVR REL GBL SHR NOEXE RD WRT LONG Total Space Allocated 1196 ENTRY POINTS Address Type Name 0-00000000 CSI VARIABLES Address Type Name Address Type Name 3-0000000C I*4 DEVIND_ADDR AP-00000018@ L*2 EQUAL 3-00000020 I*4 EQUAL_ADDR 3-00000014 I*4 FILIND_ADDR AP-0000001C@ I*2 LUN 2-00000002 I*2 MAP AP-00000010@ L*2 MORE 3-00000018 I*4 MORE_ADDR 2-00000000 I*2 NARGS 3-00000008 I*4 NODIND_ADDR 3-00000004 I*2 NUM_SW_DFN 3-00000006 I*2 NUM_SW_VAL_DFN 3-00000010 I*4 UICIND_ADDR AP-00000014@ L*2 WILD 3-0000001C I*4 WILD_ADDR ARRAYS Address Type Name Bytes Dimensions AP-00000004@ I*2 DEVIND 4 (2) AP-0000000C@ I*2 FILIND 4 (2) 3-00000000 I*2 LINE_POINTER 4 (2) AP-00000020@ I*2 NODIND 4 (2) 3-00000024 L*1 SW_NAME 40 (2, 20) 3-0000004C I*4 SW_STATE_ADDR 80 (20) 3-0000009C I*2 SW_STATE_DFLT 40 (20) 3-000000C4 I*4 SW_VALUE_ADDR 400 (100) 3-0000031C I*2 SW_VALUE_CHAIN 80 (2, 20) 3-00000254 I*2 SW_VALUE_LENGTH 200 (100) AP-00000008@ I*2 UICIND 4 (2) CSI 15-Jun-1987 09:32:53 VAX FORTRAN V4.5-219 Page 3 15-Jun-1987 09:32:50 $1$DUA11:[MP1Q.FLEALECOM.QLIB]CSI.FOR;1 FUNCTIONS AND SUBROUTINES REFERENCED Type Name ARGS COMMAND QUALIFIERS FORTRAN/F77/LIST=CSI.LST/NOI4/F77 CSI /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW) /DEBUG=(NOSYMBOLS,TRACEBACK) /STANDARD=(NOSYNTAX,NOSOURCE_FORM) /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP,NODICTIONARY,SINGLE) /WARNINGS=(GENERAL,NODECLARATIONS,NOULTRIX) /CONTINUATIONS=19 /NOCROSS_REFERENCE /NOD_LINES /NOEXTEND_SOURCE /F77 /NOG_FLOATING /NOI4 /NOMACHINE_CODE /OPTIMIZE COMPILATION STATISTICS Run Time: 0.36 seconds Elapsed Time: 1.17 seconds Page Faults: 606 Dynamic Memory: 356 pages