Index Page
dlabbs_c
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   void dlabbs_c ( SpiceInt         handle,
                   SpiceDLADescr  * descr,
                   SpiceBoolean   * found  )

Abstract

 
   Begin a backward segment search in a DLA file. 
 

Required_Reading

 
   DAS 
   DLA 
 

Keywords

 
   DAS 
   DLA 
   FILES 
 

Brief_I/O

 
   Variable  I/O  Description 
   --------  ---  -------------------------------------------------- 
   handle     I   Handle of open DLA file. 
   descr      O   Descriptor of last segment in DLA file. 
   found      O   Flag indicating whether a segment was found. 
 

Detailed_Input

 
   handle      is the integer handle associated with the file to be 
               searched. This handle is used to identify the file in 
               subsequent calls to other DLA or DAS routines. 
 

Detailed_Output

 
   descr       is the descriptor of the last DLA segment in the 
               file associated with `handle'.  
  
               `descr' is valid only if the output argument `found' is 
               SPICETRUE.
 
 
   found       is a logical flag indicating whether a segment was 
               found. `found' has the value SPICETRUE if the file  
               contains at least one segment; otherwise `found' is 
               SPICEFALSE.
 

Parameters

 
   None. 
 

Exceptions

 
   1) If the input file handle is invalid, the error will be 
      diagnosed by routines in the call tree of this routine. 
 
   2) If an error occurs while reading the DLA file, the error  
      will be diagnosed by routines in the call tree of this 
      routine. 
 
   3) If the input descriptor is invalid, this routine will 
      fail in an unpredictable manner.   
 

Files

 
   See description of input argument `handle'. 
 

Particulars

 
   DLA files are built using the DAS low-level format; DLA files are 
   a specialized type of DAS file in which data are organized as a 
   doubly linked list of segments. Each segment's data belong to 
   contiguous components of character, double precision, and integer 
   type. 
 
   This routine supports backward traversal of a DLA file's segment 
   list. Note that it is not necessary to call this routine to 
   conduct a backward traversal; all that is necessary is to have 
   access to the last descriptor in the file, which this routine 
   provides. 
 

Examples

 
   1)  Open a DLA file for read access, traverse the segment 
       list from back to front, and display segment address 
       and size attributes. 
  
 
          #include "SpiceUsr.h"
          #include "SpiceDLA.h"
          #include <stdio.h>

          int main()
          {      
             /.
             Local parameters 
             ./
             #define FILSIZ           256 

             /.
             Local variables
             ./
             SpiceBoolean            found;
             SpiceChar               fname  [ FILSIZ ];
             SpiceDLADescr           current;
             SpiceDLADescr           descr;
             SpiceInt                handle;
             SpiceInt                segno;

             /.
             Prompt for the name of the file to search.
             ./
             prompt_c ( "Name of DLA file > ", FILSIZ, fname );

             /.
             Open the DLA file for read access.  Since DLA
             files use the DAS architecture, we can use DAS
             routines to open and close the file.
             ./
             dasopr_c ( fname, &handle );

             /.
             Begin a backward search. Let `descr' contain
             the descriptor of the last segment.
             ./
             segno = 0;

             dlabbs_c ( handle, &descr, &found );

             while ( found )
             {
                /.        
                Display the contents of the current segment
                descriptor.
                ./

                ++segno;

                printf ( "\n"
                         "Segment number (offset from end of file) = %d\n"
                         "\n"
                         "   Backward segment pointer         = %d\n"
                         "   Forward segment pointer          = %d\n"
                         "   Integer component base address   = %d\n"
                         "   Integer component size           = %d\n"
                         "   D.p. component base address      = %d\n"
                         "   D.p. component size              = %d\n"
                         "   Character component base address = %d\n"
                         "   Character component size         = %d\n"
                         "\n",
                         (int)(segno),
                         (int)(descr.bwdptr),
                         (int)(descr.fwdptr),
                         (int)(descr.ibase),
                         (int)(descr.isize),
                         (int)(descr.dbase),
                         (int)(descr.dsize),
                         (int)(descr.cbase),
                         (int)(descr.csize)                            );

                /.
                Find the previous segment.
                ./
                current = descr;

                dlafps_c ( handle, &current, &descr, &found );
             }

             /.
             Close the file using the DAS close routine.
             ./
             dascls_c ( handle );

             return ( 0 );
          } 

Restrictions

 
   None. 
 

Literature_References

 
   None. 
 

Author_and_Institution

 
   N.J. Bachman    (JPL) 
 

Version

 
   -CSPICE Version 1.0.0, 10-JAN-2017 (NJB)

Index_Entries

 
   begin backward search in dla file 
 

Link to routine dlabbs_c source file dlabbs_c.c

Wed Apr  5 17:54:31 2017