1 /* zzektres.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__4 = 4;
11 static integer c__6 = 6;
12 static integer c__1 = 1;
13 
14 /* $Procedure  ZZEKTRES ( Private: EK, resolve times in encoded query ) */
zzektres_(char * query,integer * eqryi,char * eqryc,doublereal * eqryd,logical * error,char * errmsg,integer * errptr,ftnlen query_len,ftnlen eqryc_len,ftnlen errmsg_len)15 /* Subroutine */ int zzektres_(char *query, integer *eqryi, char *eqryc,
16 	doublereal *eqryd, logical *error, char *errmsg, integer *errptr,
17 	ftnlen query_len, ftnlen eqryc_len, ftnlen errmsg_len)
18 {
19     /* System generated locals */
20     integer i__1;
21 
22     /* Builtin functions */
23     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
24 
25     /* Local variables */
26     integer base, ntab, ncns;
27     extern /* Subroutine */ int zzekqtab_(integer *, char *, integer *, char *
28 	    , char *, ftnlen, ftnlen, ftnlen), zzekreqi_(integer *, char *,
29 	    integer *, ftnlen), zzekinqn_(doublereal *, integer *, integer *,
30 	    integer *, integer *, doublereal *, integer *), zzekweqi_(char *,
31 	    integer *, integer *, ftnlen), zzektcnv_(char *, doublereal *,
32 	    logical *, char *, ftnlen, ftnlen);
33     integer i__;
34     extern /* Subroutine */ int ekcii_(char *, integer *, char *, integer *,
35 	    ftnlen, ftnlen);
36     char table[64*10], alias[64*10];
37     extern /* Subroutine */ int chkin_(char *, ftnlen);
38     integer descr[6];
39     extern /* Subroutine */ int movei_(integer *, integer *, integer *);
40     integer dtype;
41     extern logical failed_(void);
42     integer sb, se;
43     doublereal et;
44     char colnam[32], timstr[32], touchc[1];
45     integer attdsc[6], cnstyp, colidx, irsolv, opcode, tabidx;
46     extern /* Subroutine */ int setmsg_(char *, ftnlen), sigerr_(char *,
47 	    ftnlen), chkout_(char *, ftnlen);
48     integer lxb, lxe;
49 
50 /* $ Abstract */
51 
52 /*     SPICE Private routine intended solely for the support of SPICE */
53 /*     routines.  Users should not call this routine directly due */
54 /*     to the volatile nature of this routine. */
55 
56 /*     Resolve time values in an encoded EK query. */
57 
58 /* $ Disclaimer */
59 
60 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
61 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
62 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
63 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
64 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
65 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
66 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
67 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
68 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
69 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
70 
71 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
72 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
73 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
74 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
75 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
76 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
77 
78 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
79 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
80 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
81 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
82 
83 /* $ Required_Reading */
84 
85 /*     EK */
86 
87 /* $ Keywords */
88 
89 /*     EK */
90 /*     PRIVATE */
91 
92 /* $ Declarations */
93 /* $ Disclaimer */
94 
95 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
96 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
97 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
98 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
99 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
100 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
101 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
102 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
103 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
104 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
105 
106 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
107 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
108 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
109 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
110 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
111 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
112 
113 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
114 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
115 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
116 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
117 
118 
119 /*     Include Section:  EK Column Attribute Descriptor Parameters */
120 
121 /*        ekattdsc.inc Version 1    23-AUG-1995 (NJB) */
122 
123 
124 /*     This include file declares parameters used in EK column */
125 /*     attribute descriptors.  Column attribute descriptors are */
126 /*     a simplified version of column descriptors:  attribute */
127 /*     descriptors describe attributes of a column but do not contain */
128 /*     addresses or pointers. */
129 
130 
131 /*     Size of column attribute descriptor */
132 
133 
134 /*     Indices of various pieces of attribute descriptors: */
135 
136 
137 /*     ATTSIZ is the index of the column's class code.  (We use the */
138 /*     word `class' to distinguish this item from the column's data */
139 /*     type.) */
140 
141 
142 /*     ATTTYP is the index of the column's data type code (CHR, INT, DP, */
143 /*     or TIME).  The type is actually implied by the class, but it */
144 /*     will frequently be convenient to look up the type directly. */
145 
146 
147 
148 /*     ATTLEN is the index of the column's string length value, if the */
149 /*     column has character type.  A value of IFALSE in this element of */
150 /*     the descriptor indicates that the strings have variable length. */
151 
152 
153 /*     ATTSIZ is the index of the column's element size value.  This */
154 /*     descriptor element is meaningful for columns with fixed-size */
155 /*     entries.  For variable-sized columns, this value is IFALSE. */
156 
157 
158 /*     ATTIDX is the location of a flag that indicates whether the column */
159 /*     is indexed.  The flag takes the value ITRUE if the column is */
160 /*     indexed and otherwise takes the value IFALSE. */
161 
162 
163 /*     ATTNFL is the index of a flag indicating whether nulls are */
164 /*     permitted in the column.  The value at location NFLIDX is */
165 /*     ITRUE if nulls are permitted and IFALSE otherwise. */
166 
167 
168 /*     End Include Section:  EK Column Attribute Descriptor Parameters */
169 
170 /* $ Disclaimer */
171 
172 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
173 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
174 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
175 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
176 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
177 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
178 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
179 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
180 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
181 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
182 
183 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
184 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
185 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
186 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
187 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
188 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
189 
190 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
191 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
192 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
193 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
194 
195 
196 /*     Include Section:  EK Boolean Enumerated Type */
197 
198 
199 /*        ekbool.inc Version 1   21-DEC-1994 (NJB) */
200 
201 
202 /*     Within the EK system, boolean values sometimes must be */
203 /*     represented by integer or character codes.  The codes and their */
204 /*     meanings are listed below. */
205 
206 /*     Integer code indicating `true': */
207 
208 
209 /*     Integer code indicating `false': */
210 
211 
212 /*     Character code indicating `true': */
213 
214 
215 /*     Character code indicating `false': */
216 
217 
218 /*     End Include Section:  EK Boolean Enumerated Type */
219 
220 /* $ Disclaimer */
221 
222 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
223 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
224 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
225 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
226 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
227 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
228 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
229 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
230 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
231 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
232 
233 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
234 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
235 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
236 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
237 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
238 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
239 
240 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
241 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
242 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
243 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
244 
245 
246 /*     Include Section:  EK Column Name Size */
247 
248 /*        ekcnamsz.inc Version 1    17-JAN-1995 (NJB) */
249 
250 
251 /*     Size of column name, in characters. */
252 
253 
254 /*     End Include Section:  EK Column Name Size */
255 
256 /* $ Disclaimer */
257 
258 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
259 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
260 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
261 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
262 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
263 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
264 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
265 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
266 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
267 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
268 
269 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
270 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
271 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
272 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
273 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
274 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
275 
276 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
277 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
278 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
279 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
280 
281 
282 /*     Include Section:  EK Operator Codes */
283 
284 /*        ekopcd.inc  Version 1  30-DEC-1994 (NJB) */
285 
286 
287 /*     Within the EK system, operators used in EK queries are */
288 /*     represented by integer codes.  The codes and their meanings are */
289 /*     listed below. */
290 
291 /*     Relational expressions in EK queries have the form */
292 
293 /*        <column name> <operator> <value> */
294 
295 /*     For columns containing numeric values, the operators */
296 
297 /*        EQ,  GE,  GT,  LE,  LT,  NE */
298 
299 /*     may be used; these operators have the same meanings as their */
300 /*     Fortran counterparts.  For columns containing character values, */
301 /*     the list of allowed operators includes those in the above list, */
302 /*     and in addition includes the operators */
303 
304 /*        LIKE,  UNLIKE */
305 
306 /*     which are used to compare strings to a template.  In the character */
307 /*     case, the meanings of the parameters */
308 
309 /*        GE,  GT,  LE,  LT */
310 
311 /*     match those of the Fortran lexical functions */
312 
313 /*        LGE, LGT, LLE, LLT */
314 
315 
316 /*     The additional unary operators */
317 
318 /*        ISNULL, NOTNUL */
319 
320 /*     are used to test whether a value of any type is null. */
321 
322 
323 
324 /*     End Include Section:  EK Operator Codes */
325 
326 /* $ Disclaimer */
327 
328 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
329 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
330 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
331 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
332 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
333 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
334 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
335 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
336 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
337 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
338 
339 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
340 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
341 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
342 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
343 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
344 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
345 
346 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
347 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
348 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
349 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
350 
351 
352 /*     Include Section:  EK Query Limit Parameters */
353 
354 /*        ekqlimit.inc  Version 3    16-NOV-1995 (NJB) */
355 
356 /*           Parameter MAXCON increased to 1000. */
357 
358 /*        ekqlimit.inc  Version 2    01-AUG-1995 (NJB) */
359 
360 /*           Updated to support SELECT clause. */
361 
362 
363 /*        ekqlimit.inc  Version 1    07-FEB-1995 (NJB) */
364 
365 
366 /*     These limits apply to character string queries input to the */
367 /*     EK scanner.  This limits are part of the EK system's user */
368 /*     interface:  the values should be advertised in the EK required */
369 /*     reading document. */
370 
371 
372 /*     Maximum length of an input query:  MAXQRY.  This value is */
373 /*     currently set to twenty-five 80-character lines. */
374 
375 
376 /*     Maximum number of columns that may be listed in the */
377 /*     `order-by clause' of a query:  MAXSEL.  MAXSEL = 50. */
378 
379 
380 /*     Maximum number of tables that may be listed in the `FROM */
381 /*     clause' of a query: MAXTAB. */
382 
383 
384 /*     Maximum number of relational expressions that may be listed */
385 /*     in the `constraint clause' of a query: MAXCON. */
386 
387 /*     This limit applies to a query when it is represented in */
388 /*     `normalized form': that is, the constraints have been */
389 /*     expressed as a disjunction of conjunctions of relational */
390 /*     expressions. The number of relational expressions in a query */
391 /*     that has been expanded in this fashion may be greater than */
392 /*     the number of relations in the query as orginally written. */
393 /*     For example, the expression */
394 
395 /*             ( ( A LT 1 ) OR ( B GT 2 ) ) */
396 /*        AND */
397 /*             ( ( C NE 3 ) OR ( D EQ 4 ) ) */
398 
399 /*     which contains 4 relational expressions, expands to the */
400 /*     equivalent normalized constraint */
401 
402 /*             (  ( A LT 1 ) AND ( C NE 3 )  ) */
403 /*        OR */
404 /*             (  ( A LT 1 ) AND ( D EQ 4 )  ) */
405 /*        OR */
406 /*             (  ( B GT 2 ) AND ( C NE 3 )  ) */
407 /*        OR */
408 /*             (  ( B GT 2 ) AND ( D EQ 4 )  ) */
409 
410 /*     which contains eight relational expressions. */
411 
412 
413 
414 /*     MXJOIN is the maximum number of tables that can be joined. */
415 
416 
417 /*     MXJCON is the maximum number of join constraints allowed. */
418 
419 
420 /*     Maximum number of order-by columns that may be used in the */
421 /*     `order-by clause' of a query: MAXORD. MAXORD = 10. */
422 
423 
424 /*     Maximum number of tokens in a query: 500. Tokens are reserved */
425 /*     words, column names, parentheses, and values. Literal strings */
426 /*     and time values count as single tokens. */
427 
428 
429 /*     Maximum number of numeric tokens in a query: */
430 
431 
432 /*     Maximum total length of character tokens in a query: */
433 
434 
435 /*     Maximum length of literal string values allowed in queries: */
436 /*     MAXSTR. */
437 
438 
439 /*     End Include Section:  EK Query Limit Parameters */
440 
441 /* $ Disclaimer */
442 
443 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
444 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
445 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
446 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
447 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
448 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
449 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
450 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
451 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
452 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
453 
454 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
455 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
456 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
457 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
458 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
459 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
460 
461 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
462 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
463 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
464 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
465 
466 
467 /*     Include Section:  EK Encoded Query Internal Parameters */
468 
469 /*        ekquery.inc  Version 3    16-NOV-1995 (NJB) */
470 
471 /*           Updated to reflect increased value of MAXCON in */
472 /*           ekqlimit.inc. */
473 
474 /*        ekquery.inc  Version 2    03-AUG-1995 (NJB) */
475 
476 /*           Updated to support representation of the SELECT clause. */
477 
478 
479 /*        ekquery.inc  Version 1    12-JAN-1995 (NJB) */
480 
481 
482 /*     An encoded EK query is an abstract data type implemented */
483 /*     as an integer cell, along with a double precision cell and */
484 /*     a character string.  The d.p. cell and string contain numeric */
485 /*     and string values from the query string represented by the */
486 /*     encoded query. */
487 
488 /*     The parameters in this file are intended for use only by the */
489 /*     EK encoded query access routines.  Callers of EK routines should */
490 /*     not use these parameters. */
491 
492 /*     The following parameters are indices of specified elements */
493 /*     in the integer portion of the encoded query. */
494 
495 /*     Encoded query architecture type: */
496 
497 
498 /*     `Name resolution' consists of: */
499 
500 /*        - Verifying existence of tables:  any table names listed */
501 /*          in the FROM clause of a query must be loaded. */
502 
503 /*        - Validating table aliases used to qualify column names. */
504 
505 /*        - Verifying existence of columns and obtaining data types */
506 /*          for columns. */
507 
508 /*        - Setting data type codes for literal values in the encoded */
509 /*          query. */
510 
511 /*        - Checking consistency of operators and operand data types. */
512 
513 /*        - Making sure unqualified column names are unambiguous. */
514 
515 /*        - For constraints, mapping the table names used to qualify */
516 /*          column names to the ordinal position in the FROM clause */
517 /*          of the corresponding table. */
518 
519 
520 /*     Initialization status---this flag indicates whether the encoded */
521 /*     query has been initialized.  Values are ITRUE or IFALSE.  See the */
522 /*     include file ekbool.inc for parameter values. */
523 
524 
525 /*     Parse status---this flag indicates whether the parsing operation */
526 /*     that produced an encoded query has been completed. Values are */
527 /*     ITRUE or IFALSE. */
528 
529 
530 /*     Name resolution status---this flag indicates whether names */
531 /*     have been resolved in an encoded query.  Values are ITRUE or */
532 /*     IFALSE. */
533 
534 
535 /*     Time resolution status---this flag indicates whether time values */
536 /*     have been resolved in an encoded query.  Time resolution */
537 /*     consists of converting strings representing time values to ET. */
538 /*     Values of the status are ITRUE or IFALSE. */
539 
540 
541 /*     Semantic check status---this flag indicates whether semantic */
542 /*     checking of constraints has been performed. */
543 
544 
545 /*     Number of tables specified in FROM clause: */
546 
547 
548 /*     Number of constraints in query: */
549 
550 
551 /*     A special value is used to indicate the `maximal' constraint--- */
552 /*     one that logically cannot be satisfied.  If the constraints */
553 /*     are equivalent to the maximal constraint, the location EQNCNS */
554 /*     is assigned the value EQMXML */
555 
556 
557 /*     Number of constraint conjunctions: */
558 
559 
560 /*     Number of order-by columns: */
561 
562 
563 /*     Number of SELECT columns: */
564 
565 
566 /*     Size of double precision buffer: */
567 
568 
569 /*     `Free' pointer into double precision buffer: */
570 
571 
572 /*     Size of character string buffer: */
573 
574 
575 /*     `Free' pointer into character string buffer: */
576 
577 
578 /*     The following four base pointers will be valid after a query */
579 /*     has been parsed: */
580 
581 /*     Base pointer for SELECT column descriptors: */
582 
583 
584 /*     Base pointer for constraint descriptors: */
585 
586 
587 /*     Base pointer for conjunction sizes: */
588 
589 
590 /*     Base pointer for order-by column descriptors: */
591 
592 
593 /*     After the quantities named above, the integer array contains */
594 /*     series of descriptors for tables, constraints, and order-by */
595 /*     columns, as well as a list of `conjunction sizes'---that is, */
596 /*     the sizes of the groups of constraints that form conjunctions, */
597 /*     after the input query has been re-arranged as a disjunction of */
598 /*     conjunctions of constraints. */
599 
600 
601 /*     The offsets of specific elements within descriptors are */
602 /*     parameterized. The base addresses of the descriptors themselves */
603 /*     must be  calculated using the counts and sizes of the items */
604 /*     preceding them. */
605 
606 /*     A diagram of the structure of the variable-size portion of the */
607 /*     integer array is shown below: */
608 
609 
610 /*        +-------------------------------------+ */
611 /*        | Fixed-size portion of encoded query | */
612 /*        +-------------------------------------+ */
613 /*        |         Encoded FROM clause         | */
614 /*        +-------------------------------------+ */
615 /*        |      Encoded constraint clause      | */
616 /*        +-------------------------------------+ */
617 /*        |          Conjunction sizes          | */
618 /*        +-------------------------------------+ */
619 /*        |       Encoded ORDER BY clause       | */
620 /*        +-------------------------------------+ */
621 /*        |        Encoded SELECT clause        | */
622 /*        +-------------------------------------+ */
623 
624 
625 /*     Value Descriptors */
626 /*     ---------------- */
627 
628 /*     In order to discuss the various descriptors below, we'll make use */
629 /*     of sub-structures called `value descriptors'.  These descriptors */
630 /*     come in two flavors:  character and double precision.  For */
631 /*     strings, a descriptor is a set of begin and end pointers that */
632 /*     indicate the location of the string in the character portion of an */
633 /*     encoded query, along with the begin and end pointers for the */
634 /*     corresponding lexeme in the original query.  The pointers are set */
635 /*     to zero when they are not in use, for example if they refer to an */
636 /*     optional lexeme that did not appear in the input query. */
637 
638 /*     All value descriptors start with a data type indicator; values */
639 /*     are from ektype.inc.  Integer and time values are referred to */
640 /*     by double precision descriptors. */
641 
642 /*     Parameters for string value descriptor elements: */
643 
644 
645 /*     Numeric value descriptors are similar to those for string values, */
646 /*     the difference being that they have only one pointer to the value */
647 /*     they represent.  This pointer is the index of the value in the */
648 /*     encoded query's numeric buffer. */
649 
650 
651 /*     All value descriptors have the same size.  In order to allow */
652 /*     table descriptors to have the same size as value descriptors, */
653 /*     we include an extra element in the descriptor. */
654 
655 
656 /*     Column Descriptors */
657 /*     ----------------- */
658 
659 /*     Each column descriptor consists of a character descriptor for the */
660 /*     name of the column, followed by an index, which gives the ordinal */
661 /*     position of the column in the logical table to which the column */
662 /*     belongs.  The index element is filled in during name resolution. */
663 
664 
665 /*     Table Descriptors */
666 /*     ----------------- */
667 
668 /*     Each table descriptor consists of a character descriptor for the */
669 /*     name of the table, followed by an index, which gives the ordinal */
670 /*     position of the table in the FROM clause in the original query. */
671 /*     The index element is filled in during name resolution.  Aliases */
672 /*     and table names have identical descriptor structures. */
673 
674 
675 /*     Constraint descriptors */
676 /*     ------------------ */
677 
678 /*     Each constraint is characterized by: */
679 
680 /*        - A code indicating whether the constraint compares values */
681 /*          in two columns or the value in a column and a literal */
682 /*          value.  The values of this element are EQCOL and EQVAL. */
683 
684 
685 
686 /*        - A descriptor for the table used to qualify the */
687 /*          column name on the left side of the constraint. */
688 
689 
690 /*        - A character value descriptor for the column name on the left */
691 /*          side of the query. */
692 
693 
694 /*        - An operator code indicating the relational operator used */
695 /*          in the constraint. */
696 
697 
698 /*        If the constraint compares values from two columns, the */
699 /*        next items are table and column name descriptors that apply to */
700 /*        the column named on the right side of the relational operator. */
701 
702 
703 /*        If the constraint has a literal value on the right side, the */
704 /*        operator code is followed by... */
705 
706 /*        - a value descriptor. */
707 
708 
709 /*        - Size of a constraint descriptor: */
710 
711 
712 /*     Conjunction sizes */
713 /*     ----------------- */
714 
715 /*     The size of each conjunction of constraints occupies a single */
716 /*     integer. */
717 
718 
719 
720 
721 /*     Order-by Column Descriptors */
722 /*     --------------------------- */
723 
724 /*     Each order-by column descriptor contains descriptors for */
725 /*     the table containing the column and for the name of the column */
726 /*     itself; one additional element is used to indicate the direction */
727 /*     of the ordering (ascending vs descending). */
728 
729 
730 /*        - The last integer in the descriptor indicates whether the */
731 /*          order direction is ascending or descending. */
732 
733 
734 /*        - Size of an order-by column descriptor: */
735 
736 
737 /*     Codes indicating sense of ordering (ascending vs descending): */
738 
739 
740 /*     SELECT Column Descriptors */
741 /*     --------------------------- */
742 
743 /*     Each SELECT column descriptor contains descriptors for */
744 /*     the table containing the column and for the name of the column */
745 /*     itself. */
746 
747 
748 /*        - Size of a SELECT column descriptor: */
749 
750 
751 /*     Miscellaneous parameters: */
752 
753 
754 /*     EQIMIN is the minimum size of the integer portion of */
755 /*     an encoded query.  EQIMIN depends on the parameters */
756 
757 /*        MAXTAB */
758 /*        MAXCON */
759 /*        MAXORD */
760 /*        MAXSEL */
761 
762 /*     all of which are declared in the include file ekqlimit.inc. */
763 /*     The functional definition of EQIMIN is: */
764 
765 /*     INTEGER               EQIMIN */
766 /*     PARAMETER           ( EQIMIN =   EQVBAS */
767 /*    .                              +  MAXTAB * EQVDSZ * 2 */
768 /*    .                              +  MAXCON * EQCDSZ */
769 /*    .                              +  MAXCON */
770 /*    .                              +  MAXORD * EQODSZ */
771 /*    .                              +  MAXSEL * EQSDSZ     ) */
772 
773 
774 /*     End Include Section:  EK Encoded Query Internal Parameters */
775 
776 /* $ Disclaimer */
777 
778 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
779 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
780 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
781 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
782 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
783 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
784 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
785 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
786 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
787 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
788 
789 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
790 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
791 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
792 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
793 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
794 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
795 
796 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
797 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
798 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
799 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
800 
801 
802 /*     Include Section:  EK Table Name Size */
803 
804 /*        ektnamsz.inc Version 1    17-JAN-1995 (NJB) */
805 
806 
807 /*     Size of table name, in characters. */
808 
809 
810 /*     End Include Section:  EK Table Name Size */
811 
812 /* $ Disclaimer */
813 
814 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
815 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
816 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
817 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
818 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
819 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
820 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
821 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
822 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
823 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
824 
825 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
826 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
827 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
828 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
829 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
830 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
831 
832 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
833 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
834 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
835 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
836 
837 
838 /*     Include Section:  EK Data Types */
839 
840 /*        ektype.inc Version 1  27-DEC-1994 (NJB) */
841 
842 
843 /*     Within the EK system, data types of EK column contents are */
844 /*     represented by integer codes.  The codes and their meanings */
845 /*     are listed below. */
846 
847 /*     Integer codes are also used within the DAS system to indicate */
848 /*     data types; the EK system makes no assumptions about compatibility */
849 /*     between the codes used here and those used in the DAS system. */
850 
851 
852 /*     Character type: */
853 
854 
855 /*     Double precision type: */
856 
857 
858 /*     Integer type: */
859 
860 
861 /*     `Time' type: */
862 
863 /*     Within the EK system, time values are represented as ephemeris */
864 /*     seconds past J2000 (TDB), and double precision numbers are used */
865 /*     to store these values.  However, since time values require special */
866 /*     treatment both on input and output, and since the `TIME' column */
867 /*     has a special role in the EK specification and code, time values */
868 /*     are identified as a type distinct from double precision numbers. */
869 
870 
871 /*     End Include Section:  EK Data Types */
872 
873 /* $ Brief_I/O */
874 
875 /*     Variable  I/O  Description */
876 /*     --------  ---  -------------------------------------------------- */
877 /*     EQRYI     I-O  Integer component of query. */
878 /*     EQRYC     I-O  Character component of query. */
879 /*     EQRYD     I-O  Numeric component of query. */
880 /*     ERROR      O   Error flag. */
881 /*     ERRMSG     O   Error message. */
882 /*     ERRPTR     O   Position in query where error was detected. */
883 
884 /* $ Detailed_Input */
885 
886 /*     QUERY          is the original query from which EQRYI and EQRYC */
887 /*                    were obtained.  QUERY is used only for */
888 /*                    construction of error messages. */
889 
890 /*     EQRYI          is the integer portion of an encoded EK query. */
891 /*                    The query must have been parsed. */
892 
893 /*     EQRYC          is the character portion of an encoded EK query. */
894 
895 /*     EQRYD          is the numeric portion of an encoded EK query. */
896 
897 /* $ Detailed_Output */
898 
899 /*     EQRYI          is the integer portion of an encoded EK query. */
900 /*                    On output, all valid time values will have been */
901 /*                    converted from strings to equivalent numeric */
902 /*                    values which represent times as ephemeris */
903 /*                    seconds past J2000 (TDB). */
904 
905 /*     EQRYC          is the character portion of an encoded EK query. */
906 
907 /*     ERROR          is a logical flag indicating whether an error was */
908 /*                    detected.  Note that a time string might be */
909 /*                    syntactically valid, but incapable of being */
910 /*                    converted to ET if the appropriate time kernels */
911 /*                    (Leapseconds or SCLK) are not loaded. */
912 
913 /*     ERRMSG         is an error message describing an error in the */
914 /*                    input query, if one was detected.  If ERROR is */
915 /*                    returned .FALSE., then ERRPTR is undefined. */
916 
917 /*     ERRPTR         is the character position in the original query */
918 /*                    at which an error was detected, if an error was */
919 /*                    found.  This index refers to the offending lexeme's */
920 /*                    position in the original query represented by the */
921 /*                    input encoded query.  If ERROR is returned .FALSE., */
922 /*                    ERRPTR is undefined. */
923 /* $ Parameters */
924 
925 /*     None. */
926 
927 /* $ Exceptions */
928 
929 /*     1)  If the input query is not initialized, the error will be */
930 /*         diagnosed by routines called by this routine.  The outputs */
931 /*         will not be modified. */
932 
933 /*     2)  If names have not been resolved in the input query, the error */
934 /*         SPICE(NAMESNOTRESOLVED) will be signalled.  The outputs */
935 /*         will not be modified. */
936 
937 /*     3)  If any sort of time conversion error occurs, the output flag */
938 /*         ERROR is set, and an error message is returned. */
939 
940 /* $ Files */
941 
942 /*     None. */
943 
944 /* $ Particulars */
945 
946 /*     Strings representing time values are interpreted as follows: */
947 
948 /*        1)  The string is first examined to see whether it's an */
949 /*            SCLK string for a recognized clock; if it is, the */
950 /*            string is converted to the equivalent ET. */
951 
952 /*        2)  If the string is not a SCLK string, it is expected */
953 /*            to be some sort of UTC representation.  The string is */
954 /*            checked to see whether it's an ISO format UTC time that */
955 /*            ISO2UTC can handle. */
956 
957 /*        3)  If the string does not conform to an ISO format, the */
958 /*            last chance is to try to get the string through */
959 /*            TPARSE.  If TPARSE can't deal with it, it's considered */
960 /*            to be invalid. */
961 
962 
963 /*     This routine assumes that encoded EK query architecture version */
964 /*     1 is to be used with the query to be initialized; this routine */
965 /*     will not work with any other architecture version. */
966 
967 /* $ Examples */
968 
969 /*     See EKFIND. */
970 
971 /* $ Restrictions */
972 
973 /*     1) A leapseconds kernel must be loaded at the time this routine */
974 /*        is called. */
975 
976 /*     2) In order to convert SCLK strings, an appropriate SCLK kernel */
977 /*        must be loaded at the time this routine is called. */
978 
979 /* $ Literature_References */
980 
981 /*     None. */
982 
983 /* $ Author_and_Institution */
984 
985 /*     N.J. Bachman       (JPL) */
986 
987 /* $ Version */
988 
989 /* -    Beta Version 1.0.0, 11-OCT-1995 (NJB) */
990 
991 /* -& */
992 
993 /*     SPICELIB functions */
994 
995 
996 /*     Local parameters */
997 
998 
999 /*     Local variables */
1000 
1001 
1002 /*     No error to start with. */
1003 
1004     *error = FALSE_;
1005     s_copy(errmsg, " ", errmsg_len, (ftnlen)1);
1006     *errptr = 0;
1007     *(unsigned char *)touchc = *(unsigned char *)query;
1008 
1009 /*     The query must have had names resolved at this point, or it's no */
1010 /*     go. */
1011 
1012     zzekreqi_(eqryi, "NAMES_RESOLVED", &irsolv, (ftnlen)14);
1013     if (failed_()) {
1014 	return 0;
1015     }
1016     if (irsolv == -1) {
1017 	chkin_("ZZEKTRES", (ftnlen)8);
1018 	setmsg_("Names are not resolved in encoded query.", (ftnlen)40);
1019 	sigerr_("SPICE(NAMESNOTRESOLVED)", (ftnlen)23);
1020 	chkout_("ZZEKTRES", (ftnlen)8);
1021 	return 0;
1022     }
1023 
1024 /*     Time strings occur only on the right sides of constraints. */
1025 /*     Examine each constraint that compares a column and a value. */
1026 
1027     zzekreqi_(eqryi, "NUM_TABLES", &ntab, (ftnlen)10);
1028     zzekreqi_(eqryi, "NUM_CONSTRAINTS", &ncns, (ftnlen)15);
1029     i__1 = ncns;
1030     for (i__ = 1; i__ <= i__1; ++i__) {
1031 
1032 /*        Calculate the base address of the constraint. */
1033 
1034 	base = ntab * 12 + 19 + (i__ - 1) * 26;
1035 
1036 /*        Obtain the constraint type.  If the RHS is not a value or if */
1037 /*        the RHS is null (as indicated by the opcode), we can skip it. */
1038 
1039 	cnstyp = eqryi[base + 6];
1040 	opcode = eqryi[base + 19];
1041 	if (cnstyp == 2 && opcode != 9 && opcode != 10) {
1042 
1043 /*           Get the index of the table containing the LHS column, and */
1044 /*           get the index of this column within that table.  Get the */
1045 /*           table name, then get the column's attributes. */
1046 
1047 	    tabidx = eqryi[base + 12];
1048 	    colidx = eqryi[base + 18];
1049 	    zzekqtab_(eqryi, eqryc, &tabidx, table, alias, eqryc_len, (ftnlen)
1050 		    64, (ftnlen)64);
1051 	    ekcii_(table, &colidx, colnam, attdsc, (ftnlen)64, (ftnlen)32);
1052 	    dtype = attdsc[1];
1053 	    if (dtype == 4) {
1054 
1055 /*              The RHS points to a string representing a time */
1056 /*              value. */
1057 
1058 		lxb = eqryi[base + 21];
1059 		lxe = eqryi[base + 21];
1060 		sb = eqryi[base + 23];
1061 		se = eqryi[base + 24];
1062 		s_copy(timstr, eqryc + (sb - 1), (ftnlen)32, se - (sb - 1));
1063 
1064 /*              Convert the time to ET, if possible. */
1065 
1066 		zzektcnv_(timstr, &et, error, errmsg, (ftnlen)32, errmsg_len);
1067 		if (*error) {
1068 		    *errptr = sb;
1069 		    return 0;
1070 		}
1071 
1072 /*              Insert the ET value into the query, and replace the */
1073 /*              value descriptor for the time string. */
1074 
1075 		zzekinqn_(&et, &c__4, &lxb, &lxe, eqryi, eqryd, descr);
1076 		movei_(descr, &c__6, &eqryi[base + 20]);
1077 	    }
1078 
1079 /*           We've parsed a time string, if the current column's type */
1080 /*           was TIME. */
1081 
1082 	}
1083 
1084 /*        We've examined the current constraint, if it compares a */
1085 /*        column with a value. */
1086 
1087     }
1088 
1089 /*     Indicate completion of time resolution. */
1090 
1091     zzekweqi_("TIMES_RESOLVED", &c__1, eqryi, (ftnlen)14);
1092     return 0;
1093 } /* zzektres_ */
1094 
1095