
                               					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   1
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0001    C+++
0002    C	CTSASSIGN.FOR
0003    C
0004    C This module contains the code for the ASSIGN command of the CAMAC Topology
0005    C Supervisor (CTS).
0006    C
0007    C
0008    C   Date	By		Comments
0009    C    ??		D.E.Greenwood	Original
0010    C 10/07/82	D.E.Greenwood	This header added; order of prompts for
0011    C				physical_module name and logical name reversed
0012    C				(physical name first) to correspond with order
0013    C				in CLD file
0014    C  1/03/83	D.E.Greenwood	Calls to REPORT changed to 2 arguments
0015    C
0016    C---
0017    C
0018    C
0019    	SUBROUTINE ASSIGN
0020    C
0021    	CHARACTER PHY_NAME*32, VALUE*32
0022    	INTEGER*2 LOG_NAM_LEN, PHY_NAM_LEN, TEMP_NUM, VALUE_LEN
0023    	INTEGER*4 CAM$PHYMOD, CLI$GET_VALUE, CLI$PRESENT
0024    	INTEGER*4 LIB$SYS_TRNLOG, LIB$SYS_GETMSG, SYS$CRELOG
0025    C
0026    	INCLUDE 'CTSDEF/LIST'			! Define standard vars.
0027  1 C	CTSDEF.FOR
0028  1 C
0029  1 C This module contains the standard variable and parameter definitions for the
0030  1 C CAMAC Topology Supervisor routines
0031  1 C
0032  1 C First, define the individual variables in the data file record
0033  1 C
0034  1 	CHARACTER*32 LOGICAL_NAME
0035  1 	CHARACTER*9 SPECIFIER
0036  1 	CHARACTER*5 CSU
0037  1 	CHARACTER*2 CSU_DEVICE
0038  1 	CHARACTER*1 CSU_CONTROLLER
0039  1 	CHARACTER*2 CSU_UNIT
0040  1 	CHARACTER*1 CR_COLON
0041  1 	CHARACTER*3 STATION
0042  1 	INTEGER*4 REF_UIC_GROUP
0043  1 	INTEGER*4 REF_UIC_MEMBER
0044  1 	CHARACTER*40 COMMENT
0045  1 C
0046  1 C Define the data file record and equivalence the parts
0047  1 C
0048  1 	CHARACTER CAMDEF_RECORD*120
0049  1 	EQUIVALENCE (CAMDEF_RECORD(1:32),LOGICAL_NAME),
0050  1 	1	(CAMDEF_RECORD(37:45),SPECIFIER),	! 33:36 reserved
0051  1 	2	(CAMDEF_RECORD(37:41),CSU),
0052  1 	3	(CAMDEF_RECORD(37:38),CSU_DEVICE),
0053  1 	4	(CAMDEF_RECORD(39:39),CSU_CONTROLLER),
0054  1 	5	(CAMDEF_RECORD(40:41),CSU_UNIT),
0055  1 	6	(CAMDEF_RECORD(42:42),CR_COLON),
0056  1 	7	(CAMDEF_RECORD(43:45),STATION),
0057  1 	8	(CAMDEF_RECORD(46:49),REF_UIC_GROUP),

ASSIGN                         					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   2
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0058  1 	9	(CAMDEF_RECORD(50:53),REF_UIC_MEMBER),
0059  1 	1	(CAMDEF_RECORD(54:93),COMMENT)
0060  1 C
0061  1 C Define data structures for use with the CAM$PHYMOD routine
0062  1 C
0063  1 	CHARACTER CSU_NAME*6
0064  1 	INTEGER*4 PHY_MOD(4),PM_RUG,PM_RUM,PM_UNIT,PM_STATION
0065  1 	EQUIVALENCE (PHY_MOD(1),PM_RUG),
0066  1 	1	(PHY_MOD(2),PM_RUM),
0067  1 	2	(PHY_MOD(3),PM_UNIT),
0068  1 	3	(PHY_MOD(4),PM_STATION)
0069    	INCLUDE '($SSDEF)'			! System status code defs.

