void shellc_c ( SpiceInt ndim,
void * array )
Sort an array of character strings according to the ASCII
collating sequence using the Shell Sort algorithm.
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
ndim I Dimension of the array.
lenvals I String length.
array I/O The array.
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
array on input, is the array to be sorted.
array on output, contains the same elements, sorted
according to the ASCII collating sequence.
The actual sorting is done in place in array.
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.
The Shell Sort Algorithm is well known.
Let array contain the following elements:
Then after a call to shellc_c, the array would be ordered as
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.
N.J. Bachman (JPL)
I.M. Underwood (JPL)
-CSPICE Version 1.0.0, 18-JUL-2002 (NJB) (IMU)
shell sort a character array