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
enchar

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

     ENCHAR ( Encode a character string )

     SUBROUTINE ENCHAR ( NUMBER, STRING )

Abstract

     Encode a nonnegative integer number into a character string
     as the expansion of the number in base CHBASE (a function of
     the size of the available character set).

Required_Reading

     None.

Keywords

     CELLS
     CHARACTER

Declarations

     IMPLICIT NONE

     INTEGER            NUMBER
     CHARACTER*(*)      STRING

     INTEGER            MINLEN
     PARAMETER        ( MINLEN = 5 )

Brief_I/O

     VARIABLE  I/O  DESCRIPTION
     --------  ---  --------------------------------------------------
     NUMBER     I   Number to be encoded.
     STRING     O   Encoded string.
     MINLEN     P   Minimum length of string.

Detailed_Input

     NUMBER   is an arbitrary nonnegative integer.

Detailed_Output

     STRING   is the character string implied by the ASCII
              interpretation of NUMBER when converted to its
              base CHBASE representation.

              Let L be the declared length of STRING, and let
              NUMBER be given by

                                  0           1                 L-1
                 NUMBER = a CHBASE  + a CHBASE  + ... + a CHBASE
                           1           2                 L

              Then

                 STRING(i:i) = CHAR(a )   for i = 1, L
                                     i

              Note that, just as for any other "numbers",
              the "digits" in STRING are arranged from right
              to left in order of increasing significance.
              The string is, in effect, "padded with nulls"
              on the left.

Parameters

     MINLEN   is the minimum length of a string into which a
              number may be encoded. In order to avoid padding
              long strings with hundreds, possibly thousands
              of null characters, only the first MINLEN characters
              of the string are actually used. Note that this
              also allows the encoded number to be preserved
              during assignments,

                 STR1 = STR2

              so long as both strings are of length MINLEN or
              greater.

Exceptions

     1)  If the length of the output string is less than MINLEN,
         the error SPICE(INSUFFLEN) is signaled.

     2)  If the number to be encoded is negative, the error
         SPICE(OUTOFRANGE) is signaled.

                                                          MINLEN
     3)  If the number to be encoded is larger than CHBASE       - 1,
         the error SPICE(OUTOFRANGE) is signaled.

Files

     None.

Particulars

     The value of CHBASE, which varies from machine to machine, is
     returned by a constant function of the same name.

Examples

     See: SCARDC, SSIZEC.

Restrictions

     None.

Literature_References

     None.

Author_and_Institution

     J. Diaz del Rio    (ODC Space)
     B.V. Semenov       (JPL)
     W.L. Taber         (JPL)
     I.M. Underwood     (JPL)

Version

    SPICELIB Version 1.1.0, 12-AUG-2021 (JDR)

        Added IMPLICIT NONE statement.

        Edited the header to comply with NAIF standard.

    SPICELIB Version 1.0.2, 31-JAN-2008 (BVS)

        Changed header section title '$C Revision' to '$C Revisions'.

    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, 31-JAN-1990 (WLT) (IMU)
Fri Dec 31 18:36:20 2021