1 /* zzekac09.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* Table of constant values */
9
10 static integer c__1 = 1;
11 static integer c__2 = 2;
12
13 /* $Procedure ZZEKAC09 ( EK, add class 9 column to segment ) */
zzekac09_(integer * handle,integer * segdsc,integer * coldsc,char * cvals,logical * nlflgs,integer * wkindx,ftnlen cvals_len)14 /* Subroutine */ int zzekac09_(integer *handle, integer *segdsc, integer *
15 coldsc, char *cvals, logical *nlflgs, integer *wkindx, ftnlen
16 cvals_len)
17 {
18 /* System generated locals */
19 integer i__1, i__2;
20
21 /* Builtin functions */
22 integer i_len(char *, ftnlen);
23 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
24
25 /* Local variables */
26 char page[1024];
27 integer from;
28 extern /* Subroutine */ int zzekcnam_(integer *, integer *, char *,
29 ftnlen), zzekacps_(integer *, integer *, integer *, integer *,
30 integer *, integer *), zzekordc_(char *, logical *, logical *,
31 integer *, integer *, ftnlen), zzekpgwc_(integer *, integer *,
32 char *, ftnlen), zzekwpai_(integer *, integer *, integer *,
33 integer *, integer *, integer *), zzekwpal_(integer *, integer *,
34 integer *, logical *, integer *, integer *), zzekslnk_(integer *,
35 integer *, integer *, integer *);
36 integer l, p, mbase, npage;
37 extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *,
38 ftnlen, ftnlen);
39 integer class__, nrows, cmbase;
40 extern logical return_(void);
41 char column[32];
42 integer colidx, datbas, dscbas, idxbas, idxpag, idxtyp, nflbas, nflpag,
43 nulptr, to;
44 logical fixlen, indexd, nullok;
45 extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *,
46 integer *, ftnlen), sigerr_(char *, ftnlen), chkout_(char *,
47 ftnlen), dasudi_(integer *, integer *, integer *, integer *);
48 integer spp;
49
50 /* $ Abstract */
51
52 /* Add an entire class 9 column to an EK segment. */
53
54 /* $ Disclaimer */
55
56 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
57 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
58 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
59 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
60 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
61 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
62 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
63 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
64 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
65 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
66
67 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
68 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
69 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
70 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
71 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
72 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
73
74 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
75 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
76 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
77 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
78
79 /* $ Required_Reading */
80
81 /* EK */
82
83 /* $ Keywords */
84
85 /* EK */
86
87 /* $ Declarations */
88 /* $ Disclaimer */
89
90 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
91 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
92 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
93 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
94 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
95 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
96 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
97 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
98 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
99 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
100
101 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
102 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
103 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
104 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
105 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
106 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
107
108 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
109 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
110 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
111 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
112
113
114 /* Include Section: EK Boolean Enumerated Type */
115
116
117 /* ekbool.inc Version 1 21-DEC-1994 (NJB) */
118
119
120 /* Within the EK system, boolean values sometimes must be */
121 /* represented by integer or character codes. The codes and their */
122 /* meanings are listed below. */
123
124 /* Integer code indicating `true': */
125
126
127 /* Integer code indicating `false': */
128
129
130 /* Character code indicating `true': */
131
132
133 /* Character code indicating `false': */
134
135
136 /* End Include Section: EK Boolean Enumerated Type */
137
138 /* $ Disclaimer */
139
140 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
141 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
142 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
143 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
144 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
145 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
146 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
147 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
148 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
149 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
150
151 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
152 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
153 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
154 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
155 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
156 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
157
158 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
159 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
160 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
161 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
162
163
164 /* Include Section: EK Column Class 9 Parameters */
165
166 /* ekclas08.inc Version 1 07-NOV-1995 (NJB) */
167
168
169 /* The following parameters give the offsets of items in the */
170 /* class 9 integer metadata array. */
171
172 /* Data array base address: */
173
174
175 /* Null flag array base address: */
176
177
178 /* Size of class 9 metadata array: */
179
180
181 /* End Include Section: EK Column Class 9 Parameters */
182
183 /* $ Disclaimer */
184
185 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
186 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
187 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
188 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
189 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
190 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
191 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
192 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
193 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
194 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
195
196 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
197 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
198 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
199 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
200 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
201 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
202
203 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
204 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
205 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
206 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
207
208
209 /* Include Section: EK Column Name Size */
210
211 /* ekcnamsz.inc Version 1 17-JAN-1995 (NJB) */
212
213
214 /* Size of column name, in characters. */
215
216
217 /* End Include Section: EK Column Name Size */
218
219 /* $ Disclaimer */
220
221 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
222 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
223 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
224 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
225 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
226 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
227 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
228 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
229 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
230 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
231
232 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
233 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
234 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
235 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
236 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
237 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
238
239 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
240 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
241 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
242 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
243
244
245 /* Include Section: EK Column Descriptor Parameters */
246
247 /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */
248
249
250 /* Note: The column descriptor size parameter CDSCSZ is */
251 /* declared separately in the include section CDSIZE$INC.FOR. */
252
253 /* Offset of column descriptors, relative to start of segment */
254 /* integer address range. This number, when added to the last */
255 /* integer address preceding the segment, yields the DAS integer */
256 /* base address of the first column descriptor. Currently, this */
257 /* offset is exactly the size of a segment descriptor. The */
258 /* parameter SDSCSZ, which defines the size of a segment descriptor, */
259 /* is declared in the include file eksegdsc.inc. */
260
261
262 /* Size of column descriptor */
263
264
265 /* Indices of various pieces of column descriptors: */
266
267
268 /* CLSIDX is the index of the column's class code. (We use the */
269 /* word `class' to distinguish this item from the column's data */
270 /* type.) */
271
272
273 /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */
274 /* or TIME). The type is actually implied by the class, but it */
275 /* will frequently be convenient to look up the type directly. */
276
277
278
279 /* LENIDX is the index of the column's string length value, if the */
280 /* column has character type. A value of IFALSE in this element of */
281 /* the descriptor indicates that the strings have variable length. */
282
283
284 /* SIZIDX is the index of the column's element size value. This */
285 /* descriptor element is meaningful for columns with fixed-size */
286 /* entries. For variable-sized columns, this value is IFALSE. */
287
288
289 /* NAMIDX is the index of the base address of the column's name. */
290
291
292 /* IXTIDX is the data type of the column's index. IXTIDX */
293 /* contains a type value only if the column is indexed. For columns */
294 /* that are not indexed, the location IXTIDX contains the boolean */
295 /* value IFALSE. */
296
297
298 /* IXPIDX is a pointer to the column's index. IXTPDX contains a */
299 /* meaningful value only if the column is indexed. The */
300 /* interpretation of the pointer depends on the data type of the */
301 /* index. */
302
303
304 /* NFLIDX is the index of a flag indicating whether nulls are */
305 /* permitted in the column. The value at location NFLIDX is */
306 /* ITRUE if nulls are permitted and IFALSE otherwise. */
307
308
309 /* ORDIDX is the index of the column's ordinal position in the */
310 /* list of columns belonging to the column's parent segment. */
311
312
313 /* METIDX is the index of the column's integer metadata pointer. */
314 /* This pointer is a DAS integer address. */
315
316
317 /* The last position in the column descriptor is reserved. No */
318 /* parameter is defined to point to this location. */
319
320
321 /* End Include Section: EK Column Descriptor Parameters */
322
323 /* $ Disclaimer */
324
325 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
326 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
327 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
328 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
329 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
330 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
331 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
332 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
333 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
334 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
335
336 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
337 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
338 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
339 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
340 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
341 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
342
343 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
344 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
345 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
346 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
347
348
349 /* Include Section: EK Data Page Parameters */
350
351 /* ekfilpar.inc Version 1 03-APR-1995 (NJB) */
352
353 /* These parameters apply to EK files using architecture 4. */
354 /* These files use a paged DAS file as their underlying file */
355 /* structure. */
356
357 /* In paged DAS EK files, data pages are structured: they contain */
358 /* metadata as well as data. The metadata is located in the last */
359 /* few addresses of each page, so as to interfere as little as */
360 /* possible with calculation of data addresses. */
361
362 /* Each data page belongs to exactly one segment. Some bookkeeping */
363 /* information, such as record pointers, is also stored in data */
364 /* pages. */
365
366 /* Each page contains a forward pointer that allows rapid lookup */
367 /* of data items that span multiple pages. Each page also keeps */
368 /* track of the current number of links from its parent segment */
369 /* to the page. Link counts enable pages to `know' when they */
370 /* are no longer in use by a segment; unused pages are deallocated */
371 /* and returned to the free list. */
372
373 /* The parameters in this include file depend on the parameters */
374 /* declared in the include file ekpage.inc. If those parameters */
375 /* change, this file must be updated. The specified parameter */
376 /* declarations we need from that file are: */
377
378 /* INTEGER PGSIZC */
379 /* PARAMETER ( PGSIZC = 1024 ) */
380
381 /* INTEGER PGSIZD */
382 /* PARAMETER ( PGSIZD = 128 ) */
383
384 /* INTEGER PGSIZI */
385 /* PARAMETER ( PGSIZI = 256 ) */
386
387
388
389 /* Character pages use an encoding mechanism to represent integer */
390 /* metadata. Each integer is encoded in five consecutive */
391 /* characters. */
392
393
394 /* Character data page parameters: */
395
396
397 /* Size of encoded integer: */
398
399
400 /* Usable page size: */
401
402
403 /* Location of character forward pointer: */
404
405
406 /* Location of character link count: */
407
408
409 /* Double precision data page parameters: */
410
411 /* Usable page size: */
412
413
414 /* Location of d.p. forward pointer: */
415
416
417 /* Location of d.p. link count: */
418
419
420 /* Integer data page parameters: */
421
422 /* Usable page size: */
423
424
425 /* Location of integer forward pointer: */
426
427
428 /* Location of integer link count: */
429
430
431 /* End Include Section: EK Data Page Parameters */
432
433 /* $ Disclaimer */
434
435 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
436 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
437 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
438 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
439 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
440 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
441 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
442 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
443 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
444 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
445
446 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
447 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
448 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
449 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
450 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
451 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
452
453 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
454 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
455 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
456 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
457
458
459 /* Include Section: EK Das Paging Parameters */
460
461 /* ekpage.inc Version 4 25-AUG-1995 (NJB) */
462
463
464
465 /* The EK DAS paging system makes use of the integer portion */
466 /* of an EK file's DAS address space to store the few numbers */
467 /* required to describe the system's state. The allocation */
468 /* of DAS integer addresses is shown below. */
469
470
471 /* DAS integer array */
472
473 /* +--------------------------------------------+ */
474 /* | EK architecture code | Address = 1 */
475 /* +--------------------------------------------+ */
476 /* | Character page size (in DAS words) | */
477 /* +--------------------------------------------+ */
478 /* | Character page base address | */
479 /* +--------------------------------------------+ */
480 /* | Number of character pages in file | */
481 /* +--------------------------------------------+ */
482 /* | Number of character pages on free list | */
483 /* +--------------------------------------------+ */
484 /* | Character free list head pointer | Address = 6 */
485 /* +--------------------------------------------+ */
486 /* | | Addresses = */
487 /* | Metadata for d.p. pages | 7--11 */
488 /* | | */
489 /* +--------------------------------------------+ */
490 /* | | Addresses = */
491 /* | Metadata for integer pages | 12--16 */
492 /* | | */
493 /* +--------------------------------------------+ */
494 /* . */
495 /* . */
496 /* . */
497 /* +--------------------------------------------+ */
498 /* | | End Address = */
499 /* | Unused space | integer page */
500 /* | | end */
501 /* +--------------------------------------------+ */
502 /* | | Start Address = */
503 /* | First integer page | integer page */
504 /* | | base */
505 /* +--------------------------------------------+ */
506 /* . */
507 /* . */
508 /* . */
509 /* +--------------------------------------------+ */
510 /* | | */
511 /* | Last integer page | */
512 /* | | */
513 /* +--------------------------------------------+ */
514
515 /* The following parameters indicate positions of elements in the */
516 /* paging system metadata array: */
517
518
519
520 /* Number of metadata items per data type: */
521
522
523 /* Character metadata indices: */
524
525
526 /* Double precision metadata indices: */
527
528
529 /* Integer metadata indices: */
530
531
532 /* Size of metadata area: */
533
534
535 /* Page sizes, in units of DAS words of the appropriate type: */
536
537
538 /* Default page base addresses: */
539
540
541 /* End Include Section: EK Das Paging Parameters */
542
543 /* $ Disclaimer */
544
545 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
546 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
547 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
548 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
549 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
550 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
551 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
552 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
553 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
554 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
555
556 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
557 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
558 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
559 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
560 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
561 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
562
563 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
564 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
565 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
566 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
567
568
569 /* Include Section: EK Segment Descriptor Parameters */
570
571 /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */
572
573
574 /* All `base addresses' referred to below are the addresses */
575 /* *preceding* the item the base applies to. This convention */
576 /* enables simplied address calculations in many cases. */
577
578 /* Size of segment descriptor. Note: the include file ekcoldsc.inc */
579 /* must be updated if this parameter is changed. The parameter */
580 /* CDOFF in that file should be kept equal to SDSCSZ. */
581
582
583 /* Index of the segment type code: */
584
585
586 /* Index of the segment's number. This number is the segment's */
587 /* index in the list of segments contained in the EK to which */
588 /* the segment belongs. */
589
590
591 /* Index of the DAS integer base address of the segment's integer */
592 /* meta-data: */
593
594
595 /* Index of the DAS character base address of the table name: */
596
597
598 /* Index of the segment's column count: */
599
600
601 /* Index of the segment's record count: */
602
603
604 /* Index of the root page number of the record tree: */
605
606
607 /* Index of the root page number of the character data page tree: */
608
609
610 /* Index of the root page number of the double precision data page */
611 /* tree: */
612
613
614 /* Index of the root page number of the integer data page tree: */
615
616
617 /* Index of the `modified' flag: */
618
619
620 /* Index of the `initialized' flag: */
621
622
623 /* Index of the shadowing flag: */
624
625
626 /* Index of the companion file handle: */
627
628
629 /* Index of the companion segment number: */
630
631
632 /* The next three items are, respectively, the page numbers of the */
633 /* last character, d.p., and integer data pages allocated by the */
634 /* segment: */
635
636
637 /* The next three items are, respectively, the page-relative */
638 /* indices of the last DAS word in use in the segment's */
639 /* last character, d.p., and integer data pages: */
640
641
642 /* Index of the DAS character base address of the column name list: */
643
644
645 /* The last descriptor element is reserved for future use. No */
646 /* parameter is defined to point to this location. */
647
648
649 /* End Include Section: EK Segment Descriptor Parameters */
650
651 /* $ Disclaimer */
652
653 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
654 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
655 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
656 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
657 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
658 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
659 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
660 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
661 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
662 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
663
664 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
665 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
666 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
667 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
668 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
669 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
670
671 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
672 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
673 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
674 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
675
676
677 /* Include Section: EK Data Types */
678
679 /* ektype.inc Version 1 27-DEC-1994 (NJB) */
680
681
682 /* Within the EK system, data types of EK column contents are */
683 /* represented by integer codes. The codes and their meanings */
684 /* are listed below. */
685
686 /* Integer codes are also used within the DAS system to indicate */
687 /* data types; the EK system makes no assumptions about compatibility */
688 /* between the codes used here and those used in the DAS system. */
689
690
691 /* Character type: */
692
693
694 /* Double precision type: */
695
696
697 /* Integer type: */
698
699
700 /* `Time' type: */
701
702 /* Within the EK system, time values are represented as ephemeris */
703 /* seconds past J2000 (TDB), and double precision numbers are used */
704 /* to store these values. However, since time values require special */
705 /* treatment both on input and output, and since the `TIME' column */
706 /* has a special role in the EK specification and code, time values */
707 /* are identified as a type distinct from double precision numbers. */
708
709
710 /* End Include Section: EK Data Types */
711
712 /* $ Brief_I/O */
713
714 /* Variable I/O Description */
715 /* -------- --- -------------------------------------------------- */
716 /* HANDLE I Handle attached to new EK file. */
717 /* SEGDSC I Segment descriptor. */
718 /* COLDSC I Column descriptor. */
719 /* CVALS I Character values to add to column. */
720 /* NLFLGS I Array of null flags for column entries. */
721 /* WKINDX I-O Work space for column index. */
722
723 /* $ Detailed_Input */
724
725 /* HANDLE the handle of an EK file that is open for writing. */
726 /* A `begin segment for fast load' operation must */
727 /* have already been performed for the designated */
728 /* segment. */
729
730 /* SEGDSC is a descriptor for the segment to which data is */
731 /* to be added. The segment descriptor is not */
732 /* updated by this routine, but some fields in the */
733 /* descriptor will become invalid after this routine */
734 /* returns. */
735
736 /* COLDSC is a descriptor for the column to be added. The */
737 /* column attributes must be filled in, but any */
738 /* pointers may be uninitialized. */
739
740 /* CVALS is an array containing the entire set of column */
741 /* entries for the specified column. The entries */
742 /* are listed in row-order: the column entry for the */
743 /* first row of the segment is first, followed by the */
744 /* column entry for the second row, and so on. The */
745 /* number of column entries must match the declared */
746 /* number of rows in the segment. Elements must be */
747 /* allocated for each column entry, including null */
748 /* entries. */
749
750 /* NLFLGS is an array of logical flags indicating whether */
751 /* the corresponding entries are null. If the Ith */
752 /* element of NLFLGS is .FALSE., the Ith column entry */
753 /* defined by CVALS is added to the specified segment */
754 /* in the specified kernel file. */
755
756 /* If the Ith element of NLFGLS is .TRUE., the */
757 /* contents of the Ith column entry are undefined. */
758
759 /* NLFLGS is used only for columns that allow null */
760 /* values; it's ignored for other columns. */
761
762 /* WKINDX is a work space array used for building a column */
763 /* index. If the column is indexed, the dimension of */
764 /* WKINDX must be at NROWS, where NROWS is the number */
765 /* of rows in the column. If the column is not */
766 /* indexed, this work space is not used, so the */
767 /* dimension may be any positive value. */
768
769 /* $ Detailed_Output */
770
771 /* None. See $Particulars for a description of the effect of this */
772 /* routine. */
773
774 /* $ Parameters */
775
776 /* None. */
777
778 /* $ Exceptions */
779
780 /* 1) If HANDLE is invalid, the error will be diagnosed by routines */
781 /* called by this routine. */
782
783 /* 2) If an I/O error occurs while reading or writing the indicated */
784 /* file, the error will be diagnosed by routines called by this */
785 /* routine. */
786
787 /* $ Files */
788
789 /* See the EK Required Reading for a discussion of the EK file */
790 /* format. */
791
792 /* $ Particulars */
793
794 /* This routine operates by side effects: it modifies the named */
795 /* EK file by adding data to the specified column. This routine */
796 /* writes the entire contents of the specified column in one shot. */
797 /* This routine creates columns much more efficiently than can be */
798 /* done by sequential calls to EKACEC, but has the drawback that */
799 /* the caller must use more memory for the routine's inputs. This */
800 /* routine cannot be used to add data to a partially completed */
801 /* column. */
802
803 /* Class 9 columns have fixed record counts, and contain */
804 /* fixed-length strings. */
805
806 /* $ Examples */
807
808 /* See EKACLC. */
809
810 /* $ Restrictions */
811
812 /* 1) This routine assumes the EK file has been set up */
813 /* properly for a fast load operation. */
814
815 /* $ Literature_References */
816
817 /* None. */
818
819 /* $ Author_and_Institution */
820
821 /* N.J. Bachman (JPL) */
822
823 /* $ Version */
824
825 /* - Beta Version 1.0.0, 09-NOV-1995 (NJB) */
826
827 /* -& */
828
829 /* SPICELIB functions */
830
831
832 /* Local variables */
833
834
835 /* Standard SPICE error handling. */
836
837 if (return_()) {
838 return 0;
839 } else {
840 chkin_("ZZEKAC09", (ftnlen)8);
841 }
842
843 /* Grab the column's attributes. Initialize the maximum non-blank */
844 /* width of the column. */
845
846 class__ = coldsc[0];
847 idxtyp = coldsc[5];
848 nulptr = coldsc[7];
849 colidx = coldsc[8];
850 l = coldsc[2];
851 nullok = nulptr != -1;
852 indexd = idxtyp != -1;
853 fixlen = l != -1;
854
855 /* This column had better be class 9. */
856
857 if (class__ != 9) {
858 zzekcnam_(handle, coldsc, column, (ftnlen)32);
859 setmsg_("Column class code # found in descriptor for column #. Clas"
860 "s should be 9.", (ftnlen)73);
861 errint_("#", &class__, (ftnlen)1);
862 errch_("#", column, (ftnlen)1, (ftnlen)32);
863 sigerr_("SPICE(NOCLASS)", (ftnlen)14);
864 chkout_("ZZEKAC09", (ftnlen)8);
865 return 0;
866 }
867
868 /* Make sure the column has fixed-length strings. */
869
870 if (! fixlen) {
871 zzekcnam_(handle, coldsc, column, (ftnlen)32);
872 setmsg_("Column # has variable string length; class 9 supports fixed"
873 "-length strings only.", (ftnlen)80);
874 errch_("#", column, (ftnlen)1, (ftnlen)32);
875 sigerr_("SPICE(BUG)", (ftnlen)10);
876 chkout_("ZZEKAC09", (ftnlen)8);
877 return 0;
878 }
879
880 /* Check the input string length. */
881
882 if (l < 0 || l > i_len(cvals, cvals_len) || l > 1014) {
883 setmsg_("String length # is just plain wrong.", (ftnlen)36);
884 errint_("#", &l, (ftnlen)1);
885 sigerr_("SPICE(INVALIDSIZE)", (ftnlen)18);
886 chkout_("ZZEKAC09", (ftnlen)8);
887 return 0;
888 }
889
890 /* Compute the number of strings we can hold in one page. */
891
892 spp = 1014 / l;
893
894 /* Find the number of rows in the segment. */
895
896 nrows = segdsc[5];
897
898 /* Decide how many pages are required to hold the array, and */
899 /* allocate that many new, contiguous pages. */
900
901 npage = (nrows + spp - 1) / spp;
902 zzekacps_(handle, segdsc, &c__1, &npage, &p, &datbas);
903
904 /* We'll use FROM to indicate the element of CVALS we're */
905 /* considering and TO to indicate the element of PAGE to write */
906 /* to. */
907
908 to = 1;
909 s_copy(page, " ", (ftnlen)1024, (ftnlen)1);
910 i__1 = nrows;
911 for (from = 1; from <= i__1; ++from) {
912
913 /* The Assignment. */
914
915 if (! nullok || ! nlflgs[from - 1]) {
916 s_copy(page + (to - 1), cvals + (from - 1) * cvals_len, to + l -
917 1 - (to - 1), cvals_len);
918 }
919 to += l;
920 if (to > 1014 - l + 1 || from == nrows) {
921
922 /* Either the current data page is full, or we've buffered */
923 /* the last of the available data. It's time to write out the */
924 /* current page. */
925
926 zzekpgwc_(handle, &p, page, (ftnlen)1024);
927
928 /* Set the link count. */
929
930 i__2 = (to - l) / l;
931 zzekslnk_(handle, &c__1, &p, &i__2);
932
933 /* Next page. */
934
935 ++p;
936 to = 1;
937 }
938 }
939
940 /* Update the column's metadata area to point to the data array. */
941
942 cmbase = coldsc[9];
943 i__1 = cmbase + 1;
944 i__2 = cmbase + 1;
945 dasudi_(handle, &i__1, &i__2, &datbas);
946
947 /* If the column is supposed to have an index, now is the time to */
948 /* build that index. Type 2 indexes are just order vectors. */
949
950 if (indexd) {
951
952 /* Compute the order vector. */
953
954 zzekordc_(cvals, &nullok, nlflgs, &nrows, wkindx, cvals_len);
955
956 /* Write out the index. */
957
958 zzekwpai_(handle, segdsc, &nrows, wkindx, &idxpag, &idxbas);
959
960 /* Update the column's metadata to point to the index. The */
961 /* pointer indicates base address of the index. Also set the */
962 /* index type in the column descriptor. */
963
964 mbase = segdsc[2];
965 dscbas = mbase + 24 + (colidx - 1) * 11;
966 i__1 = dscbas + 7;
967 i__2 = dscbas + 7;
968 dasudi_(handle, &i__1, &i__2, &idxbas);
969 i__1 = dscbas + 6;
970 i__2 = dscbas + 6;
971 dasudi_(handle, &i__1, &i__2, &c__2);
972 }
973 if (nullok) {
974
975 /* Nulls are allowed. Write out the null flag array. */
976
977 zzekwpal_(handle, segdsc, &nrows, nlflgs, &nflpag, &nflbas);
978
979 /* Update the column's metadata area to point to the null flag */
980 /* array. */
981
982 i__1 = cmbase + 2;
983 i__2 = cmbase + 2;
984 dasudi_(handle, &i__1, &i__2, &nflbas);
985 }
986 chkout_("ZZEKAC09", (ftnlen)8);
987 return 0;
988 } /* zzekac09_ */
989
990