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