kinfo_c

Index Page kinfo_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 kinfo_c ( ConstSpiceChar  * file,
                      SpiceInt          typlen,
                      SpiceInt          srclen,
                      SpiceChar       * filtyp,
                      SpiceChar       * source,
                      SpiceInt        * handle,
                      SpiceBoolean    * found  )
#### Abstract
       Return information about a loaded kernel specified by name.
#### Required_Reading
       None.
#### Keywords
       KERNEL
#### Brief_I/O
       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       file       I   Name of a kernel to fetch information for
       typlen     I   Available space in output kernel type string.
       srclen     I   Available space in output source string.
       filtyp     O   The type of the kernel.
       source     O   Name of the source file used to load file.
       handle     O   The handle attached to file.
       found      O   SPICETRUE if the specified file could be located.
#### Detailed_Input
       file        is the name of a kernel file for which descriptive
                   information is desired.

       typlen      is the amount of available space in the output kernel
                   type string.

       srclen      is the amount of available space in the output kernel
                   source string.
#### Detailed_Output
       filtyp      is the type of the kernel specified by file.  filtyp
                   will be empty if file is not on the list of kernels
                   loaded via furnsh_c.

       source      is the name of the source file that was used to
                   specify file as one to load.  If file was loaded
                   directly via a call to furnsh_c, source will be empty.
                   If file is not on the list of kernels loaded via
                   furnsh_c, source will be empty.

       handle      is the handle attached to file if it is a binary
                   kernel.  If file is a text kernel or meta-text kernel
                   handle will be zero. If file is not on the list of
                   kernels loaded via furnsh_c, handle will be set to zero.

       found       is returned SPICETRUE if the specified file exists.
                   If there is no such file, found will be set to
                   SPICEFALSE.
#### Parameters
       None.
#### Exceptions
       1) If the specified file is not on the list of files that
          are currently loaded via the interface furnsh_c, found
          will be SPICEFALSE, handle will be set to zero and filtyp
          and source will be set to empty strings.

       2) If any input or output character argument pointer is null, the
          error SPICE(NULLPOINTER) will be signaled.

       3) If either output string length argument is less than 1, the
          error SPICE(STRINGTOOSHORT) will be signaled.

       4) If either output string has length at least 1 but is too short to
          contain the output string, the corresponding is truncated on the
          right.  The output string is still null-terminated.
#### Files
       None.
#### Particulars
       This entry point allows you to request information directly
       for a specific SPICE kernel.
#### Examples
       Suppose you wish to determine the type of a loaded kernel
       so that you can call the correct summarizing routines
       for the kernel.  The following bit of pseudo code shows
       how you might use this entry point together with summarizing
       code to produce a report on the file.  (Note that the
       routines spk_summry, ck_summry, pck_summry and ek_summry
       are simply names to indicate what you might do with the
       information returned by kinfo_c.  They are not routines that
       are part of the SPICE Toolkit.)

          #include <stdio.h>
          #include "SpiceUsr.h"

          #define  FILLEN   128
          #define  TYPLEN   32
          #define  SRCLEN   128

          SpiceInt        which;
          SpiceInt        count;
          SpiceInt        handle;

          SpiceChar       file  [FILLEN];
          SpiceChar       filtyp[TYPLEN];
          SpiceChar       source[SRCLEN];

          SpiceBoolean    found;

          int main()
             {
             furnsh_c( "/kernels/standard.tm" );

             ktotal_c ( "all", &count );

             if ( count == 0 )
                {
                printf ( "No files loaded at this time.\n" );
                }
             else
                {
                printf ( "The loaded files files are: \n\n" );
                }

             for ( which = 0;  which < count;  which++ )
                {

                kdata_c ( which,  "all",    FILLEN,   TYPLEN, SRCLEN,
                         file,   filtyp,  source,  &handle,  &found );

                kinfo_c ( file, TYPLEN, SRCLEN, filtyp, source, &handle, &found );

                   if (  eqstr_c ( filtyp, "SPK" )  )
                      {
                      printf ( "%s is an SPK file.\n", file );
                      }
                   else if (  eqstr_c ( filtyp, "CK" )  )
                      {
                      printf ( "%s is a CK file.\n", file );
                      }
                   else if (  eqstr_c ( filtyp, "PCK" )  )
                      {
                      printf ( "%s is a PCK file.\n", file );
                      }
                   else if (  eqstr_c ( filtyp, "EK" )  )
                      {
                      printf ( "%s is an EK file.\n", file );
                      }
                   else if (  eqstr_c ( filtyp, "META" )  )
                      {
                      printf ( "%s is a meta-text kernel.\n", file );
                      }
                   else
                    {
                    printf ( "%s is a text kernel.\n", file );
                    }

                 }

              }
#### Restrictions
       None.
#### Literature_References
       None.
#### Author_and_Institution
       N.J. Bachman    (JPL)
       W.L. Taber      (JPL)
#### Version
       -CSPICE Version 1.1.2, 02-MAY-2008 (EDW)

          standard.ker renamed standard.tm

       -CSPICE Version 1.1.1, 05-SEP-2007 (EDW)

          Expanded Examples section to a full, compilable program.

       -CSPICE Version 1.1.0, 02-FEB-2003 (EDW)

          Corrected example code to match routine's argument list.

       -CSPICE Version 1.0.0, 01-SEP-1999 (NJB) (WLT)
#### Index_Entries
       Fetch information about a loaded SPICE kernel
#### Link to routine kinfo_c source file kinfo_c.c

    Thu Apr 16 08:58:26 2009