spcrnl |
Table of contents
ProcedureSPCRNL ( SPK and CK, read next line of comments ) ENTRY SPCRNL ( LINE, EOC ) AbstractContinue reading lines from the comment area of a binary SPK or CK file specified by the most recent call to the routine SPCRFL. Required_ReadingSPC KeywordsFILES DeclarationsIMPLICIT NONE CHARACTER*(*) LINE LOGICAL EOC Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- LINE O Next line of text from the comment area. EOC O End of comments? Detailed_InputNone. Detailed_OutputLINE is the next line of text from the comment area of the SPK or CK file. LINE may be blank. SPCRFL reads the first line of comments from a specified binary SPK or CK file. Once SPCRFL has been called, SPCRNL may be called repetitively to read the next lines of the comment area until the end. EOC is .TRUE. if there are no more comments to read. Otherwise, EOC is .FALSE. ParametersNone. Exceptions1) If SPCRFL is not called prior to calling SPCRNL, the error SPICE(SPCRFLNOTCALLED) is signaled. 2) If the most recent call to SPCRFL returned EOC with the value true, then SPCRNL will return EOC with the same value. 3) If EOC is .TRUE., LINE will be blank. 4) If the first line of comments in the comment area is longer than the declared length of LINE, it will be truncated to fit into the variable. 5) If there is a problem reading from the comment area, the error SPICE(FILEREADFAILED) is signaled. 6) If the comments are not in the correct format, the error SPICE(FORMATERROR) is signaled. FilesThe handle of the binary SPK or CK is specified with the routine SPCRFL. ParticularsThe structure of SPK and CK files accommodates comments in addition to data. The following five routines are available for accessing the comment area of a binary SPK or CK file: SPCAC add comments SPCEC extract comments SPCDC delete comments SPCRFL read first line of comments SPCRNL read next line of comments Note that comments must consist of only text, that is, printable ASCII characters, specifically ASCII 32-126. This excludes tabs (ASCII 9) and control characters. The SPC conversion routines---SPCB2A, SPCA2B, SPCB2T, and SPCT2B---include these comments when converting SPK and CK files between binary and text formats. ExamplesSuppose we have a binary SPK file called A.BSP. The following code fragment searches the comment area for a lines containing the character string `SOURCE' and writes the lines to standard output. C C Open the binary SPK file and get its handle. C CALL DAFOPR ( 'A.BSP', HANDLE ) C C Read the first line of comments. C CALL SPCRFL ( HANDLE, LINE, EOC ) C C Search for the string 'SOURCE' in the line. If C it is found, write the line. Then get the next C line of comments and repeat as long as we're not C at the end. C DO WHILE ( .NOT. EOC ) IF ( POS ( LINE, 'SOURCE', 1 ) .NE. 0 ) THEN WRITE (*,*) LINE END IF CALL SPCRNL ( LINE, EOC ) END DO Restrictions1) This routine assumes that the comment area of the binary SPK or CK file contains only text stored by SPCAC. Comments written any other way may not be handled properly. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) K.R. Gehringer (JPL) J.E. McLean (JPL) W.L. Taber (JPL) F.S. Turner (JPL) VersionSPICELIB Version 2.1.0, 17-AUG-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 2.0.0, 16-NOV-2001 (FST) Updated this entry point to utilize the handle manager interfaces. See the $Revisions section of the subroutine header above for a detailed discussion of the changes. SPICELIB Version 1.1.0, 27-JUL-1992 (KRG) Removed a call to the SPICELIB subroutine SUFFIX() which was used to join two parts of a comment line that may be broken across two comment records. The problem was, SUFFIX cannot know about leading/embedded blanks when it appends, so blanks were inadvertently removed when they happened to be stored at the end of comment record. Added the variable TMPLEN to record the length of the first part of a comment line that may be broken across comment records. SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.0, 15-APR-1991 (JEM) |
Fri Dec 31 18:36:49 2021