      SUBROUTINE CSISW(NAME,STATE,DEFAULT)                              00123 
      IMPLICIT NONE                                                     00127 
      INCLUDE ' 32766 .FID/NOLIST'                                      00127 
      INTEGER*2 MAX_NUM_SW                                              00141 
      INTEGER*2 MAX_NUM_VAL                                             00142 
      PARAMETER (MAX_NUM_SW=20)   !Max number of switches               00144 
      PARAMETER (MAX_NUM_VAL=100) !Max number of switch values          00145 
      INTEGER*4 DEVIND_ADDR     !Address to return device indicies      00147 
      INTEGER*4 EQUAL_ADDR      !Address to return equal status         00148 
      INTEGER*4 FILIND_ADDR     !Address to return file spec indicies   00149 
      INTEGER*2 LINE_POINTER(2) !Position in input line after last      00150 
      INTEGER*4 MORE_ADDR       !Address to return more status          00153 
      INTEGER*4 NODIND_ADDR     !Address to return Node indicies!861031 00154 
      INTEGER*2 NUM_SW_DFN      !Number of switches defined             00155 
      INTEGER*2 NUM_SW_VAL_DFN  !Number of switch values defined        00156 
      BYTE      SW_NAME(2,MAX_NUM_SW) !ASCII switch names               00157 
      INTEGER*4 SW_STATE_ADDR(MAX_NUM_SW) !Addr to return sw status     00158 
      INTEGER*2 SW_STATE_DFLT(MAX_NUM_SW) !Default for sw status        00159 
      INTEGER*4 SW_VALUE_ADDR(MAX_NUM_VAL) !Addr to return sw value     00160 
      INTEGER*2 SW_VALUE_CHAIN(2,MAX_NUM_SW) !Pointers to 1st & last sw 00161 
      INTEGER*2 SW_VALUE_LENGTH(MAX_NUM_VAL)                            00165 
      INTEGER*4 UICIND_ADDR     !Address to return directory indicies   00178 
      INTEGER*4 WILD_ADDR       !Address to return WILD status          00179 
      COMMON/CSI_DATA_BASE__/LINE_POINTER,                              00181 
     1 NUM_SW_DFN,NUM_SW_VAL_DFN,NODIND_ADDR,DEVIND_ADDR,UICIND_ADDR,   00182 
     2 FILIND_ADDR,MORE_ADDR,WILD_ADDR,EQUAL_ADDR,SW_NAME,              00183 
     3 SW_STATE_ADDR,SW_STATE_DFLT,SW_VALUE_ADDR,SW_VALUE_LENGTH,       00184 
     4 SW_VALUE_CHAIN                                                   00185 
      BYTE NAME(2),BNAME(2)                                             00191 
      INTEGER*2 STATE,DEFAULT,NARGS,MAP,ILOC,INAME(MAX_NUM_SW),DNAME,I  00192 
      EQUIVALENCE (INAME(1),SW_NAME(1,1)),(BNAME(1),DNAME)              00193 
      ASSIGN 32757 TO I32758                                            00197 
      GO TO 32758                                                       00197 
32757 IF(ILOC.NE.0)THEN                                                 00198 
      TYPE 1,NAME                                                       00199 
1     FORMAT(' CSISW--SWITCH "',2A1,'" ALREADY DEFINED')                00200 
      CALL EXIT !PDP11 CSISW FORCES EXIT!                               00201 
      ELSE                                                              00203 
      IF(NUM_SW_DFN.EQ.MAX_NUM_SW)THEN                                  00207 
      TYPE 2,NAME                                                       00208 
2     FORMAT(' CSISW--OUT OF ROOM FOR SWITCH "',2A1,'"')                00209 
      CALL EXIT !PDP11 CSISW FORCES EXIT!                               00210 
      ELSE                                                              00212 
      NUM_SW_DFN=NUM_SW_DFN+1                                           00216 
      DO I=1,2                                                          00217 
      SW_NAME(I,NUM_SW_DFN)=NAME(I)                                     00217 
      ENDDO                                                             00217 
      SW_STATE_ADDR(NUM_SW_DFN)=%LOC(STATE)                             00218 
      CALL ARGS(NARGS,MAP)                                              00222 
      IF((NARGS.GE.3).AND.((MAP.AND."4).NE.0))THEN                      00223 
      SW_STATE_DFLT(NUM_SW_DFN)=DEFAULT                                 00224 
      ELSE                                                              00226 
      SW_STATE_DFLT(NUM_SW_DFN)=.FALSE.                                 00226 
      ENDIF                                                             00226 
      SW_VALUE_CHAIN(1,NUM_SW_DFN)=0                                    00230 
      SW_VALUE_CHAIN(2,NUM_SW_DFN)=0                                    00231 
      ENDIF                                                             00232 
      ENDIF                                                             00233 
      RETURN                                                            00234 
32758 CONTINUE                                                          00235 
      DO I=1,2                                                          00240 
      BNAME(I)=NAME(I)                                                  00240 
      ENDDO                                                             00240 
      ILOC=1                                                            00241 
      DOWHILE(.NOT.(ILOC.GT.NUM_SW_DFN.OR.DNAME.EQ.INAME(ILOC)))        00242 
      ILOC=ILOC+1                                                       00242 
      ENDDO                                                             00242 
      IF(ILOC.GT.NUM_SW_DFN)ILOC=0                                      00243 
      GO TO I32758                                                      00244 
      END                                                               00245 
