C$Procedure GETCOM ( Get info from a comment area ) SUBROUTINE GETCOM ( FILE, BEGMRK, ENDMRK, . NAME, N, VALUES, FOUND) C$ Abstract C C Retrieve information from the comment area of a binary kernel file. C C$ Required_Reading C C KERNELS C C$ Keywords C C$ Declarations CHARACTER*(*) FILE CHARACTER*(*) BEGMRK CHARACTER*(*) ENDMRK CHARACTER*(*) NAME INTEGER N DOUBLE PRECISION VALUES ( * ) LOGICAL FOUND C Parameters INTEGER MAXVAR PARAMETER ( MAXVAR = 50 ) INTEGER MAXVAL PARAMETER ( MAXVAL = 300 ) INTEGER MAXLEN PARAMETER ( MAXLEN = 32 ) C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C FILE I Name of the kernel file. C BEGMRK I Marker for beginning of data area. C ENDMRK I Marker for end of data area. C NAME I Name of value to be retrieved. C N O Number of values retrieved, associated with NAME. C VALUES O Values retrieved. C FOUND O True if the data area was found. C C$ Detailed_Input C C FILE is the name of the kernel file whose comment C area will be read. C C BEGMRK a mark indicating the start of the data to C be read section of the comment area. C C ENDMRK a mark indicating the end of the data to C be read section of the comment area. C C NAME Name of values retrieved. C C$ Detailed_Output C C N Number of values retrieved, associated with NAME. C C VALUES Double precision values retrieved. C C FOUND True if the data area was found. C C$ Parameters C C MAXVAR is the maximum number of variables that the C table may hold at any one time. C C MAXLEN is the maximum length of the variable names C that can be stored in the table. C C MAXVAL is the maximum number of distinct values that C may belong to the variables in the table. C Each variable must have at least one value, and C may have any number, so long as the total number C does not exceed MAXVAL. MAXVAL must be at least C as large as MAXVAR. C C$ Files C C See the ENTRY points for a discussion of their arguments. C C$ Exceptions C C 1) If GETCOM is called directly, the error SPICE(BOGUSENTRY) is C signalled. C C$ Particulars C C The purpose of this routine is to maintain a table of variables C read from the comment area of binary kernel files. The C following entry points may be used to access the table. C C LDCOM Loads the variables from a kernel file into C a symbol table. C C RTCOM Returns the value of a variable from C the symbol table. C C Nominally, the table contains up to 50 separate variables C and up to 300 separate values. The names of the individual C variables may contain up to 32 characters. All of these figures C may be increased or decreased as necessary. C C C$ Examples C C The following code fragment demonstrates how the data from C the comments of a binary kernel file can be loaded into the table. C C C Load the variables from the kernel file into the C C the table. C C CALL LDCOM ( KERNEL, BEGMRK, ENDMRK ) C C C C C We can examine the values associated with any variable C C in the table using RTCOM. C C C CALL RTCOM ( NAME, N, VALUES, FOUND ) C C$ Restrictions C C None. C C$ Literature_References C C C$ Author_and_Institution C C K.S. Zukor (JPL) C C$ Version C C- SPICELIB Version 1.0.0, 25-APR-1994 (KSZ) C C-& C$ Index_Entries C C Fetch text kernel format data from a DAF comment area C C-& C C SPICELIB functions C LOGICAL RETURN LOGICAL FAILED C C Parameters C INTEGER MRKLEN PARAMETER ( MRKLEN = 20 ) INTEGER LBCELL PARAMETER ( LBCELL = -5 ) C C Local variables C C C The following is the symbol table used for holding table C variables. C CHARACTER*(MAXLEN) TABSYM ( LBCELL:MAXVAR ) INTEGER TABPTR ( LBCELL:MAXVAR ) DOUBLE PRECISION TABVAL ( LBCELL:MAXVAL ) C C First is our initialization flag. C LOGICAL FIRST C C The remaining local variables... C CHARACTER*(MAXLEN) VARNAM LOGICAL EOF C C Save EVERYTHING. C SAVE C C Initial values C DATA FIRST / .TRUE. / C C Standard SPICE error handling. C IF ( RETURN () ) THEN RETURN ELSE CALL CHKIN ( 'GETCOM' ) END IF C C This routine should never be called. If this routine is called, C an error is signalled. C CALL SETMSG ( 'GETCOM: You have called an entry which ' // . 'performs no run-time function. This may ' // . 'indicate a bug. Please check the documentation ' // . 'for the subroutine GETCOM.' ) CALL SIGERR ( 'SPICE(BOGUSENTRY)' ) CALL CHKOUT ( 'GETCOM' ) RETURN C$Procedure LDCOM ( load info from a kernel file into a table ) ENTRY LDCOM ( FILE, BEGMRK, ENDMRK ) C$ Abstract C C Load the variables contained in a NAIF kernel file into a C symbol table. C C$ Required_Reading C C KERNEL C C$ Keywords C C CONSTANTS C FILES C C$ Declarations C C CHARACTER*(*) FILE C CHARACTER*(*) BEGMRK C CHARACTER*(*) ENDMRK C C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C FILE I Name of the kernel file. C BEGMRK I Marker for beginning of data area. C ENDMRK I Marker for end of data area. C C$ Detailed_Input C C FILE is the name of the kernel file whose comment area C variables will be loaded into the table. C C BEGMRK a mark indicating the start of the data to C be read section of the comment area. C C ENDMRK a mark indicating the end of the data to C be read section of the comment area. C C C$ Detailed_Output C C None. C C$ Parameters C C None. C C$ Exceptions C C None. C C$ Files C C The NAIF binary kernel file FILE whose comment area is C set up to be read. C C$ Particulars C C None. C C$ Examples C C The following code fragment demonstrates how the data from C the comment area binary kernel file can be loaded into the table. C C C Load the variables from the kernel file into the C C the table. C C CALL LDCOM ( KERNEL, BEGMRK, ENDMRK ) C C C C C We can examine the values associated with any variable C C in the table using RTCOM. C C C CALL RTCOM ( NAME, N, VALUES, FOUND ) C C$ Restrictions C C None. C C$ Literature_References C C None. C C$ Author_and_Institution C C K.S. Zukor (JPL) C C$ Version C C- SPICELIB Version 1.0.0, 26-APR-1994 (KSZ) C C C Standard SPICE error handling. C IF ( RETURN() ) THEN RETURN ELSE CALL CHKIN ( 'LDCOM' ) END IF C C Initialize the table if necessary. C IF ( FIRST ) THEN FIRST = .FALSE. CALL SSIZEC ( MAXVAR, TABSYM ) CALL SSIZEI ( MAXVAR, TABPTR ) CALL SSIZED ( MAXVAL, TABVAL ) END IF IF ( FAILED() ) THEN CALL CHKOUT ( 'LDCOM' ) RETURN ELSE FIRST = .FALSE. END IF C C Open the kernel file and read the first variable. C C Read the first line of the file. C (This first line cannot contain any data values we may need C because data value must be preceded by a beginning-of-data C marker.) C CALL RDCNEW ( FILE, BEGMRK, ENDMRK ) CALL RDCVAR ( TABSYM, TABPTR, TABVAL, . VARNAM, EOF ) C C Read the variables in the comment area, one at a time. C DO WHILE ( .NOT. EOF .AND. .NOT. FAILED() ) CALL RDCVAR ( TABSYM, TABPTR, TABVAL, . VARNAM, EOF ) END DO CALL CHKOUT ( 'LDCOM' ) RETURN C$Procedure RTCOM ( Return the value from a table ) ENTRY RTCOM ( NAME, N, VALUES, FOUND ) C$ Abstract C C Return the value of a variable from a table. C C$ Required_Reading C C KERNEL C C$ Keywords C C CONSTANTS C FILES C C$ Declarations C C CHARACTER*(*) NAME C INTEGER N C DOUBLE PRECISION VALUES ( * ) C LOGICAL FOUND C C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C NAME I Name of the variable whose value is to be returned. C N O Number of values associated with NAME. C VALUES O Values associated with NAME. C FOUND O True if variable is in table. C C$ Detailed_Input C C NAME is the name of the variable whose values are to be C returned. If the variable is not in the table, FOUND C will be FALSE. C C$ Detailed_Output C C N is the number of values associated with NAME. C If NAME is not in the table, N = 0. C C VALUES is the array of values associated with NAME. C If NAME is not in the table, no values are given to C the elements of VALUES. C C FOUND is TRUE if the variable is in the table, FALSE if it C is not. C C$ Parameters C C None. C C$ Exceptions C C 1) If NAME is not present on the variable table, the value C of N is set to zero, FOUND is set to FALSE and the array C VALUES is left unchanged. C C$ Files C C None. C C$ Particulars C C None. C C$ Examples C C The following code fragment demonstrates how the data from C the binary kernel file can be loaded into the table. C C C Load the variables from the kernel file into the C C the table. C C CALL LDCOM ( KERNEL, BEGMRK, ENDMRK ) C C C C C We can examine the values associated with any variable C C in the table using RTCOM. C C C CALL RTCOM ( NAME, N, VALUES, FOUND ) C C$ Restrictions C C None. C C$ Literature_References C C None. C C$ Author_and_Institution C C K.S. Zukor (JPL) C C$ Version C C- SPICELIB Version 1.0.0, 27-APR-1994 (KSZ) C C-& C$ Index_Entries C C Fetch text kernel format data from a DAF comment area C C-& C C Standard SPICE error handling. C IF ( RETURN() ) THEN RETURN ELSE CALL CHKIN ( 'RTCOM' ) END IF C C Either it's there or it's not. C CALL SYGETD ( NAME, TABSYM, TABPTR, TABVAL, . N, VALUES, FOUND ) IF ( .NOT. FOUND ) THEN N = 0 END IF CALL CHKOUT ( 'RTCOM' ) RETURN END