1 /*
2 
3 -Procedure ekucei_c ( EK, update integer column entry )
4 
5 -Abstract
6 
7    Update an integer column entry in a specified EK record.
8 
9 -Disclaimer
10 
11    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
12    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
13    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
14    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
15    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
16    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
17    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
18    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
19    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
20    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
21 
22    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
23    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
24    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
25    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
26    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
27    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
28 
29    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
30    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
31    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
32    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
33 
34 -Required_Reading
35 
36    EK
37 
38 -Keywords
39 
40    EK
41    FILES
42    UTILITY
43 
44 */
45 
46    #include "SpiceUsr.h"
47    #include "SpiceZfc.h"
48    #include "SpiceZmc.h"
49    #include "SpiceZim.h"
50    #undef    ekucei_c
51 
52 
ekucei_c(SpiceInt handle,SpiceInt segno,SpiceInt recno,ConstSpiceChar * column,SpiceInt nvals,ConstSpiceInt * ivals,SpiceBoolean isnull)53    void ekucei_c  ( SpiceInt          handle,
54                     SpiceInt          segno,
55                     SpiceInt          recno,
56                     ConstSpiceChar  * column,
57                     SpiceInt          nvals,
58                     ConstSpiceInt   * ivals,
59                     SpiceBoolean      isnull )
60 /*
61 
62 -Brief_I/O
63 
64    Variable  I/O  Description
65    --------  ---  --------------------------------------------------
66    handle     I   Handle attached to EK file.
67    segno      I   Index of segment containing record.
68    recno      I   Record in which entry is to be updated.
69    column     I   Column name.
70    nvals      I   Number of values in new column entry.
71    ivals      I   Integer values comprising new column entry.
72    isnull     I   Flag indicating whether column entry is null.
73 
74 -Detailed_Input
75 
76    handle         is a file handle attached to an EK open for
77                   write access.
78 
79    segno          is the index of the segment containing the column
80                   entry to be updated.  EK segment numbers range from
81                   0 to N-1, where N is the number of segments
82                   in the kernel.
83 
84    recno          is the index of the record containing the column
85                   entry to be updated.  This record number is
86                   relative to the start of the segment indicated by
87                   segno; the first record in the segment has index 0.
88 
89    column         is the name of the column containing the entry to
90                   be updated.
91 
92    nvals,
93    ivals          are, respectively, the number of values to insert into
94                   the specified column and the set of values
95                   themselves.  The data values are written in to the
96                   specifed column and record.
97 
98                   If the  column has fixed-size entries, then nvals
99                   must equal the entry size for the specified column.
100 
101                   For columns with variable-sized entries, the size
102                   of the new entry need not match the size of the
103                   entry it replaces.  In particular, the new entry
104                   may be larger.
105 
106    isnull         is a logical flag indicating whether the entry is
107                   null.  If isnull is SPICEFALSE, the column entry
108                   defined by nvals and ivals is added to the
109                   specified kernel file.
110 
111                   If ISNULL is SPICETRUE, nvals and ivals are ignored.
112                   The column entry is marked as a null value.
113                   The contents of the column entry are undefined.
114                   If the column has fixed-length, variable-size
115                   entries, the number of entries is considered to
116                   be 1.
117 
118                   The new entry may be null even though it replaces
119                   a non-null value, and vice versa.
120 
121 -Detailed_Output
122 
123    None.  See $Particulars for a description of the effect of this
124    routine.
125 
126 -Parameters
127 
128    None.
129 
130 -Exceptions
131 
132    1)  If handle is invalid, the error will be diagnosed by routines
133        called by this routine.
134 
135    2)  If segno is out of range, the error will diagnosed by routines
136        called by this routine.
137 
138    3)  If column is not the name of a declared column, the error
139        will be diagnosed by routines called by this routine.
140 
141    4)  If column specifies a column of whose data type is not
142        integer, the error SPICE(WRONGDATATYPE) will be
143        signaled.
144 
145    5)  If recno is out of range, the error will diagnosed by routines
146        called by this routine.
147 
148    6)  If the specified column has fixed-size entries and nvals
149        does not match this size, the error will diagnosed by routines
150        called by this routine.
151 
152    7)  If the specified column has variable-size entries and nvals
153        is non-positive, the error will diagnosed by routines
154        called by this routine.
155 
156    8)  If an attempt is made to add a null value to a column that
157        doesn't take null values, the error will diagnosed by routines
158        called by this routine.
159 
160    9)  If COLUMN specifies a column of whose class is not
161        an integer class known to this routine, the error
162        SPICE(NOCLASS) will be signaled.
163 
164    10) If an I/O error occurs while reading or writing the indicated
165        file, the error will be diagnosed by routines called by this
166        routine.
167 
168    11) If the input column name string pointer is null, the error
169        SPICE(NULLPOINTER) will be signaled.
170 
171    12) If the input column name string has length zero, the error
172        SPICE(EMPTYSTRING) will be signaled.
173 
174 
175 -Files
176 
177    See the EK Required Reading for a discussion of the EK file
178    format.
179 
180 -Particulars
181 
182    This routine operates by side effects:  it modifies the named
183    EK file by adding data to the specified record in the specified
184    column.  Data may be added to a segment in random order; it is not
185    necessary to fill in columns or rows sequentially. Data may only
186    be added one logical element at a time.  Partial assignments of
187    logical elements are not supported.
188 
189 -Examples
190 
191    1)  Replace the value in the third record of the column ICOL in
192        the fifth segment of an EK file designated by handle.  Set
193        the new value to 999.
194 
195           #include <SpiceUsr.h>
196               .
197               .
198               .
199           ekucei_c ( handle, 4, 2, "ICOL", 1, 999, SPICEFALSE );
200 
201 
202    2)  Same as (1), but this time add a null value.  The argument
203        999 is ignored because the null flag is set to SPICETRUE
204 
205           #include <SpiceUsr.h>
206               .
207               .
208               .
209           ekucei_c ( handle, 4, 2, "ICOL", 1, 999, SPICETRUE );
210 
211 
212    3)  Replace the entry in the third record of the column IARRAY in
213        the fifth segment of an EK file designated by handle.  Set
214        the new value using an array ibuff of 10 values.
215 
216           #include <SpiceUsr.h>
217               .
218               .
219               .
220           ekucei_c ( handle, 4, 2, "IARRAY", 10, ibuff, SPICEFALSE );
221 
222 -Restrictions
223 
224    None.
225 
226 -Literature_References
227 
228    None.
229 
230 -Author_and_Institution
231 
232    N.J. Bachman   (JPL)
233 
234 -Version
235 
236    -CSPICE Version 1.0.0, 28-AUG-2001 (NJB)
237 
238 -Index_Entries
239 
240    replace integer entry in an EK column
241 
242 -&
243 */
244 
245 { /* Begin ekucei_c */
246 
247 
248    /*
249    Local variables
250    */
251    logical                 null;
252 
253    /*
254    Participate in error tracing.
255    */
256    chkin_c ( "ekucei_c" );
257 
258    /*
259    Check the column name to make sure the pointer is non-null
260    and the string length is non-zero.
261    */
262    CHKFSTR ( CHK_STANDARD, "ekucei_c", column );
263 
264    /*
265    Convert the null flag to type logical before passing it to
266    ekucei_.  Also map the segment and record numbers to their
267    Fortran-style counterparts.
268    */
269 
270    null = isnull;
271 
272    segno++;
273    recno++;
274 
275    ekucei_  (  ( integer * ) &handle,
276                ( integer * ) &segno,
277                ( integer * ) &recno,
278                ( char    * )  column,
279                ( integer * ) &nvals,
280                ( integer * )  ivals,
281                ( logical * ) &null,
282                ( ftnlen    ) strlen(column) );
283 
284 
285    chkout_c ( "ekucei_c" );
286 
287 } /* End ekucei_c */
288