bschoc_c |

## ProcedureSpiceInt bschoc_c ( ConstSpiceChar * value, SpiceInt ndim, SpiceInt lenvals, const void * array, ConstSpiceInt * order ) ## AbstractDo a binary search for a given value within a character string array, accompanied by an order vector. Return the index of the matching array entry, or -1 if the key value is not found. ## Required_ReadingNone. ## KeywordsARRAY, SEARCH ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- value I Key value to be found in array. ndim I Dimension of array. lenvals I String length. array I Character string array to search. order I Order vector. The function returns the index of the first matching array element or -1 if the value is not found. ## Detailed_Inputvalue is the key value to be found in the array. Trailing blanks space in this key are not significant: string matches found by this routine do not require trailing blanks in value to match those in the corresponding element of array. ndim is the dimension of the array. 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 is the array of character srings to be searched. Trailing blanks in the strings in this array are not significant. order is an order vector which can be used to access the elements of array in order. The contents of order are a permutation of the sequence of integers ranging from zero to ndim-1. ## Detailed_OutputThe function returns the index of the specified value in the input array. Indices range from zero to ndim-1. If the input array does not contain the specified value, the function returns -1. If the input array contains more than one occurrence of the specified value, the returned index may point to any of the occurrences. ## ParametersNone. ## Exceptions1) If ndim < 1 the function value is -1. This is not considered an error. 2) If input key value pointer is null, the error SPICE(NULLPOINTER) will be signaled. The function returns -1. 3) The input key value may have length zero. This case is not considered an error. 4) If the input array pointer is null, the error SPICE(NULLPOINTER) will be signaled. The function returns -1. 5) If the input array string's length is less than 2, the error SPICE(STRINGTOOSHORT) will be signaled. The function returns -1. 6) If memory cannot be allocated to create a Fortran-style version of the input order vector, the error SPICE(MALLOCFAILED) is signaled. The function returns -1 in this case. ## FilesNone. ## ParticularsA binary search is performed on the input array, whose order is given by an associated order vector. If an element of the array is found to match the input value, the index of that element is returned. If no matching element is found, -1 is returned. ## ExamplesLet the input arguments array and order contain the following elements: array order "FEYNMAN" 1 "BOHR" 2 "EINSTEIN" 0 "NEWTON" 4 "GALILEO" 3 Then ## Restrictions1) The input array is assumed to be sorted in increasing order. If this condition is not met, the results of ## Literature_ReferencesNone ## Author_and_InstitutionN.J. Bachman (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) ## Version-CSPICE Version 1.1.0, 07-MAR-2009 (NJB) This file now includes the header file f2cMang.h. This header supports name mangling of f2c library functions. Header sections were re-ordered. -CSPICE Version 1.0.0, 26-AUG-2002 (NJB) (WLT) (IMU) ## Index_Entriessearch in a character array |

Wed Apr 5 17:54:29 2017