1 /* zzekrcmp.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__24 = 24;
11 static integer c__11 = 11;
12 
13 /* $Procedure ZZEKRCMP ( EK, row comparison ) */
zzekrcmp_(integer * op,integer * ncols,integer * han1,integer * sgdsc1,integer * cdlst1,integer * row1,integer * elts1,integer * han2,integer * sgdsc2,integer * cdlst2,integer * row2,integer * elts2)14 logical zzekrcmp_(integer *op, integer *ncols, integer *han1, integer *sgdsc1,
15 	 integer *cdlst1, integer *row1, integer *elts1, integer *han2,
16 	integer *sgdsc2, integer *cdlst2, integer *row2, integer *elts2)
17 {
18     /* System generated locals */
19     logical ret_val;
20 
21     /* Local variables */
22     integer hans[2], elts[2], rows[2];
23     extern integer zzekecmp_(integer *, integer *, integer *, integer *,
24 	    integer *);
25     extern /* Subroutine */ int chkin_(char *, ftnlen), movei_(integer *,
26 	    integer *, integer *);
27     integer cldscs[22]	/* was [11][2] */, sgdscs[48]	/* was [24][2] */;
28     extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *,
29 	    integer *, ftnlen), sigerr_(char *, ftnlen), chkout_(char *,
30 	    ftnlen);
31     integer col, rel;
32 
33 /* $ Abstract */
34 
35 /*     Compare two EK rows, using as the order relation dictionary */
36 /*     ordering on a specified list of columns. */
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 /*     UTILITY */
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 Column Descriptor Parameters */
100 
101 /*        ekcoldsc.inc Version 6    23-AUG-1995 (NJB) */
102 
103 
104 /*     Note:  The column descriptor size parameter CDSCSZ  is */
105 /*     declared separately in the include section CDSIZE$INC.FOR. */
106 
107 /*     Offset of column descriptors, relative to start of segment */
108 /*     integer address range.  This number, when added to the last */
109 /*     integer address preceding the segment, yields the DAS integer */
110 /*     base address of the first column descriptor.  Currently, this */
111 /*     offset is exactly the size of a segment descriptor.  The */
112 /*     parameter SDSCSZ, which defines the size of a segment descriptor, */
113 /*     is declared in the include file eksegdsc.inc. */
114 
115 
116 /*     Size of column descriptor */
117 
118 
119 /*     Indices of various pieces of column descriptors: */
120 
121 
122 /*     CLSIDX is the index of the column's class code.  (We use the */
123 /*     word `class' to distinguish this item from the column's data */
124 /*     type.) */
125 
126 
127 /*     TYPIDX is the index of the column's data type code (CHR, INT, DP, */
128 /*     or TIME).  The type is actually implied by the class, but it */
129 /*     will frequently be convenient to look up the type directly. */
130 
131 
132 
133 /*     LENIDX is the index of the column's string length value, if the */
134 /*     column has character type.  A value of IFALSE in this element of */
135 /*     the descriptor indicates that the strings have variable length. */
136 
137 
138 /*     SIZIDX is the index of the column's element size value.  This */
139 /*     descriptor element is meaningful for columns with fixed-size */
140 /*     entries.  For variable-sized columns, this value is IFALSE. */
141 
142 
143 /*     NAMIDX is the index of the base address of the column's name. */
144 
145 
146 /*     IXTIDX is the data type of the column's index.  IXTIDX */
147 /*     contains a type value only if the column is indexed. For columns */
148 /*     that are not indexed, the location IXTIDX contains the boolean */
149 /*     value IFALSE. */
150 
151 
152 /*     IXPIDX is a pointer to the column's index.  IXTPDX contains a */
153 /*     meaningful value only if the column is indexed.  The */
154 /*     interpretation of the pointer depends on the data type of the */
155 /*     index. */
156 
157 
158 /*     NFLIDX is the index of a flag indicating whether nulls are */
159 /*     permitted in the column.  The value at location NFLIDX is */
160 /*     ITRUE if nulls are permitted and IFALSE otherwise. */
161 
162 
163 /*     ORDIDX is the index of the column's ordinal position in the */
164 /*     list of columns belonging to the column's parent segment. */
165 
166 
167 /*     METIDX is the index of the column's integer metadata pointer. */
168 /*     This pointer is a DAS integer address. */
169 
170 
171 /*     The last position in the column descriptor is reserved.  No */
172 /*     parameter is defined to point to this location. */
173 
174 
175 /*     End Include Section:  EK Column Descriptor Parameters */
176 
177 /* $ Disclaimer */
178 
179 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
180 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
181 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
182 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
183 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
184 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
185 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
186 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
187 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
188 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
189 
190 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
191 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
192 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
193 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
194 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
195 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
196 
197 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
198 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
199 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
200 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
201 
202 
203 /*     Include Section:  EK Operator Codes */
204 
205 /*        ekopcd.inc  Version 1  30-DEC-1994 (NJB) */
206 
207 
208 /*     Within the EK system, operators used in EK queries are */
209 /*     represented by integer codes.  The codes and their meanings are */
210 /*     listed below. */
211 
212 /*     Relational expressions in EK queries have the form */
213 
214 /*        <column name> <operator> <value> */
215 
216 /*     For columns containing numeric values, the operators */
217 
218 /*        EQ,  GE,  GT,  LE,  LT,  NE */
219 
220 /*     may be used; these operators have the same meanings as their */
221 /*     Fortran counterparts.  For columns containing character values, */
222 /*     the list of allowed operators includes those in the above list, */
223 /*     and in addition includes the operators */
224 
225 /*        LIKE,  UNLIKE */
226 
227 /*     which are used to compare strings to a template.  In the character */
228 /*     case, the meanings of the parameters */
229 
230 /*        GE,  GT,  LE,  LT */
231 
232 /*     match those of the Fortran lexical functions */
233 
234 /*        LGE, LGT, LLE, LLT */
235 
236 
237 /*     The additional unary operators */
238 
239 /*        ISNULL, NOTNUL */
240 
241 /*     are used to test whether a value of any type is null. */
242 
243 
244 
245 /*     End Include Section:  EK Operator Codes */
246 
247 /* $ Disclaimer */
248 
249 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
250 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
251 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
252 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
253 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
254 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
255 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
256 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
257 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
258 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
259 
260 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
261 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
262 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
263 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
264 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
265 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
266 
267 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
268 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
269 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
270 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
271 
272 
273 /*     Include Section:  EK Query Limit Parameters */
274 
275 /*        ekqlimit.inc  Version 3    16-NOV-1995 (NJB) */
276 
277 /*           Parameter MAXCON increased to 1000. */
278 
279 /*        ekqlimit.inc  Version 2    01-AUG-1995 (NJB) */
280 
281 /*           Updated to support SELECT clause. */
282 
283 
284 /*        ekqlimit.inc  Version 1    07-FEB-1995 (NJB) */
285 
286 
287 /*     These limits apply to character string queries input to the */
288 /*     EK scanner.  This limits are part of the EK system's user */
289 /*     interface:  the values should be advertised in the EK required */
290 /*     reading document. */
291 
292 
293 /*     Maximum length of an input query:  MAXQRY.  This value is */
294 /*     currently set to twenty-five 80-character lines. */
295 
296 
297 /*     Maximum number of columns that may be listed in the */
298 /*     `order-by clause' of a query:  MAXSEL.  MAXSEL = 50. */
299 
300 
301 /*     Maximum number of tables that may be listed in the `FROM */
302 /*     clause' of a query: MAXTAB. */
303 
304 
305 /*     Maximum number of relational expressions that may be listed */
306 /*     in the `constraint clause' of a query: MAXCON. */
307 
308 /*     This limit applies to a query when it is represented in */
309 /*     `normalized form': that is, the constraints have been */
310 /*     expressed as a disjunction of conjunctions of relational */
311 /*     expressions. The number of relational expressions in a query */
312 /*     that has been expanded in this fashion may be greater than */
313 /*     the number of relations in the query as orginally written. */
314 /*     For example, the expression */
315 
316 /*             ( ( A LT 1 ) OR ( B GT 2 ) ) */
317 /*        AND */
318 /*             ( ( C NE 3 ) OR ( D EQ 4 ) ) */
319 
320 /*     which contains 4 relational expressions, expands to the */
321 /*     equivalent normalized constraint */
322 
323 /*             (  ( A LT 1 ) AND ( C NE 3 )  ) */
324 /*        OR */
325 /*             (  ( A LT 1 ) AND ( D EQ 4 )  ) */
326 /*        OR */
327 /*             (  ( B GT 2 ) AND ( C NE 3 )  ) */
328 /*        OR */
329 /*             (  ( B GT 2 ) AND ( D EQ 4 )  ) */
330 
331 /*     which contains eight relational expressions. */
332 
333 
334 
335 /*     MXJOIN is the maximum number of tables that can be joined. */
336 
337 
338 /*     MXJCON is the maximum number of join constraints allowed. */
339 
340 
341 /*     Maximum number of order-by columns that may be used in the */
342 /*     `order-by clause' of a query: MAXORD. MAXORD = 10. */
343 
344 
345 /*     Maximum number of tokens in a query: 500. Tokens are reserved */
346 /*     words, column names, parentheses, and values. Literal strings */
347 /*     and time values count as single tokens. */
348 
349 
350 /*     Maximum number of numeric tokens in a query: */
351 
352 
353 /*     Maximum total length of character tokens in a query: */
354 
355 
356 /*     Maximum length of literal string values allowed in queries: */
357 /*     MAXSTR. */
358 
359 
360 /*     End Include Section:  EK Query Limit Parameters */
361 
362 /* $ Disclaimer */
363 
364 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
365 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
366 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
367 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
368 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
369 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
370 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
371 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
372 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
373 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
374 
375 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
376 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
377 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
378 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
379 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
380 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
381 
382 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
383 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
384 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
385 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
386 
387 
388 /*     Include Section:  EK Segment Descriptor Parameters */
389 
390 /*        eksegdsc.inc  Version 8  06-NOV-1995 (NJB) */
391 
392 
393 /*     All `base addresses' referred to below are the addresses */
394 /*     *preceding* the item the base applies to.  This convention */
395 /*     enables simplied address calculations in many cases. */
396 
397 /*     Size of segment descriptor.  Note:  the include file ekcoldsc.inc */
398 /*     must be updated if this parameter is changed.  The parameter */
399 /*     CDOFF in that file should be kept equal to SDSCSZ. */
400 
401 
402 /*     Index of the segment type code: */
403 
404 
405 /*     Index of the segment's number.  This number is the segment's */
406 /*     index in the list of segments contained in the EK to which */
407 /*     the segment belongs. */
408 
409 
410 /*     Index of the DAS integer base address of the segment's integer */
411 /*     meta-data: */
412 
413 
414 /*     Index of the DAS character base address of the table name: */
415 
416 
417 /*     Index of the segment's column count: */
418 
419 
420 /*     Index of the segment's record count: */
421 
422 
423 /*     Index of the root page number of the record tree: */
424 
425 
426 /*     Index of the root page number of the character data page tree: */
427 
428 
429 /*     Index of the root page number of the double precision data page */
430 /*     tree: */
431 
432 
433 /*     Index of the root page number of the integer data page tree: */
434 
435 
436 /*     Index of the `modified' flag: */
437 
438 
439 /*     Index of the `initialized' flag: */
440 
441 
442 /*     Index of the shadowing flag: */
443 
444 
445 /*     Index of the companion file handle: */
446 
447 
448 /*     Index of the companion segment number: */
449 
450 
451 /*     The next three items are, respectively, the page numbers of the */
452 /*     last character, d.p., and integer data pages allocated by the */
453 /*     segment: */
454 
455 
456 /*     The next three items are, respectively, the page-relative */
457 /*     indices of the last DAS word in use in the segment's */
458 /*     last character, d.p., and integer data pages: */
459 
460 
461 /*     Index of the DAS character base address of the column name list: */
462 
463 
464 /*     The last descriptor element is reserved for future use.  No */
465 /*     parameter is defined to point to this location. */
466 
467 
468 /*     End Include Section:  EK Segment Descriptor Parameters */
469 
470 /* $ Disclaimer */
471 
472 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
473 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
474 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
475 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
476 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
477 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
478 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
479 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
480 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
481 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
482 
483 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
484 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
485 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
486 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
487 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
488 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
489 
490 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
491 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
492 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
493 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
494 
495 
496 /*     Include Section:  EK Data Types */
497 
498 /*        ektype.inc Version 1  27-DEC-1994 (NJB) */
499 
500 
501 /*     Within the EK system, data types of EK column contents are */
502 /*     represented by integer codes.  The codes and their meanings */
503 /*     are listed below. */
504 
505 /*     Integer codes are also used within the DAS system to indicate */
506 /*     data types; the EK system makes no assumptions about compatibility */
507 /*     between the codes used here and those used in the DAS system. */
508 
509 
510 /*     Character type: */
511 
512 
513 /*     Double precision type: */
514 
515 
516 /*     Integer type: */
517 
518 
519 /*     `Time' type: */
520 
521 /*     Within the EK system, time values are represented as ephemeris */
522 /*     seconds past J2000 (TDB), and double precision numbers are used */
523 /*     to store these values.  However, since time values require special */
524 /*     treatment both on input and output, and since the `TIME' column */
525 /*     has a special role in the EK specification and code, time values */
526 /*     are identified as a type distinct from double precision numbers. */
527 
528 
529 /*     End Include Section:  EK Data Types */
530 
531 /* $ Brief_I/O */
532 
533 /*     Variable  I/O  Description */
534 /*     --------  ---  -------------------------------------------------- */
535 /*     OP         I   Code for relational operator. */
536 /*     NCOLS      I   Number of columns used to define order relation. */
537 /*     HAN1       I   Handle of EK containing first row to compare. */
538 /*     SGDSC1     I   Descriptor of segment containing first row. */
539 /*     ROW1       I   Number of first row (relative to segment). */
540 /*     ELTS1      I   List of element indices for first row. */
541 /*     CDLST1     I   List of column descriptors for first row. */
542 /*     HAN2       I   Handle of EK containing second row to compare. */
543 /*     SGDSC2     I   Descriptor of segment containing second row. */
544 /*     ROW2       I   Number of second row (relative to segment). */
545 /*     CDLST2     I   List of column descriptors for second row. */
546 /*     ELTS2      I   List of element indices for second row. */
547 
548 /*     The function returns .TRUE. if and only if the two rows */
549 /*     satisfy the order relation specified by the input arguments. */
550 
551 /* $ Detailed_Input */
552 
553 /*     OP             is an integer code representing a binary operator */
554 /*                    that expresses an order relation.  The allowed */
555 /*                    values of OP are the parameters */
556 
557 /*                       EQ */
558 /*                       GE */
559 /*                       GT */
560 /*                       LE */
561 /*                       LT */
562 /*                       NE */
563 
564 /*                    This routine test whether the input rows satisfy */
565 /*                    the order relation */
566 
567 /*                       <row1> OP <row2> */
568 
569 
570 /*     NCOLS          is the number of columns used to define a */
571 /*                    dictionary ordering. */
572 
573 /*     HAN1           is the file handle of the EK containing the first */
574 /*                    row. */
575 
576 /*     SGDSC1         is the segment descriptor of the EK segment */
577 /*                    containing the first of the two rows to be */
578 /*                    compared. */
579 
580 /*     CDLST1         is a list of column descriptors.  These descriptors */
581 /*                    identify the columns that define the dictionary */
582 /*                    ordering used to compare the input rows. */
583 
584 /*     ROW1           is the row number of the first row to be compared. */
585 
586 /*     ELTS1          is a list of column entry element indices for the */
587 /*                    first row.  These indices identify the elements */
588 /*                    to be used in the row comparison.  The value of */
589 /*                    ELTS1(I) is used only if the column specified by */
590 /*                    the Ith column descriptor of CDLST1 is */
591 /*                    array-valued. */
592 
593 /*     HAN2           is the file handle of the EK containing the second */
594 /*                    row to be compared. */
595 
596 /*     SGDSC2         is the segment descriptor of the EK segment */
597 /*                    containing the second row. */
598 
599 /*     CDLST2         is a list of column descriptors for the second row. */
600 /*                    This list parallels CDLST1:  the Nth descriptor */
601 /*                    in CDLST2 is for a column having the same name and */
602 /*                    attributes as that designated by the Nth descriptor */
603 /*                    in CDLST1. */
604 
605 /*     ROW2           is the row number of the second row. */
606 
607 /*     ELTS2          is a list of column entry element indices for the */
608 /*                    second row.  These indices identify the elements */
609 /*                    to be used in the row comparison.  The value of */
610 /*                    ELTS2(I) is used only if the column specified by */
611 /*                    the Ith column descriptor of CDLST2 is */
612 /*                    array-valued. */
613 
614 /* $ Detailed_Output */
615 
616 /*     The function returns .TRUE. if and only if the two rows satisfy */
617 /*     the order relation specified by the input arguments: */
618 
619 /*        <row 1> OP <row 2> */
620 
621 /*     The ordering used to compare the rows is a dictionary ordering */
622 /*     defined by the column descriptor lists CDLST1 and CDLST2.  The */
623 /*     order relationship between the columns is determined by comparing */
624 /*     the entries in both rows in the column identified by CDLST1(*,1) */
625 /*     and CDLST2(*,1); if these column entries are equal, the entries */
626 /*     identified by CDLST1(*,2) and CDLST2(*,2) are compared, and so */
627 /*     on, until the tie is broken or all of the specified column entries */
628 /*     have been compared. */
629 
630 /* $ Parameters */
631 
632 /*     Within the EK system, relational operators used in EK queries are */
633 /*     represented by integer codes.  The codes and their meanings are */
634 /*     listed below. */
635 
636 /*     Relational expressions in EK queries have the form */
637 
638 /*        <column name> <operator> <value> */
639 
640 /*     For columns containing numeric values, the operators */
641 
642 /*        EQ,  GE,  GT,  LE,  LT,  NE */
643 
644 /*     may be used; these operators have the same meanings as their */
645 /*     Fortran counterparts.  In the character case, the same operators */
646 /*     may be used; the meanings of the parameters */
647 
648 /*        GE,  GT,  LE,  LT */
649 
650 /*     match those of the Fortran lexical functions */
651 
652 /*        LGE, LGT, LLE, LLT */
653 
654 /*     Null values are considered to precede all non-null values. */
655 
656 /* $ Exceptions */
657 
658 /*     1)  If the either of input file handles is invalid, the error */
659 /*         will be diagnosed by routines called by this routine. */
660 /*         The function value is .FALSE. in this case. */
661 
662 /*     2)  If an I/O error occurs while attempting to find the address */
663 /*         range of the specified column entry element, the error will */
664 /*         be diagnosed by routines called by this routine.  The */
665 /*         function value is .FALSE. in this case. */
666 
667 /*     3)  If any of the input segment descriptors, column descriptors, */
668 /*         or row numbers are invalid, this routine may fail in */
669 /*         unpredictable, but possibly spectacular, ways.  Except */
670 /*         as described in this header section, no attempt is made to */
671 /*         handle these errors. */
672 
673 /*     4)  If the data type code in the input column descriptor is not */
674 /*         recognized, the error SPICE(INVALIDDATATYPE) is signalled. */
675 /*         The function value is .FALSE. in this case. */
676 
677 /*     5)  If the relational operator code OP is not recognized, the */
678 /*         error SPICE(UNNATURALRELATION) is signalled. */
679 /*         The function value is .FALSE. in this case. */
680 
681 /* $ Files */
682 
683 /*     See the descriptions of the arguments HAN1 and HAN2 in */
684 /*     $Detailed_Input. */
685 
686 /* $ Particulars */
687 
688 /*     This routine is an EK utility intended to centralize a frequently */
689 /*     performed comparison operation. */
690 
691 /* $ Examples */
692 
693 /*     See EKSRCH. */
694 
695 /* $ Restrictions */
696 
697 /*     1)  This routine must execute quickly.  Therefore, it checks in */
698 /*         only if it detects an error.  If an error is signalled by a */
699 /*         routine called by this routine, this routine will not appear */
700 /*         in the SPICELIB traceback display.  Also, in the interest */
701 /*         of speed, this routine does not test the value of the SPICELIB */
702 /*         function RETURN upon entry. */
703 
704 /* $ Literature_References */
705 
706 /*     None. */
707 
708 /* $ Author_and_Institution */
709 
710 /*     N.J. Bachman   (JPL) */
711 
712 /* $ Version */
713 
714 /* -    SPICELIB Version 1.0.1, 02-JAN-2007 (EDW) */
715 
716 /*        Edited to remove typo in function declaration. */
717 /*        Declaration included an extraneous continutation */
718 /*        marker. */
719 
720 /* -    Beta Version 1.0.0, 17-OCT-1995 (NJB) */
721 
722 /* -& */
723 
724 /*     Non-SPICELIB functions */
725 
726 
727 /*     Local variables */
728 
729 
730 /*     Use discovery check-in for speed. */
731 
732 /*     The function value defaults to .FALSE. */
733 
734     ret_val = FALSE_;
735 
736 /*     The input column descriptors identify the columns to be used */
737 /*     to define an order relation on the input rows.  The order */
738 /*     relation is `dictionary' ordering:  if the elements of the */
739 /*     first n columns of both rows are equal, the corresponding */
740 /*     elements in the (n+1)st columns are compared to attempt to */
741 /*     break the tie. */
742 
743 /*     The first step is to determine the relation that holds between */
744 /*     the rows.  We start out assuming we have equality. */
745 
746     hans[0] = *han1;
747     hans[1] = *han2;
748     movei_(sgdsc1, &c__24, sgdscs);
749     movei_(sgdsc2, &c__24, &sgdscs[24]);
750     rows[0] = *row1;
751     rows[1] = *row2;
752     rel = 1;
753     col = 1;
754     while(col <= *ncols && rel == 1) {
755 
756 /*        Compare the entries in the two rows in the columns indicated */
757 /*        by the Nth column descriptor pair. */
758 
759 	movei_(&cdlst1[col * 11 - 11], &c__11, cldscs);
760 	movei_(&cdlst2[col * 11 - 11], &c__11, &cldscs[11]);
761 	elts[0] = elts1[col - 1];
762 	elts[1] = elts2[col - 1];
763 	rel = zzekecmp_(hans, sgdscs, cldscs, rows, elts);
764 
765 /*        We've completed the comparison for the column numbered COL. */
766 
767 	++col;
768     }
769 
770 /*     Determine the truth of the input relational expression. */
771 
772     if (*op == 1) {
773 	ret_val = rel == 1;
774     } else if (*op == 5) {
775 	ret_val = rel == 5;
776     } else if (*op == 4) {
777 	ret_val = rel != 3;
778     } else if (*op == 3) {
779 	ret_val = rel == 3;
780     } else if (*op == 2) {
781 	ret_val = rel != 5;
782     } else if (*op == 6) {
783 	ret_val = rel != 1;
784     } else {
785 
786 /*        Sorry, we couldn't resist. */
787 
788 	ret_val = FALSE_;
789 	chkin_("ZZEKRCMP", (ftnlen)8);
790 	setmsg_("The relational operator # was not recognized.", (ftnlen)45);
791 	errint_("#", op, (ftnlen)1);
792 	sigerr_("SPICE(UNNATURALRELATION)", (ftnlen)24);
793 	chkout_("ZZEKRCMP", (ftnlen)8);
794 	return ret_val;
795     }
796     return ret_val;
797 } /* zzekrcmp_ */
798 
799