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

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_DLAFPS finds the segment preceding a specified segment in a DLA
   file.

I/O


   Given:

      handle   the integer handle associated with the file to be searched.

               help, handle
                  LONG = Scalar

               This handle is used to identify the file in subsequent calls
               to other DLA or DAS routines.

      dladsc   the descriptor of a DLA segment in the file associated with
               `handle'.

               help, dladsc
                  LONG = Array[SPICE_DLA_DSCSIZ]

               The descriptor of the segment preceding `dladsc' is sought.

               The segment descriptor layout is:

                  +---------------+
                  | BACKWARD PTR  | Linked list backward pointer
                  +---------------+
                  | FORWARD PTR   | Linked list forward pointer
                  +---------------+
                  | BASE INT ADDR | Base DAS integer address
                  +---------------+
                  | INT COMP SIZE | Size of integer segment component
                  +---------------+
                  | BASE DP ADDR  | Base DAS d.p. address
                  +---------------+
                  | DP COMP SIZE  | Size of d.p. segment component
                  +---------------+
                  | BASE CHR ADDR | Base DAS character address
                  +---------------+
                  | CHR COMP SIZE | Size of character segment component
                  +---------------+

   the call:

      cspice_dlafps, handle, dladsc, prvdsc, found

   returns:

      prvdsc   the descriptor of the DLA segment preceding the segment
               associated with the input argument `dladsc'.

               help, prvdsc
                  LONG = Array[SPICE_DLA_DSCSIZ]

               `prvdsc' is valid only if the output argument `found' is
               True

      found    a logical flag indicating whether the previous segment was
               found.

               help, found
                  BOOLEAN = Scalar

               `found' has the value True if the segment was found;
               otherwise `found' is False.

Parameters


   SPICE_DLA_DSCSIZ

               is the size of a SPICELIB DLA descriptor, defined in
               IcyDLA.pro.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Open a DLA file for read access, traverse the segment
      list from back to front, and display segment address
      and size attributes.


      Example code begins here.


      PRO dlafps_ex1

         ;;
         ;; IcyUser is a file that makes certain variables global.
         ;; You must call IcyUser to have access to the parameters used
         ;; in this example.
         ;;
         ;; To use the variables in IcyUser, add the 'src/icy' directory
         ;; to your IDL path by doing the following in which /path/to is the
         ;; local path to Icy.
         ;;
         ;;    pref_set, 'IDL_PATH', '/path/to/icy/src/icy:<IDL_DEFAULT>', $
         ;;                           /COMMIT
         ;;
         @IcyUser

         ;;
         ;; Prompt for the name of the file to search.
         ;;
         fname = ' '
         read, fname, PROMPT = 'Name of DLA file > '

         ;;
         ;; 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.
         ;;
         cspice_dasopr, fname, handle

         ;;
         ;; Count the segments in the file; this allows us
         ;; to label the segments in our display.
         ;;
         nsegs = 0L
         cspice_dlabbs, handle, dladsc, found

         while ( found ) do begin

            nsegs = nsegs + 1L
            currnt = dladsc
            cspice_dlafps, handle, currnt, dladsc, found

         endwhile

         ;;
         ;; Begin a backward search.  Let `dladsc' contain
         ;; the descriptor of the last segment.
         ;;
         segno = nsegs + 1L

         cspice_dlabbs, handle, dladsc, found

         while ( found ) do begin

            ;;
            ;; Display the contents of the current segment
            ;; descriptor.
            ;;
            segno = segno - 1L

            print, ' '
            print, ' '
            print, 'Segment number = ', segno
            print, ' '
            print, 'Backward segment pointer         = ',                    $
                                dladsc[SPICE_DLA_BWDIDX]
            print, 'Forward segment pointer          = ',                    $
                                dladsc[SPICE_DLA_FWDIDX]
            print, 'Character component base address = ',                    $
                                dladsc[SPICE_DLA_CBSIDX]
            print, 'Character component size         = ',                    $
                                dladsc[SPICE_DLA_CSZIDX]
            print, 'D.p. base address                = ',                    $
                                dladsc[SPICE_DLA_DBSIDX]
            print, 'D.p. component size              = ',                    $
                                dladsc[SPICE_DLA_DSZIDX]
            print, 'Integer base address             = ',                    $
                                dladsc[SPICE_DLA_IBSIDX]
            print, 'Integer component size           = ',                    $
                                dladsc[SPICE_DLA_ISZIDX]
            print, ' '

            ;;
            ;; Find the previous segment.
            ;;
            ;; To avoid using `dladsc' as both input and output
            ;; in the following call, we copy `dladsc'
            ;; into the variable `currnt'.  We then find the
            ;; segment preceding `currnt'.
            ;;
            currnt = dladsc
            cspice_dlafps, handle, currnt, dladsc, found

         endwhile

         ;;
         ;; Close the file using the DAS close routine.
         ;;
         cspice_dascls, handle

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, using the DSK file named phobos512.bds, the output
      was:


      Name of DLA file > phobos512.bds


      Segment number =            1

      Backward segment pointer         =           -1
      Forward segment pointer          =           -1
      Character component base address =            0
      Character component size         =            0
      D.p. base address                =            0
      D.p. component size              =      4737076
      Integer base address             =           11
      Integer component size           =     29692614


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. A backward traversal may be started from any segment in
   the file; it is not necessary to call cspice_dlabbs first. The role of
   cspice_dlabbs is simply to return the descriptor of the last segment in
   the file.

Exceptions


   1)  If the input file handle is invalid, an error is
       signaled by a routine in the call tree of this routine.

   2)  If a failure occurs while reading the DLA file, an error
       is signaled by a routine in the call tree of this routine.

   3)  If any of the input arguments, `handle' or `dladsc', is
       undefined, an error is signaled by the IDL error handling
       system.

   4)  If any of the input arguments, `handle' or `dladsc', is not of
       the expected type, or it does not have the expected dimensions
       and size, an error is signaled by the Icy interface.

   5)  If any of the output arguments, `prvdsc' or `found', is not a
       named variable, an error is signaled by the Icy interface.

Files


   See description of input argument `handle'.

Restrictions


   None.

Required_Reading


   DAS.REQ
   DLA.REQ
   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Icy Version 1.0.0, 16-JUL-2021 (JDR)

Index_Entries


   find previous segment in DLA file



Fri Dec 31 18:43:03 2021