ASSIGN                         					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   3
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0460    C
0461    C Get physical specification and it's length.  If we must prompt for the
0462    C spec., remove leading and/or trailing double-quotes (") so as to be
0463    C consistent with the way the CLI handles quoted parameters.
0464    C
0465    	IF (CLI$PRESENT('PHY_NAME')) THEN
0466    	  CALL CLI$GET_VALUE('PHY_NAME',PHY_NAME)
0467    	ELSE
0468    	  CALL LIB$GET_INPUT(PHY_NAME,'Physical specification: ',PHY_NAM_LEN)
0469    	  IF (PHY_NAME(PHY_NAM_LEN:) .EQ. '"')
0470         &		PHY_NAME = PHY_NAME(:PHY_NAM_LEN-1)
0471    	  IF (PHY_NAME(1:1) .EQ. '"') PHY_NAME = PHY_NAME(2:)
0472    	END IF
0473    	CALL STR$UPCASE(PHY_NAME,PHY_NAME)
0474    	CALL STR$TRIM(PHY_NAME,PHY_NAME,PHY_NAM_LEN)
0475    C
0476    C Verify and parse physical specification into its components.
0477    C
0478    	ISTAT = CAM$PHYMOD(PHY_NAME(1:PHY_NAM_LEN),CSU_NAME,PHY_MOD)
0479    	IF (.NOT. ISTAT) THEN
0480    	  CALL REPORT(' ', ISTAT)
0481    	  GOTO 89000
0482    	END IF
0483    C
0484    C Get the logical name (may have to prompt for it) and its length.
0485    C
0486    	IF (CLI$PRESENT('LOG_NAME')) THEN
0487    	  CALL CLI$GET_VALUE('LOG_NAME',LOGICAL_NAME)
0488    	ELSE
0489    	  CALL LIB$GET_INPUT(LOGICAL_NAME,'Logical name: ',LOG_NAM_LEN)
0490    	END IF
0491    	CALL STR$UPCASE(LOGICAL_NAME,LOGICAL_NAME)
0492    	CALL STR$TRIM(LOGICAL_NAME,LOGICAL_NAME,LOG_NAM_LEN)
0493    C
0494    C Insure logical name is legal and does not duplicate any existing one in the
0495    C system logical name table.
0496    C
0497    	ISTAT = LIB$SYS_TRNLOG(LOGICAL_NAME(1:LOG_NAM_LEN),,LOGICAL_NAME,,,6)
0498    	IF (ISTAT .EQ. SS$_NOTRAN) GOTO 2000
0499    	IF (ISTAT .EQ. SS$_NORMAL .OR. ISTAT .EQ. SS$_STRTRU) THEN
0500    	  TYPE *, '%CTS-W-INUSE, logical name already in use'
0501    	ELSE
0502    	  CALL REPORT(' ', ISTAT)
0503    	END IF
0504    	GOTO 89000
0505    C
0506    C Get the optional comment.
0507    C
0508    2000	COMMENT = ' '
0509    	IF (CLI$PRESENT('COMMENT')) CALL CLI$GET_VALUE('COMMENT',COMMENT)
0510    C
0511    C Get the optional reference uic
0512    C
0513    	IF (CLI$PRESENT('REFERENCE_UIC')) THEN
0514    	  CALL GET_REF_UIC(PHY_NAME,PHY_NAM_LEN)
0515    	  IF (.NOT. CAM$PHYMOD(PHY_NAME(1:PHY_NAM_LEN),CSU_NAME,PHY_MOD))
0516    	1	 THEN

ASSIGN                         					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   4
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0517    	    TYPE *, '%CTS-W-ILLUIC, illegal reference uic'
0518    	    GOTO 89000
0519    	  END IF
0520    	END IF
0521    C
0522    C Create the physical specification portion of the file record, create the
0523    C logical name, write the record to the file and we're done.
0524    C
0525    	CALL MAKE_PHY_REC(CSU_NAME,PHY_MOD,CAMDEF_RECORD)
0526    	CALL MAKE_FULL_SPEC(CAMDEF_RECORD,PHY_NAME,PHY_NAM_LEN)
0527    	ISTAT = SYS$CRELOG(%VAL(0),LOGICAL_NAME(1:LOG_NAM_LEN),
0528    	1	PHY_NAME(1:PHY_NAM_LEN),)
0529    	IF (ISTAT .EQ. SS$_NORMAL) THEN
0530    	  WRITE (1) CAMDEF_RECORD
0531    	ELSE
0532    	  CALL REPORT(' ', ISTAT)
0533    	END IF
0534    89000	RETURN
0535    	END

ASSIGN                         					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   5
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  508   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                 163   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 656   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                 1327


ENTRY POINTS

    Address  Type  Name          

  0-00000000       ASSIGN        


VARIABLES

    Address  Type  Name                                Address  Type  Name                            

  2-00000010  CHAR CAMDEF_RECORD                     2-00000045  CHAR COMMENT                         
  2-00000039  CHAR CR_COLON                          2-00000034  CHAR CSU                             
  2-00000036  CHAR CSU_CONTROLLER                    2-00000034  CHAR CSU_DEVICE                      
  2-000000C8  CHAR CSU_NAME                          2-00000037  CHAR CSU_UNIT                        
  2-000000DC  I*4  ISTAT                             2-000000D8  I*4  LIB$SYS_GETMSG                  
  2-00000010  CHAR LOGICAL_NAME                      2-000000CE  I*2  LOG_NAM_LEN                     
  2-00000088  CHAR PHY_NAME                          2-000000D0  I*2  PHY_NAM_LEN                     
  2-00000000  I*4  PM_RUG                            2-00000004  I*4  PM_RUM                          
  2-0000000C  I*4  PM_STATION                        2-00000008  I*4  PM_UNIT                         
  2-0000003D  I*4  REF_UIC_GROUP                     2-00000041  I*4  REF_UIC_MEMBER                  
  2-00000034  CHAR SPECIFIER                         2-000000E0  R*4  SS$_STRTRU                      
  2-0000003A  CHAR STATION                           2-000000D2  I*2  TEMP_NUM                        
  2-000000A8  CHAR VALUE                             2-000000D4  I*2  VALUE_LEN                       


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  2-00000000  I*4  PHY_MOD                16  (4)


LABELS

    Address   Label       Address   Label   

  0-0000012D  2000      0-000001FB  89000   

ASSIGN                         					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   6
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

   I*4  CAM$PHYMOD                              CLI$GET_VALUE                      I*4  CLI$PRESENT                     
        GET_REF_UIC                             LIB$GET_INPUT                      I*4  LIB$SYS_TRNLOG                  
        MAKE_FULL_SPEC                          MAKE_PHY_REC                            REPORT                          
        STR$TRIM                                STR$UPCASE                         I*4  SYS$CRELOG                      

                               					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   7
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0001    	SUBROUTINE MAKE_PHY_REC(CSU_ID,PHY_MOD_SPEC,RECORD)
0002    C
0003    	CHARACTER*(*) CSU_ID,RECORD
0004    	INTEGER*2 COLON_LOC
0005    	INTEGER*4 PHY_MOD_SPEC(*)
0006    C
0007    	INCLUDE 'CTSDEF'
0050    C
0051    	CAMDEF_RECORD = RECORD
0052    	DO 10000 I=1,4
0053    	  PHY_MOD(I) = PHY_MOD_SPEC(I)
0054    10000	END DO
0055    	CSU(1:3) = CSU_ID(1:3)
0056    	ENCODE (2,90000,CSU_UNIT) PM_UNIT
0057    	CR_COLON = ':'
0058    	ENCODE (3,90010,STATION) PM_STATION
0059    	REF_UIC_GROUP = PM_RUG
0060    	REF_UIC_MEMBER = PM_RUM
0061    	RECORD = CAMDEF_RECORD
0062    	RETURN
0063    C
0064    90000	FORMAT(I2)
0065    90010	FORMAT('N',I2)
0066    	END

MAKE_PHY_REC                   					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   8
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  182   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                   9   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 184   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  375


ENTRY POINTS

    Address  Type  Name          

  0-00000000       MAKE_PHY_REC  


VARIABLES

    Address  Type  Name                                Address  Type  Name                            

  2-00000010  CHAR CAMDEF_RECORD                     2-0000008E  I*2  COLON_LOC                       
  2-00000045  CHAR COMMENT                           2-00000039  CHAR CR_COLON                        
  2-00000034  CHAR CSU                               2-00000036  CHAR CSU_CONTROLLER                  
  2-00000034  CHAR CSU_DEVICE                       AP-00000004@ CHAR CSU_ID                          
  2-00000088  CHAR CSU_NAME                          2-00000037  CHAR CSU_UNIT                        
  2-00000090  I*4  I                                 2-00000010  CHAR LOGICAL_NAME                    
  2-00000000  I*4  PM_RUG                            2-00000004  I*4  PM_RUM                          
  2-0000000C  I*4  PM_STATION                        2-00000008  I*4  PM_UNIT                         
 AP-0000000C@ CHAR RECORD                            2-0000003D  I*4  REF_UIC_GROUP                   
  2-00000041  I*4  REF_UIC_MEMBER                    2-00000034  CHAR SPECIFIER                       
  2-0000003A  CHAR STATION                         


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  2-00000000  I*4  PHY_MOD                16  (4)
 AP-00000008@ I*4  PHY_MOD_SPEC           **  (*)


LABELS

    Address   Label       Address   Label       Address   Label   

      **      10000     1-00000000  90000'    1-00000003  90010'  

                               					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page   9
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0001    	SUBROUTINE GET_REF_UIC(SPEC_STR,SPEC_STR_LEN)
0002    C
0003    	CHARACTER*(*) SPEC_STR, UIC*15
0004    	INTEGER*2 COLON_LOC, LFBRKT_LOC, SPEC_STR_LEN, UIC_LEN
0005    C
0006    	CALL CLI$GET_VALUE('REFERENCE_UIC',UIC)
0007    	CALL STR$TRIM(UIC,UIC,UIC_LEN)
0008    	LFBRKT_LOC = INDEX(SPEC_STR,'[')
0009    	IF (LFBRKT_LOC .GT. 0) SPEC_STR =
0010    	1	SPEC_STR(1:LFBRKT_LOC-1)//SPEC_STR(INDEX(SPEC_STR,']')+1:)
0011    	COLON_LOC = INDEX(SPEC_STR,':')
0012    	SPEC_STR = SPEC_STR(1:COLON_LOC)//UIC(1:UIC_LEN)
0013    	1	//SPEC_STR(COLON_LOC+1:)
0014    	CALL STR$TRIM(SPEC_STR,SPEC_STR,SPEC_STR_LEN)
0015    	RETURN
0016    	END

GET_REF_UIC                    					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page  10
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  223   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                  20   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 152   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  395


ENTRY POINTS

    Address  Type  Name          

  0-00000000       GET_REF_UIC   


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-00000010  I*2  COLON_LOC       2-00000012  I*2  LFBRKT_LOC     AP-00000004@ CHAR SPEC_STR       AP-00000008@ I*2  SPEC_STR_LEN  
  2-00000000  CHAR UIC             2-00000014  I*2  UIC_LEN       


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name          

        CLI$GET_VALUE    I*4  LIB$INDEX             STR$TRIM      

                               					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page  11
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

0001    	SUBROUTINE MAKE_FULL_SPEC(RECORD,PHY_SPEC,PHY_SPEC_LEN)
0002    C
0003    	CHARACTER PHY_SPEC*(*), RECORD*(*), REFERENCE_UIC*15
0004    	INTEGER*2 PHY_SPEC_LEN, REF_UIC_LEN
0005    	INCLUDE 'CTSDEF'
0048    C
0049    	CAMDEF_RECORD = RECORD
0050    	CALL MAKE_REF(CAMDEF_RECORD,REFERENCE_UIC)
0051    	CALL MAKE_SPECIFIER(CAMDEF_RECORD,PHY_SPEC)
0052    	CALL STR$TRIM(REFERENCE_UIC,REFERENCE_UIC,REF_UIC_LEN)
0053    	IF (REF_UIC_LEN .GT. 0) THEN
0054    	  COLON_LOC = INDEX(PHY_SPEC,':')
0055    	  PHY_SPEC = PHY_SPEC(1:COLON_LOC)//REFERENCE_UIC(1:REF_UIC_LEN)
0056    	1	//PHY_SPEC(COLON_LOC+1:)
0057    	END IF
0058    	CALL STR$TRIM(PHY_SPEC,PHY_SPEC,PHY_SPEC_LEN)
0059    	RETURN
0060    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  181   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                   2   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 272   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  455


ENTRY POINTS

    Address  Type  Name                            

  0-00000000       MAKE_FULL_SPEC                  


VARIABLES

    Address  Type  Name                                Address  Type  Name                            

  2-00000010  CHAR CAMDEF_RECORD                     2-000000A0  R*4  COLON_LOC                       
  2-00000045  CHAR COMMENT                           2-00000039  CHAR CR_COLON                        
  2-00000034  CHAR CSU                               2-00000036  CHAR CSU_CONTROLLER                  
  2-00000034  CHAR CSU_DEVICE                        2-00000097  CHAR CSU_NAME                        
  2-00000037  CHAR CSU_UNIT                          2-00000010  CHAR LOGICAL_NAME                    
 AP-00000008@ CHAR PHY_SPEC                         AP-0000000C@ I*2  PHY_SPEC_LEN                    
  2-00000000  I*4  PM_RUG                            2-00000004  I*4  PM_RUM                          
  2-0000000C  I*4  PM_STATION                        2-00000008  I*4  PM_UNIT                         
 AP-00000004@ CHAR RECORD                            2-00000088  CHAR REFERENCE_UIC                   
  2-0000003D  I*4  REF_UIC_GROUP                     2-0000009E  I*2  REF_UIC_LEN                     
  2-00000041  I*4  REF_UIC_MEMBER                    2-00000034  CHAR SPECIFIER                       
  2-0000003A  CHAR STATION                         

MAKE_FULL_SPEC                 					 7-Jan-1983 13:28:41	VAX-11 FORTRAN V3.1-23              Page  12
								 3-Jan-1983 15:54:05	SYS$SYSROOT:[CAMAC.CTS]CTSASSIGN.FOR;42     

ARRAYS

    Address  Type  Name                Bytes  Dimensions

  2-00000000  I*4  PHY_MOD                16  (4)


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

   I*4  LIB$INDEX                               MAKE_REF                                MAKE_SPECIFIER                  
        STR$TRIM                        


COMMAND QUALIFIERS

  FORTRAN /LIS CTS,CTSASSIGN,CTSDEASGN,CTSMODIFY,CTSSET,CTSSHOW,WCCOPY,WCMATCH

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /STANDARD=(NOSYNTAX,NOSOURCE_FORM)
  /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP)
  /F77  /NOG_FLOATING  /I4  /OPTIMIZE  /WARNINGS  /NOD_LINES  /NOCROSS_REFERENCE  /NOMACHINE_CODE  /CONTINUATIONS=19


COMPILATION STATISTICS

  Run Time:           5.31 seconds
  Elapsed Time:       5.96 seconds
  Page Faults:        63
  Dynamic Memory:     340 pages
