Index Page shellc_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 shellc_c ( SpiceInt     ndim,
                       SpiceInt     lenvals,
                       void       * array   )
#### Abstract
       Sort an array of character strings according to the ASCII
       collating sequence using the Shell Sort algorithm.
#### Required_Reading
       None.
#### Keywords
        ARRAY,  SORT
#### Brief_I/O
       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       ndim       I   Dimension of the array.
       lenvals    I   String length.
       array     I/O  The array.
#### Detailed_Input
       ndim        is the number of elements in the array to be sorted.

       lenvals     is the declared length of the strings in the input
                   string array, including null terminators.  The input
                   array should be declared with dimension

                      [ndim][lenvals]

       array       on input, is the array to be sorted.
#### Detailed_Output
       array       on output, contains the same elements, sorted
                   according to the ASCII collating sequence.
                   The actual sorting is done in place in array.
#### Parameters
       None.
#### Exceptions
       1) If ndim < 2, this routine does not modify the array.

       2) If the input string array pointer is null, the error
          SPICE(NULLPOINTER) will be signaled.

       3) If the input array string length is less than 2, the error
          SPICE(STRINGTOOSHORT) will be signaled.
#### Files
        None.
#### Particulars
       The Shell Sort Algorithm is well known.
#### Examples
       Let array contain the following elements:

          "FEYNMAN"
          "NEWTON"
          "EINSTEIN"
          "GALILEO"
          "EUCLID"
          "Galileo"

       Then after a call to shellc_c, the array would be ordered as
       follows:

          "EINSTEIN"
          "EUCLID"
          "FEYNMAN"
          "GALILEO"
          "Galileo"
          "NEWTON"
#### Restrictions
       1)  The input array is assumed to be sorted in increasing order. If
           this condition is not met, the results of bsrchc_c are unpredictable.

       2)  String comparisons performed by this routine are Fortran-style:
           trailing blanks in the input array or key value are ignored.
           This gives consistent behavior with CSPICE code generated by
           the f2c translator, as well as with the Fortran SPICE Toolkit.

           Note that this behavior is not identical to that of the ANSI
           C library functions strcmp and strncmp.
#### Literature_References
       None.
#### Author_and_Institution
       N.J. Bachman    (JPL)
       I.M. Underwood  (JPL)
#### Version
      -CSPICE Version 1.0.0, 18-JUL-2002 (NJB) (IMU)
#### Index_Entries
       shell sort a character array
#### Link to routine shellc_c source file shellc_c.c

    Wed Jun  9 13:05:29 2010