appndc_c |
Table of contents
Procedureappndc_c ( Append an item to a character cell ) void appndc_c ( ConstSpiceChar * item, SpiceCell * cell ) AbstractAppend an item to a character cell. Required_ReadingCELLS KeywordsCELLS Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- item I The item to append. cell I-O The cell to which item will be appended. Detailed_Inputitem is a character string which is to be appended to `cell'. cell is a character SPICE cell to which `item' will be appended. `cell' must be declared as a character SpiceCell. CSPICE provides the following macro, which declares and initializes the cell SPICECHAR_CELL ( cell, CELLSZ, CELLMLEN ); where CELLSZ is the maximum capacity of `cell' and CELLMLEN is the maximum length of any member in the character cell. Detailed_Outputcell is the input cell with `item' appended. `item' is the last member of `cell'. If `cell' is actually a SPICE set on input and ceases to qualify as a set as result of the append operation, the `isSet' member of `cell' will be set to SPICEFALSE. ParametersNone. Exceptions1) If the input cell argument is a SpiceCell of type other than character, the error SPICE(TYPEMISMATCH) is signaled. 2) If the cell is not large enough to accommodate the addition of a new element, the error SPICE(CELLTOOSMALL) is signaled. 3) If the length of the item is longer than the length of the cell, `item' is truncated on the right. 4) If on input cell is actually a SPICE set, that is, it contains sorted elements with no duplicates, and if item is not strictly greater than the last element, on output the `isSet' member of cell will be set to SPICEFALSE. This case is not considered an error. 5) If the input string pointer is null, the error SPICE(NULLPOINTER) is signaled. FilesNone. ParticularsNone. Examples1) In the following example, the item "PLUTO" is appended to the character cell planets. planets is declared with string length NAMLEN. #include "SpiceUsr.h" . . . /. Declare the cell with string length NAMLEN and with maximum number of elements MAXSIZ. ./ SPICECHAR_CELL ( planets, MAXSIZ, NAMLEN ); . . . /. Before appending "PLUTO", suppose the cell planets' data array contains: Element 0: == "MERCURY" Element 1: == "VENUS" Element 2: == "EARTH" Element 3: == "MARS" Element 4: == "JUPITER" Element 5: == "SATURN" Element 6: == "URANUS" Element 7: == "NEPTUNE" Append the string "PLUTO" at index 8, and update the cell's cardinality. ./ appndc_c ( "PLUTO", &planets ); /. The cell's data array now has the contents Element 0: == "MERCURY" Element 1: == "VENUS" Element 2: == "EARTH" Element 3: == "MARS" Element 4: == "JUPITER" Element 5: == "SATURN" Element 6: == "URANUS" Element 7: == "NEPTUNE" Element 8: == "PLUTO" ./ Restrictions1) 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_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) H.A. Neilan (JPL) Version-CSPICE Version 1.1.1, 27-AUG-2021 (JDR) Edited the header to comply with NAIF standard. Extended description of argument "cell" in -Detailed_Input to include type and preferred declaration method. -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, 21-AUG-2002 (NJB) (HAN) Index_Entriesappend an item to a character cell |
Fri Dec 31 18:41:01 2021