1 /* zzekrd07.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 
12 /* $Procedure   ZZEKRD07 ( EK, read class 7 column entry ) */
zzekrd07_(integer * handle,integer * segdsc,integer * coldsc,integer * recptr,integer * ival,logical * isnull)13 /* Subroutine */ int zzekrd07_(integer *handle, integer *segdsc, integer *
14 	coldsc, integer *recptr, integer *ival, logical *isnull)
15 {
16     /* System generated locals */
17     integer i__1, i__2;
18 
19     /* Local variables */
20     integer mdat[2];
21     extern integer zzekrp2n_(integer *, integer *, integer *);
22     char cflag[1];
23     integer q, r__;
24     extern /* Subroutine */ int chkin_(char *, ftnlen);
25     integer recno, ncols, addrss, colidx, datbas, metloc, nflbas, offset;
26     logical nullok;
27     extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *,
28 	    integer *, ftnlen), errhan_(char *, integer *, ftnlen), sigerr_(
29 	    char *, ftnlen), chkout_(char *, ftnlen), dasrdi_(integer *,
30 	    integer *, integer *, integer *), dasrdc_(integer *, integer *,
31 	    integer *, integer *, integer *, char *, ftnlen);
32 
33 /* $ Abstract */
34 
35 /*     Read a column entry from a specified record in a class 7 column. */
36 /*     Class 7 columns contain fixed-count, scalar integer values. */
37 
38 /* $ Disclaimer */
39 
40 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
41 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
42 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
43 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
44 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
45 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
46 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
47 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
48 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
49 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
50 
51 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
52 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
53 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
54 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
55 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
56 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
57 
58 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
59 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
60 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
61 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
62 
63 /* $ Required_Reading */
64 
65 /*     EK */
66 
67 /* $ Keywords */
68 
69 /*     EK */
70 /*     PRIVATE */
71 
72 /* $ Declarations */
73 /* $ Disclaimer */
74 
75 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
76 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
77 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
78 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
79 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
80 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
81 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
82 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
83 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
84 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
85 
86 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
87 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
88 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
89 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
90 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
91 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
92 
93 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
94 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
95 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
96 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
97 
98 
99 /*     Include Section:  EK Boolean Enumerated Type */
100 
101 
102 /*        ekbool.inc Version 1   21-DEC-1994 (NJB) */
103 
104 
105 /*     Within the EK system, boolean values sometimes must be */
106 /*     represented by integer or character codes.  The codes and their */
107 /*     meanings are listed below. */
108 
109 /*     Integer code indicating `true': */
110 
111 
112 /*     Integer code indicating `false': */
113 
114 
115 /*     Character code indicating `true': */
116 
117 
118 /*     Character code indicating `false': */
119 
120 
121 /*     End Include Section:  EK Boolean Enumerated Type */
122 
123 /* $ Disclaimer */
124 
125 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
126 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
127 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
128 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
129 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
130 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
131 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
132 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
133 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
134 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
135 
136 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
137 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
138 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
139 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
140 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
141 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
142 
143 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
144 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
145 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
146 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
147 
148 
149 /*     Include Section:  EK Column Class 7 Parameters */
150 
151 /*        ekclas07.inc  Version 1    07-NOV-1995 (NJB) */
152 
153 
154 /*     The following parameters give the offsets of items in the */
155 /*     class 7 integer metadata array. */
156 
157 /*     Data array base address: */
158 
159 
160 /*     Null flag array base address: */
161 
162 
163 /*     Size of class 7 metadata array: */
164 
165 
166 /*     End Include Section:  EK Column Class 7 Parameters */
167 
168 /* $ Disclaimer */
169 
170 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
171 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
172 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
173 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
174 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
175 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
176 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
177 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
178 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
179 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
180 
181 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
182 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
183 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
184 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
185 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
186 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
187 
188 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
189 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
190 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
191 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
192 
193 
194 /*     Include Section:  EK Column Descriptor Parameters */
195 
196 /*        ekcoldsc.inc Version 6    23-AUG-1995 (NJB) */
197 
198 
199 /*     Note:  The column descriptor size parameter CDSCSZ  is */
200 /*     declared separately in the include section CDSIZE$INC.FOR. */
201 
202 /*     Offset of column descriptors, relative to start of segment */
203 /*     integer address range.  This number, when added to the last */
204 /*     integer address preceding the segment, yields the DAS integer */
205 /*     base address of the first column descriptor.  Currently, this */
206 /*     offset is exactly the size of a segment descriptor.  The */
207 /*     parameter SDSCSZ, which defines the size of a segment descriptor, */
208 /*     is declared in the include file eksegdsc.inc. */
209 
210 
211 /*     Size of column descriptor */
212 
213 
214 /*     Indices of various pieces of column descriptors: */
215 
216 
217 /*     CLSIDX is the index of the column's class code.  (We use the */
218 /*     word `class' to distinguish this item from the column's data */
219 /*     type.) */
220 
221 
222 /*     TYPIDX is the index of the column's data type code (CHR, INT, DP, */
223 /*     or TIME).  The type is actually implied by the class, but it */
224 /*     will frequently be convenient to look up the type directly. */
225 
226 
227 
228 /*     LENIDX is the index of the column's string length value, if the */
229 /*     column has character type.  A value of IFALSE in this element of */
230 /*     the descriptor indicates that the strings have variable length. */
231 
232 
233 /*     SIZIDX is the index of the column's element size value.  This */
234 /*     descriptor element is meaningful for columns with fixed-size */
235 /*     entries.  For variable-sized columns, this value is IFALSE. */
236 
237 
238 /*     NAMIDX is the index of the base address of the column's name. */
239 
240 
241 /*     IXTIDX is the data type of the column's index.  IXTIDX */
242 /*     contains a type value only if the column is indexed. For columns */
243 /*     that are not indexed, the location IXTIDX contains the boolean */
244 /*     value IFALSE. */
245 
246 
247 /*     IXPIDX is a pointer to the column's index.  IXTPDX contains a */
248 /*     meaningful value only if the column is indexed.  The */
249 /*     interpretation of the pointer depends on the data type of the */
250 /*     index. */
251 
252 
253 /*     NFLIDX is the index of a flag indicating whether nulls are */
254 /*     permitted in the column.  The value at location NFLIDX is */
255 /*     ITRUE if nulls are permitted and IFALSE otherwise. */
256 
257 
258 /*     ORDIDX is the index of the column's ordinal position in the */
259 /*     list of columns belonging to the column's parent segment. */
260 
261 
262 /*     METIDX is the index of the column's integer metadata pointer. */
263 /*     This pointer is a DAS integer address. */
264 
265 
266 /*     The last position in the column descriptor is reserved.  No */
267 /*     parameter is defined to point to this location. */
268 
269 
270 /*     End Include Section:  EK Column Descriptor Parameters */
271 
272 /* $ Disclaimer */
273 
274 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
275 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
276 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
277 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
278 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
279 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
280 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
281 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
282 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
283 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
284 
285 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
286 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
287 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
288 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
289 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
290 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
291 
292 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
293 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
294 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
295 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
296 
297 
298 /*     Include Section:  EK Data Page Parameters */
299 
300 /*        ekfilpar.inc  Version 1  03-APR-1995 (NJB) */
301 
302 /*     These parameters apply to EK files using architecture 4. */
303 /*     These files use a paged DAS file as their underlying file */
304 /*     structure. */
305 
306 /*     In paged DAS EK files, data pages are structured:  they contain */
307 /*     metadata as well as data.  The metadata is located in the last */
308 /*     few addresses of each page, so as to interfere as little as */
309 /*     possible with calculation of data addresses. */
310 
311 /*     Each data page belongs to exactly one segment.  Some bookkeeping */
312 /*     information, such as record pointers, is also stored in data */
313 /*     pages. */
314 
315 /*     Each page contains a forward pointer that allows rapid lookup */
316 /*     of data items that span multiple pages.  Each page also keeps */
317 /*     track of the current number of links from its parent segment */
318 /*     to the page.  Link counts enable pages to `know' when they */
319 /*     are no longer in use by a segment; unused pages are deallocated */
320 /*     and returned to the free list. */
321 
322 /*     The parameters in this include file depend on the parameters */
323 /*     declared in the include file ekpage.inc.  If those parameters */
324 /*     change, this file must be updated.  The specified parameter */
325 /*     declarations we need from that file are: */
326 
327 /*        INTEGER               PGSIZC */
328 /*        PARAMETER           ( PGSIZC = 1024 ) */
329 
330 /*        INTEGER               PGSIZD */
331 /*        PARAMETER           ( PGSIZD = 128 ) */
332 
333 /*        INTEGER               PGSIZI */
334 /*        PARAMETER           ( PGSIZI = 256 ) */
335 
336 
337 
338 /*     Character pages use an encoding mechanism to represent integer */
339 /*     metadata.  Each integer is encoded in five consecutive */
340 /*     characters. */
341 
342 
343 /*     Character data page parameters: */
344 
345 
346 /*     Size of encoded integer: */
347 
348 
349 /*     Usable page size: */
350 
351 
352 /*     Location of character forward pointer: */
353 
354 
355 /*     Location of character link count: */
356 
357 
358 /*     Double precision data page parameters: */
359 
360 /*     Usable page size: */
361 
362 
363 /*     Location of d.p. forward pointer: */
364 
365 
366 /*     Location of d.p. link count: */
367 
368 
369 /*     Integer data page parameters: */
370 
371 /*     Usable page size: */
372 
373 
374 /*     Location of integer forward pointer: */
375 
376 
377 /*     Location of integer link count: */
378 
379 
380 /*     End Include Section:  EK Data Page Parameters */
381 
382 /* $ Disclaimer */
383 
384 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
385 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
386 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
387 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
388 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
389 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
390 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
391 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
392 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
393 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
394 
395 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
396 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
397 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
398 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
399 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
400 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
401 
402 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
403 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
404 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
405 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
406 
407 
408 /*     Include Section:  EK Das Paging Parameters */
409 
410 /*        ekpage.inc  Version 4    25-AUG-1995 (NJB) */
411 
412 
413 
414 /*     The EK DAS paging system makes use of the integer portion */
415 /*     of an EK file's DAS address space to store the few numbers */
416 /*     required to describe the system's state.  The allocation */
417 /*     of DAS integer addresses is shown below. */
418 
419 
420 /*                       DAS integer array */
421 
422 /*        +--------------------------------------------+ */
423 /*        |            EK architecture code            |  Address = 1 */
424 /*        +--------------------------------------------+ */
425 /*        |      Character page size (in DAS words)    | */
426 /*        +--------------------------------------------+ */
427 /*        |        Character page base address         | */
428 /*        +--------------------------------------------+ */
429 /*        |      Number of character pages in file     | */
430 /*        +--------------------------------------------+ */
431 /*        |   Number of character pages on free list   | */
432 /*        +--------------------------------------------+ */
433 /*        |      Character free list head pointer      |  Address = 6 */
434 /*        +--------------------------------------------+ */
435 /*        |                                            |  Addresses = */
436 /*        |           Metadata for d.p. pages          |    7--11 */
437 /*        |                                            | */
438 /*        +--------------------------------------------+ */
439 /*        |                                            |  Addresses = */
440 /*        |         Metadata for integer pages         |    12--16 */
441 /*        |                                            | */
442 /*        +--------------------------------------------+ */
443 /*                              . */
444 /*                              . */
445 /*                              . */
446 /*        +--------------------------------------------+ */
447 /*        |                                            |  End Address = */
448 /*        |                Unused space                |  integer page */
449 /*        |                                            |  end */
450 /*        +--------------------------------------------+ */
451 /*        |                                            |  Start Address = */
452 /*        |             First integer page             |  integer page */
453 /*        |                                            |  base */
454 /*        +--------------------------------------------+ */
455 /*                              . */
456 /*                              . */
457 /*                              . */
458 /*        +--------------------------------------------+ */
459 /*        |                                            | */
460 /*        |              Last integer page             | */
461 /*        |                                            | */
462 /*        +--------------------------------------------+ */
463 
464 /*     The following parameters indicate positions of elements in the */
465 /*     paging system metadata array: */
466 
467 
468 
469 /*     Number of metadata items per data type: */
470 
471 
472 /*     Character metadata indices: */
473 
474 
475 /*     Double precision metadata indices: */
476 
477 
478 /*     Integer metadata indices: */
479 
480 
481 /*     Size of metadata area: */
482 
483 
484 /*     Page sizes, in units of DAS words of the appropriate type: */
485 
486 
487 /*     Default page base addresses: */
488 
489 
490 /*     End Include Section:  EK Das Paging Parameters */
491 
492 /* $ Disclaimer */
493 
494 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
495 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
496 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
497 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
498 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
499 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
500 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
501 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
502 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
503 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
504 
505 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
506 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
507 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
508 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
509 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
510 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
511 
512 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
513 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
514 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
515 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
516 
517 
518 /*     Include Section:  EK Segment Descriptor Parameters */
519 
520 /*        eksegdsc.inc  Version 8  06-NOV-1995 (NJB) */
521 
522 
523 /*     All `base addresses' referred to below are the addresses */
524 /*     *preceding* the item the base applies to.  This convention */
525 /*     enables simplied address calculations in many cases. */
526 
527 /*     Size of segment descriptor.  Note:  the include file ekcoldsc.inc */
528 /*     must be updated if this parameter is changed.  The parameter */
529 /*     CDOFF in that file should be kept equal to SDSCSZ. */
530 
531 
532 /*     Index of the segment type code: */
533 
534 
535 /*     Index of the segment's number.  This number is the segment's */
536 /*     index in the list of segments contained in the EK to which */
537 /*     the segment belongs. */
538 
539 
540 /*     Index of the DAS integer base address of the segment's integer */
541 /*     meta-data: */
542 
543 
544 /*     Index of the DAS character base address of the table name: */
545 
546 
547 /*     Index of the segment's column count: */
548 
549 
550 /*     Index of the segment's record count: */
551 
552 
553 /*     Index of the root page number of the record tree: */
554 
555 
556 /*     Index of the root page number of the character data page tree: */
557 
558 
559 /*     Index of the root page number of the double precision data page */
560 /*     tree: */
561 
562 
563 /*     Index of the root page number of the integer data page tree: */
564 
565 
566 /*     Index of the `modified' flag: */
567 
568 
569 /*     Index of the `initialized' flag: */
570 
571 
572 /*     Index of the shadowing flag: */
573 
574 
575 /*     Index of the companion file handle: */
576 
577 
578 /*     Index of the companion segment number: */
579 
580 
581 /*     The next three items are, respectively, the page numbers of the */
582 /*     last character, d.p., and integer data pages allocated by the */
583 /*     segment: */
584 
585 
586 /*     The next three items are, respectively, the page-relative */
587 /*     indices of the last DAS word in use in the segment's */
588 /*     last character, d.p., and integer data pages: */
589 
590 
591 /*     Index of the DAS character base address of the column name list: */
592 
593 
594 /*     The last descriptor element is reserved for future use.  No */
595 /*     parameter is defined to point to this location. */
596 
597 
598 /*     End Include Section:  EK Segment Descriptor Parameters */
599 
600 /* $ Disclaimer */
601 
602 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
603 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
604 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
605 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
606 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
607 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
608 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
609 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
610 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
611 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
612 
613 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
614 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
615 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
616 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
617 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
618 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
619 
620 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
621 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
622 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
623 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
624 
625 
626 /*     Include Section:  EK Data Types */
627 
628 /*        ektype.inc Version 1  27-DEC-1994 (NJB) */
629 
630 
631 /*     Within the EK system, data types of EK column contents are */
632 /*     represented by integer codes.  The codes and their meanings */
633 /*     are listed below. */
634 
635 /*     Integer codes are also used within the DAS system to indicate */
636 /*     data types; the EK system makes no assumptions about compatibility */
637 /*     between the codes used here and those used in the DAS system. */
638 
639 
640 /*     Character type: */
641 
642 
643 /*     Double precision type: */
644 
645 
646 /*     Integer type: */
647 
648 
649 /*     `Time' type: */
650 
651 /*     Within the EK system, time values are represented as ephemeris */
652 /*     seconds past J2000 (TDB), and double precision numbers are used */
653 /*     to store these values.  However, since time values require special */
654 /*     treatment both on input and output, and since the `TIME' column */
655 /*     has a special role in the EK specification and code, time values */
656 /*     are identified as a type distinct from double precision numbers. */
657 
658 
659 /*     End Include Section:  EK Data Types */
660 
661 /* $ Brief_I/O */
662 
663 /*     Variable  I/O  Description */
664 /*     --------  ---  -------------------------------------------------- */
665 /*     HANDLE     I   Handle attached to EK file. */
666 /*     SEGDSC     I   Segment descriptor. */
667 /*     COLDSC     I   Column descriptor. */
668 /*     RECPTR     I   Record pointer. */
669 /*     IVAL       O   Integer value in column entry. */
670 /*     ISNULL     O   Flag indicating whether column entry is null. */
671 
672 /* $ Detailed_Input */
673 
674 /*     HANDLE         is an EK file handle. */
675 
676 /*     SEGDSC         is the descriptor of the segment from which data is */
677 /*                    to be read. */
678 
679 /*     COLDSC         is the descriptor of the column from which data is */
680 /*                    to be read. */
681 
682 /*     RECPTR         is a pointer to the record containing the column */
683 /*                    entry to be written.  For class 7 columns, record */
684 /*                    pointers are identical to record numbers. */
685 
686 /* $ Detailed_Output */
687 
688 /*     IVAL           is the value read from the specified column entry. */
689 
690 /*     ISNULL         is a logical flag indicating whether the column */
691 /*                    entry is null. */
692 
693 /* $ Parameters */
694 
695 /*     None. */
696 
697 /* $ Exceptions */
698 
699 /*     1)  If HANDLE is invalid, the error will be diagnosed by routines */
700 /*         called by this routine. */
701 
702 /*     2)  If the ordinal position of the column specified by COLDSC */
703 /*         is out of range, the error SPICE(INVALIDINDEX) is signaled. */
704 
705 /*     3)  If an I/O error occurs while reading the indicated file, */
706 /*         the error will be diagnosed by routines called by this */
707 /*         routine. */
708 
709 /* $ Files */
710 
711 /*     See the EK Required Reading for a discussion of the EK file */
712 /*     format. */
713 
714 /* $ Particulars */
715 
716 /*     This routine is a utility for reading data from class 7 columns. */
717 
718 /* $ Examples */
719 
720 /*     See EKRCEI. */
721 
722 /* $ Restrictions */
723 
724 /*     None. */
725 
726 /* $ Literature_References */
727 
728 /*     None. */
729 
730 /* $ Author_and_Institution */
731 
732 /*     N.J. Bachman   (JPL) */
733 
734 /* $ Version */
735 
736 /* -    SPICELIB Version 1.1.0, 07-FEB-2015 (NJB) */
737 
738 /*        Now uses ERRHAN to insert DAS file name into */
739 /*        long error messages. */
740 
741 /*        Bug fix: changed max column index in long error */
742 /*        message from NREC to NCOLS. */
743 
744 /* -    Beta Version 1.0.0, 09-NOV-1995 (NJB) */
745 
746 /* -& */
747 
748 /*     Non-SPICELIB functions */
749 
750 
751 /*     Local variables */
752 
753 
754 /*     Use discovery check-in. */
755 
756 
757 /*     Make sure the column exists. */
758 
759     ncols = segdsc[4];
760     colidx = coldsc[8];
761     metloc = coldsc[9];
762     nullok = coldsc[7] == 1;
763     if (colidx < 1 || colidx > ncols) {
764 	recno = zzekrp2n_(handle, &segdsc[1], recptr);
765 	chkin_("ZZEKRD07", (ftnlen)8);
766 	setmsg_("Column index = #; valid range is 1:#.SEGNO = #; RECNO = #; "
767 		"EK = #", (ftnlen)65);
768 	errint_("#", &colidx, (ftnlen)1);
769 	errint_("#", &ncols, (ftnlen)1);
770 	errint_("#", &segdsc[1], (ftnlen)1);
771 	errint_("#", &recno, (ftnlen)1);
772 	errhan_("#", handle, (ftnlen)1);
773 	sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
774 	chkout_("ZZEKRD07", (ftnlen)8);
775 	return 0;
776     }
777 
778 /*     Read the metadata block.  There are two items in the block: */
779 
780 /*        1) The base address of the first page of the data */
781 /*        2) The base address of the null flag array, if nulls are */
782 /*           permitted. */
783 
784     i__1 = metloc + 1;
785     i__2 = metloc + 2;
786     dasrdi_(handle, &i__1, &i__2, mdat);
787     datbas = mdat[0];
788     nflbas = mdat[1];
789 
790 /*     If null values are permitted, the first step is to get */
791 /*     the null flag for the value of interest.  Compute the */
792 /*     address of this flag. */
793 
794 /*     There are CPSIZE null flags per page, and each page has size */
795 /*     PGSIZC.  The null flags start at the beginning of the page. */
796 
797     if (nullok) {
798 	q = (*recptr - 1) / 1014;
799 	r__ = *recptr - q * 1014;
800 	offset = r__ + (q << 10);
801 	addrss = nflbas + offset;
802 	dasrdc_(handle, &addrss, &addrss, &c__1, &c__1, cflag, (ftnlen)1);
803 	*isnull = *(unsigned char *)cflag == 'T';
804 	if (*isnull) {
805 	    return 0;
806 	}
807     }
808 
809 /*     If we're still here, we'll read the data value. */
810 
811     *isnull = FALSE_;
812 
813 /*     The address calculation for the value is analogous to that */
814 /*     for the null flag. */
815 
816     q = (*recptr - 1) / 254;
817     r__ = *recptr - q * 254;
818     offset = r__ + (q << 8);
819     addrss = datbas + offset;
820     dasrdi_(handle, &addrss, &addrss, ival);
821     return 0;
822 } /* zzekrd07_ */
823 
824