1 /* ekssum.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 /* $Procedure      EKSSUM ( EK, return segment summary ) */
ekssum_(integer * handle,integer * segno,char * tabnam,integer * nrows,integer * ncols,char * cnames,char * dtypes,integer * sizes,integer * strlns,logical * indexd,logical * nullok,ftnlen tabnam_len,ftnlen cnames_len,ftnlen dtypes_len)9 /* Subroutine */ int ekssum_(integer *handle, integer *segno, char *tabnam,
10 	integer *nrows, integer *ncols, char *cnames, char *dtypes, integer *
11 	sizes, integer *strlns, logical *indexd, logical *nullok, ftnlen
12 	tabnam_len, ftnlen cnames_len, ftnlen dtypes_len)
13 {
14     /* Initialized data */
15 
16     static char typstr[4*4] = "CHR " "DP  " "INT " "TIME";
17 
18     /* System generated locals */
19     integer i__1, i__2, i__3;
20 
21     /* Builtin functions */
22     integer s_rnge(char *, integer, char *, integer);
23     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
24 
25     /* Local variables */
26     extern /* Subroutine */ int zzeksinf_(integer *, integer *, char *,
27 	    integer *, char *, integer *, ftnlen, ftnlen);
28     integer i__;
29     extern /* Subroutine */ int chkin_(char *, ftnlen);
30     extern logical failed_(void);
31     integer segdsc[24], cdscrs[1100]	/* was [11][100] */;
32     extern logical return_(void);
33     extern /* Subroutine */ int chkout_(char *, ftnlen);
34 
35 /* $ Abstract */
36 
37 /*     Return summary information for a specified segment in a */
38 /*     specified EK. */
39 
40 /* $ Disclaimer */
41 
42 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
43 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
44 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
45 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
46 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
47 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
48 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
49 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
50 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
51 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
52 
53 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
54 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
55 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
56 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
57 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
58 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
59 
60 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
61 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
62 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
63 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
64 
65 /* $ Required_Reading */
66 
67 /*     EK */
68 
69 /* $ Keywords */
70 
71 /*     EK */
72 /*     UTILITY */
73 
74 /* $ Declarations */
75 /* $ Disclaimer */
76 
77 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
78 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
79 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
80 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
81 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
82 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
83 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
84 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
85 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
86 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
87 
88 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
89 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
90 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
91 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
92 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
93 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
94 
95 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
96 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
97 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
98 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
99 
100 
101 /*     Include Section:  EK Boolean Enumerated Type */
102 
103 
104 /*        ekbool.inc Version 1   21-DEC-1994 (NJB) */
105 
106 
107 /*     Within the EK system, boolean values sometimes must be */
108 /*     represented by integer or character codes.  The codes and their */
109 /*     meanings are listed below. */
110 
111 /*     Integer code indicating `true': */
112 
113 
114 /*     Integer code indicating `false': */
115 
116 
117 /*     Character code indicating `true': */
118 
119 
120 /*     Character code indicating `false': */
121 
122 
123 /*     End Include Section:  EK Boolean Enumerated Type */
124 
125 /* $ Disclaimer */
126 
127 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
128 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
129 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
130 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
131 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
132 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
133 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
134 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
135 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
136 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
137 
138 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
139 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
140 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
141 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
142 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
143 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
144 
145 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
146 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
147 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
148 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
149 
150 
151 /*     Include Section:  EK Column Descriptor Parameters */
152 
153 /*        ekcoldsc.inc Version 6    23-AUG-1995 (NJB) */
154 
155 
156 /*     Note:  The column descriptor size parameter CDSCSZ  is */
157 /*     declared separately in the include section CDSIZE$INC.FOR. */
158 
159 /*     Offset of column descriptors, relative to start of segment */
160 /*     integer address range.  This number, when added to the last */
161 /*     integer address preceding the segment, yields the DAS integer */
162 /*     base address of the first column descriptor.  Currently, this */
163 /*     offset is exactly the size of a segment descriptor.  The */
164 /*     parameter SDSCSZ, which defines the size of a segment descriptor, */
165 /*     is declared in the include file eksegdsc.inc. */
166 
167 
168 /*     Size of column descriptor */
169 
170 
171 /*     Indices of various pieces of column descriptors: */
172 
173 
174 /*     CLSIDX is the index of the column's class code.  (We use the */
175 /*     word `class' to distinguish this item from the column's data */
176 /*     type.) */
177 
178 
179 /*     TYPIDX is the index of the column's data type code (CHR, INT, DP, */
180 /*     or TIME).  The type is actually implied by the class, but it */
181 /*     will frequently be convenient to look up the type directly. */
182 
183 
184 
185 /*     LENIDX is the index of the column's string length value, if the */
186 /*     column has character type.  A value of IFALSE in this element of */
187 /*     the descriptor indicates that the strings have variable length. */
188 
189 
190 /*     SIZIDX is the index of the column's element size value.  This */
191 /*     descriptor element is meaningful for columns with fixed-size */
192 /*     entries.  For variable-sized columns, this value is IFALSE. */
193 
194 
195 /*     NAMIDX is the index of the base address of the column's name. */
196 
197 
198 /*     IXTIDX is the data type of the column's index.  IXTIDX */
199 /*     contains a type value only if the column is indexed. For columns */
200 /*     that are not indexed, the location IXTIDX contains the boolean */
201 /*     value IFALSE. */
202 
203 
204 /*     IXPIDX is a pointer to the column's index.  IXTPDX contains a */
205 /*     meaningful value only if the column is indexed.  The */
206 /*     interpretation of the pointer depends on the data type of the */
207 /*     index. */
208 
209 
210 /*     NFLIDX is the index of a flag indicating whether nulls are */
211 /*     permitted in the column.  The value at location NFLIDX is */
212 /*     ITRUE if nulls are permitted and IFALSE otherwise. */
213 
214 
215 /*     ORDIDX is the index of the column's ordinal position in the */
216 /*     list of columns belonging to the column's parent segment. */
217 
218 
219 /*     METIDX is the index of the column's integer metadata pointer. */
220 /*     This pointer is a DAS integer address. */
221 
222 
223 /*     The last position in the column descriptor is reserved.  No */
224 /*     parameter is defined to point to this location. */
225 
226 
227 /*     End Include Section:  EK Column Descriptor Parameters */
228 
229 /* $ Disclaimer */
230 
231 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
232 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
233 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
234 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
235 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
236 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
237 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
238 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
239 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
240 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
241 
242 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
243 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
244 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
245 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
246 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
247 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
248 
249 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
250 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
251 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
252 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
253 
254 
255 /*     Include Section:  EK General Limit Parameters */
256 
257 /*        ekglimit.inc  Version 1    21-MAY-1995 (NJB) */
258 
259 
260 /*     This file contains general limits for the EK system. */
261 
262 /*     MXCLSG is the maximum number of columns allowed in a segment. */
263 /*     This limit applies to logical tables as well, since all segments */
264 /*     in a logical table must have the same column definitions. */
265 
266 
267 /*     End Include Section:  EK General Limit Parameters */
268 
269 /* $ Disclaimer */
270 
271 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
272 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
273 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
274 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
275 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
276 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
277 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
278 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
279 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
280 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
281 
282 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
283 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
284 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
285 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
286 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
287 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
288 
289 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
290 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
291 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
292 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
293 
294 
295 /*     Include Section:  EK Segment Descriptor Parameters */
296 
297 /*        eksegdsc.inc  Version 8  06-NOV-1995 (NJB) */
298 
299 
300 /*     All `base addresses' referred to below are the addresses */
301 /*     *preceding* the item the base applies to.  This convention */
302 /*     enables simplied address calculations in many cases. */
303 
304 /*     Size of segment descriptor.  Note:  the include file ekcoldsc.inc */
305 /*     must be updated if this parameter is changed.  The parameter */
306 /*     CDOFF in that file should be kept equal to SDSCSZ. */
307 
308 
309 /*     Index of the segment type code: */
310 
311 
312 /*     Index of the segment's number.  This number is the segment's */
313 /*     index in the list of segments contained in the EK to which */
314 /*     the segment belongs. */
315 
316 
317 /*     Index of the DAS integer base address of the segment's integer */
318 /*     meta-data: */
319 
320 
321 /*     Index of the DAS character base address of the table name: */
322 
323 
324 /*     Index of the segment's column count: */
325 
326 
327 /*     Index of the segment's record count: */
328 
329 
330 /*     Index of the root page number of the record tree: */
331 
332 
333 /*     Index of the root page number of the character data page tree: */
334 
335 
336 /*     Index of the root page number of the double precision data page */
337 /*     tree: */
338 
339 
340 /*     Index of the root page number of the integer data page tree: */
341 
342 
343 /*     Index of the `modified' flag: */
344 
345 
346 /*     Index of the `initialized' flag: */
347 
348 
349 /*     Index of the shadowing flag: */
350 
351 
352 /*     Index of the companion file handle: */
353 
354 
355 /*     Index of the companion segment number: */
356 
357 
358 /*     The next three items are, respectively, the page numbers of the */
359 /*     last character, d.p., and integer data pages allocated by the */
360 /*     segment: */
361 
362 
363 /*     The next three items are, respectively, the page-relative */
364 /*     indices of the last DAS word in use in the segment's */
365 /*     last character, d.p., and integer data pages: */
366 
367 
368 /*     Index of the DAS character base address of the column name list: */
369 
370 
371 /*     The last descriptor element is reserved for future use.  No */
372 /*     parameter is defined to point to this location. */
373 
374 
375 /*     End Include Section:  EK Segment Descriptor Parameters */
376 
377 /* $ Disclaimer */
378 
379 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
380 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
381 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
382 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
383 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
384 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
385 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
386 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
387 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
388 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
389 
390 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
391 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
392 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
393 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
394 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
395 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
396 
397 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
398 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
399 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
400 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
401 
402 
403 /*     Include Section:  EK Data Types */
404 
405 /*        ektype.inc Version 1  27-DEC-1994 (NJB) */
406 
407 
408 /*     Within the EK system, data types of EK column contents are */
409 /*     represented by integer codes.  The codes and their meanings */
410 /*     are listed below. */
411 
412 /*     Integer codes are also used within the DAS system to indicate */
413 /*     data types; the EK system makes no assumptions about compatibility */
414 /*     between the codes used here and those used in the DAS system. */
415 
416 
417 /*     Character type: */
418 
419 
420 /*     Double precision type: */
421 
422 
423 /*     Integer type: */
424 
425 
426 /*     `Time' type: */
427 
428 /*     Within the EK system, time values are represented as ephemeris */
429 /*     seconds past J2000 (TDB), and double precision numbers are used */
430 /*     to store these values.  However, since time values require special */
431 /*     treatment both on input and output, and since the `TIME' column */
432 /*     has a special role in the EK specification and code, time values */
433 /*     are identified as a type distinct from double precision numbers. */
434 
435 
436 /*     End Include Section:  EK Data Types */
437 
438 /* $ Brief_I/O */
439 
440 /*     Variable  I/O  Description */
441 /*     --------  ---  -------------------------------------------------- */
442 /*     HANDLE     I   Handle of EK. */
443 /*     SEGNO      I   Number of segment to be summarized. */
444 /*     TABNAM     O   Name of table containing segment. */
445 /*     NROWS      O   Number of rows in segment. */
446 /*     NCOLS      O   Number of columns in segment. */
447 /*     CNAMES     O   Names of columns in segment. */
448 /*     DTYPES     O   Data types of columns in segment. */
449 /*     SIZES      O   Entry sizes of columns in segment. */
450 /*     STRLNS     O   String lengths of columns in segment. */
451 /*     INDEXD     O   Flags indicating whether columns are indexed. */
452 /*     NULLOK     O   Flags indicating whether columns allow nulls. */
453 
454 /* $ Detailed_Input */
455 
456 /*     HANDLE         is an EK file handle specifying the EK containing */
457 /*                    the segment to be summarized. */
458 
459 /*     SEGNO          is the number of the segment whose summary is */
460 /*                    desired.  Segments are numbered from 1 to NSEG, */
461 /*                    where NSEG is the count of segments in the file. */
462 
463 /* $ Detailed_Output */
464 
465 /*     TABNAM         is the name of the table to which the segment */
466 /*                    belongs. */
467 
468 /*     NROWS          is the number of rows in the segment. */
469 
470 /*     NCOLS          is the number of columns in the segment.  The */
471 /*                    maximum number of columns in a segment is given */
472 /*                    by the parameter MXCLSG, which is defined in the */
473 /*                    include file */
474 
475 /*                       ekglimit.inc. */
476 
477 /*                    Currently, this limit is set at 100 columns. */
478 
479 /*     CNAMES         is an array of names of columns in the segment. */
480 
481 /*     DTYPES         is an array of data types of columns in the */
482 /*                    segment.  Each data type is indicated by a short */
483 /*                    character string.  The strings and their meanings */
484 /*                    are: */
485 
486 /*                       'CHR'       Character type. */
487 /*                       'DP'        Double precision type. */
488 /*                       'INT'       Integer type. */
489 /*                       'TIME'      Time type. */
490 
491 /*                    The Ith element of DTYPES corresponds to the */
492 /*                    column whose name is the Ith element of CNAMES. */
493 
494 /*     SIZES          is an array of declared sizes of column entries. */
495 /*                    The Ith element of SIZES is the declared size of */
496 /*                    the column whose name is the Ith element of CNAMES. */
497 /*                    Scalar-valued columns have size 1; fixed-size, */
498 /*                    array-valued columns have size greater than 1. */
499 /*                    Array valued columns of variable size have a size */
500 /*                    value of -1. */
501 
502 /*     STRLNS         is an array of declared string lengths of */
503 /*                    character column entries.  These lengths are */
504 /*                    defined only for columns of character type. */
505 /*                    The Ith element of SIZES is the declared size of */
506 /*                    the column whose name is the Ith element of CNAMES, */
507 /*                    if that column has character type; otherwise, the */
508 /*                    Ith element of STRLNS is undefined.  For */
509 /*                    character columns having variable string length, */
510 /*                    the returned value of STRLNS is -1. */
511 
512 /*     INDEXD         is an array of logical flags indicating whether the */
513 /*                    corresponding columns are indexed.  The Ith element */
514 /*                    of INDEXD applies to the column whose name is the */
515 /*                    Ith element of CNAMES. */
516 
517 /*     NULLOK         is an array of logical flags indicating whether the */
518 /*                    corresponding columns allow null values.  The Ith */
519 /*                    element of NULLOK applies to the column whose name */
520 /*                    is the Ith element of CNAMES. */
521 
522 /* $ Parameters */
523 
524 /*     None. */
525 
526 /* $ Exceptions */
527 
528 /*     1)  If HANDLE is invalid, the error will be diagnosed by routines */
529 /*         called by this routine.  The output arguments will not be */
530 /*         modified. */
531 
532 /*     2)  If SEGNO is not the index of an existing segment in the */
533 /*         specified file, the error SPICE(INDEXOUTOFRANGE) will be */
534 /*         signalled.  The output arguments will not be modified. */
535 
536 /*     3)  If an I/O error occurs while attempting to obtain summary */
537 /*         information for the specified segment, the error will be */
538 /*         diagnosed by routines called by this routine.  The output */
539 /*         arguments may be modified in this case. */
540 
541 /* $ Files */
542 
543 /*     See the description of HANDLE in $Detailed_Input. */
544 
545 /* $ Particulars */
546 
547 /*     This routine supports the function of summarizing a binary */
548 /*     EK file, allowing NAIF Toolkit users to determine whether it */
549 /*     contains data of interest.  The routine also also provides */
550 /*     address information necessary to retrieve information from the */
551 /*     segment. */
552 
553 /* $ Examples */
554 
555 /*     1)  Dump the table and column names of the segments in an EK. */
556 
557 /*            C */
558 /*            C     Open the EK for read access and get the number of */
559 /*            C     segments it contains. */
560 /*            C */
561 /*                  CALL EKOPR ( EKNAME, HANDLE ) */
562 
563 /*                  NSEG = EKNSEG ( HANDLE ) */
564 
565 /*            C */
566 /*            C     Loop through the segments, dumping the desired */
567 /*            C     summary information for each one. */
568 /*            C */
569 /*                  WRITE (*,*) ' ' */
570 /*                  WRITE (*,*) ' ' */
571 /*                  WRITE (*,*) 'Segment summary for file ', EKNAME */
572 /*                  WRITE (*,*) ' ' */
573 /*                  WRITE (*,*) ' ' */
574 
575 /*                  DO I = 1, NSEG */
576 
577 /*                     CALL EKSSUM (  HANDLE,  SEGNO,   TABNAM,  NROWS, */
578 /*                 .                  NCOLS,   CNAMES,  DTYPES,  SIZES, */
579 /*                 .                  STRLNS,  INDEXD,  NULLOK         ) */
580 
581 /*                     WRITE (*,*) */
582 /*                 .   '========================================'      // */
583 /*                 .   '========================================' */
584 
585 
586 /*                     WRITE (*,*) 'Table containing segment: ', TABNAM */
587 
588 /*                     WRITE (*,*) ' ' */
589 /*                     WRITE (*,*) 'Number of rows:     ', NROWS */
590 /*                     WRITE (*,*) 'Number of columns:  ', NCOLS */
591 /*                     WRITE (*,*) ' ' */
592 /*                     WRITE (*,*) 'Column names and attributes: ' */
593 /*                     WRITE (*,*) ' ' */
594 
595 /*                     DO J = 1, NCOLS */
596 
597 /*                        WRITE (*,*) 'Column:   '//CNAMES(J) */
598 /*                        WRITE (*,*) ' ' */
599 /*                        WRITE (*,*) 'Data type: ', DTYPES(J) */
600 /*                        WRITE (*,*) 'Dimension: ', SIZES(J) */
601 
602 /*                        IF ( DTYPES(J) .EQ. 'CHR' ) THEN */
603 /*                           WRITE (*,*) 'String length: ', STRLNS(J) */
604 /*                        END IF */
605 
606 /*                        IF ( INDEXD(J) ) THEN */
607 /*                           WRITE (*,*) 'Indexed' */
608 /*                        END IF */
609 
610 /*                        IF ( NULLOK(J) ) THEN */
611 /*                           WRITE (*,*) 'Nulls allowed' */
612 /*                        ELSE */
613 /*                           WRITE (*,*) 'Nulls not allowed' */
614 /*                        END IF */
615 
616 /*                        WRITE (*,*) ' ' */
617 /*                     END DO */
618 
619 /*                     WRITE (*,*) */
620 /*                 .   '========================================'      // */
621 /*                 .   '========================================' */
622 
623 /*                  END DO */
624 
625 /*                  END */
626 
627 /* $ Restrictions */
628 
629 /*     None. */
630 
631 /* $ Literature_References */
632 
633 /*     None. */
634 
635 /* $ Author_and_Institution */
636 
637 /*     N.J. Bachman   (JPL) */
638 
639 /* $ Version */
640 
641 /* -    SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
642 
643 /*        Bug fix:  correct parameter is now used to set dimension */
644 /*        of local variable SEGDSC. */
645 
646 /* -    Beta Version 1.0.0, 26-SEP-1995 (NJB) */
647 
648 /* -& */
649 /* $ Index_Entries */
650 
651 /*     return EK segment summary */
652 
653 /* -& */
654 /* $ Revisions */
655 
656 /* -    SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
657 
658 /*        Bug fix:  correct parameter SDSCSZ is now used to set dimension */
659 /*        of local variable SEGDSC.  Previously, the parameter */
660 /*        CDSCSZ had been used. */
661 
662 /* -& */
663 
664 /*     SPICELIB functions */
665 
666 
667 /*     Local parameters */
668 
669 
670 /*     Local variables */
671 
672 
673 /*     Saved variables */
674 
675 
676 /*     Initial values */
677 
678 
679 /*     Standard SPICE error handling. */
680 
681     if (return_()) {
682 	return 0;
683     } else {
684 	chkin_("EKSSUM", (ftnlen)6);
685     }
686 
687 /*     Get the info from a knowledgeable source. */
688 
689     zzeksinf_(handle, segno, tabnam, segdsc, cnames, cdscrs, tabnam_len,
690 	    cnames_len);
691     if (failed_()) {
692 	chkout_("EKSSUM", (ftnlen)6);
693 	return 0;
694     }
695     *nrows = segdsc[5];
696     *ncols = segdsc[4];
697     i__1 = *ncols;
698     for (i__ = 1; i__ <= i__1; ++i__) {
699 	s_copy(dtypes + (i__ - 1) * dtypes_len, typstr + (((i__3 = cdscrs[(
700 		i__2 = i__ * 11 - 10) < 1100 && 0 <= i__2 ? i__2 : s_rnge(
701 		"cdscrs", i__2, "ekssum_", (ftnlen)355)] - 1) < 4 && 0 <=
702 		i__3 ? i__3 : s_rnge("typstr", i__3, "ekssum_", (ftnlen)355))
703 		<< 2), dtypes_len, (ftnlen)4);
704 	sizes[i__ - 1] = cdscrs[(i__2 = i__ * 11 - 8) < 1100 && 0 <= i__2 ?
705 		i__2 : s_rnge("cdscrs", i__2, "ekssum_", (ftnlen)357)];
706 	if (cdscrs[(i__2 = i__ * 11 - 10) < 1100 && 0 <= i__2 ? i__2 : s_rnge(
707 		"cdscrs", i__2, "ekssum_", (ftnlen)359)] == 1) {
708 	    strlns[i__ - 1] = cdscrs[(i__2 = i__ * 11 - 9) < 1100 && 0 <=
709 		    i__2 ? i__2 : s_rnge("cdscrs", i__2, "ekssum_", (ftnlen)
710 		    360)];
711 	} else {
712 	    strlns[i__ - 1] = 0;
713 	}
714 	indexd[i__ - 1] = cdscrs[(i__2 = i__ * 11 - 6) < 1100 && 0 <= i__2 ?
715 		i__2 : s_rnge("cdscrs", i__2, "ekssum_", (ftnlen)365)] != -1;
716 	nullok[i__ - 1] = cdscrs[(i__2 = i__ * 11 - 4) < 1100 && 0 <= i__2 ?
717 		i__2 : s_rnge("cdscrs", i__2, "ekssum_", (ftnlen)366)] != -1;
718     }
719     chkout_("EKSSUM", (ftnlen)6);
720     return 0;
721 } /* ekssum_ */
722 
723