1 /* ekqmgr.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__20 = 20;
11 static integer c__200 = 200;
12 static integer c__10000 = 10000;
13 static integer c__500 = 500;
14 static integer c__100 = 100;
15 static integer c__24 = 24;
16 static integer c__11 = 11;
17 static integer c__10 = 10;
18 static integer c__1000 = 1000;
19 static integer c__1 = 1;
20 static integer c__0 = 0;
21 static integer c__11000 = 11000;
22
23 /* $Procedure EKQMGR ( EK, query manager ) */
ekqmgr_0_(int n__,integer * cindex,integer * elment,char * eqryc,doublereal * eqryd,integer * eqryi,char * fname,integer * row,integer * selidx,char * column,integer * handle,integer * n,char * table,integer * attdsc,integer * ccount,logical * found,integer * nelt,integer * nmrows,logical * semerr,char * errmsg,char * cdata,doublereal * ddata,integer * idata,logical * null,ftnlen eqryc_len,ftnlen fname_len,ftnlen column_len,ftnlen table_len,ftnlen errmsg_len,ftnlen cdata_len)24 /* Subroutine */ int ekqmgr_0_(int n__, integer *cindex, integer *elment,
25 char *eqryc, doublereal *eqryd, integer *eqryi, char *fname, integer *
26 row, integer *selidx, char *column, integer *handle, integer *n, char
27 *table, integer *attdsc, integer *ccount, logical *found, integer *
28 nelt, integer *nmrows, logical *semerr, char *errmsg, char *cdata,
29 doublereal *ddata, integer *idata, logical *null, ftnlen eqryc_len,
30 ftnlen fname_len, ftnlen column_len, ftnlen table_len, ftnlen
31 errmsg_len, ftnlen cdata_len)
32 {
33 /* Initialized data */
34
35 static integer lelts[1000] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
36 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
37 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
38 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
39 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
40 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
41 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
42 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
43 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
44 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
45 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
46 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
47 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
48 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
49 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
50 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
51 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
52 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
53 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
54 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
55 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
56 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
57 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
58 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
59 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
60 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
61 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
62 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
63 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
64 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
65 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
66 static integer oelts[10] = { 1,1,1,1,1,1,1,1,1,1 };
67 static integer relts[1000] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
68 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
69 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
70 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
71 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
72 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
73 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
74 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
75 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
76 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
77 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
78 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
79 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
80 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
81 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
82 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
83 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
84 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
85 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
86 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
87 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
88 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
89 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
90 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
91 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
92 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
93 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
94 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
95 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
96 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
97 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
98 static char chtype[4*4] = "CHR " "DP " "INT " "TIME";
99 static integer fthead = 0;
100 static integer tbhead = 0;
101 static logical first = TRUE_;
102
103 /* System generated locals */
104 integer i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8, i__9, i__10,
105 i__11, i__12, i__13, i__14;
106
107 /* Builtin functions */
108 integer s_rnge(char *, integer, char *, integer);
109 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
110 integer s_cmp(char *, char *, ftnlen, ftnlen);
111
112 /* Local variables */
113 static integer begidx, cdscrs[5500] /* was [11][500] */, cjrows, cjsize,
114 cnstyp[1000], col, colptr, delseg, endidx, key, keydsc[11],
115 ldscrs[11000] /* was [11][1000] */, ltbidx[1000], new__,
116 nmatch, norder, nsv, ops[1000], ordbas, ptroff, nact, ntab, rbas[
117 10], rdscrs[11000] /* was [11][1000] */, conj, resbas, rowidx,
118 nseg, rowvec[10], rtbidx[1000], rtotal, nsel, rwvbas, selcol[50],
119 selctp[50], seltab[50], seg, segdsc[24], segvec[10], sgvbas, tab,
120 tabidx, next, tbcurr, top, tptvec[16], unrows;
121 static logical activc[1000], activv[1000], attmch, dosort, fnd, indexd,
122 keyfnd, nulsok, presnt, sorted;
123 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
124 ftnlen), lnkini_(integer *, integer *), dascls_(integer *),
125 setmsg_(char *, ftnlen), errhan_(char *, integer *, ftnlen),
126 lnkilb_(integer *, integer *, integer *), zzekpgch_(integer *,
127 char *, ftnlen), ssizec_(integer *, char *, ftnlen), validc_(
128 integer *, integer *, char *, ftnlen), lnkfsl_(integer *, integer
129 *, integer *), errint_(char *, integer *, ftnlen);
130 extern logical zzekrmch_(integer *, logical *, integer *, integer *,
131 integer *, integer *, integer *, integer *, integer *, char *,
132 integer *, integer *, doublereal *, integer *, ftnlen);
133 extern /* Subroutine */ int zzekqtab_(integer *, char *, integer *, char *
134 , char *, ftnlen, ftnlen, ftnlen);
135 extern logical zzekvmch_(integer *, logical *, integer *, integer *,
136 integer *, integer *, integer *, integer *, integer *, integer *,
137 integer *, integer *, integer *);
138 extern /* Subroutine */ int ssizei_(integer *, integer *), zzeksinf_(
139 integer *, integer *, char *, integer *, char *, integer *,
140 ftnlen, ftnlen), zzekreqi_(integer *, char *, integer *, ftnlen),
141 appndc_(char *, char *, ftnlen, ftnlen), appndi_(integer *,
142 integer *), zzeksdec_(integer *), cleari_(integer *, integer *),
143 zzekqcnj_(integer *, integer *, integer *), zzekqcon_(integer *,
144 char *, doublereal *, integer *, integer *, char *, integer *,
145 char *, integer *, integer *, char *, integer *, char *, integer *
146 , integer *, integer *, integer *, doublereal *, integer *,
147 ftnlen, ftnlen, ftnlen, ftnlen, ftnlen), zzekkey_(integer *,
148 integer *, integer *, integer *, integer *, integer *, integer *,
149 integer *, char *, integer *, integer *, doublereal *, integer *,
150 logical *, integer *, integer *, integer *, integer *, logical *,
151 ftnlen), zzekixlk_(integer *, integer *, integer *, integer *),
152 zzekrplk_(integer *, integer *, integer *, integer *);
153 extern integer zzekesiz_(integer *, integer *, integer *, integer *);
154 extern /* Subroutine */ int zzeksupd_(integer *, integer *, integer *),
155 zzekjoin_(integer *, integer *, integer *, logical *, integer *,
156 integer *, integer *, integer *, integer *, integer *, integer *,
157 integer *, integer *, integer *, integer *, integer *, integer *,
158 integer *), zzekspsh_(integer *, integer *), zzeksrd_(integer *,
159 integer *, integer *), zzekweed_(integer *, integer *, integer *),
160 zzekqsel_(integer *, char *, integer *, integer *, integer *,
161 char *, integer *, char *, integer *, ftnlen, ftnlen, ftnlen),
162 zzekvset_(integer *, integer *), zzekqord_(integer *, char *,
163 integer *, char *, integer *, char *, integer *, integer *,
164 ftnlen, ftnlen, ftnlen), zzekjsrt_(integer *, integer *, integer *
165 , integer *, integer *, integer *, integer *, integer *, integer *
166 , integer *, integer *, integer *, integer *), zzekstop_(integer *
167 );
168 static integer i__, cjbeg, j;
169 extern integer cardc_(char *, ftnlen);
170 static integer k, cbegs[1000], cjend, l, r__, t, cends[1000];
171 extern /* Subroutine */ int chkin_(char *, ftnlen);
172 static logical cmtch;
173 static integer ubase[200], fthan[20];
174 static char cnams[32*500];
175 static integer lxbeg, lcidx[1000];
176 extern /* Subroutine */ int ekcls_(integer *);
177 static integer cvlen;
178 static doublereal dvals[1000];
179 static integer lxend, nconj, sthan[200], ivals[1000], ncols;
180 static char state[80];
181 static integer ctnew;
182 extern integer lnktl_(integer *, integer *);
183 static integer dtnew, dtype[1000], jsize;
184 extern logical eqstr_(char *, char *, ftnlen, ftnlen);
185 static integer npcol, ocols[10], otabs[10], jbase1, jbase2, rcidx[1000],
186 rsize[200], sense[10], sizes[1000], stnew, usize;
187 static logical vmtch;
188 extern /* Subroutine */ int ekopr_(char *, integer *, ftnlen), lnkan_(
189 integer *, integer *), movec_(char *, integer *, char *, ftnlen,
190 ftnlen), movei_(integer *, integer *, integer *), errch_(char *,
191 char *, ftnlen, ftnlen), zzekjsqz_(integer *), zzekvcal_(integer *
192 , integer *, integer *), zzekrsc_(integer *, integer *, integer *,
193 integer *, integer *, integer *, char *, logical *, logical *,
194 ftnlen), zzekrsd_(integer *, integer *, integer *, integer *,
195 integer *, doublereal *, logical *, logical *), zzekrsi_(integer *
196 , integer *, integer *, integer *, integer *, integer *, logical *
197 , logical *);
198 extern logical failed_(void);
199 static integer ctclas[500];
200 extern integer isrchc_(char *, integer *, char *, ftnlen, ftnlen);
201 extern logical return_(void);
202 extern integer eknseg_(integer *), lnknxt_(integer *, integer *), lnknfn_(
203 integer *);
204 static integer ftpool[52] /* was [2][26] */, tbpool[212] /* was [2][
205 106] */, tbstpt[100], tbncol[100];
206 static char tbnams[64*100];
207 static integer tbctpt[100], tbfils[2000] /* was [20][100] */, tbflsz[
208 100], stpool[412] /* was [2][206] */, stsidx[200], stdscs[4800]
209 /* was [24][200] */, stnrow[200], stncol[200], stdtpt[200],
210 dtpool[20012] /* was [2][10006] */, dtdscs[110000] /*
211 was [11][10000] */, ctpool[1012] /* was [2][506] */;
212 static char ctnams[32*500];
213 static integer cttyps[500], ctlens[500];
214 static logical ctfixd[500];
215 static integer ctsizs[500];
216 static logical ctindx[500], ctnull[500];
217 static char cnmset[32*506], colnam[32], frmals[64*10], frmtab[64*10],
218 lcname[32], ltname[64], problm[80], rcname[32], rtname[64],
219 tabnam[64], tabvec[64*16];
220
221 /* $ Abstract */
222
223 /* Manage query operations on EK files. */
224
225 /* $ Disclaimer */
226
227 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
228 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
229 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
230 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
231 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
232 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
233 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
234 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
235 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
236 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
237
238 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
239 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
240 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
241 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
242 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
243 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
244
245 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
246 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
247 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
248 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
249
250 /* $ Required_Reading */
251
252 /* EK */
253
254 /* $ Keywords */
255
256 /* EK */
257 /* FILES */
258 /* SEARCH */
259
260 /* $ Declarations */
261 /* $ Disclaimer */
262
263 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
264 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
265 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
266 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
267 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
268 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
269 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
270 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
271 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
272 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
273
274 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
275 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
276 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
277 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
278 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
279 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
280
281 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
282 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
283 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
284 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
285
286
287 /* Include Section: EK Column Attribute Descriptor Parameters */
288
289 /* ekattdsc.inc Version 1 23-AUG-1995 (NJB) */
290
291
292 /* This include file declares parameters used in EK column */
293 /* attribute descriptors. Column attribute descriptors are */
294 /* a simplified version of column descriptors: attribute */
295 /* descriptors describe attributes of a column but do not contain */
296 /* addresses or pointers. */
297
298
299 /* Size of column attribute descriptor */
300
301
302 /* Indices of various pieces of attribute descriptors: */
303
304
305 /* ATTSIZ is the index of the column's class code. (We use the */
306 /* word `class' to distinguish this item from the column's data */
307 /* type.) */
308
309
310 /* ATTTYP is the index of the column's data type code (CHR, INT, DP, */
311 /* or TIME). The type is actually implied by the class, but it */
312 /* will frequently be convenient to look up the type directly. */
313
314
315
316 /* ATTLEN is the index of the column's string length value, if the */
317 /* column has character type. A value of IFALSE in this element of */
318 /* the descriptor indicates that the strings have variable length. */
319
320
321 /* ATTSIZ is the index of the column's element size value. This */
322 /* descriptor element is meaningful for columns with fixed-size */
323 /* entries. For variable-sized columns, this value is IFALSE. */
324
325
326 /* ATTIDX is the location of a flag that indicates whether the column */
327 /* is indexed. The flag takes the value ITRUE if the column is */
328 /* indexed and otherwise takes the value IFALSE. */
329
330
331 /* ATTNFL is the index of a flag indicating whether nulls are */
332 /* permitted in the column. The value at location NFLIDX is */
333 /* ITRUE if nulls are permitted and IFALSE otherwise. */
334
335
336 /* End Include Section: EK Column Attribute Descriptor Parameters */
337
338 /* $ Disclaimer */
339
340 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
341 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
342 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
343 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
344 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
345 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
346 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
347 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
348 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
349 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
350
351 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
352 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
353 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
354 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
355 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
356 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
357
358 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
359 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
360 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
361 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
362
363
364 /* Include Section: EK Boolean Enumerated Type */
365
366
367 /* ekbool.inc Version 1 21-DEC-1994 (NJB) */
368
369
370 /* Within the EK system, boolean values sometimes must be */
371 /* represented by integer or character codes. The codes and their */
372 /* meanings are listed below. */
373
374 /* Integer code indicating `true': */
375
376
377 /* Integer code indicating `false': */
378
379
380 /* Character code indicating `true': */
381
382
383 /* Character code indicating `false': */
384
385
386 /* End Include Section: EK Boolean Enumerated Type */
387
388 /* $ Disclaimer */
389
390 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
391 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
392 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
393 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
394 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
395 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
396 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
397 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
398 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
399 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
400
401 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
402 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
403 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
404 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
405 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
406 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
407
408 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
409 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
410 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
411 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
412
413
414 /* Include Section: EK Column Name Size */
415
416 /* ekcnamsz.inc Version 1 17-JAN-1995 (NJB) */
417
418
419 /* Size of column name, in characters. */
420
421
422 /* End Include Section: EK Column Name Size */
423
424 /* $ Disclaimer */
425
426 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
427 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
428 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
429 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
430 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
431 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
432 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
433 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
434 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
435 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
436
437 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
438 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
439 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
440 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
441 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
442 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
443
444 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
445 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
446 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
447 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
448
449
450 /* Include Section: EK Column Descriptor Parameters */
451
452 /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */
453
454
455 /* Note: The column descriptor size parameter CDSCSZ is */
456 /* declared separately in the include section CDSIZE$INC.FOR. */
457
458 /* Offset of column descriptors, relative to start of segment */
459 /* integer address range. This number, when added to the last */
460 /* integer address preceding the segment, yields the DAS integer */
461 /* base address of the first column descriptor. Currently, this */
462 /* offset is exactly the size of a segment descriptor. The */
463 /* parameter SDSCSZ, which defines the size of a segment descriptor, */
464 /* is declared in the include file eksegdsc.inc. */
465
466
467 /* Size of column descriptor */
468
469
470 /* Indices of various pieces of column descriptors: */
471
472
473 /* CLSIDX is the index of the column's class code. (We use the */
474 /* word `class' to distinguish this item from the column's data */
475 /* type.) */
476
477
478 /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */
479 /* or TIME). The type is actually implied by the class, but it */
480 /* will frequently be convenient to look up the type directly. */
481
482
483
484 /* LENIDX is the index of the column's string length value, if the */
485 /* column has character type. A value of IFALSE in this element of */
486 /* the descriptor indicates that the strings have variable length. */
487
488
489 /* SIZIDX is the index of the column's element size value. This */
490 /* descriptor element is meaningful for columns with fixed-size */
491 /* entries. For variable-sized columns, this value is IFALSE. */
492
493
494 /* NAMIDX is the index of the base address of the column's name. */
495
496
497 /* IXTIDX is the data type of the column's index. IXTIDX */
498 /* contains a type value only if the column is indexed. For columns */
499 /* that are not indexed, the location IXTIDX contains the boolean */
500 /* value IFALSE. */
501
502
503 /* IXPIDX is a pointer to the column's index. IXTPDX contains a */
504 /* meaningful value only if the column is indexed. The */
505 /* interpretation of the pointer depends on the data type of the */
506 /* index. */
507
508
509 /* NFLIDX is the index of a flag indicating whether nulls are */
510 /* permitted in the column. The value at location NFLIDX is */
511 /* ITRUE if nulls are permitted and IFALSE otherwise. */
512
513
514 /* ORDIDX is the index of the column's ordinal position in the */
515 /* list of columns belonging to the column's parent segment. */
516
517
518 /* METIDX is the index of the column's integer metadata pointer. */
519 /* This pointer is a DAS integer address. */
520
521
522 /* The last position in the column descriptor is reserved. No */
523 /* parameter is defined to point to this location. */
524
525
526 /* End Include Section: EK Column Descriptor Parameters */
527
528 /* $ Disclaimer */
529
530 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
531 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
532 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
533 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
534 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
535 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
536 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
537 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
538 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
539 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
540
541 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
542 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
543 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
544 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
545 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
546 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
547
548 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
549 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
550 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
551 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
552
553
554 /* Include Section: EK Join Row Set Parameters */
555
556 /* ekjrs.inc Version 1 07-FEB-1995 (NJB) */
557
558
559 /* Maximum number of join row sets in a join row set union: */
560
561
562 /* The layout of a join row set in the EK scratch area is shown */
563 /* below: */
564
565 /* +--------------------------------------------+ */
566 /* | join row set size | 1 element */
567 /* +--------------------------------------------+ */
568 /* | number of row vectors in join row set | 1 element */
569 /* +--------------------------------------------+ */
570 /* | table count (TC) | 1 element */
571 /* +--------------------------------------------+ */
572 /* | segment vector count (SVC) | 1 element */
573 /* +--------------------------------------------+ */
574 /* | segment vector 1 | TC elements */
575 /* +--------------------------------------------+ */
576 /* . */
577 /* . */
578 /* . */
579 /* +--------------------------------------------+ */
580 /* | segment vector SVC | TC elements */
581 /* +--------------------------------------------+ */
582 /* | segment vector 1 row set base address | 1 element */
583 /* +--------------------------------------------+ */
584 /* | segment vector 1 row count (RC_1) | 1 element */
585 /* +--------------------------------------------+ */
586 /* . */
587 /* . */
588 /* . */
589 /* +--------------------------------------------+ */
590 /* | segment vector SVC row set base address | 1 element */
591 /* +--------------------------------------------+ */
592 /* | segment vector SVC row count (RC_SVC) | 1 element */
593 /* +--------------------------------------------+ */
594 /* | Augmented row vectors for segment vector 1 | (TC+1)*RC_1 */
595 /* +--------------------------------------------+ elements */
596 /* . */
597 /* . */
598 /* . */
599 /* +--------------------------------------------+ */
600 /* |Augmented row vectors for segment vector SVC| (TC+1)*RC_SVC1 */
601 /* +--------------------------------------------+ elements */
602
603
604 /* The following parameters indicate positions of elements in the */
605 /* join row set structure: */
606
607
608 /* Base-relative index of join row set size */
609
610
611 /* Index of row vector count */
612
613
614 /* Index of table count */
615
616
617 /* Index of segment vector count */
618
619
620 /* Base address of first segment vector */
621
622
623
624 /* End Include Section: EK Join Row Set Parameters */
625
626 /* $ Disclaimer */
627
628 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
629 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
630 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
631 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
632 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
633 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
634 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
635 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
636 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
637 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
638
639 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
640 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
641 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
642 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
643 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
644 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
645
646 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
647 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
648 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
649 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
650
651
652 /* Include Section: EK Operator Codes */
653
654 /* ekopcd.inc Version 1 30-DEC-1994 (NJB) */
655
656
657 /* Within the EK system, operators used in EK queries are */
658 /* represented by integer codes. The codes and their meanings are */
659 /* listed below. */
660
661 /* Relational expressions in EK queries have the form */
662
663 /* <column name> <operator> <value> */
664
665 /* For columns containing numeric values, the operators */
666
667 /* EQ, GE, GT, LE, LT, NE */
668
669 /* may be used; these operators have the same meanings as their */
670 /* Fortran counterparts. For columns containing character values, */
671 /* the list of allowed operators includes those in the above list, */
672 /* and in addition includes the operators */
673
674 /* LIKE, UNLIKE */
675
676 /* which are used to compare strings to a template. In the character */
677 /* case, the meanings of the parameters */
678
679 /* GE, GT, LE, LT */
680
681 /* match those of the Fortran lexical functions */
682
683 /* LGE, LGT, LLE, LLT */
684
685
686 /* The additional unary operators */
687
688 /* ISNULL, NOTNUL */
689
690 /* are used to test whether a value of any type is null. */
691
692
693
694 /* End Include Section: EK Operator Codes */
695
696 /* $ Disclaimer */
697
698 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
699 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
700 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
701 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
702 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
703 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
704 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
705 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
706 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
707 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
708
709 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
710 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
711 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
712 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
713 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
714 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
715
716 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
717 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
718 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
719 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
720
721
722 /* Include Section: EK Query Limit Parameters */
723
724 /* ekqlimit.inc Version 3 16-NOV-1995 (NJB) */
725
726 /* Parameter MAXCON increased to 1000. */
727
728 /* ekqlimit.inc Version 2 01-AUG-1995 (NJB) */
729
730 /* Updated to support SELECT clause. */
731
732
733 /* ekqlimit.inc Version 1 07-FEB-1995 (NJB) */
734
735
736 /* These limits apply to character string queries input to the */
737 /* EK scanner. This limits are part of the EK system's user */
738 /* interface: the values should be advertised in the EK required */
739 /* reading document. */
740
741
742 /* Maximum length of an input query: MAXQRY. This value is */
743 /* currently set to twenty-five 80-character lines. */
744
745
746 /* Maximum number of columns that may be listed in the */
747 /* `order-by clause' of a query: MAXSEL. MAXSEL = 50. */
748
749
750 /* Maximum number of tables that may be listed in the `FROM */
751 /* clause' of a query: MAXTAB. */
752
753
754 /* Maximum number of relational expressions that may be listed */
755 /* in the `constraint clause' of a query: MAXCON. */
756
757 /* This limit applies to a query when it is represented in */
758 /* `normalized form': that is, the constraints have been */
759 /* expressed as a disjunction of conjunctions of relational */
760 /* expressions. The number of relational expressions in a query */
761 /* that has been expanded in this fashion may be greater than */
762 /* the number of relations in the query as orginally written. */
763 /* For example, the expression */
764
765 /* ( ( A LT 1 ) OR ( B GT 2 ) ) */
766 /* AND */
767 /* ( ( C NE 3 ) OR ( D EQ 4 ) ) */
768
769 /* which contains 4 relational expressions, expands to the */
770 /* equivalent normalized constraint */
771
772 /* ( ( A LT 1 ) AND ( C NE 3 ) ) */
773 /* OR */
774 /* ( ( A LT 1 ) AND ( D EQ 4 ) ) */
775 /* OR */
776 /* ( ( B GT 2 ) AND ( C NE 3 ) ) */
777 /* OR */
778 /* ( ( B GT 2 ) AND ( D EQ 4 ) ) */
779
780 /* which contains eight relational expressions. */
781
782
783
784 /* MXJOIN is the maximum number of tables that can be joined. */
785
786
787 /* MXJCON is the maximum number of join constraints allowed. */
788
789
790 /* Maximum number of order-by columns that may be used in the */
791 /* `order-by clause' of a query: MAXORD. MAXORD = 10. */
792
793
794 /* Maximum number of tokens in a query: 500. Tokens are reserved */
795 /* words, column names, parentheses, and values. Literal strings */
796 /* and time values count as single tokens. */
797
798
799 /* Maximum number of numeric tokens in a query: */
800
801
802 /* Maximum total length of character tokens in a query: */
803
804
805 /* Maximum length of literal string values allowed in queries: */
806 /* MAXSTR. */
807
808
809 /* End Include Section: EK Query Limit Parameters */
810
811 /* $ Disclaimer */
812
813 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
814 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
815 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
816 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
817 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
818 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
819 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
820 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
821 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
822 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
823
824 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
825 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
826 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
827 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
828 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
829 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
830
831 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
832 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
833 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
834 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
835
836
837 /* Include Section: EK Encoded Query Internal Parameters */
838
839 /* ekquery.inc Version 3 16-NOV-1995 (NJB) */
840
841 /* Updated to reflect increased value of MAXCON in */
842 /* ekqlimit.inc. */
843
844 /* ekquery.inc Version 2 03-AUG-1995 (NJB) */
845
846 /* Updated to support representation of the SELECT clause. */
847
848
849 /* ekquery.inc Version 1 12-JAN-1995 (NJB) */
850
851
852 /* An encoded EK query is an abstract data type implemented */
853 /* as an integer cell, along with a double precision cell and */
854 /* a character string. The d.p. cell and string contain numeric */
855 /* and string values from the query string represented by the */
856 /* encoded query. */
857
858 /* The parameters in this file are intended for use only by the */
859 /* EK encoded query access routines. Callers of EK routines should */
860 /* not use these parameters. */
861
862 /* The following parameters are indices of specified elements */
863 /* in the integer portion of the encoded query. */
864
865 /* Encoded query architecture type: */
866
867
868 /* `Name resolution' consists of: */
869
870 /* - Verifying existence of tables: any table names listed */
871 /* in the FROM clause of a query must be loaded. */
872
873 /* - Validating table aliases used to qualify column names. */
874
875 /* - Verifying existence of columns and obtaining data types */
876 /* for columns. */
877
878 /* - Setting data type codes for literal values in the encoded */
879 /* query. */
880
881 /* - Checking consistency of operators and operand data types. */
882
883 /* - Making sure unqualified column names are unambiguous. */
884
885 /* - For constraints, mapping the table names used to qualify */
886 /* column names to the ordinal position in the FROM clause */
887 /* of the corresponding table. */
888
889
890 /* Initialization status---this flag indicates whether the encoded */
891 /* query has been initialized. Values are ITRUE or IFALSE. See the */
892 /* include file ekbool.inc for parameter values. */
893
894
895 /* Parse status---this flag indicates whether the parsing operation */
896 /* that produced an encoded query has been completed. Values are */
897 /* ITRUE or IFALSE. */
898
899
900 /* Name resolution status---this flag indicates whether names */
901 /* have been resolved in an encoded query. Values are ITRUE or */
902 /* IFALSE. */
903
904
905 /* Time resolution status---this flag indicates whether time values */
906 /* have been resolved in an encoded query. Time resolution */
907 /* consists of converting strings representing time values to ET. */
908 /* Values of the status are ITRUE or IFALSE. */
909
910
911 /* Semantic check status---this flag indicates whether semantic */
912 /* checking of constraints has been performed. */
913
914
915 /* Number of tables specified in FROM clause: */
916
917
918 /* Number of constraints in query: */
919
920
921 /* A special value is used to indicate the `maximal' constraint--- */
922 /* one that logically cannot be satisfied. If the constraints */
923 /* are equivalent to the maximal constraint, the location EQNCNS */
924 /* is assigned the value EQMXML */
925
926
927 /* Number of constraint conjunctions: */
928
929
930 /* Number of order-by columns: */
931
932
933 /* Number of SELECT columns: */
934
935
936 /* Size of double precision buffer: */
937
938
939 /* `Free' pointer into double precision buffer: */
940
941
942 /* Size of character string buffer: */
943
944
945 /* `Free' pointer into character string buffer: */
946
947
948 /* The following four base pointers will be valid after a query */
949 /* has been parsed: */
950
951 /* Base pointer for SELECT column descriptors: */
952
953
954 /* Base pointer for constraint descriptors: */
955
956
957 /* Base pointer for conjunction sizes: */
958
959
960 /* Base pointer for order-by column descriptors: */
961
962
963 /* After the quantities named above, the integer array contains */
964 /* series of descriptors for tables, constraints, and order-by */
965 /* columns, as well as a list of `conjunction sizes'---that is, */
966 /* the sizes of the groups of constraints that form conjunctions, */
967 /* after the input query has been re-arranged as a disjunction of */
968 /* conjunctions of constraints. */
969
970
971 /* The offsets of specific elements within descriptors are */
972 /* parameterized. The base addresses of the descriptors themselves */
973 /* must be calculated using the counts and sizes of the items */
974 /* preceding them. */
975
976 /* A diagram of the structure of the variable-size portion of the */
977 /* integer array is shown below: */
978
979
980 /* +-------------------------------------+ */
981 /* | Fixed-size portion of encoded query | */
982 /* +-------------------------------------+ */
983 /* | Encoded FROM clause | */
984 /* +-------------------------------------+ */
985 /* | Encoded constraint clause | */
986 /* +-------------------------------------+ */
987 /* | Conjunction sizes | */
988 /* +-------------------------------------+ */
989 /* | Encoded ORDER BY clause | */
990 /* +-------------------------------------+ */
991 /* | Encoded SELECT clause | */
992 /* +-------------------------------------+ */
993
994
995 /* Value Descriptors */
996 /* ---------------- */
997
998 /* In order to discuss the various descriptors below, we'll make use */
999 /* of sub-structures called `value descriptors'. These descriptors */
1000 /* come in two flavors: character and double precision. For */
1001 /* strings, a descriptor is a set of begin and end pointers that */
1002 /* indicate the location of the string in the character portion of an */
1003 /* encoded query, along with the begin and end pointers for the */
1004 /* corresponding lexeme in the original query. The pointers are set */
1005 /* to zero when they are not in use, for example if they refer to an */
1006 /* optional lexeme that did not appear in the input query. */
1007
1008 /* All value descriptors start with a data type indicator; values */
1009 /* are from ektype.inc. Integer and time values are referred to */
1010 /* by double precision descriptors. */
1011
1012 /* Parameters for string value descriptor elements: */
1013
1014
1015 /* Numeric value descriptors are similar to those for string values, */
1016 /* the difference being that they have only one pointer to the value */
1017 /* they represent. This pointer is the index of the value in the */
1018 /* encoded query's numeric buffer. */
1019
1020
1021 /* All value descriptors have the same size. In order to allow */
1022 /* table descriptors to have the same size as value descriptors, */
1023 /* we include an extra element in the descriptor. */
1024
1025
1026 /* Column Descriptors */
1027 /* ----------------- */
1028
1029 /* Each column descriptor consists of a character descriptor for the */
1030 /* name of the column, followed by an index, which gives the ordinal */
1031 /* position of the column in the logical table to which the column */
1032 /* belongs. The index element is filled in during name resolution. */
1033
1034
1035 /* Table Descriptors */
1036 /* ----------------- */
1037
1038 /* Each table descriptor consists of a character descriptor for the */
1039 /* name of the table, followed by an index, which gives the ordinal */
1040 /* position of the table in the FROM clause in the original query. */
1041 /* The index element is filled in during name resolution. Aliases */
1042 /* and table names have identical descriptor structures. */
1043
1044
1045 /* Constraint descriptors */
1046 /* ------------------ */
1047
1048 /* Each constraint is characterized by: */
1049
1050 /* - A code indicating whether the constraint compares values */
1051 /* in two columns or the value in a column and a literal */
1052 /* value. The values of this element are EQCOL and EQVAL. */
1053
1054
1055
1056 /* - A descriptor for the table used to qualify the */
1057 /* column name on the left side of the constraint. */
1058
1059
1060 /* - A character value descriptor for the column name on the left */
1061 /* side of the query. */
1062
1063
1064 /* - An operator code indicating the relational operator used */
1065 /* in the constraint. */
1066
1067
1068 /* If the constraint compares values from two columns, the */
1069 /* next items are table and column name descriptors that apply to */
1070 /* the column named on the right side of the relational operator. */
1071
1072
1073 /* If the constraint has a literal value on the right side, the */
1074 /* operator code is followed by... */
1075
1076 /* - a value descriptor. */
1077
1078
1079 /* - Size of a constraint descriptor: */
1080
1081
1082 /* Conjunction sizes */
1083 /* ----------------- */
1084
1085 /* The size of each conjunction of constraints occupies a single */
1086 /* integer. */
1087
1088
1089
1090
1091 /* Order-by Column Descriptors */
1092 /* --------------------------- */
1093
1094 /* Each order-by column descriptor contains descriptors for */
1095 /* the table containing the column and for the name of the column */
1096 /* itself; one additional element is used to indicate the direction */
1097 /* of the ordering (ascending vs descending). */
1098
1099
1100 /* - The last integer in the descriptor indicates whether the */
1101 /* order direction is ascending or descending. */
1102
1103
1104 /* - Size of an order-by column descriptor: */
1105
1106
1107 /* Codes indicating sense of ordering (ascending vs descending): */
1108
1109
1110 /* SELECT Column Descriptors */
1111 /* --------------------------- */
1112
1113 /* Each SELECT column descriptor contains descriptors for */
1114 /* the table containing the column and for the name of the column */
1115 /* itself. */
1116
1117
1118 /* - Size of a SELECT column descriptor: */
1119
1120
1121 /* Miscellaneous parameters: */
1122
1123
1124 /* EQIMIN is the minimum size of the integer portion of */
1125 /* an encoded query. EQIMIN depends on the parameters */
1126
1127 /* MAXTAB */
1128 /* MAXCON */
1129 /* MAXORD */
1130 /* MAXSEL */
1131
1132 /* all of which are declared in the include file ekqlimit.inc. */
1133 /* The functional definition of EQIMIN is: */
1134
1135 /* INTEGER EQIMIN */
1136 /* PARAMETER ( EQIMIN = EQVBAS */
1137 /* . + MAXTAB * EQVDSZ * 2 */
1138 /* . + MAXCON * EQCDSZ */
1139 /* . + MAXCON */
1140 /* . + MAXORD * EQODSZ */
1141 /* . + MAXSEL * EQSDSZ ) */
1142
1143
1144 /* End Include Section: EK Encoded Query Internal Parameters */
1145
1146 /* $ Disclaimer */
1147
1148 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1149 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1150 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1151 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1152 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1153 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1154 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1155 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1156 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1157 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1158
1159 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1160 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1161 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1162 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1163 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1164 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1165
1166 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1167 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1168 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1169 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1170
1171
1172 /* Include Section: EK Segment Descriptor Parameters */
1173
1174 /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */
1175
1176
1177 /* All `base addresses' referred to below are the addresses */
1178 /* *preceding* the item the base applies to. This convention */
1179 /* enables simplied address calculations in many cases. */
1180
1181 /* Size of segment descriptor. Note: the include file ekcoldsc.inc */
1182 /* must be updated if this parameter is changed. The parameter */
1183 /* CDOFF in that file should be kept equal to SDSCSZ. */
1184
1185
1186 /* Index of the segment type code: */
1187
1188
1189 /* Index of the segment's number. This number is the segment's */
1190 /* index in the list of segments contained in the EK to which */
1191 /* the segment belongs. */
1192
1193
1194 /* Index of the DAS integer base address of the segment's integer */
1195 /* meta-data: */
1196
1197
1198 /* Index of the DAS character base address of the table name: */
1199
1200
1201 /* Index of the segment's column count: */
1202
1203
1204 /* Index of the segment's record count: */
1205
1206
1207 /* Index of the root page number of the record tree: */
1208
1209
1210 /* Index of the root page number of the character data page tree: */
1211
1212
1213 /* Index of the root page number of the double precision data page */
1214 /* tree: */
1215
1216
1217 /* Index of the root page number of the integer data page tree: */
1218
1219
1220 /* Index of the `modified' flag: */
1221
1222
1223 /* Index of the `initialized' flag: */
1224
1225
1226 /* Index of the shadowing flag: */
1227
1228
1229 /* Index of the companion file handle: */
1230
1231
1232 /* Index of the companion segment number: */
1233
1234
1235 /* The next three items are, respectively, the page numbers of the */
1236 /* last character, d.p., and integer data pages allocated by the */
1237 /* segment: */
1238
1239
1240 /* The next three items are, respectively, the page-relative */
1241 /* indices of the last DAS word in use in the segment's */
1242 /* last character, d.p., and integer data pages: */
1243
1244
1245 /* Index of the DAS character base address of the column name list: */
1246
1247
1248 /* The last descriptor element is reserved for future use. No */
1249 /* parameter is defined to point to this location. */
1250
1251
1252 /* End Include Section: EK Segment Descriptor Parameters */
1253
1254 /* $ Disclaimer */
1255
1256 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1257 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1258 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1259 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1260 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1261 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1262 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1263 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1264 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1265 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1266
1267 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1268 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1269 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1270 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1271 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1272 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1273
1274 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1275 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1276 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1277 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1278
1279
1280 /* Include Section: EK Table Name Size */
1281
1282 /* ektnamsz.inc Version 1 17-JAN-1995 (NJB) */
1283
1284
1285 /* Size of table name, in characters. */
1286
1287
1288 /* End Include Section: EK Table Name Size */
1289
1290 /* $ Disclaimer */
1291
1292 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1293 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1294 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1295 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1296 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1297 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1298 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1299 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1300 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1301 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1302
1303 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1304 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1305 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1306 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1307 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1308 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1309
1310 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1311 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1312 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1313 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1314
1315
1316 /* Include Section: EK Data Types */
1317
1318 /* ektype.inc Version 1 27-DEC-1994 (NJB) */
1319
1320
1321 /* Within the EK system, data types of EK column contents are */
1322 /* represented by integer codes. The codes and their meanings */
1323 /* are listed below. */
1324
1325 /* Integer codes are also used within the DAS system to indicate */
1326 /* data types; the EK system makes no assumptions about compatibility */
1327 /* between the codes used here and those used in the DAS system. */
1328
1329
1330 /* Character type: */
1331
1332
1333 /* Double precision type: */
1334
1335
1336 /* Integer type: */
1337
1338
1339 /* `Time' type: */
1340
1341 /* Within the EK system, time values are represented as ephemeris */
1342 /* seconds past J2000 (TDB), and double precision numbers are used */
1343 /* to store these values. However, since time values require special */
1344 /* treatment both on input and output, and since the `TIME' column */
1345 /* has a special role in the EK specification and code, time values */
1346 /* are identified as a type distinct from double precision numbers. */
1347
1348
1349 /* End Include Section: EK Data Types */
1350
1351 /* $ Brief_I/O */
1352
1353 /* Variable I/O Entry points */
1354 /* -------- --- -------------------------------------------------- */
1355 /* CINDEX I EKCII */
1356 /* ELMENT I EKGC, EKGD, EKGI */
1357 /* EQRYC I EKSRCH */
1358 /* EQRYD I EKSRCH */
1359 /* EQRYI I EKSRCH */
1360 /* FNAME I EKLEF */
1361 /* ROW I EKGC, EKGD, EKGI, EKNELT */
1362 /* SELIDX I EKGC, EKGD, EKGI, EKNELT */
1363 /* COLUMN I-O EKCIN, EKGC, EKGD, EKGI, EKNELT, EKCII */
1364 /* HANDLE I-O EKLEF, EKUEF */
1365 /* N I-O EKTNAM, EKNTAB */
1366 /* TABLE I-O EKCCNT, EKCII, EKTNAM */
1367 /* ATTDSC O EKCII, EKCIN */
1368 /* CCOUNT O EKCCNT */
1369 /* FOUND O EKCIN, EKGC, EKGD, EKGI */
1370 /* NELT O EKNELT */
1371 /* NMROWS O EKSRCH */
1372 /* SEMERR O EKSRCH */
1373 /* ERRMSG O EKSRCH */
1374 /* CDATA O EKGC */
1375 /* DDATA O EKGD */
1376 /* IDATA O EKGI */
1377 /* NULL O EKGC, EKGD, EKGI */
1378 /* FTSIZE P All */
1379 /* MAXCON P All */
1380 /* MXCLLD P All */
1381 /* STSIZE P All */
1382 /* MAXORD P All */
1383 /* CNAMSZ P All */
1384 /* ITSIZE P All */
1385
1386 /* $ Detailed_Input */
1387
1388 /* See the entry points for descriptions of their inputs. */
1389
1390 /* $ Detailed_Output */
1391
1392 /* See the entry points for descriptions of their outputs. */
1393
1394 /* $ Parameters */
1395
1396 /* FTSIZE is the maximum number of EK files that may be */
1397 /* loaded. Any other DAS files loaded by the calling */
1398 /* program count against this limit. */
1399
1400 /* STSIZE is the size of the segment table; this is the */
1401 /* maximum number of segments that can be loaded at */
1402 /* one time. */
1403
1404 /* MXTBLD is the maximum number of tables that can be loaded */
1405 /* at any time. A table can consist of multiple */
1406 /* segments. */
1407
1408 /* MXCLLD is the maximum number of columns that can be loaded */
1409 /* at any time. A column may be spread across */
1410 /* multiple segments; in this case, the portions of */
1411 /* the column contained in each segment count against */
1412 /* this limit. */
1413
1414 /* ADSCSZ is the size of column attribute descriptor. */
1415 /* (Defined in ekattdsc.inc.) */
1416
1417 /* LBCELL is the SPICELIB cell lower bound. */
1418
1419 /* Many other parameters are defined in the include files referenced */
1420 /* above. See those files for details. */
1421
1422
1423 /* $ Exceptions */
1424
1425 /* 1) If this routine is called directly, the error */
1426 /* SPICE(BOGUSENTRY) is signaled. */
1427
1428 /* See the headers of the entry points for descriptions of exceptions */
1429 /* specific to those routines. */
1430
1431 /* $ Files */
1432
1433 /* This suite of routines reads binary `sequence component' EK files. */
1434 /* In order for a binary EK file to be accessible to this routine, */
1435 /* the file must be `loaded' via a call to the entry point EKLEF. */
1436
1437 /* Text format EK files cannot be used by this routine; they must */
1438 /* first be converted by binary format by the NAIF Toolkit utility */
1439 /* SPACIT. */
1440
1441 /* $ Particulars */
1442
1443 /* EKQMGR is an umbrella routine for its entry points: all variables */
1444 /* used by the entry points are declared here. */
1445
1446 /* EKQMGR supports loading and unloading EK files, executing queries, */
1447 /* and fetching the results of executed queries. The entry points */
1448 /* and their functions are: */
1449
1450 /* File loading and unloading: */
1451
1452 /* EKLEF ( EK, load event file ) */
1453 /* EKUEF ( EK, unload event file ) */
1454
1455 /* Query execution: */
1456
1457 /* EKSRCH ( EK, search for events ) */
1458
1459 /* Fetching query results: */
1460
1461 /* EKGC ( EK, get event data, character ) */
1462 /* EKGD ( EK, get event data, double precision ) */
1463 /* EKGI ( EK, get event data, integer ) */
1464
1465 /* Utilities: */
1466
1467 /* EKNTAB ( EK, return the number of loaded tables ) */
1468 /* EKTNAM ( EK, return the names of loaded tables ) */
1469 /* EKCCNT ( EK, return the column count of a table ) */
1470 /* EKCII ( EK, look up column info by index ) */
1471 /* EKNELT ( EK, return number of elements in column entry ) */
1472
1473
1474 /* To issue queries to the EK system, users would normally call the */
1475 /* high-level interface routine EKFIND. EKFIND parses queries and */
1476 /* converts them to the encoded form expected by EKSRCH. It is */
1477 /* possible to call EKSRCH directly, but this should not be attempted */
1478 /* by others than EK masters. EKFIND is not an entry point of */
1479 /* EKQMGR, but instead is a separate subroutine. */
1480
1481 /* $ Examples */
1482
1483 /* 1) Query the EK system and fetch data matching queries. */
1484 /* The code fragment shown here does not rely on advance */
1485 /* knowledge of the input query or the contents of any loaded EK */
1486 /* files. */
1487
1488 /* To simplify the example, we assume that all data are scalar. */
1489 /* This assumption relieves us of the need to test the size of */
1490 /* column entries before fetching them. In the event that a */
1491 /* column contains variable-size array entries, the entry point */
1492 /* EKNELT may be called to obtain the size of column entries to */
1493 /* be fetched. See EKNELT for an example. */
1494
1495
1496 /* C */
1497 /* C Load EK file. Also load leapseconds file for */
1498 /* C time conversion. */
1499 /* C */
1500 /* CALL EKLEF ( EK, HANDLE ) */
1501 /* CALL FURNSH ( LEAP ) */
1502
1503 /* C */
1504 /* C Prompt for query. Parse the SELECT clause using */
1505 /* C EKPSEL. */
1506 /* C */
1507 /* CALL PROMPT ( 'Enter query > ', QUERY ) */
1508
1509 /* CALL EKPSEL ( QUERY, */
1510 /* N, */
1511 /* XBEGS, */
1512 /* XENDS, */
1513 /* XBEGS, */
1514 /* XTYPES, */
1515 /* XCLASS, */
1516 /* TABS, */
1517 /* COLS, */
1518 /* ERROR, */
1519 /* ERRMSG ) */
1520
1521
1522 /* IF ( ERROR ) THEN */
1523
1524 /* WRITE (*,*) ERRMSG */
1525
1526 /* ELSE */
1527 /* C */
1528 /* C Submit query to the EK query system. */
1529 /* C */
1530 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
1531
1532 /* IF ( ERROR ) THEN */
1533
1534 /* WRITE (*,*) ERRMSG */
1535
1536 /* ELSE */
1537 /* C */
1538 /* C Fetch the rows that matched the query. */
1539 /* C */
1540 /* DO ROW = 1, NMROWS */
1541 /* C */
1542 /* C Fetch data from the Ith row. */
1543 /* C */
1544 /* WRITE (*,*) ' ' */
1545 /* WRITE (*,*) 'ROW = ', ROW */
1546
1547 /* DO COL = 1, N */
1548 /* C */
1549 /* C Fetch the data from the Jth selected */
1550 /* C column. */
1551 /* C */
1552 /* IF ( XCLASS(COL) .EQ. 'COL' ) THEN */
1553
1554 /* OUTSTR = COLS(COL) */
1555 /* CALL PREFIX ( '.', 0, OUTSTR ) */
1556 /* CALL PREFIX ( TABS(COL), 0, OUTSTR ) */
1557 /* WRITE (*,*) 'COLUMN = ', OUTSTR */
1558
1559 /* ELSE */
1560
1561 /* B = XBEGS(COL) */
1562 /* E = XENDS(COL) */
1563 /* WRITE (*,*) 'ITEM = ', QUERY(B:E) */
1564
1565 /* END IF */
1566
1567 /* IF ( XTYPES(COL) .EQ. 'CHR' ) THEN */
1568
1569 /* CALL EKGC ( COL, ROW, 1, */
1570 /* . CDATA, NULL, FOUND ) */
1571
1572 /* IF ( NULL ) THEN */
1573 /* WRITE (*,*) '<Null>' */
1574 /* ELSE */
1575 /* WRITE (*,*) CDATA */
1576 /* END IF */
1577
1578
1579 /* ELSE IF ( XTYPES(COL) .EQ. 'DP' ) THEN */
1580
1581 /* CALL EKGD ( COL, ROW, 1, */
1582 /* . DDATA, NULL, FOUND ) */
1583
1584 /* IF ( NULL ) THEN */
1585 /* WRITE (*,*) '<Null>' */
1586 /* ELSE */
1587 /* WRITE (*,*) DDATA */
1588 /* END IF */
1589
1590
1591 /* ELSE IF ( XTYPES(COL) .EQ. 'INT' ) THEN */
1592
1593 /* CALL EKGI ( COL, ROW, 1, */
1594 /* . IDATA, NULL, FOUND ) */
1595
1596 /* IF ( NULL ) THEN */
1597 /* WRITE (*,*) '<Null>' */
1598 /* ELSE */
1599 /* WRITE (*,*) IDATA */
1600 /* END IF */
1601
1602
1603 /* ELSE */
1604 /* C */
1605 /* C The item is a time value. Convert it */
1606 /* C to UTC for output. */
1607 /* C */
1608 /* CALL EKGD ( COL, ROW, 1, */
1609 /* . TDATA, NULL, FOUND ) */
1610
1611 /* IF ( NULL ) THEN */
1612 /* WRITE (*,*) '<Null>' */
1613 /* ELSE */
1614 /* CALL ET2UTC ( TDATA, 'C', 3, UTC ) */
1615 /* WRITE (*,*) UTC */
1616 /* END IF */
1617
1618 /* END IF */
1619
1620 /* END DO */
1621 /* C */
1622 /* C We're done with the column having index COL. */
1623 /* C */
1624 /* END DO */
1625 /* C */
1626 /* C We're done with the row having index ROW. */
1627 /* C */
1628 /* END IF */
1629 /* C */
1630 /* C We either processed the query or had an error. */
1631 /* C */
1632 /* END IF */
1633 /* C */
1634 /* C We either parsed the SELECT clause or had an error. */
1635 /* C */
1636
1637 /* $ Restrictions */
1638
1639 /* None. */
1640
1641 /* $ Literature_References */
1642
1643 /* None. */
1644
1645 /* $ Author_and_Institution */
1646
1647 /* N.J. Bachman (JPL) */
1648 /* B.V. Semenov (JPL) */
1649
1650 /* $ Version */
1651
1652 /* - SPICELIB Version 2.1.0, 09-FEB-2015 (NJB) */
1653
1654 /* Now uses ERRHAN to insert DAS file name into */
1655 /* long error messages. */
1656
1657 /* - SPICELIB Version 2.0.3, 10-FEB-2014 (BVS) */
1658
1659 /* Added descriptions of ADSCSZ and LBCELL to the Parameters */
1660 /* section of the header. */
1661
1662 /* - SPICELIB Version 2.0.2, 22-AUG-2006 (EDW) */
1663
1664 /* Replaced references to LDPOOL with references */
1665 /* to FURNSH. */
1666
1667 /* - SPICELIB Version 2.0.1, 22-SEP-2004 (EDW) */
1668
1669 /* Removed from the header descriptions, all occurrences of the */
1670 /* token used to mark the $Procedure section. */
1671
1672 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
1673
1674 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
1675 /* it now has its link count reset to 1 via a call to EKCLS. */
1676
1677 /* - SPICELIB Version 1.3.0, 12-FEB-1999 (NJB) */
1678
1679 /* Bug fix: in entry point EKNELT, there was a error handling */
1680 /* branch that called CHKOUT where CHKIN should have been called. */
1681 /* This has been fixed. */
1682
1683 /* - SPICELIB Version 1.2.0, 21-JUL-1998 (NJB) */
1684
1685 /* In the entry point EKSRCH, a ZZEKJSQZ call was added after */
1686 /* the ZZEKJOIN call. This change reduces the scratch area usage */
1687 /* for intermediate results of joins. It also prevents ZZEKJOIN */
1688 /* from being handed a join row set containing a segment vector */
1689 /* having no corresponding row vectors. */
1690
1691 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
1692
1693 /* Code fixes were made in routines */
1694
1695 /* EKNELT, EKGC, EKGD, EKGI */
1696
1697 /* Version lines were fixed in all routines: versions were */
1698 /* changed from "Beta" to "SPICELIB." */
1699
1700 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
1701
1702 /* -& */
1703 /* $ Index_Entries */
1704
1705 /* Manage EK query operations */
1706
1707 /* -& */
1708 /* $ Revisions */
1709
1710 /* - SPICELIB Version 1.3.0, 12-FEB-1999 (NJB) */
1711
1712 /* Bug fix: in entry point EKNELT, there was a error handling */
1713 /* branch that called CHKOUT where CHKIN should have been called. */
1714 /* This has been fixed. */
1715
1716 /* - SPICELIB Version 1.2.0, 21-JUL-1998 (NJB) */
1717
1718 /* In the entry point EKSRCH, a ZZEKJSQZ call was added after */
1719 /* the ZZEKJOIN call. This change reduces the scratch area usage */
1720 /* for intermediate results of joins. It also prevents ZZEKJOIN */
1721 /* from being handed a join row set containing a segment vector */
1722 /* having no corresponding row vectors. */
1723
1724 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
1725
1726 /* Code fixes were made in routines */
1727
1728 /* EKNELT, EKGC, EKGD, EKGI */
1729
1730 /* Version lines were fixed in all routines: versions were */
1731 /* changed from "Beta" to "SPICELIB." */
1732
1733 /* -& */
1734
1735 /* SPICELIB functions */
1736
1737
1738 /* Non-SPICELIB functions */
1739
1740
1741 /* Linked list functions: */
1742
1743 /* Find next node */
1744 /* Find tail of list */
1745 /* Return number of free nodes */
1746
1747
1748
1749 /* Local parameters */
1750
1751
1752 /* Maximum number of constraints allowed in a single query: */
1753
1754
1755 /* Miscellaneous parameters */
1756
1757
1758 /* Number of data types */
1759
1760
1761 /* Length of strings used for data type names. */
1762
1763
1764 /* Length of status strings. */
1765
1766
1767 /* Local variables */
1768
1769
1770 /* As do the CK and SPK `BSR' entry points, the EKQMGR entry points */
1771 /* make use of an amusing panoply of tables, linked lists, and */
1772 /* pointers. Here's where they're declared and described. */
1773
1774
1775 /* The file table contains a list of handles of loaded EK files. */
1776 /* Entries in the table are organized as a doubly linked list. */
1777 /* Names of file table variables begin with the string 'FT'. */
1778
1779 /* The maximum number of EK files that can be loaded is FTSIZE. */
1780
1781 /* The linked list pool used to index table entries is called */
1782 /* FTPOOL. */
1783
1784 /* FTHAN is an array containing file handles of loaded EKs. */
1785
1786 /* FTHEAD is the head node of the file list. */
1787
1788
1789 /* The table list contains table names, segment table pointers, */
1790 /* and column table pointers for every table associated with a */
1791 /* loaded segment. The segment table pointers indicate the head node */
1792 /* of the segment list for each table. The column table pointers */
1793 /* indicate the column names and attributes associated with each */
1794 /* table. */
1795
1796 /* The entries of the table list are organized as a doubly linked */
1797 /* list. All variables in the table list have names starting with */
1798 /* the string 'TB'. */
1799
1800 /* MXTBLD is the maximum number of tables that can be */
1801 /* accommodated by the table list. */
1802
1803 /* TBPOOL is the doubly linked list pool used to index the */
1804 /* table list. */
1805
1806 /* TBNAMS is an array of table names. */
1807
1808 /* TBSTPT is an array containing pointers to the heads of segment */
1809 /* lists corresponding to segments belonging to the table. */
1810
1811 /* TBNCOL is the number of columns in each table. */
1812
1813 /* TBCTPT is an array of pointers to lists of column table */
1814 /* entries giving the names and attributes of the columns in each */
1815 /* table. */
1816
1817 /* TBFILS is an array containing, for each table, handles of the */
1818 /* files that contain segments belonging to that table. */
1819
1820 /* TBFLSZ is an array of sizes of handle lists for each table */
1821 /* entry. */
1822
1823 /* TBHEAD is the head node of the table list. */
1824
1825
1826
1827
1828 /* The segment table contains descriptive information for each */
1829 /* loaded segment. Entries in the table are indexed by a linked */
1830 /* list pool containing a doubly linked list for each system (or */
1831 /* instrument) for which segments are loaded. */
1832
1833 /* Names of segment table variables begin with the string 'ST'. */
1834
1835 /* The maximum number of segments that can be loaded is MAXSEG. */
1836 /* Currently, the value of MAXSEG is just the size of the segment */
1837 /* table, STSIZE. */
1838
1839 /* The linked list pool used to index segment table entries is */
1840 /* called STPOOL. */
1841
1842 /* For each loaded segment, the following information is stored: */
1843
1844 /* -- The file handle of the EK containing the segment. */
1845
1846 /* -- The index of the segment within the EK that contains it. */
1847 /* Indices start at 1 and end with the segment count for the */
1848 /* EK file. */
1849
1850 /* -- The segment descriptor. */
1851
1852 /* -- The number of rows in the segment. */
1853
1854 /* -- The number of columns in the segment. */
1855
1856 /* -- A pointer to a list of column descriptors. The */
1857 /* column descriptor table contains a complete descriptor */
1858 /* for every loaded column. */
1859
1860
1861
1862
1863 /* The column descriptor table contains a column descriptor for */
1864 /* every loaded column. This table allows segments to share the */
1865 /* area used for buffering descriptors, making it reasonable for */
1866 /* the buffer space to have room for fewer than */
1867
1868 /* MXCLLD * MAXSEG */
1869
1870 /* column descriptors. */
1871
1872 /* The space in the table is organized as a doubly linked list. */
1873
1874
1875 /* The column attribute table contains attribute information for */
1876 /* every column in every loaded segment. There is one entry per */
1877 /* column name; columns with the same names and different data */
1878 /* types may not be loaded simultaneously. */
1879
1880 /* The entries of the column table are organized as a doubly linked */
1881 /* list. All variables in the column table have names starting with */
1882 /* the string 'CT'. */
1883
1884 /* CTSIZE is the maximum number of distinct column declarations */
1885 /* that can be accommodated by the column table. */
1886
1887 /* CTPOOL is the doubly linked list pool used to index the column */
1888 /* table. */
1889
1890 /* CTNAMS is an array containing column names. */
1891
1892 /* CTCLAS is an array containing column class specifiers. */
1893
1894 /* CTTYPS is an array containing column data types. */
1895
1896 /* CTLENS is an array containing column string length specifiers. */
1897
1898 /* CTFIXD is an array of logical flags indicating whether the */
1899 /* columns they correspond to have fixed size. */
1900
1901 /* CTSIZS is an array of integers indicating the number of array */
1902 /* elements per column entry, for fixed-size columns. */
1903
1904 /* CTINDX is an array of logical flags that indicate whether the */
1905 /* columns they correspond to are indexed. */
1906
1907 /* CTNULL is an array of logical flags that indicate whether the */
1908 /* columns they correspond to may contain null values. */
1909
1910
1911
1912
1913 /* Other local variables */
1914
1915
1916
1917 /* Saved variables */
1918
1919
1920
1921 /* Initial values */
1922
1923 /* Parameter adjustments */
1924 if (eqryd) {
1925 }
1926 if (eqryi) {
1927 }
1928 if (attdsc) {
1929 }
1930
1931 /* Function Body */
1932 switch(n__) {
1933 case 1: goto L_eklef;
1934 case 2: goto L_ekuef;
1935 case 3: goto L_ekntab;
1936 case 4: goto L_ektnam;
1937 case 5: goto L_ekccnt;
1938 case 6: goto L_ekcii;
1939 case 7: goto L_eksrch;
1940 case 8: goto L_eknelt;
1941 case 9: goto L_ekgc;
1942 case 10: goto L_ekgd;
1943 case 11: goto L_ekgi;
1944 }
1945
1946
1947 /* Standard SPICE error handling. */
1948
1949 if (return_()) {
1950 return 0;
1951 } else {
1952 chkin_("EKQMGR", (ftnlen)6);
1953 }
1954
1955 /* Never come here. */
1956
1957 sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17);
1958 chkout_("EKQMGR", (ftnlen)6);
1959 return 0;
1960 /* $Procedure EKLEF ( EK, load event file ) */
1961
1962 L_eklef:
1963 /* $ Abstract */
1964
1965 /* Load an EK file, making it accessible to the EK readers. */
1966
1967 /* $ Disclaimer */
1968
1969 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1970 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1971 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1972 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1973 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1974 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1975 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1976 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1977 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1978 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1979
1980 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1981 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1982 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1983 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1984 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1985 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1986
1987 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1988 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1989 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1990 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1991
1992 /* $ Required_Reading */
1993
1994 /* EK */
1995
1996 /* $ Keywords */
1997
1998 /* EK */
1999 /* FILES */
2000 /* SEARCH */
2001
2002 /* $ Declarations */
2003
2004 /* CHARACTER*(*) FNAME */
2005 /* INTEGER HANDLE */
2006
2007 /* $ Brief_I/O */
2008
2009 /* Variable I/O Description */
2010 /* -------- --- -------------------------------------------------- */
2011 /* FNAME I Name of EK file to load. */
2012 /* HANDLE O File handle of loaded EK file. */
2013
2014 /* $ Detailed_Input */
2015
2016 /* FNAME is the name of a binary EK file to be loaded. */
2017
2018 /* $ Detailed_Output */
2019
2020 /* HANDLE is the handle of the EK file. The file is */
2021 /* accessible by the EK reader routines once it */
2022 /* has been loaded. */
2023
2024 /* $ Parameters */
2025
2026 /* None. */
2027
2028 /* $ Exceptions */
2029
2030 /* 1) If the EK file indicated by FNAME contains a column whose */
2031 /* name matches that of a column in an already loaded EK, but */
2032 /* whose declared attributes don't match those of the loaded */
2033 /* column of the same name, the error SPICE(BADATTRIBUTES) is */
2034 /* signaled. HANDLE is is undefined in this case. */
2035
2036 /* 2) Loading an EK file that is already loaded does not cause side */
2037 /* effects. The handle already associated with the file will be */
2038 /* returned. */
2039
2040 /* 3) If a file open error occurs, the problem will be diagnosed by */
2041 /* routines called by this routine. HANDLE is undefined in */
2042 /* this case. */
2043
2044 /* 4) If loading the input file would cause the maximum number of */
2045 /* loaded EK files to be exceeded, the error */
2046 /* SPICE(EKFILETABLEFULL) will be signaled. HANDLE is */
2047 /* undefined in this case. This routine will attempt to */
2048 /* unload the file from the DAS system. */
2049
2050 /* 5) If loading the input file would cause the maximum number of */
2051 /* loaded DAS files to be exceeded, the error will be diagnosed */
2052 /* by routines called by this routine. HANDLE is undefined in */
2053 /* this case. This routine will attempt to unload the file */
2054 /* from the DAS system. */
2055
2056 /* 6) If loading the input file would cause the maximum number of */
2057 /* segments allowed in loaded EK files to be exceeded, the error */
2058 /* SPICE(EKSEGMENTTABLEFULL) will be signaled. HANDLE is */
2059 /* is undefined in this case. This routine will attempt to */
2060 /* unload the file from the DAS system. */
2061
2062 /* 7) If loading the input file would cause the maximum number of */
2063 /* columns allowed in loaded EK files to be exceeded, the error */
2064 /* SPICE(EKCOLDESCTABLEFULL) will be signaled. HANDLE is */
2065 /* is undefined in this case. This routine will attempt to */
2066 /* unload the file from the DAS system. */
2067
2068 /* 8) If loading the input file would cause the maximum allowed */
2069 /* number of columns having distinct attributes in loaded EK */
2070 /* files to be exceeded, the error SPICE(EKCOLATTRTABLEFULL) will */
2071 /* be signaled. HANDLE is is undefined in this case. This */
2072 /* routine will attempt to unload the file from the DAS system. */
2073
2074 /* 9) If loading the input file would cause the maximum number of */
2075 /* instrument codes allowed in loaded EK files to be exceeded, */
2076 /* the error SPICE(EKIDTABLEFULL) will be signaled. HANDLE is */
2077 /* is undefined in this case. This routine will attempt to */
2078 /* unload the file from the DAS system. */
2079
2080 /* 10) If the input file does not contain at least one segment, the */
2081 /* error SPICE(EKNOSEGMENTS) will be signaled. */
2082
2083 /* $ Files */
2084
2085 /* See description of FNAME in $Detailed_Input. */
2086
2087 /* $ Particulars */
2088
2089 /* This routine makes EK files known to the EK system. It is */
2090 /* necessary to load EK files using this routine in order to */
2091 /* query the files using the EK readers. */
2092
2093 /* $ Examples */
2094
2095 /* 1) Load three EK files. During query execution, all files */
2096 /* will be searched. */
2097
2098 /* DO I = 1, 3 */
2099 /* CALL EKLEF ( EK(I), HANDLE ) */
2100 /* END DO */
2101
2102 /* [Perform queries] */
2103
2104
2105 /* 2) Load 25 EK files sequentially, unloading the previous file */
2106 /* before each new file is loaded. Unloading files prevents */
2107 /* them from being searched during query execution. */
2108
2109 /* DO I = 1, 25 */
2110
2111 /* CALL EKLEF ( EK(I), HANDLE ) */
2112
2113 /* [Perform queries] */
2114
2115 /* CALL EKUEF ( HANDLE ) */
2116
2117 /* END DO */
2118
2119 /* $ Restrictions */
2120
2121 /* 1) EK files containing columns having the same name but */
2122 /* inconsistent declarations are not diagnosed. Such kernels */
2123 /* are invalid in any case. */
2124
2125 /* $ Literature_References */
2126
2127 /* None. */
2128
2129 /* $ Author_and_Institution */
2130
2131 /* N.J. Bachman (JPL) */
2132
2133 /* $ Version */
2134
2135 /* - SPICELIB Version 2.1.0, 09-FEB-2015 (NJB) */
2136
2137 /* Now uses ERRHAN to insert DAS file name into */
2138 /* long error messages. */
2139
2140 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
2141
2142 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
2143 /* it now has its link count reset to 1 via a call to EKCLS. */
2144
2145 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
2146
2147 /* Previous version line was changed from "Beta" to "SPICELIB." */
2148
2149 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
2150
2151 /* -& */
2152 /* $ Index_Entries */
2153
2154 /* load EK file */
2155 /* load E-Kernel */
2156
2157 /* -& */
2158
2159 /* Standard SPICE error handling. */
2160
2161 if (return_()) {
2162 return 0;
2163 } else {
2164 chkin_("EKLEF", (ftnlen)5);
2165 }
2166
2167 /* Here's a brief overview of what follows: */
2168
2169 /* -- We do some once-per-program run initializations. */
2170
2171 /* -- We do some simple error checks. We need to make sure */
2172 /* that DAS can load the file, and that the EK architecture is */
2173 /* the right kind. */
2174
2175 /* -- We need to make sure that there's enough space in our */
2176 /* data structures to hold the information about the new */
2177 /* EK. Some of these checks are simple; we do these first. */
2178 /* However, checking that we have enough room in the column */
2179 /* table is best done by simply loading the column data into */
2180 /* the table. If we run out of room, we abort the load. */
2181
2182 /* -- We also need to make sure that the column attributes for */
2183 /* any two columns with the same name in the same table are */
2184 /* identical. This is easy to do if the attributes for every */
2185 /* column we've encountered have been loaded into the column */
2186 /* table. */
2187
2188 /* -- We save the table name and column names and attributes for */
2189 /* each new table we encounter. For each table, we maintain a */
2190 /* list of handles of files that contain segments in that */
2191 /* table. */
2192
2193 /* -- We make a segment table entry for each segment we find. */
2194
2195 /* -- We save the column descriptor for each column we find, */
2196 /* associating it with the segment table entry for the segment */
2197 /* containing the column. The column descriptor entries are */
2198 /* linked together in the same order that the corresponding */
2199 /* column names appear in the parent table's column name list; */
2200 /* this order is not necessarily the order that the columns */
2201 /* have within the segment. */
2202
2203 /* -- We maintain a list of handles of loaded EKs. */
2204
2205 /* If we run out of room in the column table, we clean up our */
2206 /* mess. This means removing the current file's contributions */
2207 /* to the column table, segment table, file table, and if */
2208 /* necessary, the table list. */
2209
2210
2211 /* On the first pass through this routine, initialize the tables, */
2212 /* if it hasn't been done yet. */
2213
2214 if (first) {
2215
2216 /* Initialize the file table pool, segment table pool, column */
2217 /* descriptor pool, column table pool, and table list pool. */
2218
2219 lnkini_(&c__20, ftpool);
2220 lnkini_(&c__200, stpool);
2221 lnkini_(&c__10000, dtpool);
2222 lnkini_(&c__500, ctpool);
2223 lnkini_(&c__100, tbpool);
2224 fthead = 0;
2225 tbhead = 0;
2226 first = FALSE_;
2227 }
2228
2229 /* Open the EK file for read access. Bail out now if this doesn't */
2230 /* work. This retreat will protect the various tables from */
2231 /* corruption. */
2232
2233 ekopr_(fname, handle, fname_len);
2234 if (failed_()) {
2235 chkout_("EKLEF", (ftnlen)5);
2236 return 0;
2237 }
2238
2239 /* Check to see whether the named EK has already been loaded. */
2240 /* If so, we've added another link to the EK, which must be */
2241 /* removed. */
2242
2243 i__ = fthead;
2244 while(i__ > 0) {
2245 if (*handle == fthan[(i__1 = i__ - 1) < 20 && 0 <= i__1 ? i__1 :
2246 s_rnge("fthan", i__1, "ekqmgr_", (ftnlen)1214)]) {
2247
2248 /* The last call we made to EKOPR added another link to */
2249 /* the EK file. Remove this link. */
2250
2251 dascls_(handle);
2252 chkout_("EKLEF", (ftnlen)5);
2253 return 0;
2254 }
2255 i__ = lnknxt_(&i__, ftpool);
2256 }
2257
2258 /* Nothing doing unless the architecture is correct. This file */
2259 /* should be a paged DAS EK. */
2260
2261 zzekpgch_(handle, "READ", (ftnlen)4);
2262
2263 /* Before getting too involved with this new EK file, let's check it */
2264 /* out. We must have enough room to accommodate it in the file */
2265 /* table, segment table, table list, and column table. */
2266
2267 /* Make sure there's enough room in the file table. */
2268
2269 if (lnknfn_(ftpool) == 0) {
2270
2271 /* Sorry, there are no free file table entries left. */
2272
2273 /* We close the EK AFTER setting the long error message. */
2274
2275 setmsg_("The EK file # could not be loaded; the maximum number of lo"
2276 "aded EKs has already been reached.", (ftnlen)93);
2277 errhan_("#", handle, (ftnlen)1);
2278 ekcls_(handle);
2279 sigerr_("SPICE(EKFILETABLEFULL)", (ftnlen)22);
2280 chkout_("EKLEF", (ftnlen)5);
2281 return 0;
2282 }
2283
2284 /* Find out how many segments are in the new kernel, and make */
2285 /* sure there's enough room in the segment table. */
2286
2287 nseg = eknseg_(handle);
2288 if (nseg > lnknfn_(stpool)) {
2289
2290 /* There are too many segments for the amount of space we've got */
2291 /* left. */
2292
2293 /* We close the EK AFTER setting the long error message. */
2294
2295 setmsg_("The EK file # could not be loaded; the maximum number of lo"
2296 "aded segments has already been reached.", (ftnlen)98);
2297 errhan_("#", handle, (ftnlen)1);
2298 ekcls_(handle);
2299 sigerr_("SPICE(EKSEGTABLEFULL)", (ftnlen)21);
2300 chkout_("EKLEF", (ftnlen)5);
2301 return 0;
2302 } else if (nseg < 1) {
2303 setmsg_("The EK file # contains no segments.", (ftnlen)35);
2304 errhan_("#", handle, (ftnlen)1);
2305 ekcls_(handle);
2306 sigerr_("SPICE(EKNOSEGMENTS)", (ftnlen)19);
2307 chkout_("EKLEF", (ftnlen)5);
2308 return 0;
2309 }
2310
2311 /* At this point, the file has insinuated itself into our confidence, */
2312 /* justified or not. We'll attempt to load the segment and column */
2313 /* tables, and we'll update the table list if new tables are */
2314 /* introduced in this file. */
2315
2316 seg = 1;
2317 s_copy(state, "LOAD_FILE_TABLE", (ftnlen)80, (ftnlen)15);
2318 while(s_cmp(state, "DONE", (ftnlen)80, (ftnlen)4) != 0) {
2319 if (s_cmp(state, "LOAD_FILE_TABLE", (ftnlen)80, (ftnlen)15) == 0) {
2320
2321 /* Allocate a file table entry and link the new entry in before */
2322 /* the current head of the list. Update the list head pointer. */
2323 /* Record the file handle in the new file table entry. */
2324
2325 lnkan_(ftpool, &new__);
2326 lnkilb_(&new__, &fthead, ftpool);
2327 fthead = new__;
2328 fthan[(i__1 = new__ - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("fthan"
2329 , i__1, "ekqmgr_", (ftnlen)1317)] = *handle;
2330 s_copy(state, "SUMMARIZE_SEGMENT", (ftnlen)80, (ftnlen)17);
2331 } else if (s_cmp(state, "SUMMARIZE_SEGMENT", (ftnlen)80, (ftnlen)17)
2332 == 0) {
2333
2334 /* Get the summary information for this segment. */
2335
2336 zzeksinf_(handle, &seg, tabnam, segdsc, cnams, cdscrs, (ftnlen)64,
2337 (ftnlen)32);
2338 ncols = segdsc[4];
2339
2340 /* Before going further, check the segment for duplicate */
2341 /* column names. Bail out if we find any. */
2342
2343 ssizec_(&c__500, cnmset, (ftnlen)32);
2344 movec_(cnams, &ncols, cnmset + 192, (ftnlen)32, (ftnlen)32);
2345 validc_(&c__500, &ncols, cnmset, (ftnlen)32);
2346 if (cardc_(cnmset, (ftnlen)32) < ncols) {
2347 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2348 s_copy(problm, "DUPLICATE_COLUMN_NAMES", (ftnlen)80, (ftnlen)
2349 22);
2350 } else {
2351 s_copy(state, "FIND_TABLE", (ftnlen)80, (ftnlen)10);
2352 }
2353 } else if (s_cmp(state, "FIND_TABLE", (ftnlen)80, (ftnlen)10) == 0) {
2354
2355 /* Traverse the table list, checking for a match. */
2356
2357 tbcurr = tbhead;
2358 presnt = FALSE_;
2359 while(tbcurr > 0 && ! presnt) {
2360 if (s_cmp(tabnam, tbnams + (((i__1 = tbcurr - 1) < 100 && 0 <=
2361 i__1 ? i__1 : s_rnge("tbnams", i__1, "ekqmgr_", (
2362 ftnlen)1362)) << 6), (ftnlen)64, (ftnlen)64) == 0) {
2363 presnt = TRUE_;
2364 } else {
2365 tbcurr = lnknxt_(&tbcurr, tbpool);
2366 }
2367 }
2368
2369 /* If TABNAM is the name of a table we know about, go on to */
2370 /* fill out the segment list entry for the current segment. */
2371 /* If we didn't find TABNAM, we have a new table. Make a table */
2372 /* list entry for it. */
2373
2374 if (presnt) {
2375
2376 /* Before going further, make sure the number of columns */
2377 /* in the segment matches the number of columns in the */
2378 /* parent table. */
2379
2380 if (ncols != tbncol[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2381 i__1 : s_rnge("tbncol", i__1, "ekqmgr_", (ftnlen)1382)
2382 ]) {
2383 npcol = tbncol[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2384 i__1 : s_rnge("tbncol", i__1, "ekqmgr_", (ftnlen)
2385 1384)];
2386 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2387 s_copy(problm, "COLUMN_NUMBER_MISMATCH", (ftnlen)80, (
2388 ftnlen)22);
2389 } else {
2390
2391 /* Add the current file to the list of files containing */
2392 /* the current table. */
2393
2394 tbfils[(i__1 = tbcurr * 20 - 20) < 2000 && 0 <= i__1 ?
2395 i__1 : s_rnge("tbfils", i__1, "ekqmgr_", (ftnlen)
2396 1393)] = *handle;
2397 tbflsz[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 :
2398 s_rnge("tbflsz", i__1, "ekqmgr_", (ftnlen)1394)] =
2399 tbflsz[(i__2 = tbcurr - 1) < 100 && 0 <= i__2 ?
2400 i__2 : s_rnge("tbflsz", i__2, "ekqmgr_", (ftnlen)
2401 1394)] + 1;
2402 s_copy(state, "MAKE_SEGMENT_TABLE_ENTRY", (ftnlen)80, (
2403 ftnlen)24);
2404 }
2405 } else {
2406
2407 /* This segment belongs to a new table. */
2408
2409 s_copy(state, "MAKE_TABLE_LIST_ENTRY", (ftnlen)80, (ftnlen)21)
2410 ;
2411 }
2412 } else if (s_cmp(state, "MAKE_TABLE_LIST_ENTRY", (ftnlen)80, (ftnlen)
2413 21) == 0) {
2414
2415 /* Allocate a table list entry, if we can. */
2416
2417 if (lnknfn_(tbpool) == 0) {
2418
2419 /* Oops, we're out of room. */
2420
2421 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2422 s_copy(problm, "TABLE_LIST_FULL", (ftnlen)80, (ftnlen)15);
2423 } else {
2424
2425 /* We have an entry; link it to the tail of the table list. */
2426 /* For consistency with the case in which the table entry */
2427 /* already exists, we'll call the table list node TBCURR. */
2428
2429 /* If this is the first table in the table list, set the */
2430 /* table head pointer. */
2431
2432 lnkan_(tbpool, &tbcurr);
2433 if (tbhead <= 0) {
2434 tbhead = tbcurr;
2435 } else {
2436 lnkilb_(&tbhead, &tbcurr, tbpool);
2437 }
2438
2439 /* Fill in the table name. */
2440
2441 s_copy(tbnams + (((i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2442 i__1 : s_rnge("tbnams", i__1, "ekqmgr_", (ftnlen)1442)
2443 ) << 6), tabnam, (ftnlen)64, (ftnlen)64);
2444
2445 /* Since this table is new, the file list for this table */
2446 /* contains only the handle of the current EK. */
2447
2448 tbfils[(i__1 = tbcurr * 20 - 20) < 2000 && 0 <= i__1 ? i__1 :
2449 s_rnge("tbfils", i__1, "ekqmgr_", (ftnlen)1447)] = *
2450 handle;
2451 tbflsz[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2452 "tbflsz", i__1, "ekqmgr_", (ftnlen)1448)] = 1;
2453
2454 /* Initialize the column count, column table pointer, and */
2455 /* segment list pointer for this table. */
2456
2457 tbncol[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2458 "tbncol", i__1, "ekqmgr_", (ftnlen)1454)] = ncols;
2459 tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2460 "tbctpt", i__1, "ekqmgr_", (ftnlen)1455)] = 0;
2461 tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2462 "tbstpt", i__1, "ekqmgr_", (ftnlen)1456)] = 0;
2463
2464 /* Go on to add a segment table entry for the current */
2465 /* segment. */
2466
2467 s_copy(state, "MAKE_SEGMENT_TABLE_ENTRY", (ftnlen)80, (ftnlen)
2468 24);
2469 }
2470 } else if (s_cmp(state, "MAKE_SEGMENT_TABLE_ENTRY", (ftnlen)80, (
2471 ftnlen)24) == 0) {
2472
2473 /* Add the data for the current segment to the segment */
2474 /* table. */
2475
2476 /* Allocate a segment table entry. We've already verified */
2477 /* that there's enough room. */
2478
2479 lnkan_(stpool, &stnew);
2480
2481 /* Link this segment table entry to the tail of the segment */
2482 /* list for the parent table, or, if the tail is NIL, just set */
2483 /* the segment list pointer to the current segment node. */
2484
2485 if (tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2486 "tbstpt", i__1, "ekqmgr_", (ftnlen)1482)] <= 0) {
2487 tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
2488 "tbstpt", i__1, "ekqmgr_", (ftnlen)1484)] = stnew;
2489 } else {
2490 lnkilb_(&tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1
2491 : s_rnge("tbstpt", i__1, "ekqmgr_", (ftnlen)1488)], &
2492 stnew, stpool);
2493 }
2494
2495 /* At this point, we can fill in all elements of the segment */
2496 /* table entry except for the pointers into the column table */
2497 /* and the column base addresses. */
2498
2499 sthan[(i__1 = stnew - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("sth"
2500 "an", i__1, "ekqmgr_", (ftnlen)1497)] = *handle;
2501 stsidx[(i__1 = stnew - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge(
2502 "stsidx", i__1, "ekqmgr_", (ftnlen)1498)] = seg;
2503 stnrow[(i__1 = stnew - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge(
2504 "stnrow", i__1, "ekqmgr_", (ftnlen)1499)] = segdsc[5];
2505 stncol[(i__1 = stnew - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge(
2506 "stncol", i__1, "ekqmgr_", (ftnlen)1500)] = segdsc[4];
2507 stdtpt[(i__1 = stnew - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge(
2508 "stdtpt", i__1, "ekqmgr_", (ftnlen)1501)] = 0;
2509 movei_(segdsc, &c__24, &stdscs[(i__1 = stnew * 24 - 24) < 4800 &&
2510 0 <= i__1 ? i__1 : s_rnge("stdscs", i__1, "ekqmgr_", (
2511 ftnlen)1503)]);
2512
2513 /* The next step is to set up the column attributes and */
2514 /* descriptors. */
2515
2516 s_copy(state, "MAKE_COLUMN_TABLE_ENTRIES", (ftnlen)80, (ftnlen)25)
2517 ;
2518 } else if (s_cmp(state, "MAKE_COLUMN_TABLE_ENTRIES", (ftnlen)80, (
2519 ftnlen)25) == 0) {
2520 if (presnt) {
2521
2522 /* If the current table was present before loading the */
2523 /* current segment, we must make sure that the attributes */
2524 /* of the columns in this segment match those of the table */
2525 /* to which the segment belongs. */
2526
2527 /* We must load the column descriptors for this segment */
2528 /* in the *same order* as those for every other segment */
2529 /* in the table. This order matches that of the columns */
2530 /* in the column attribute list for the table. */
2531
2532 /* For each column in the column list of the current table, */
2533 /* check the list of column names for the current segment, */
2534 /* looking for a match. */
2535
2536 j = tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 :
2537 s_rnge("tbctpt", i__1, "ekqmgr_", (ftnlen)1532)];
2538 while(j > 0 && s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)5) !=
2539 0) {
2540 k = isrchc_(ctnams + (((i__1 = j - 1) < 500 && 0 <= i__1 ?
2541 i__1 : s_rnge("ctnams", i__1, "ekqmgr_", (ftnlen)
2542 1538)) << 5), &ncols, cnams, (ftnlen)32, (ftnlen)
2543 32);
2544 if (k > 0) {
2545
2546 /* We have a name match. At this point, we must */
2547 /* check that the column's other attributes---data */
2548 /* type, size, and whether the column is */
2549 /* indexed---match as well. It's an error if they */
2550 /* don't. */
2551
2552 indexd = cdscrs[(i__1 = k * 11 - 6) < 5500 && 0 <=
2553 i__1 ? i__1 : s_rnge("cdscrs", i__1, "ekqmgr_"
2554 , (ftnlen)1549)] != -1;
2555 nulsok = cdscrs[(i__1 = k * 11 - 4) < 5500 && 0 <=
2556 i__1 ? i__1 : s_rnge("cdscrs", i__1, "ekqmgr_"
2557 , (ftnlen)1550)] != -1;
2558 attmch = cdscrs[(i__1 = k * 11 - 11) < 5500 && 0 <=
2559 i__1 ? i__1 : s_rnge("cdscrs", i__1, "ekqmgr_"
2560 , (ftnlen)1551)] == ctclas[(i__2 = j - 1) <
2561 500 && 0 <= i__2 ? i__2 : s_rnge("ctclas",
2562 i__2, "ekqmgr_", (ftnlen)1551)] && cdscrs[(
2563 i__3 = k * 11 - 10) < 5500 && 0 <= i__3 ?
2564 i__3 : s_rnge("cdscrs", i__3, "ekqmgr_", (
2565 ftnlen)1551)] == cttyps[(i__4 = j - 1) < 500
2566 && 0 <= i__4 ? i__4 : s_rnge("cttyps", i__4,
2567 "ekqmgr_", (ftnlen)1551)] && cdscrs[(i__5 = k
2568 * 11 - 9) < 5500 && 0 <= i__5 ? i__5 : s_rnge(
2569 "cdscrs", i__5, "ekqmgr_", (ftnlen)1551)] ==
2570 ctlens[(i__6 = j - 1) < 500 && 0 <= i__6 ?
2571 i__6 : s_rnge("ctlens", i__6, "ekqmgr_", (
2572 ftnlen)1551)] && cdscrs[(i__7 = k * 11 - 8) <
2573 5500 && 0 <= i__7 ? i__7 : s_rnge("cdscrs",
2574 i__7, "ekqmgr_", (ftnlen)1551)] == ctsizs[(
2575 i__8 = j - 1) < 500 && 0 <= i__8 ? i__8 :
2576 s_rnge("ctsizs", i__8, "ekqmgr_", (ftnlen)
2577 1551)] && indexd == ctindx[(i__9 = j - 1) <
2578 500 && 0 <= i__9 ? i__9 : s_rnge("ctindx",
2579 i__9, "ekqmgr_", (ftnlen)1551)] && nulsok ==
2580 ctnull[(i__10 = j - 1) < 500 && 0 <= i__10 ?
2581 i__10 : s_rnge("ctnull", i__10, "ekqmgr_", (
2582 ftnlen)1551)];
2583 if (attmch) {
2584
2585 /* Great, the attributes match. Actually, the */
2586 /* addition of the current segment can *change* */
2587 /* one attribute of the current table: the */
2588 /* maximum non-blank width associated with the */
2589 /* current column, if the column has character */
2590 /* type. We'll make this change after we're */
2591 /* sure we won't have to undo it. */
2592
2593 /* Store the column descriptor for this column */
2594 /* in the descriptor table. We'll need to */
2595 /* allocate a descriptor table entry first. */
2596
2597 if (lnknfn_(dtpool) == 0) {
2598
2599 /* No free nodes left in the descriptor table. */
2600
2601 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2602 s_copy(problm, "DESCRIPTOR_TABLE_FULL", (
2603 ftnlen)80, (ftnlen)21);
2604 } else {
2605
2606 /* A free node is available. Link it in */
2607 /* at the tail of the descriptor list for */
2608 /* the current segment. */
2609
2610 lnkan_(dtpool, &dtnew);
2611 if (stdtpt[(i__1 = stnew - 1) < 200 && 0 <=
2612 i__1 ? i__1 : s_rnge("stdtpt", i__1,
2613 "ekqmgr_", (ftnlen)1589)] <= 0) {
2614 stdtpt[(i__1 = stnew - 1) < 200 && 0 <=
2615 i__1 ? i__1 : s_rnge("stdtpt",
2616 i__1, "ekqmgr_", (ftnlen)1591)] =
2617 dtnew;
2618 } else {
2619 lnkilb_(&stdtpt[(i__1 = stnew - 1) < 200
2620 && 0 <= i__1 ? i__1 : s_rnge(
2621 "stdtpt", i__1, "ekqmgr_", (
2622 ftnlen)1595)], &dtnew, dtpool);
2623 }
2624
2625 /* Fill in the descriptor. */
2626
2627 movei_(&cdscrs[(i__1 = k * 11 - 11) < 5500 &&
2628 0 <= i__1 ? i__1 : s_rnge("cdscrs",
2629 i__1, "ekqmgr_", (ftnlen)1602)], &
2630 c__11, &dtdscs[(i__2 = dtnew * 11 -
2631 11) < 110000 && 0 <= i__2 ? i__2 :
2632 s_rnge("dtdscs", i__2, "ekqmgr_", (
2633 ftnlen)1602)]);
2634 }
2635
2636 /* We filled in a descriptor table entry, or */
2637 /* else we ran out of room. */
2638
2639 } else {
2640
2641 /* Seriously bad news. Someone's tried to */
2642 /* load an EK containing a column with */
2643 /* attributes that conflict with those of a */
2644 /* loaded column of the same name in the */
2645 /* current table. */
2646
2647 s_copy(colnam, ctnams + (((i__1 = j - 1) < 500 &&
2648 0 <= i__1 ? i__1 : s_rnge("ctnams", i__1,
2649 "ekqmgr_", (ftnlen)1620)) << 5), (ftnlen)
2650 32, (ftnlen)32);
2651 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2652 s_copy(problm, "MISMATCHED_COLUMN_ATTRIBUTES", (
2653 ftnlen)80, (ftnlen)28);
2654 }
2655 } else {
2656
2657 /* No name match; the current column from the current */
2658 /* table is not present in the segment we're looking */
2659 /* at. */
2660
2661 s_copy(colnam, ctnams + (((i__1 = j - 1) < 500 && 0 <=
2662 i__1 ? i__1 : s_rnge("ctnams", i__1, "ekqmg"
2663 "r_", (ftnlen)1633)) << 5), (ftnlen)32, (
2664 ftnlen)32);
2665 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2666 s_copy(problm, "MISSING_COLUMN", (ftnlen)80, (ftnlen)
2667 14);
2668 }
2669
2670 /* The current column matched one in the column list */
2671 /* for the current table, or else we have a problem. */
2672
2673 /* Advance to the next column in the table's column list. */
2674
2675 if (s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)5) != 0) {
2676 j = lnknxt_(&j, ctpool);
2677 }
2678 }
2679
2680 /* We've made descriptor table entries for each column in */
2681 /* the current segment, or else we have an error. */
2682
2683 } else {
2684
2685 /* We need to set up the column attribute entries for */
2686 /* the new table introduced by loading this segment. We */
2687 /* also need to set up descriptor table entries for the */
2688 /* segment. We *don't* have to check the consistency of */
2689 /* the attributes of the columns. */
2690
2691 k = 1;
2692 while(k <= ncols && s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)
2693 5) != 0) {
2694
2695 /* Allocate a new entry in the column attribute table and */
2696 /* link it to the tail of the column list for the */
2697 /* current table. If the column list is empty, update */
2698 /* the list head. */
2699
2700 if (lnknfn_(ctpool) == 0) {
2701
2702 /* There's no more space to store attribute */
2703 /* descriptors. */
2704
2705 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2706 s_copy(problm, "ATTRIBUTE_TABLE_FULL", (ftnlen)80, (
2707 ftnlen)20);
2708 } else {
2709 lnkan_(ctpool, &ctnew);
2710 if (tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2711 i__1 : s_rnge("tbctpt", i__1, "ekqmgr_", (
2712 ftnlen)1684)] <= 0) {
2713 tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2714 i__1 : s_rnge("tbctpt", i__1, "ekqmgr_", (
2715 ftnlen)1686)] = ctnew;
2716 } else {
2717 lnkilb_(&tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <=
2718 i__1 ? i__1 : s_rnge("tbctpt", i__1,
2719 "ekqmgr_", (ftnlen)1690)], &ctnew, ctpool)
2720 ;
2721 }
2722
2723 /* Fill in the new column attribute entry with the */
2724 /* attributes for this column. */
2725
2726 s_copy(ctnams + (((i__1 = ctnew - 1) < 500 && 0 <=
2727 i__1 ? i__1 : s_rnge("ctnams", i__1, "ekqmgr_"
2728 , (ftnlen)1698)) << 5), cnams + (((i__2 = k -
2729 1) < 500 && 0 <= i__2 ? i__2 : s_rnge("cnams",
2730 i__2, "ekqmgr_", (ftnlen)1698)) << 5), (
2731 ftnlen)32, (ftnlen)32);
2732 ctclas[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2733 s_rnge("ctclas", i__1, "ekqmgr_", (ftnlen)
2734 1699)] = cdscrs[(i__2 = k * 11 - 11) < 5500 &&
2735 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2736 "ekqmgr_", (ftnlen)1699)];
2737 cttyps[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2738 s_rnge("cttyps", i__1, "ekqmgr_", (ftnlen)
2739 1700)] = cdscrs[(i__2 = k * 11 - 10) < 5500 &&
2740 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2741 "ekqmgr_", (ftnlen)1700)];
2742 ctlens[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2743 s_rnge("ctlens", i__1, "ekqmgr_", (ftnlen)
2744 1701)] = cdscrs[(i__2 = k * 11 - 9) < 5500 &&
2745 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2746 "ekqmgr_", (ftnlen)1701)];
2747 ctsizs[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2748 s_rnge("ctsizs", i__1, "ekqmgr_", (ftnlen)
2749 1702)] = cdscrs[(i__2 = k * 11 - 8) < 5500 &&
2750 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2751 "ekqmgr_", (ftnlen)1702)];
2752 ctindx[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2753 s_rnge("ctindx", i__1, "ekqmgr_", (ftnlen)
2754 1703)] = cdscrs[(i__2 = k * 11 - 6) < 5500 &&
2755 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2756 "ekqmgr_", (ftnlen)1703)] != -1;
2757 ctfixd[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2758 s_rnge("ctfixd", i__1, "ekqmgr_", (ftnlen)
2759 1704)] = cdscrs[(i__2 = k * 11 - 8) < 5500 &&
2760 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2761 "ekqmgr_", (ftnlen)1704)] != -1;
2762 ctnull[(i__1 = ctnew - 1) < 500 && 0 <= i__1 ? i__1 :
2763 s_rnge("ctnull", i__1, "ekqmgr_", (ftnlen)
2764 1705)] = cdscrs[(i__2 = k * 11 - 4) < 5500 &&
2765 0 <= i__2 ? i__2 : s_rnge("cdscrs", i__2,
2766 "ekqmgr_", (ftnlen)1705)] != -1;
2767
2768 /* Store the column descriptor for this column */
2769 /* in the descriptor table. We'll need to */
2770 /* allocate a descriptor table entry first. */
2771
2772 if (lnknfn_(dtpool) == 0) {
2773
2774 /* No free nodes left in the descriptor table. */
2775
2776 s_copy(state, "ABORT", (ftnlen)80, (ftnlen)5);
2777 s_copy(problm, "DESCRIPTOR_TABLE_FULL", (ftnlen)
2778 80, (ftnlen)21);
2779 } else {
2780
2781 /* A free node is available. Link it in at the */
2782 /* tail of the descriptor list for the current */
2783 /* segment. */
2784
2785 lnkan_(dtpool, &dtnew);
2786 if (stdtpt[(i__1 = stnew - 1) < 200 && 0 <= i__1 ?
2787 i__1 : s_rnge("stdtpt", i__1, "ekqmgr_",
2788 (ftnlen)1727)] <= 0) {
2789 stdtpt[(i__1 = stnew - 1) < 200 && 0 <= i__1 ?
2790 i__1 : s_rnge("stdtpt", i__1, "ekqm"
2791 "gr_", (ftnlen)1729)] = dtnew;
2792 } else {
2793 lnkilb_(&stdtpt[(i__1 = stnew - 1) < 200 && 0
2794 <= i__1 ? i__1 : s_rnge("stdtpt",
2795 i__1, "ekqmgr_", (ftnlen)1733)], &
2796 dtnew, dtpool);
2797 }
2798
2799 /* Fill in the descriptor. */
2800
2801 movei_(&cdscrs[(i__1 = k * 11 - 11) < 5500 && 0 <=
2802 i__1 ? i__1 : s_rnge("cdscrs", i__1,
2803 "ekqmgr_", (ftnlen)1740)], &c__11, &
2804 dtdscs[(i__2 = dtnew * 11 - 11) < 110000
2805 && 0 <= i__2 ? i__2 : s_rnge("dtdscs",
2806 i__2, "ekqmgr_", (ftnlen)1740)]);
2807 }
2808 }
2809
2810 /* We created attribute and descriptor entries for the */
2811 /* current column, or we encountered an error. */
2812
2813 if (s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)5) != 0) {
2814
2815 /* Consider the next column. */
2816
2817 ++k;
2818 }
2819 }
2820
2821 /* We created attribute and descriptor entries for every */
2822 /* column in the current segment, or we encountered an */
2823 /* error. */
2824
2825 }
2826
2827 /* We've processed the current segment in the new file, or */
2828 /* else we have an error condition. */
2829
2830 if (s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)5) != 0) {
2831
2832 /* We're ready to look at the next segment in the new file. */
2833
2834 s_copy(state, "NEXT_SEGMENT", (ftnlen)80, (ftnlen)12);
2835 }
2836 } else if (s_cmp(state, "NEXT_SEGMENT", (ftnlen)80, (ftnlen)12) == 0)
2837 {
2838 if (seg < nseg) {
2839 ++seg;
2840 s_copy(state, "SUMMARIZE_SEGMENT", (ftnlen)80, (ftnlen)17);
2841 } else {
2842
2843 /* We're done with all of the segments. */
2844
2845 s_copy(state, "DONE", (ftnlen)80, (ftnlen)4);
2846 }
2847 } else if (s_cmp(state, "ABORT", (ftnlen)80, (ftnlen)5) == 0) {
2848
2849 /* We must clean up all the data structure additions we made to */
2850 /* accommodate the new file. */
2851
2852 /* Basically, we unload the new file. We defer the call to */
2853 /* EKCLS until after we've reported the error. */
2854
2855 /* The file table is first. The file is at the head of the */
2856 /* list. If the file has a successor, that file is now at the */
2857 /* head of the list. */
2858
2859 fthead = lnknxt_(&new__, ftpool);
2860 if (fthead < 0) {
2861
2862 /* There are no files left. Clean up the whole shebang. */
2863
2864 lnkini_(&c__20, ftpool);
2865 lnkini_(&c__200, stpool);
2866 lnkini_(&c__10000, dtpool);
2867 lnkini_(&c__500, ctpool);
2868 lnkini_(&c__100, tbpool);
2869 fthead = 0;
2870 tbhead = 0;
2871 } else {
2872
2873 /* If we arrived here, the file we're unloading is not the */
2874 /* only loaded file. */
2875
2876 /* Free the file table entry for the file. The entry can be */
2877 /* regarded as a sublist that starts and ends with the Ith */
2878 /* node, so we can call the `free sublist' routine to get */
2879 /* rid of it. */
2880
2881 lnkfsl_(&new__, &new__, ftpool);
2882
2883 /* It's time to clean up the table list, segment table, */
2884 /* column attribute table, and column descriptor table. The */
2885 /* plan is to traverse the table list, and for each member */
2886 /* of the list, traverse the corresponding segment list, */
2887 /* removing from the list information about segments and */
2888 /* columns in the file we're unloading. If the segment list */
2889 /* for any table becomes empty, we remove the entry for that */
2890 /* table from the table list. */
2891
2892 tbcurr = tbhead;
2893 while(tbcurr > 0) {
2894
2895 /* See whether the current table is in the file we're */
2896 /* unloading. */
2897
2898 i__ = 1;
2899 while(i__ <= tbflsz[(i__1 = tbcurr - 1) < 100 && 0 <=
2900 i__1 ? i__1 : s_rnge("tbflsz", i__1, "ekqmgr_", (
2901 ftnlen)1861)] && ! fnd) {
2902 if (tbfils[(i__1 = i__ + tbcurr * 20 - 21) < 2000 &&
2903 0 <= i__1 ? i__1 : s_rnge("tbfils", i__1,
2904 "ekqmgr_", (ftnlen)1864)] == *handle) {
2905
2906 /* This table is affected by unloading the file. */
2907
2908 fnd = TRUE_;
2909 } else {
2910
2911 /* Look at the next file handle. */
2912
2913 ++i__;
2914 }
2915 }
2916 if (fnd) {
2917
2918 /* Update the information for the current table to */
2919 /* reflect the unloading of the specified EK. */
2920
2921 /* Unloading the specified EK removes one handle from */
2922 /* the list of file handles associated with this */
2923 /* table. Compress this handle out of the list. */
2924
2925 i__2 = tbflsz[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
2926 i__1 : s_rnge("tbflsz", i__1, "ekqmgr_", (
2927 ftnlen)1890)] - 1;
2928 for (j = i__; j <= i__2; ++j) {
2929 tbfils[(i__1 = j + tbcurr * 20 - 21) < 2000 && 0
2930 <= i__1 ? i__1 : s_rnge("tbfils", i__1,
2931 "ekqmgr_", (ftnlen)1892)] = tbfils[(i__3 =
2932 j + 1 + tbcurr * 20 - 21) < 2000 && 0 <=
2933 i__3 ? i__3 : s_rnge("tbfils", i__3,
2934 "ekqmgr_", (ftnlen)1892)];
2935 }
2936 tbflsz[(i__2 = tbcurr - 1) < 100 && 0 <= i__2 ? i__2 :
2937 s_rnge("tbflsz", i__2, "ekqmgr_", (ftnlen)
2938 1896)] = tbflsz[(i__1 = tbcurr - 1) < 100 &&
2939 0 <= i__1 ? i__1 : s_rnge("tbflsz", i__1,
2940 "ekqmgr_", (ftnlen)1896)] - 1;
2941
2942 /* Traverse the segment list for this table, looking */
2943 /* for segments in the specified EK. */
2944
2945 delseg = tbstpt[(i__2 = tbcurr - 1) < 100 && 0 <=
2946 i__2 ? i__2 : s_rnge("tbstpt", i__2, "ekqmgr_"
2947 , (ftnlen)1902)];
2948 while(delseg > 0) {
2949 if (sthan[(i__2 = delseg - 1) < 200 && 0 <= i__2 ?
2950 i__2 : s_rnge("sthan", i__2, "ekqmgr_", (
2951 ftnlen)1906)] == *handle) {
2952
2953 /* This segment is aboard the sinking ship. Put */
2954 /* it out of its misery. */
2955
2956 /* First, euthanize its column descriptors. */
2957 /* These descriptors are linked together, so we */
2958 /* can free all of them in one shot. */
2959
2960 j = stdtpt[(i__2 = delseg - 1) < 200 && 0 <=
2961 i__2 ? i__2 : s_rnge("stdtpt", i__2,
2962 "ekqmgr_", (ftnlen)1915)];
2963 if (j > 0) {
2964 k = lnktl_(&j, dtpool);
2965 lnkfsl_(&j, &k, dtpool);
2966 }
2967
2968 /* Now we can delete the segment table entry */
2969 /* itself. This deletion may necessitate */
2970 /* updating the segment list pointer in the */
2971 /* parent table's table list entry. */
2972
2973 if (delseg == tbstpt[(i__2 = tbcurr - 1) <
2974 100 && 0 <= i__2 ? i__2 : s_rnge(
2975 "tbstpt", i__2, "ekqmgr_", (ftnlen)
2976 1928)]) {
2977 tbstpt[(i__2 = tbcurr - 1) < 100 && 0 <=
2978 i__2 ? i__2 : s_rnge("tbstpt",
2979 i__2, "ekqmgr_", (ftnlen)1930)] =
2980 lnknxt_(&delseg, stpool);
2981 }
2982 next = lnknxt_(&delseg, stpool);
2983 lnkfsl_(&delseg, &delseg, stpool);
2984
2985 /* The segment we just freed may have been the */
2986 /* last one belonging to this table. We deal */
2987 /* with this possibility later, below the end of */
2988 /* the current loop. */
2989
2990 delseg = next;
2991 } else {
2992 delseg = lnknxt_(&delseg, stpool);
2993 }
2994 }
2995
2996 /* We've examined all of the segments in the current */
2997 /* table. */
2998
2999 /* If the segment list for the current table became */
3000 /* empty as a result of our having plundered the */
3001 /* segment table, delete the entry for this table from */
3002 /* the table list. We do *not* need to concern */
3003 /* ourselves with the possibility that this deletion */
3004 /* will empty the table list, since we know we're */
3005 /* not unloading the last loaded file. However, we */
3006 /* may need to update the head-of-list pointer for the */
3007 /* table list. */
3008
3009 if (tbstpt[(i__2 = tbcurr - 1) < 100 && 0 <= i__2 ?
3010 i__2 : s_rnge("tbstpt", i__2, "ekqmgr_", (
3011 ftnlen)1969)] <= 0) {
3012
3013 /* There are no loaded segments left for this */
3014 /* table. */
3015
3016 /* Delete the list of column attribute entries for */
3017 /* the columns in this table, then delete the */
3018 /* table's entry from the table list. */
3019
3020 /* The column attribute entries are linked, so we */
3021 /* can free them in one shot. Don't crash if the */
3022 /* column attribute list is empty. */
3023
3024 j = tbctpt[(i__2 = tbcurr - 1) < 100 && 0 <= i__2
3025 ? i__2 : s_rnge("tbctpt", i__2, "ekqmgr_",
3026 (ftnlen)1982)];
3027 if (j > 0) {
3028 k = lnktl_(&j, ctpool);
3029 lnkfsl_(&j, &k, ctpool);
3030 }
3031 if (tbcurr == tbhead) {
3032
3033 /* The entry for this table is at the head of */
3034 /* the table list. Update the head of the list. */
3035
3036 tbhead = lnknxt_(&tbcurr, tbpool);
3037 next = tbhead;
3038 } else {
3039 next = lnknxt_(&tbcurr, tbpool);
3040 }
3041
3042 /* Make the entry for this table go away. */
3043
3044 lnkfsl_(&tbcurr, &tbcurr, tbpool);
3045
3046 /* Look at the next table. */
3047
3048 tbcurr = next;
3049 } else {
3050
3051 /* We're done with the current table. Look at the */
3052 /* next one. */
3053
3054 tbcurr = lnknxt_(&tbcurr, tbpool);
3055 }
3056
3057 /* We've cleaned up the table entry for the current */
3058 /* table, if it was necessary to do so. */
3059
3060 } else {
3061
3062 /* The current table is not affected by unloading this */
3063 /* file. Examine the next table. */
3064
3065 tbcurr = lnknxt_(&tbcurr, tbpool);
3066 }
3067
3068 /* We've processed the current table. */
3069
3070 }
3071 }
3072
3073 /* We've cleaned up after the aborted partial load. */
3074
3075 /* Now that the mess has been arranged, tell the user what the */
3076 /* problem was. */
3077
3078 if (s_cmp(problm, "TABLE_LIST_FULL", (ftnlen)80, (ftnlen)15) == 0)
3079 {
3080 setmsg_("The EK file # could not be loaded; the maximum numb"
3081 "er of distinct tables has already been reached.", (
3082 ftnlen)98);
3083 errhan_("#", handle, (ftnlen)1);
3084 sigerr_("SPICE(EKTABLELISTFULL)", (ftnlen)22);
3085 } else if (s_cmp(problm, "DUPLICATE_COLUMN_NAMES", (ftnlen)80, (
3086 ftnlen)22) == 0) {
3087 setmsg_("The EK file # could not be loaded; the segment # co"
3088 "ntains duplicate column names in table #.", (ftnlen)
3089 92);
3090 errhan_("#", handle, (ftnlen)1);
3091 errint_("#", &seg, (ftnlen)1);
3092 errch_("#", tabnam, (ftnlen)1, (ftnlen)64);
3093 sigerr_("SPICE(EKCOLNUMMISMATCH)", (ftnlen)23);
3094 } else if (s_cmp(problm, "COLUMN_NUMBER_MISMATCH", (ftnlen)80, (
3095 ftnlen)22) == 0) {
3096 setmsg_("The EK file # could not be loaded; the number of co"
3097 "lumns (#) in segment # does not match the number of "
3098 "columns (#) in the parent table #.", (ftnlen)137);
3099 errhan_("#", handle, (ftnlen)1);
3100 errint_("#", &ncols, (ftnlen)1);
3101 errint_("#", &seg, (ftnlen)1);
3102 errint_("#", &npcol, (ftnlen)1);
3103 errch_("#", tabnam, (ftnlen)1, (ftnlen)64);
3104 sigerr_("SPICE(EKCOLNUMMISMATCH)", (ftnlen)23);
3105 } else if (s_cmp(problm, "MISMATCHED_COLUMN_ATTRIBUTES", (ftnlen)
3106 80, (ftnlen)28) == 0) {
3107 setmsg_("EK file # contains a column whose attributes confli"
3108 "ct with a loaded column. The offending column name "
3109 "is #; the column is in segment #* of the file.", (
3110 ftnlen)149);
3111 errhan_("#", handle, (ftnlen)1);
3112 errch_("#", colnam, (ftnlen)1, (ftnlen)32);
3113 errint_("*", &seg, (ftnlen)1);
3114 sigerr_("SPICE(BADATTRIBUTES)", (ftnlen)20);
3115 } else if (s_cmp(problm, "DESCRIPTOR_TABLE_FULL", (ftnlen)80, (
3116 ftnlen)21) == 0) {
3117 setmsg_("The EK file # could not be loaded; themaximum allow"
3118 "ed number of loaded columns already been reached.", (
3119 ftnlen)100);
3120 errhan_("#", handle, (ftnlen)1);
3121 sigerr_("SPICE(COLDESCTABLEFULL)", (ftnlen)23);
3122 } else if (s_cmp(problm, "ATTRIBUTE_TABLE_FULL", (ftnlen)80, (
3123 ftnlen)20) == 0) {
3124 setmsg_("The EK file # could not be loaded; the maximum numb"
3125 "er of columns havingdistinct attributes has already "
3126 "been reached.", (ftnlen)116);
3127 errhan_("#", handle, (ftnlen)1);
3128 sigerr_("SPICE(EKCOLATTRTABLEFULL)", (ftnlen)25);
3129 } else if (s_cmp(problm, "MISSING_COLUMN", (ftnlen)80, (ftnlen)14)
3130 == 0) {
3131 setmsg_("The EK file # could not be loaded; the column # in "
3132 "already loaded table # is not present in segment # i"
3133 "n the EK file.", (ftnlen)117);
3134 errhan_("#", handle, (ftnlen)1);
3135 errch_("#", colnam, (ftnlen)1, (ftnlen)32);
3136 errch_("#", tabnam, (ftnlen)1, (ftnlen)64);
3137 errint_("#", &seg, (ftnlen)1);
3138 sigerr_("SPICE(EKMISSINGCOLUMN)", (ftnlen)22);
3139 } else {
3140 setmsg_("The EK file # could not be loaded; the problem \""
3141 "#\" occurred while attempting to load the file. By "
3142 "way, there is a bug in EKLEF if you see this message."
3143 , (ftnlen)152);
3144 errhan_("#", handle, (ftnlen)1);
3145 errch_("#", problm, (ftnlen)1, (ftnlen)80);
3146 sigerr_("SPICE(BUG)", (ftnlen)10);
3147 }
3148 ekcls_(handle);
3149 chkout_("EKLEF", (ftnlen)5);
3150 return 0;
3151 }
3152 }
3153
3154 /* At this point, we've made the file table, table list, segment */
3155 /* table, column descriptor table, and column attribute table updates */
3156 /* necessary to reflect the presence of the new file. */
3157
3158 chkout_("EKLEF", (ftnlen)5);
3159 return 0;
3160 /* $Procedure EKUEF ( EK, unload event file ) */
3161
3162 L_ekuef:
3163 /* $ Abstract */
3164
3165 /* Unload an EK file, making its contents inaccessible to the */
3166 /* EK reader routines, and clearing space in order to allow other */
3167 /* EK files to be loaded. */
3168
3169 /* $ Disclaimer */
3170
3171 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
3172 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
3173 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
3174 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
3175 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
3176 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
3177 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
3178 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
3179 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
3180 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
3181
3182 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
3183 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
3184 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
3185 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
3186 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
3187 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
3188
3189 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
3190 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
3191 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
3192 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
3193
3194 /* $ Required_Reading */
3195
3196 /* EK */
3197
3198 /* $ Keywords */
3199
3200 /* EK */
3201 /* FILES */
3202
3203 /* $ Declarations */
3204
3205 /* INTEGER HANDLE */
3206
3207 /* $ Brief_I/O */
3208
3209 /* Variable I/O Description */
3210 /* -------- --- -------------------------------------------------- */
3211 /* HANDLE I Handle of EK file. */
3212
3213 /* $ Detailed_Input */
3214
3215 /* HANDLE is a file handle returned by EKLEF. */
3216
3217 /* $ Detailed_Output */
3218
3219 /* None. See $Particulars for a description of the effect of this */
3220 /* routine. */
3221
3222 /* $ Parameters */
3223
3224 /* None. */
3225
3226 /* $ Exceptions */
3227
3228 /* 1) Unloading a file that is not loaded has no effect. */
3229
3230 /* $ Files */
3231
3232 /* See the description of the input argument HANDLE in */
3233 /* $Detailed_Input. */
3234
3235 /* $ Particulars */
3236
3237 /* This routine removes information about an EK file from the */
3238 /* EK system, freeing space to increase the number of other EK */
3239 /* files that can be loaded. The file is also unloaded from */
3240 /* the DAS system and closed. */
3241
3242 /* $ Examples */
3243
3244 /* 1) Load 25 EK files sequentially, unloading the previous file */
3245 /* before each new file is loaded. Unloading files prevents */
3246 /* them from being searched during query execution. */
3247
3248 /* DO I = 1, 25 */
3249
3250 /* CALL EKLEF ( EK(I), HANDLE ) */
3251
3252 /* [Perform queries] */
3253
3254 /* CALL EKUEF ( HANDLE ) */
3255
3256 /* END DO */
3257
3258 /* $ Restrictions */
3259
3260 /* None. */
3261
3262 /* $ Literature_References */
3263
3264 /* None. */
3265
3266 /* $ Author_and_Institution */
3267
3268 /* N.J. Bachman (JPL) */
3269
3270 /* $ Version */
3271
3272 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
3273
3274 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
3275 /* it now has its link count reset to 1 via a call to EKCLS. */
3276
3277 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
3278
3279 /* Previous version line was changed from "Beta" to "SPICELIB." */
3280
3281 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
3282
3283 /* -& */
3284 /* $ Index_Entries */
3285
3286 /* unload EK file */
3287
3288 /* -& */
3289
3290 /* Standard SPICE error handling. */
3291
3292 if (return_()) {
3293 return 0;
3294 } else {
3295 chkin_("EKUEF", (ftnlen)5);
3296 }
3297
3298 /* On the first pass through this routine, initialize the tables, */
3299 /* if it hasn't been done yet. */
3300
3301 if (first) {
3302
3303 /* Initialize the file table pool, segment table pool, column */
3304 /* descriptor pool, column table pool, and table list pool. */
3305
3306 lnkini_(&c__20, ftpool);
3307 lnkini_(&c__200, stpool);
3308 lnkini_(&c__10000, dtpool);
3309 lnkini_(&c__500, ctpool);
3310 lnkini_(&c__100, tbpool);
3311 fthead = 0;
3312 tbhead = 0;
3313 first = FALSE_;
3314 }
3315
3316 /* Check to see whether the named EK has been loaded. Do nothing */
3317 /* if not. */
3318
3319 i__ = fthead;
3320 fnd = FALSE_;
3321 while(i__ > 0 && ! fnd) {
3322 if (*handle == fthan[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 :
3323 s_rnge("fthan", i__2, "ekqmgr_", (ftnlen)2342)]) {
3324 fnd = TRUE_;
3325 } else {
3326 i__ = lnknxt_(&i__, ftpool);
3327 }
3328 }
3329 if (! fnd) {
3330 chkout_("EKUEF", (ftnlen)5);
3331 return 0;
3332 }
3333
3334 /* If we got to here, HANDLE points to a loaded EK file. It's */
3335 /* time to wipe from the EK tables all trivial fond records */
3336 /* pertaining to the file in question. */
3337
3338 /* The file table is first. */
3339
3340 if (i__ == fthead) {
3341
3342 /* The file is at the head of the list. If the file has a */
3343 /* successor, that file is now at the head of the list. */
3344
3345 fthead = lnknxt_(&i__, ftpool);
3346 if (fthead < 0) {
3347
3348 /* There are no files left. Clean up the whole shebang. */
3349
3350 lnkini_(&c__20, ftpool);
3351 lnkini_(&c__200, stpool);
3352 lnkini_(&c__10000, dtpool);
3353 lnkini_(&c__500, ctpool);
3354 lnkini_(&c__100, tbpool);
3355 fthead = 0;
3356 tbhead = 0;
3357
3358 /* Close the EK file, to keep the DAS system's bookkeeping */
3359 /* up to date. */
3360
3361 ekcls_(handle);
3362 chkout_("EKUEF", (ftnlen)5);
3363 return 0;
3364 }
3365 }
3366
3367 /* If we arrived here, the file we're unloading is not the only */
3368 /* loaded file. */
3369
3370 /* Free the file table entry for the file. The entry can be */
3371 /* regarded as a sublist that starts and ends with the Ith node, */
3372 /* so we can call the `free sublist' routine to get rid of it. */
3373
3374 lnkfsl_(&i__, &i__, ftpool);
3375
3376 /* It's time to clean up the table list, segment table, column */
3377 /* attribute table, and column descriptor table. The plan is */
3378 /* to traverse the table list, and for each member of the list, */
3379 /* traverse the corresponding segment list, removing from the list */
3380 /* information about segments and columns in the file we're */
3381 /* unloading. If the segment list for any table becomes empty, we */
3382 /* remove the entry for that table from the table list. */
3383
3384 tbcurr = tbhead;
3385 while(tbcurr > 0) {
3386
3387 /* See whether the current table is in the file we're unloading. */
3388
3389 i__ = 1;
3390 while(i__ <= tbflsz[(i__2 = tbcurr - 1) < 100 && 0 <= i__2 ? i__2 :
3391 s_rnge("tbflsz", i__2, "ekqmgr_", (ftnlen)2422)] && ! fnd) {
3392 if (tbfils[(i__2 = i__ + tbcurr * 20 - 21) < 2000 && 0 <= i__2 ?
3393 i__2 : s_rnge("tbfils", i__2, "ekqmgr_", (ftnlen)2424)] ==
3394 *handle) {
3395
3396 /* This table is affected by unloading the file. */
3397
3398 fnd = TRUE_;
3399 } else {
3400
3401 /* Look at the next file handle. */
3402
3403 ++i__;
3404 }
3405 }
3406 if (fnd) {
3407
3408 /* Update the information for the current table to reflect */
3409 /* the unloading of the specified EK. */
3410
3411 /* Unloading the specified EK removes one handle from the */
3412 /* list of file handles associated with this table. Compress */
3413 /* this handle out of the list. */
3414
3415 i__1 = tbflsz[(i__2 = tbcurr - 1) < 100 && 0 <= i__2 ? i__2 :
3416 s_rnge("tbflsz", i__2, "ekqmgr_", (ftnlen)2450)] - 1;
3417 for (j = i__; j <= i__1; ++j) {
3418 tbfils[(i__2 = j + tbcurr * 20 - 21) < 2000 && 0 <= i__2 ?
3419 i__2 : s_rnge("tbfils", i__2, "ekqmgr_", (ftnlen)2452)
3420 ] = tbfils[(i__3 = j + 1 + tbcurr * 20 - 21) < 2000 &&
3421 0 <= i__3 ? i__3 : s_rnge("tbfils", i__3, "ekqmgr_",
3422 (ftnlen)2452)];
3423 }
3424 tbflsz[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
3425 "tbflsz", i__1, "ekqmgr_", (ftnlen)2456)] = tbflsz[(i__2 =
3426 tbcurr - 1) < 100 && 0 <= i__2 ? i__2 : s_rnge("tbflsz",
3427 i__2, "ekqmgr_", (ftnlen)2456)] - 1;
3428
3429 /* Traverse the segment list for this table, looking */
3430 /* for segments in the specified EK. */
3431
3432 seg = tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 :
3433 s_rnge("tbstpt", i__1, "ekqmgr_", (ftnlen)2462)];
3434 while(seg > 0) {
3435 if (sthan[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge(
3436 "sthan", i__1, "ekqmgr_", (ftnlen)2466)] == *handle) {
3437
3438 /* This segment is aboard the sinking ship. Put it */
3439 /* out of its misery. */
3440
3441 /* First, euthanize the segment's column descriptors. */
3442 /* These descriptors are linked together, so we can free */
3443 /* all of them in one shot. Don't crash if the column */
3444 /* descriptor list is empty. */
3445
3446 j = stdtpt[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 :
3447 s_rnge("stdtpt", i__1, "ekqmgr_", (ftnlen)2476)];
3448 if (j > 0) {
3449 k = lnktl_(&j, dtpool);
3450 lnkfsl_(&j, &k, dtpool);
3451 }
3452
3453 /* Now we can delete the segment table entry itself. */
3454 /* This deletion may necessitate updating the segment */
3455 /* list pointer in the parent table's table list entry. */
3456
3457 if (seg == tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
3458 i__1 : s_rnge("tbstpt", i__1, "ekqmgr_", (ftnlen)
3459 2488)]) {
3460 tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 :
3461 s_rnge("tbstpt", i__1, "ekqmgr_", (ftnlen)
3462 2490)] = lnknxt_(&seg, stpool);
3463 }
3464 next = lnknxt_(&seg, stpool);
3465 lnkfsl_(&seg, &seg, stpool);
3466 seg = next;
3467 } else {
3468 seg = lnknxt_(&seg, stpool);
3469 }
3470 }
3471
3472 /* We've examined all of the segments in the current table. */
3473
3474 /* If the segment list for the current table became empty */
3475 /* as a result of our having plundered the segment table, */
3476 /* delete the entry for this table from the table list. We do */
3477 /* *not* need to concern ourselves with the possibility that */
3478 /* this deletion will empty the table list, since we know we're */
3479 /* not unloading the last loaded file. However, we may need to */
3480 /* update the head-of-list pointer for the table list. */
3481
3482 if (tbstpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
3483 "tbstpt", i__1, "ekqmgr_", (ftnlen)2520)] <= 0) {
3484
3485 /* There are no loaded segments left for this table. */
3486
3487 /* Delete the list of column attribute entries for the */
3488 /* columns in this table, then delete the table's entry from */
3489 /* the table list. */
3490
3491 /* The column attribute entries are linked, so we can free */
3492 /* them in one shot. */
3493
3494 j = tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 :
3495 s_rnge("tbctpt", i__1, "ekqmgr_", (ftnlen)2531)];
3496 if (j > 0) {
3497 k = lnktl_(&j, ctpool);
3498 lnkfsl_(&j, &k, ctpool);
3499 }
3500 if (tbcurr == tbhead) {
3501
3502 /* The entry for this table is at the head of the */
3503 /* table list. Update the head of the list. */
3504
3505 tbhead = lnknxt_(&tbcurr, tbpool);
3506 next = tbhead;
3507 } else {
3508 next = lnknxt_(&tbcurr, tbpool);
3509 }
3510
3511 /* Make the entry for this table go away. */
3512
3513 lnkfsl_(&tbcurr, &tbcurr, tbpool);
3514
3515 /* The successor of the current node is the next node to */
3516 /* examine. */
3517
3518 tbcurr = next;
3519 } else {
3520
3521 /* We're done with the current table. Look at the next one. */
3522
3523 tbcurr = lnknxt_(&tbcurr, tbpool);
3524 }
3525
3526 /* We've cleaned up the table entry for the current table, */
3527 /* if it was necessary to do so. */
3528
3529 } else {
3530
3531 /* The current table is not affected by unloading this file. */
3532 /* Examine the next table. */
3533
3534 tbcurr = lnknxt_(&tbcurr, tbpool);
3535 }
3536
3537 /* We've processed the current table. */
3538
3539 }
3540
3541 /* Don't forget to unload the EK file from the DAS system. */
3542
3543 ekcls_(handle);
3544 chkout_("EKUEF", (ftnlen)5);
3545 return 0;
3546 /* $Procedure EKNTAB ( EK, return number of loaded tables ) */
3547
3548 L_ekntab:
3549 /* $ Abstract */
3550
3551 /* Return the number of loaded EK tables. */
3552
3553 /* $ Disclaimer */
3554
3555 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
3556 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
3557 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
3558 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
3559 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
3560 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
3561 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
3562 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
3563 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
3564 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
3565
3566 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
3567 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
3568 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
3569 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
3570 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
3571 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
3572
3573 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
3574 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
3575 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
3576 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
3577
3578 /* $ Required_Reading */
3579
3580 /* EK */
3581
3582 /* $ Keywords */
3583
3584 /* EK */
3585 /* FILES */
3586
3587 /* $ Declarations */
3588
3589 /* INTEGER N */
3590
3591 /* $ Brief_I/O */
3592
3593 /* Variable I/O Description */
3594 /* -------- --- -------------------------------------------------- */
3595 /* N O Number of loaded tables. */
3596
3597 /* $ Detailed_Input */
3598
3599 /* None. */
3600
3601 /* $ Detailed_Output */
3602
3603 /* N is the number of loaded tables. The count refers */
3604 /* to the number of logical tables; if multiple */
3605 /* segments contain data for the same table, these */
3606 /* segments collectively contribute only one table */
3607 /* to the count. */
3608
3609 /* $ Parameters */
3610
3611 /* None. */
3612
3613 /* $ Exceptions */
3614
3615 /* None. */
3616
3617 /* $ Files */
3618
3619 /* The returned count is based on the currently loaded EK files. */
3620 /* These files must be loaded via the entry point EKLEF. */
3621
3622 /* $ Particulars */
3623
3624 /* This routine is a utility that provides the caller with the */
3625 /* number of loaded tables. Callers of EKTNAM can use this count */
3626 /* as the upper bound on set of table indices when looking up table */
3627 /* names. */
3628
3629 /* $ Examples */
3630
3631 /* 1) Suppose we have the following list of EK files and tables */
3632 /* contained in those files: */
3633
3634 /* File name Table name */
3635 /* --------- ---------- */
3636
3637 /* FILE_1.EK TABLE_1 */
3638 /* TABLE_2 */
3639
3640 /* FILE_2.EK TABLE_1 */
3641 /* TABLE_3 */
3642
3643 /* FILE_3.EK TABLE_2 */
3644 /* TABLE_3 */
3645 /* TABLE_4 */
3646
3647
3648 /* Then after loading these files, the call */
3649
3650 /* CALL EKNTAB ( N ) */
3651
3652 /* returns the value N = 4. */
3653
3654 /* $ Restrictions */
3655
3656 /* None. */
3657
3658 /* $ Literature_References */
3659
3660 /* None. */
3661
3662 /* $ Author_and_Institution */
3663
3664 /* N.J. Bachman (JPL) */
3665
3666 /* $ Version */
3667
3668 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
3669
3670 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
3671 /* it now has its link count reset to 1 via a call to EKCLS. */
3672
3673 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
3674
3675 /* Previous version line was changed from "Beta" to "SPICELIB." */
3676
3677 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
3678
3679 /* -& */
3680 /* $ Index_Entries */
3681
3682 /* return number of loaded tables */
3683
3684 /* -& */
3685 if (first) {
3686
3687 /* Initialize the file table pool, segment table pool, column */
3688 /* descriptor pool, column table pool, and table list pool. */
3689
3690 lnkini_(&c__20, ftpool);
3691 lnkini_(&c__200, stpool);
3692 lnkini_(&c__10000, dtpool);
3693 lnkini_(&c__500, ctpool);
3694 lnkini_(&c__100, tbpool);
3695 fthead = 0;
3696 tbhead = 0;
3697 first = FALSE_;
3698 }
3699
3700 /* Return the number of loaded tables. */
3701
3702 *n = 100 - lnknfn_(tbpool);
3703 return 0;
3704 /* $Procedure EKTNAM ( EK, return name of loaded table ) */
3705
3706 L_ektnam:
3707 /* $ Abstract */
3708
3709 /* Return the name of a specified, loaded table. */
3710
3711 /* $ Disclaimer */
3712
3713 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
3714 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
3715 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
3716 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
3717 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
3718 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
3719 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
3720 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
3721 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
3722 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
3723
3724 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
3725 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
3726 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
3727 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
3728 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
3729 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
3730
3731 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
3732 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
3733 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
3734 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
3735
3736 /* $ Required_Reading */
3737
3738 /* EK */
3739
3740 /* $ Keywords */
3741
3742 /* EK */
3743 /* FILES */
3744
3745 /* $ Declarations */
3746
3747 /* INTEGER N */
3748 /* CHARACTER*(*) TABLE */
3749
3750 /* $ Brief_I/O */
3751
3752 /* Variable I/O Description */
3753 /* -------- --- -------------------------------------------------- */
3754 /* N I Index of table. */
3755 /* TABLE O Name of table. */
3756
3757 /* $ Detailed_Input */
3758
3759 /* N is the index of the table whose name is desired. */
3760 /* The value of N ranges from 1 to the number of */
3761 /* loaded tables, which count may be obtained from */
3762 /* EKNTAB. */
3763
3764 /* $ Detailed_Output */
3765
3766 /* TABLE is the name of the Nth loaded table. */
3767
3768 /* $ Parameters */
3769
3770 /* None. */
3771
3772 /* $ Exceptions */
3773
3774 /* 1) If this routine is called when no files are loaded, the */
3775 /* error SPICE(NOLOADEDFILES) is signaled. */
3776
3777 /* 2) If the input N is out of range, the error SPICE(INVALDINDEX) */
3778 /* is signaled. */
3779
3780 /* $ Files */
3781
3782 /* The returned name is based on the currently loaded EK files. */
3783
3784 /* $ Particulars */
3785
3786 /* This routine is a utility that provides the caller with the */
3787 /* name of a specified loaded table. The index of a table with */
3788 /* a given name depends on the kernels loaded and possibly on */
3789 /* the order in which the files have been loaded. */
3790
3791 /* $ Examples */
3792
3793 /* 1) Dump the names of the loaded tables. */
3794
3795 /* CALL EKNTAB ( N ) */
3796
3797 /* DO I = 1, N */
3798 /* CALL EKTNAM ( I, TABLE ) */
3799 /* WRITE (*,*) TABLE */
3800 /* END DO */
3801
3802 /* $ Restrictions */
3803
3804 /* None. */
3805
3806 /* $ Literature_References */
3807
3808 /* None. */
3809
3810 /* $ Author_and_Institution */
3811
3812 /* N.J. Bachman (JPL) */
3813
3814 /* $ Version */
3815
3816 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
3817
3818 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
3819 /* it now has its link count reset to 1 via a call to EKCLS. */
3820
3821 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
3822
3823 /* Previous version line was changed from "Beta" to "SPICELIB." */
3824
3825 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
3826
3827 /* -& */
3828 /* $ Index_Entries */
3829
3830 /* return name of a loaded table */
3831
3832 /* -& */
3833
3834 /* Standard SPICE error handling. */
3835
3836 if (return_()) {
3837 return 0;
3838 } else {
3839 chkin_("EKTNAM", (ftnlen)6);
3840 }
3841 if (first) {
3842
3843 /* Initialize the file table pool, segment table pool, column */
3844 /* descriptor pool, column table pool, and table list pool. */
3845
3846 lnkini_(&c__20, ftpool);
3847 lnkini_(&c__200, stpool);
3848 lnkini_(&c__10000, dtpool);
3849 lnkini_(&c__500, ctpool);
3850 lnkini_(&c__100, tbpool);
3851 fthead = 0;
3852 tbhead = 0;
3853 first = FALSE_;
3854 }
3855
3856 /* There nothing to fetch if no files are loaded. A sure */
3857 /* symptom of this problem is that the file list is empty. */
3858
3859 if (fthead <= 0) {
3860 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
3861 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
3862 chkout_("EKTNAM", (ftnlen)6);
3863 return 0;
3864 }
3865 tbcurr = tbhead;
3866 fnd = FALSE_;
3867 i__ = 0;
3868 while(tbcurr > 0 && ! fnd) {
3869 ++i__;
3870 if (i__ == *n) {
3871 fnd = TRUE_;
3872 s_copy(table, tbnams + (((i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
3873 i__1 : s_rnge("tbnams", i__1, "ekqmgr_", (ftnlen)2956)) <<
3874 6), table_len, (ftnlen)64);
3875 } else {
3876 tbcurr = lnknxt_(&tbcurr, tbpool);
3877 }
3878 }
3879 if (! fnd) {
3880 setmsg_("The index # does not correspond to a loaded table.", (ftnlen)
3881 50);
3882 errint_("#", n, (ftnlen)1);
3883 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
3884 }
3885 chkout_("EKTNAM", (ftnlen)6);
3886 return 0;
3887 /* $Procedure EKCCNT ( EK, column count ) */
3888
3889 L_ekccnt:
3890 /* $ Abstract */
3891
3892 /* Return the number of distinct columns in a specified, currently */
3893 /* loaded table */
3894
3895 /* $ Disclaimer */
3896
3897 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
3898 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
3899 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
3900 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
3901 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
3902 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
3903 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
3904 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
3905 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
3906 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
3907
3908 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
3909 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
3910 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
3911 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
3912 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
3913 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
3914
3915 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
3916 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
3917 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
3918 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
3919
3920 /* $ Required_Reading */
3921
3922 /* EK */
3923
3924 /* $ Keywords */
3925
3926 /* EK */
3927 /* FILES */
3928 /* UTILITY */
3929
3930 /* $ Declarations */
3931
3932 /* CHARACTER*(*) TABLE */
3933 /* INTEGER CCOUNT */
3934
3935 /* $ Brief_I/O */
3936
3937 /* Variable I/O Description */
3938 /* -------- --- -------------------------------------------------- */
3939 /* TABLE I Name of table. */
3940 /* CCOUNT O Count of distinct, currently loaded columns. */
3941
3942 /* $ Detailed_Input */
3943
3944 /* TABLE is the name of a currently loaded table. Case */
3945 /* is not significant in the table name. */
3946
3947 /* $ Detailed_Output */
3948
3949 /* CCOUNT is the number of distinct columns in TABLE. */
3950 /* Columns that have the same name but belong to */
3951 /* different segments that are considered to be */
3952 /* portions of the same column, if the segments */
3953 /* containing those columns belong to TABLE. */
3954
3955 /* $ Parameters */
3956
3957 /* None. */
3958
3959 /* $ Exceptions */
3960
3961 /* 1) If the specified table is not loaded, the error */
3962 /* SPICE(TABLENOTLOADED) is signaled. */
3963
3964 /* $ Files */
3965
3966 /* See the header of EKQMGR for a description of files used */
3967 /* by this routine. */
3968
3969 /* $ Particulars */
3970
3971 /* This routine is a utility intended for use in conjunction with */
3972 /* the entry point EKCII. These routines can be used to find the */
3973 /* names and attributes of the columns that are currently loaded. */
3974
3975 /* $ Examples */
3976
3977 /* 1) Dump the names and attributes of the columns in each loaded */
3978 /* table. EKCCNT is used to obtain column counts. */
3979
3980 /* C */
3981 /* C Get the number of loaded tables. */
3982 /* C */
3983 /* CALL EKNTAB ( NTAB ) */
3984
3985 /* DO TAB = 1, NTAB */
3986 /* C */
3987 /* C Get the name of the current table, and look up */
3988 /* C the column count for this table. */
3989 /* C */
3990 /* CALL EKTNAM ( TAB, TABNAM ) */
3991 /* CALL EKCCNT ( TABNAM, NCOLS ) */
3992
3993 /* WRITE (*,*) 'TABLE = ', TABNAM */
3994 /* WRITE (*,*) ' ' */
3995
3996 /* C */
3997 /* C For each column in the current table, look up the */
3998 /* C column's attributes. The attribute block */
3999 /* C index parameters are defined in the include file */
4000 /* C ekattdsc.inc. */
4001 /* C */
4002 /* DO I = 1, NCOLS */
4003
4004 /* CALL EKCII ( TABNAM, I, COLNAM, ATTDSC ) */
4005
4006 /* WRITE (*,*) 'COLUMN = ', COLNAM */
4007
4008 /* C */
4009 /* C Write out the current column's data type. */
4010 /* C */
4011 /* IF ( ATTDSC(ATTTYP) .EQ. CHR ) THEN */
4012 /* WRITE (*,*) 'TYPE = CHR' */
4013
4014 /* IF ( ATTDSC(ATTLEN) .EQ. -1 ) THEN */
4015 /* WRITE (*,*) 'STRING LENGTH = VARIABLE.' */
4016 /* ELSE */
4017 /* WRITE (*,*) 'STRING LENGTH = ', */
4018 /* . ATTDSC(ATTLEN) */
4019 /* END IF */
4020
4021 /* ELSE IF ( ATTDSC(ATTTYP) .EQ. DP ) THEN */
4022 /* WRITE (*,*) 'TYPE = DP' */
4023
4024 /* ELSE IF ( ATTDSC(ATTTYP) .EQ. INT ) THEN */
4025 /* WRITE (*,*) 'TYPE = INT' */
4026
4027 /* ELSE */
4028 /* WRITE (*,*) 'TYPE = TIME' */
4029 /* END IF */
4030
4031 /* C */
4032 /* C Write out the current column's entry size. */
4033 /* C */
4034 /* WRITE (*,*) 'SIZE = ', ATTDSC(ATTSIZ) */
4035
4036 /* C */
4037 /* C Indicate whether the current column is indexed. */
4038 /* C */
4039 /* IF ( ATTDSC(ATTIDX) .EQ. -1 ) THEN */
4040 /* WRITE (*,*) 'NOT INDEXED' */
4041 /* ELSE */
4042 /* WRITE (*,*) 'INDEXED' */
4043 /* END IF */
4044
4045 /* C */
4046 /* C Indicate whether the current column allows */
4047 /* C null values. */
4048 /* C */
4049 /* IF ( ATTDSC(ATTNFL) .EQ. -1 ) THEN */
4050 /* WRITE (*,*) 'NULL VALUES NOT ALLOWED' */
4051 /* ELSE */
4052 /* WRITE (*,*) 'NULL VALUES ALLOWED' */
4053 /* END IF */
4054
4055 /* END DO */
4056
4057 /* END DO */
4058
4059
4060 /* $ Restrictions */
4061
4062 /* None. */
4063
4064 /* $ Literature_References */
4065
4066 /* None. */
4067
4068 /* $ Author_and_Institution */
4069
4070 /* N.J. Bachman (JPL) */
4071
4072 /* $ Version */
4073
4074 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
4075
4076 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
4077 /* it now has its link count reset to 1 via a call to EKCLS. */
4078
4079 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
4080
4081 /* Misspelling of "conjunction" was fixed. */
4082
4083 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
4084
4085
4086 /* -& */
4087 /* $ Index_Entries */
4088
4089 /* return the number of loaded EK columns */
4090 /* return the count of loaded EK columns */
4091
4092 /* -& */
4093
4094 /* Standard SPICE error handling. */
4095
4096 if (return_()) {
4097 return 0;
4098 } else {
4099 chkin_("EKCCNT", (ftnlen)6);
4100 }
4101
4102 /* On the first pass through this routine, initialize the tables, */
4103 /* if it hasn't been done yet. */
4104
4105 if (first) {
4106
4107 /* Initialize the file table pool, segment table pool, column */
4108 /* descriptor pool, column table pool, and table list pool. */
4109
4110 lnkini_(&c__20, ftpool);
4111 lnkini_(&c__200, stpool);
4112 lnkini_(&c__10000, dtpool);
4113 lnkini_(&c__500, ctpool);
4114 lnkini_(&c__100, tbpool);
4115 fthead = 0;
4116 tbhead = 0;
4117 first = FALSE_;
4118 }
4119
4120 /* Find the table. If there's no match, the number of loaded columns */
4121 /* is zero. */
4122
4123 tbcurr = tbhead;
4124 fnd = FALSE_;
4125 while(tbcurr > 0 && ! fnd) {
4126 if (eqstr_(table, tbnams + (((i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
4127 i__1 : s_rnge("tbnams", i__1, "ekqmgr_", (ftnlen)3233)) << 6),
4128 table_len, (ftnlen)64)) {
4129 fnd = TRUE_;
4130 } else {
4131 tbcurr = lnknxt_(&tbcurr, tbpool);
4132 }
4133 }
4134 if (! fnd) {
4135 *ccount = 0;
4136 setmsg_("The table # is not currently loaded.", (ftnlen)36);
4137 errch_("#", table, (ftnlen)1, table_len);
4138 sigerr_("SPICE(TABLENOTLOADED)", (ftnlen)21);
4139 chkout_("EKCCNT", (ftnlen)6);
4140 return 0;
4141 } else {
4142
4143 /* Count the columns in the attribute table for the current table. */
4144
4145 *ccount = 0;
4146 col = tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge(
4147 "tbctpt", i__1, "ekqmgr_", (ftnlen)3256)];
4148 while(col > 0) {
4149 ++(*ccount);
4150 col = lnknxt_(&col, ctpool);
4151 }
4152 }
4153 chkout_("EKCCNT", (ftnlen)6);
4154 return 0;
4155 /* $Procedure EKCII ( EK, column info by index ) */
4156
4157 L_ekcii:
4158 /* $ Abstract */
4159
4160 /* Return attribute information about a column belonging to a loaded */
4161 /* EK table, specifying the column by table and index. */
4162
4163 /* $ Disclaimer */
4164
4165 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
4166 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
4167 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
4168 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
4169 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
4170 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
4171 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
4172 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
4173 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
4174 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
4175
4176 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
4177 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
4178 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
4179 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
4180 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
4181 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
4182
4183 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
4184 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
4185 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
4186 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
4187
4188 /* $ Required_Reading */
4189
4190 /* EK */
4191
4192 /* $ Keywords */
4193
4194 /* EK */
4195 /* FILES */
4196 /* UTILITY */
4197
4198 /* $ Declarations */
4199
4200 /* CHARACTER*(*) TABLE */
4201 /* INTEGER CINDEX */
4202 /* CHARACTER*(*) COLUMN */
4203 /* INTEGER ATTDSC ( ADSCSZ ) */
4204
4205 /* $ Brief_I/O */
4206
4207 /* Variable I/O Description */
4208 /* -------- --- -------------------------------------------------- */
4209 /* TABLE I Name of table containing column. */
4210 /* CINDEX I Index of column whose attributes are to be found. */
4211 /* COLUMN O Name of column. */
4212 /* ATTDSC O Column attribute descriptor. */
4213
4214 /* $ Detailed_Input */
4215
4216 /* TABLE is the name of a loaded EK table. Case is not */
4217 /* significant. */
4218
4219 /* CINDEX is the index, within TABLE's column attribute */
4220 /* table, of the column whose attributes are to be */
4221 /* found. The indices of the column table entries */
4222 /* range from 1 to CCOUNT, where CCOUNT is the value */
4223 /* returned by the entry point EKCCNT. */
4224
4225 /* $ Detailed_Output */
4226
4227 /* COLUMN is the name of the specified column. */
4228
4229 /* ATTDSC is a column attribute descriptor. ATTDSC is an */
4230 /* integer array containing descriptive information */
4231 /* that applies uniformly to all loaded columns */
4232 /* having the name COLUMN. The following parameter */
4233 /* values occur in ATTDSC: */
4234
4235 /* IFALSE: -1 */
4236 /* ITRUE: 1 */
4237 /* CHR: 1 */
4238 /* DP: 2 */
4239 /* INT: 3 */
4240 /* TIME: 4 */
4241
4242 /* The meanings of the elements of ATTDSC are given */
4243 /* below. The indices of the elements are */
4244 /* parameterized; the parameter values are defined */
4245 /* in the include file ekattdsc.inc. */
4246
4247 /* ATTDSC(ATTCLS): Column class code */
4248
4249 /* ATTDSC(ATTTYP): Data type code---CHR, DP, INT, */
4250 /* or TIME */
4251
4252 /* ATTDSC(ATTLEN): String length; applies to CHR */
4253 /* type. Value is IFALSE for */
4254 /* variable-length strings. */
4255
4256 /* ATTDSC(ATTSIZ): Column entry size; value is */
4257 /* IFALSE for variable-size */
4258 /* columns. Here `size' refers */
4259 /* to the number of array */
4260 /* elements in a column entry. */
4261
4262 /* ATTDSC(ATTIDX): Index flag; value is ITRUE if */
4263 /* column is indexed, IFALSE */
4264 /* otherwise. */
4265
4266 /* ATTDSC(ATTNFL): Null flag; value is ITRUE if */
4267 /* column may contain null */
4268 /* values, IFALSE otherwise. */
4269
4270 /* $ Parameters */
4271
4272 /* ADSCSZ is the size of column attribute descriptor. */
4273 /* (Defined in ekattdsc.inc.) */
4274
4275 /* $ Exceptions */
4276
4277 /* 1) If the specified table is not loaded, the error */
4278 /* SPICE(TABLENOTLOADED) is signaled. */
4279
4280 /* 2) If the input argument CINDEX is less than one or greater */
4281 /* than the number of columns in TABLE, the error */
4282 /* SPICE(INVALIDINDEX) is signaled. */
4283
4284 /* $ Files */
4285
4286 /* See the header of EKQMGR for a description of files used */
4287 /* by this routine. */
4288
4289 /* $ Particulars */
4290
4291 /* This routine is a utility that allows a calling routine to */
4292 /* determine the attributes of the currently loaded columns. */
4293
4294 /* $ Examples */
4295
4296 /* 1) Dump the names and attributes of the columns in each loaded */
4297 /* table. EKCII is used to obtain column attributes. */
4298
4299 /* C */
4300 /* C Get the number of loaded tables. */
4301 /* C */
4302 /* CALL EKNTAB ( NTAB ) */
4303
4304 /* DO TAB = 1, NTAB */
4305 /* C */
4306 /* C Get the name of the current table, and look up */
4307 /* C the column count for this table. */
4308 /* C */
4309 /* CALL EKTNAM ( TAB, TABNAM ) */
4310 /* CALL EKCCNT ( TABNAM, NCOLS ) */
4311
4312 /* WRITE (*,*) 'TABLE = ', TABNAM */
4313 /* WRITE (*,*) ' ' */
4314
4315 /* C */
4316 /* C For each column in the current table, look up the */
4317 /* C column's attributes. The attribute block */
4318 /* C index parameters are defined in the include file */
4319 /* C ekattdsc.inc. */
4320 /* C */
4321 /* DO I = 1, NCOLS */
4322
4323 /* CALL EKCII ( TABNAM, I, COLNAM, ATTDSC ) */
4324
4325 /* WRITE (*,*) 'COLUMN = ', COLNAM */
4326
4327 /* C */
4328 /* C Write out the current column's data type. */
4329 /* C */
4330 /* IF ( ATTDSC(ATTTYP) .EQ. CHR ) THEN */
4331 /* WRITE (*,*) 'TYPE = CHR' */
4332
4333 /* IF ( ATTDSC(ATTLEN) .EQ. -1 ) THEN */
4334 /* WRITE (*,*) 'STRING LENGTH = VARIABLE.' */
4335 /* ELSE */
4336 /* WRITE (*,*) 'STRING LENGTH = ', */
4337 /* . ATTDSC(ATTLEN) */
4338 /* END IF */
4339
4340 /* ELSE IF ( ATTDSC(ATTTYP) .EQ. DP ) THEN */
4341 /* WRITE (*,*) 'TYPE = DP' */
4342
4343 /* ELSE IF ( ATTDSC(ATTTYP) .EQ. INT ) THEN */
4344 /* WRITE (*,*) 'TYPE = INT' */
4345
4346 /* ELSE */
4347 /* WRITE (*,*) 'TYPE = TIME' */
4348 /* END IF */
4349
4350 /* C */
4351 /* C Write out the current column's entry size. */
4352 /* C */
4353 /* WRITE (*,*) 'SIZE = ', ATTDSC(ATTSIZ) */
4354
4355 /* C */
4356 /* C Indicate whether the current column is indexed. */
4357 /* C */
4358 /* IF ( ATTDSC(ATTIDX) .EQ. -1 ) THEN */
4359 /* WRITE (*,*) 'NOT INDEXED' */
4360 /* ELSE */
4361 /* WRITE (*,*) 'INDEXED' */
4362 /* END IF */
4363
4364 /* C */
4365 /* C Indicate whether the current column allows */
4366 /* C null values. */
4367 /* C */
4368 /* IF ( ATTDSC(ATTNFL) .EQ. -1 ) THEN */
4369 /* WRITE (*,*) 'NULL VALUES NOT ALLOWED' */
4370 /* ELSE */
4371 /* WRITE (*,*) 'NULL VALUES ALLOWED' */
4372 /* END IF */
4373
4374 /* END DO */
4375
4376 /* END DO */
4377
4378
4379 /* $ Restrictions */
4380
4381 /* None. */
4382
4383 /* $ Literature_References */
4384
4385 /* None. */
4386
4387 /* $ Author_and_Institution */
4388
4389 /* N.J. Bachman (JPL) */
4390 /* B.V. Semenov (JPL) */
4391
4392 /* $ Version */
4393
4394 /* - SPICELIB Version 2.0.1, 10-FEB-2014 (BVS) */
4395
4396 /* Added description of ADSCSZ to the Parameters section of the */
4397 /* header. */
4398
4399 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
4400
4401 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
4402 /* it now has its link count reset to 1 via a call to EKCLS. */
4403
4404 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
4405
4406 /* Previous version line was changed from "Beta" to "SPICELIB." */
4407
4408 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
4409
4410 /* -& */
4411 /* $ Index_Entries */
4412
4413 /* return information on loaded EK column specified by index */
4414
4415 /* -& */
4416
4417 /* Standard SPICE error handling. */
4418
4419 if (return_()) {
4420 return 0;
4421 } else {
4422 chkin_("EKCII", (ftnlen)5);
4423 }
4424
4425 /* On the first pass through this routine, initialize the tables, */
4426 /* if it hasn't been done yet. */
4427
4428 if (first) {
4429
4430 /* Initialize the file table pool, segment table pool, column */
4431 /* descriptor pool, column table pool, and table list pool. */
4432
4433 lnkini_(&c__20, ftpool);
4434 lnkini_(&c__200, stpool);
4435 lnkini_(&c__10000, dtpool);
4436 lnkini_(&c__500, ctpool);
4437 lnkini_(&c__100, tbpool);
4438 fthead = 0;
4439 tbhead = 0;
4440 first = FALSE_;
4441 }
4442
4443 /* Find the table. If there's no match, the number of loaded columns */
4444 /* is zero. */
4445
4446 tbcurr = tbhead;
4447 fnd = FALSE_;
4448 while(tbcurr > 0 && ! fnd) {
4449 if (eqstr_(table, tbnams + (((i__1 = tbcurr - 1) < 100 && 0 <= i__1 ?
4450 i__1 : s_rnge("tbnams", i__1, "ekqmgr_", (ftnlen)3580)) << 6),
4451 table_len, (ftnlen)64)) {
4452 fnd = TRUE_;
4453 } else {
4454 tbcurr = lnknxt_(&tbcurr, tbpool);
4455 }
4456 }
4457 if (! fnd) {
4458 setmsg_("The table # is not currently loaded.", (ftnlen)36);
4459 errch_("#", table, (ftnlen)1, table_len);
4460 sigerr_("SPICE(TABLENOTLOADED)", (ftnlen)21);
4461 chkout_("EKCII", (ftnlen)5);
4462 return 0;
4463 }
4464
4465 /* Locate the named column in the column attribute table. */
4466
4467 i__ = 0;
4468 col = tbctpt[(i__1 = tbcurr - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge("tbc"
4469 "tpt", i__1, "ekqmgr_", (ftnlen)3604)];
4470 while(col > 0 && i__ < *cindex) {
4471 ++i__;
4472 if (i__ == *cindex) {
4473
4474 /* We've found the column. Set the output arguments using */
4475 /* its attributes. */
4476
4477 s_copy(column, ctnams + (((i__1 = col - 1) < 500 && 0 <= i__1 ?
4478 i__1 : s_rnge("ctnams", i__1, "ekqmgr_", (ftnlen)3615)) <<
4479 5), column_len, (ftnlen)32);
4480 attdsc[0] = ctclas[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 :
4481 s_rnge("ctclas", i__1, "ekqmgr_", (ftnlen)3617)];
4482 attdsc[1] = cttyps[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 :
4483 s_rnge("cttyps", i__1, "ekqmgr_", (ftnlen)3618)];
4484 attdsc[2] = ctlens[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 :
4485 s_rnge("ctlens", i__1, "ekqmgr_", (ftnlen)3619)];
4486 attdsc[3] = ctsizs[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 :
4487 s_rnge("ctsizs", i__1, "ekqmgr_", (ftnlen)3620)];
4488 if (ctindx[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 : s_rnge(
4489 "ctindx", i__1, "ekqmgr_", (ftnlen)3622)]) {
4490 attdsc[4] = 1;
4491 } else {
4492 attdsc[4] = -1;
4493 }
4494 if (ctnull[(i__1 = col - 1) < 500 && 0 <= i__1 ? i__1 : s_rnge(
4495 "ctnull", i__1, "ekqmgr_", (ftnlen)3628)]) {
4496 attdsc[5] = 1;
4497 } else {
4498 attdsc[5] = -1;
4499 }
4500 chkout_("EKCII", (ftnlen)5);
4501 return 0;
4502 } else {
4503 col = lnknxt_(&col, ctpool);
4504 }
4505 }
4506
4507 /* We end up here if we ran out of columns before finding the */
4508 /* CINDEXth one, or if CINDEX was non-positive. */
4509
4510 setmsg_("Column indices for table # range from # to #; requested index w"
4511 "as #.", (ftnlen)68);
4512 errch_("#", tabnam, (ftnlen)1, (ftnlen)64);
4513 i__1 = max(1,i__);
4514 errint_("#", &i__1, (ftnlen)1);
4515 errint_("#", &i__, (ftnlen)1);
4516 errint_("#", cindex, (ftnlen)1);
4517 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
4518 chkout_("EKCII", (ftnlen)5);
4519 return 0;
4520 /* $Procedure EKSRCH ( EK, search for events ) */
4521
4522 L_eksrch:
4523 /* $ Abstract */
4524
4525 /* Search for EK events matching a specified set of constraints. */
4526
4527 /* $ Disclaimer */
4528
4529 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
4530 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
4531 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
4532 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
4533 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
4534 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
4535 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
4536 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
4537 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
4538 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
4539
4540 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
4541 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
4542 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
4543 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
4544 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
4545 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
4546
4547 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
4548 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
4549 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
4550 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
4551
4552 /* $ Required_Reading */
4553
4554 /* EK */
4555
4556 /* $ Keywords */
4557
4558 /* EK */
4559 /* EVENT */
4560 /* FILES */
4561 /* SEARCH */
4562
4563 /* $ Declarations */
4564
4565 /* INTEGER EQRYI ( LBCELL : * ) */
4566 /* CHARACTER*(*) EQRYC */
4567 /* DOUBLE PRECISION EQRYD ( * ) */
4568 /* INTEGER NMROWS */
4569 /* LOGICAL SEMERR */
4570 /* CHARACTER*(*) ERRMSG */
4571
4572 /* $ Brief_I/O */
4573
4574 /* Variable I/O Description */
4575 /* -------- --- -------------------------------------------------- */
4576 /* EQRYI I Integer component of encoded query. */
4577 /* EQRYC I Character component of encoded query. */
4578 /* EQRYD I D.p. component of encoded query. */
4579 /* NMROWS O Number of rows matching query constraints. */
4580 /* SEMERR O Flag indicating whether semantic error occurred. */
4581 /* ERRMSG O Message describing semantic error, if any. */
4582
4583 /* $ Detailed_Input */
4584
4585 /* EQRYI, */
4586 /* EQRYC, */
4587 /* EQRYD are, respectively, the integer, character, and */
4588 /* double precision portions of an encoded query. */
4589 /* The query must have been parsed and must have */
4590 /* its table and column names resolved. Time values */
4591 /* must have been resolved. The query is expected */
4592 /* to be semantically correct. */
4593
4594 /* $ Detailed_Output */
4595
4596 /* NMROWS is the number of rows matching the input query */
4597 /* constraints. */
4598
4599 /* SEMERR is a logical flag indicating whether a semantic */
4600 /* error was detected while attempting to respond to */
4601 /* the input query. */
4602
4603 /* ERRMSG is a descriptive error message that is set if a */
4604 /* semantic error is detected. Otherwise, ERRMSG */
4605 /* is returned blank. */
4606
4607 /* See $Particulars for a description of the effect of this */
4608 /* routine. */
4609
4610 /* $ Parameters */
4611
4612 /* LBCELL is the SPICELIB cell lower bound. */
4613
4614 /* $ Exceptions */
4615
4616 /* 1) If this routine is called when no files are loaded, the */
4617 /* error SPICE(NOLOADEDFILES) is signaled. */
4618
4619 /* 2) If the structure of the input query is invalid, this routine */
4620 /* may fail in mysterious ways. */
4621
4622 /* $ Files */
4623
4624 /* See the header of EKQMGR for a description of files used */
4625 /* by this routine. */
4626
4627 /* $ Particulars */
4628
4629 /* NAIF Toolkit-based applications will rarely need to call this */
4630 /* routine directly; the high-level routine EKFIND should normally */
4631 /* be used to query the EK system. */
4632
4633 /* Because the structure of encoded queries is not part of the */
4634 /* SPICELIB user interface, we strongly recommend that users' */
4635 /* applications not call this routine directly. */
4636
4637 /* $ Examples */
4638
4639 /* See the header of the umbrella subroutine EKQMGR for a */
4640 /* comprehensive example of the use of EKQMGR's entry points. */
4641
4642 /* $ Restrictions */
4643
4644 /* 1) This routine should normally not be called directly from */
4645 /* users' applications. */
4646
4647 /* $ Literature_References */
4648
4649 /* None. */
4650
4651 /* $ Author_and_Institution */
4652
4653 /* N.J. Bachman (JPL) */
4654 /* B.V. Semenov (JPL) */
4655
4656 /* $ Version */
4657
4658 /* - SPICELIB Version 2.0.1, 10-FEB-2014 (BVS) */
4659
4660 /* Added description of LBCELL to the Parameters section of the */
4661 /* header. */
4662
4663 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
4664
4665 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
4666 /* it now has its link count reset to 1 via a call to EKCLS. */
4667
4668 /* - SPICELIB Version 1.2.0, 21-JUL-1998 (NJB) */
4669
4670 /* ZZEKJSQZ call was added after the ZZEKJOIN call. This change */
4671 /* reduces the scratch area usage for intermediate results of */
4672 /* joins. It also prevents ZZEKJOIN from being handed a join */
4673 /* row set containing a segment vector having no corresponding */
4674 /* row vectors. */
4675
4676 /* Removed a comment in the join loop indicating that non-join */
4677 /* constraints involving comparisons of column entries in the */
4678 /* table were being activated. This comment was incorrect; the */
4679 /* constraints in question were applied earlier. */
4680
4681 /* - SPICELIB Version 1.0.1, 07-JUL-1996 (NJB) */
4682
4683 /* Previous version line was changed from "Beta" to "SPICELIB." */
4684
4685 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
4686
4687 /* -& */
4688 /* $ Index_Entries */
4689
4690 /* search for events in loaded EK files */
4691
4692 /* -& */
4693
4694 /* Standard SPICE error handling. */
4695
4696 if (return_()) {
4697 return 0;
4698 } else {
4699 chkin_("EKSRCH", (ftnlen)6);
4700 }
4701
4702 /* There nothing to search if no files are loaded. A sure */
4703 /* symptom of this problem is that the file list is empty. */
4704
4705 if (fthead <= 0) {
4706 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
4707 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
4708 chkout_("EKSRCH", (ftnlen)6);
4709 return 0;
4710 }
4711
4712 /* No error to begin with. */
4713
4714 *semerr = FALSE_;
4715 s_copy(errmsg, " ", errmsg_len, (ftnlen)1);
4716 *nmrows = 0;
4717 if (first) {
4718
4719 /* Initialize the file table pool, segment table pool, column */
4720 /* descriptor pool, column table pool, and table list pool. */
4721
4722 lnkini_(&c__20, ftpool);
4723 lnkini_(&c__200, stpool);
4724 lnkini_(&c__10000, dtpool);
4725 lnkini_(&c__500, ctpool);
4726 lnkini_(&c__100, tbpool);
4727 fthead = 0;
4728 tbhead = 0;
4729 first = FALSE_;
4730 }
4731
4732 /* Read some of our favorite things from the query. We need: */
4733
4734 /* - the table count */
4735 /* - the SELECT clause column count */
4736 /* - the order-by column count */
4737 /* - the table and alias list */
4738
4739 zzekreqi_(eqryi, "NUM_TABLES", &ntab, (ftnlen)10);
4740 zzekreqi_(eqryi, "NUM_SELECT_COLS", &nsel, (ftnlen)15);
4741 zzekreqi_(eqryi, "NUM_ORDERBY_COLS", &norder, (ftnlen)16);
4742 i__1 = ntab;
4743 for (i__ = 1; i__ <= i__1; ++i__) {
4744 zzekqtab_(eqryi, eqryc, &i__, frmtab + (((i__2 = i__ - 1) < 10 && 0 <=
4745 i__2 ? i__2 : s_rnge("frmtab", i__2, "ekqmgr_", (ftnlen)3904)
4746 ) << 6), frmals + (((i__3 = i__ - 1) < 10 && 0 <= i__3 ? i__3
4747 : s_rnge("frmals", i__3, "ekqmgr_", (ftnlen)3904)) << 6),
4748 eqryc_len, (ftnlen)64, (ftnlen)64);
4749 }
4750
4751 /* Initialize the table vectors. Also initialize a vector of column */
4752 /* list pointers. */
4753
4754 ssizec_(&c__10, tabvec, (ftnlen)64);
4755 ssizei_(&c__10, tptvec);
4756
4757 /* Fill in the FROM table vector and corresponding column pointer */
4758 /* vector. It's an error if a table referenced in the FROM clause */
4759 /* can't be found. */
4760
4761 i__1 = ntab;
4762 for (i__ = 1; i__ <= i__1; ++i__) {
4763
4764 /* Find the table list entry for this table name. */
4765
4766 tbcurr = tbhead;
4767 fnd = FALSE_;
4768 while(tbcurr > 0 && ! fnd) {
4769 if (s_cmp(tbnams + (((i__2 = tbcurr - 1) < 100 && 0 <= i__2 ?
4770 i__2 : s_rnge("tbnams", i__2, "ekqmgr_", (ftnlen)3928)) <<
4771 6), frmtab + (((i__3 = i__ - 1) < 10 && 0 <= i__3 ? i__3
4772 : s_rnge("frmtab", i__3, "ekqmgr_", (ftnlen)3928)) << 6),
4773 (ftnlen)64, (ftnlen)64) == 0) {
4774
4775 /* We've found the table list entry for the Ith table. */
4776
4777 appndc_(frmtab + (((i__2 = i__ - 1) < 10 && 0 <= i__2 ? i__2 :
4778 s_rnge("frmtab", i__2, "ekqmgr_", (ftnlen)3932)) <<
4779 6), tabvec, (ftnlen)64, (ftnlen)64);
4780 appndi_(&tbcurr, tptvec);
4781 fnd = TRUE_;
4782 } else {
4783 tbcurr = lnknxt_(&tbcurr, tbpool);
4784 }
4785 }
4786 if (! fnd) {
4787 setmsg_("The table # is not currently loaded.", (ftnlen)36);
4788 errch_("#", frmtab + (((i__2 = i__ - 1) < 10 && 0 <= i__2 ? i__2 :
4789 s_rnge("frmtab", i__2, "ekqmgr_", (ftnlen)3943)) << 6), (
4790 ftnlen)1, (ftnlen)64);
4791 sigerr_("SPICE(INVALIDTABLENAME)", (ftnlen)23);
4792 chkout_("EKSRCH", (ftnlen)6);
4793 return 0;
4794 }
4795 }
4796
4797 /* Since this is a new search, re-initialize the stack in the EK */
4798 /* scratch area. Also initialize our total segment list count. */
4799
4800 zzekstop_(&top);
4801 zzeksdec_(&top);
4802
4803 /* Initialize the size of the join row set union for the current */
4804 /* query. At this point, no matching rows have been found. */
4805
4806 usize = 0;
4807 unrows = 0;
4808
4809 /* Get the number of conjunctions and the sizes of the conjunctions. */
4810
4811 zzekreqi_(eqryi, "NUM_CONJUNCTIONS", &nconj, (ftnlen)16);
4812 cleari_(&c__1000, sizes);
4813 i__1 = nconj;
4814 for (i__ = 1; i__ <= i__1; ++i__) {
4815 zzekqcnj_(eqryi, &i__, &sizes[(i__2 = i__ - 1) < 1000 && 0 <= i__2 ?
4816 i__2 : s_rnge("sizes", i__2, "ekqmgr_", (ftnlen)3972)]);
4817 }
4818
4819 /* For each conjunction of constraints, we'll build a join row */
4820 /* set representing the row vectors matching those constraints. */
4821 /* The final result will be a join row set union representing the */
4822 /* row vectors satisfying at least one conjunction. */
4823
4824 /* We want to build a join row set even if there are *no* */
4825 /* constraints. Therefore, we always make at least one pass */
4826 /* through the loop below. */
4827
4828 cjend = 0;
4829 i__1 = max(1,nconj);
4830 for (conj = 1; conj <= i__1; ++conj) {
4831
4832 /* Our objective is to build a join row set representing the table */
4833 /* defined by the FROM columns and the input constraints. To do */
4834 /* this, we'll first build a trivial join row set for each table; */
4835 /* this join row set represents the rows that satisfy constraints */
4836 /* on columns in that table. Having done this, we'll produce a */
4837 /* final (for this conjunction) join row set that represents the */
4838 /* constrained join of the FROM tables. The base address of this */
4839 /* join row set will be stored in the array UBASE. */
4840
4841 /* We'll start out by recording the FROM table indices and column */
4842 /* list indices of columns listed in the constraints. */
4843
4844 if (nconj == 0) {
4845 cjsize = 0;
4846 } else {
4847 cjsize = sizes[(i__2 = conj - 1) < 1000 && 0 <= i__2 ? i__2 :
4848 s_rnge("sizes", i__2, "ekqmgr_", (ftnlen)4004)];
4849 }
4850 cjbeg = cjend + 1;
4851 cjend += cjsize;
4852 i__2 = cjsize;
4853 for (i__ = 1; i__ <= i__2; ++i__) {
4854 i__14 = cjbeg + i__ - 1;
4855 zzekqcon_(eqryi, eqryc, eqryd, &i__14, &cnstyp[(i__3 = i__ - 1) <
4856 1000 && 0 <= i__3 ? i__3 : s_rnge("cnstyp", i__3, "ekqmg"
4857 "r_", (ftnlen)4012)], ltname, <bidx[(i__4 = i__ - 1) <
4858 1000 && 0 <= i__4 ? i__4 : s_rnge("ltbidx", i__4, "ekqmg"
4859 "r_", (ftnlen)4012)], lcname, &lcidx[(i__5 = i__ - 1) <
4860 1000 && 0 <= i__5 ? i__5 : s_rnge("lcidx", i__5, "ekqmgr_"
4861 , (ftnlen)4012)], &ops[(i__6 = i__ - 1) < 1000 && 0 <=
4862 i__6 ? i__6 : s_rnge("ops", i__6, "ekqmgr_", (ftnlen)4012)
4863 ], rtname, &rtbidx[(i__7 = i__ - 1) < 1000 && 0 <= i__7 ?
4864 i__7 : s_rnge("rtbidx", i__7, "ekqmgr_", (ftnlen)4012)],
4865 rcname, &rcidx[(i__8 = i__ - 1) < 1000 && 0 <= i__8 ?
4866 i__8 : s_rnge("rcidx", i__8, "ekqmgr_", (ftnlen)4012)], &
4867 dtype[(i__9 = i__ - 1) < 1000 && 0 <= i__9 ? i__9 :
4868 s_rnge("dtype", i__9, "ekqmgr_", (ftnlen)4012)], &cbegs[(
4869 i__10 = i__ - 1) < 1000 && 0 <= i__10 ? i__10 : s_rnge(
4870 "cbegs", i__10, "ekqmgr_", (ftnlen)4012)], &cends[(i__11 =
4871 i__ - 1) < 1000 && 0 <= i__11 ? i__11 : s_rnge("cends",
4872 i__11, "ekqmgr_", (ftnlen)4012)], &dvals[(i__12 = i__ - 1)
4873 < 1000 && 0 <= i__12 ? i__12 : s_rnge("dvals", i__12,
4874 "ekqmgr_", (ftnlen)4012)], &ivals[(i__13 = i__ - 1) <
4875 1000 && 0 <= i__13 ? i__13 : s_rnge("ivals", i__13, "ekq"
4876 "mgr_", (ftnlen)4012)], eqryc_len, (ftnlen)64, (ftnlen)32,
4877 (ftnlen)64, (ftnlen)32);
4878 }
4879 i__2 = ntab;
4880 for (t = 1; t <= i__2; ++t) {
4881
4882 /* We will build a trivial (one-table) join row set for the */
4883 /* current table. */
4884
4885 /* Initialize the join row set. Retain the base address. We */
4886 /* can fill in the table count right away; the count is 1. */
4887
4888 zzekstop_(&rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
4889 "rbas", i__3, "ekqmgr_", (ftnlen)4030)]);
4890 for (i__ = 1; i__ <= 4; ++i__) {
4891 zzekspsh_(&c__1, &c__0);
4892 }
4893 i__5 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
4894 "rbas", i__3, "ekqmgr_", (ftnlen)4036)] + 3;
4895 i__6 = rbas[(i__4 = t - 1) < 10 && 0 <= i__4 ? i__4 : s_rnge(
4896 "rbas", i__4, "ekqmgr_", (ftnlen)4036)] + 3;
4897 zzeksupd_(&i__5, &i__6, &c__1);
4898
4899 /* Count the loaded segments for the current table. We'll */
4900 /* leave enough room in the join row set for each segment. */
4901
4902 tab = tptvec[(i__3 = t + 5) < 16 && 0 <= i__3 ? i__3 : s_rnge(
4903 "tptvec", i__3, "ekqmgr_", (ftnlen)4042)];
4904 i__ = tbstpt[(i__3 = tab - 1) < 100 && 0 <= i__3 ? i__3 : s_rnge(
4905 "tbstpt", i__3, "ekqmgr_", (ftnlen)4043)];
4906 nsv = 0;
4907 while(i__ > 0) {
4908 zzekspsh_(&c__1, &c__0);
4909 ++nsv;
4910 i__ = lnknxt_(&i__, stpool);
4911 }
4912
4913 /* Save room for the row vector base addresses and counts. */
4914
4915 i__3 = nsv << 1;
4916 for (i__ = 1; i__ <= i__3; ++i__) {
4917 zzekspsh_(&c__1, &c__0);
4918 }
4919
4920 /* At this point, we can set the segment vector count in the */
4921 /* join row set. */
4922
4923 i__5 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
4924 "rbas", i__3, "ekqmgr_", (ftnlen)4066)] + 4;
4925 i__6 = rbas[(i__4 = t - 1) < 10 && 0 <= i__4 ? i__4 : s_rnge(
4926 "rbas", i__4, "ekqmgr_", (ftnlen)4066)] + 4;
4927 zzeksupd_(&i__5, &i__6, &nsv);
4928
4929 /* Find the matching rows in the segments belonging to the */
4930 /* current table. */
4931
4932 seg = tbstpt[(i__3 = tab - 1) < 100 && 0 <= i__3 ? i__3 : s_rnge(
4933 "tbstpt", i__3, "ekqmgr_", (ftnlen)4072)];
4934 nseg = 0;
4935 rtotal = 0;
4936 while(seg > 0) {
4937 ++nseg;
4938
4939 /* The segment vector for this segment is trivial: it's */
4940 /* just the segment's index in the segment table. */
4941
4942 sgvbas = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 :
4943 s_rnge("rbas", i__3, "ekqmgr_", (ftnlen)4083)] + 4 + (
4944 nseg - 1);
4945 i__3 = sgvbas + 1;
4946 i__4 = sgvbas + 1;
4947 zzeksupd_(&i__3, &i__4, &seg);
4948
4949 /* Label as `inactive' any constraints that don't apply to */
4950 /* this table. Join constraints are inactive at this stage */
4951 /* of the game. Label all other constraints `active'. */
4952 /* We'll keep track of column and value constraints */
4953 /* separately. */
4954
4955 i__3 = cjsize;
4956 for (i__ = 1; i__ <= i__3; ++i__) {
4957
4958 /* Each constraint is active to start with. */
4959
4960 activc[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
4961 s_rnge("activc", i__4, "ekqmgr_", (ftnlen)4098)] =
4962 cnstyp[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ?
4963 i__5 : s_rnge("cnstyp", i__5, "ekqmgr_", (ftnlen)
4964 4098)] == 1;
4965 activv[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
4966 s_rnge("activv", i__4, "ekqmgr_", (ftnlen)4099)] =
4967 cnstyp[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ?
4968 i__5 : s_rnge("cnstyp", i__5, "ekqmgr_", (ftnlen)
4969 4099)] == 2;
4970
4971 /* The parent table of the LHS column must be the Tth */
4972 /* table, or this constraint does not apply. */
4973
4974 /* We'll also exclude join constraints. Note that */
4975 /* constraints comparing values from two columns need not */
4976 /* be join constraints: it's possible that the column on */
4977 /* the right belongs to the same FROM table as the */
4978 /* column on the left. */
4979
4980 if (ltbidx[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
4981 s_rnge("ltbidx", i__4, "ekqmgr_", (ftnlen)4111)]
4982 != t) {
4983 activc[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
4984 s_rnge("activc", i__4, "ekqmgr_", (ftnlen)
4985 4113)] = FALSE_;
4986 activv[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
4987 s_rnge("activv", i__4, "ekqmgr_", (ftnlen)
4988 4114)] = FALSE_;
4989 } else if (cnstyp[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ?
4990 i__4 : s_rnge("cnstyp", i__4, "ekqmgr_", (ftnlen)
4991 4117)] == 1) {
4992 if (ltbidx[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ?
4993 i__4 : s_rnge("ltbidx", i__4, "ekqmgr_", (
4994 ftnlen)4119)] != rtbidx[(i__5 = i__ - 1) <
4995 1000 && 0 <= i__5 ? i__5 : s_rnge("rtbidx",
4996 i__5, "ekqmgr_", (ftnlen)4119)]) {
4997
4998 /* This is a join constraint; disable it. */
4999
5000 activc[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ?
5001 i__4 : s_rnge("activc", i__4, "ekqmgr_", (
5002 ftnlen)4123)] = FALSE_;
5003 }
5004 }
5005 }
5006
5007 /* At this point, we'll have to search the segment for */
5008 /* matching rows. Pick a key column for the segment. To */
5009 /* do this, we'll need to pack an array with column */
5010 /* descriptors for each active constraint. The */
5011 /* descriptor for the column on the left side of the Ith */
5012 /* constraint will be placed in elements LDSCRS(*,I), if */
5013 /* the Ith constraint is active. */
5014
5015 cleari_(&c__11000, ldscrs);
5016 i__3 = cjsize;
5017 for (i__ = 1; i__ <= i__3; ++i__) {
5018 if (activv[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ? i__4 :
5019 s_rnge("activv", i__4, "ekqmgr_", (ftnlen)4147)])
5020 {
5021
5022 /* Look up the column descriptor for this */
5023 /* constraint. */
5024
5025 j = stdtpt[(i__4 = seg - 1) < 200 && 0 <= i__4 ? i__4
5026 : s_rnge("stdtpt", i__4, "ekqmgr_", (ftnlen)
5027 4152)];
5028 i__5 = lcidx[(i__4 = i__ - 1) < 1000 && 0 <= i__4 ?
5029 i__4 : s_rnge("lcidx", i__4, "ekqmgr_", (
5030 ftnlen)4154)];
5031 for (k = 2; k <= i__5; ++k) {
5032 j = lnknxt_(&j, dtpool);
5033 }
5034 movei_(&dtdscs[(i__5 = j * 11 - 11) < 110000 && 0 <=
5035 i__5 ? i__5 : s_rnge("dtdscs", i__5, "ekqmgr_"
5036 , (ftnlen)4158)], &c__11, &ldscrs[(i__4 = i__
5037 * 11 - 11) < 11000 && 0 <= i__4 ? i__4 :
5038 s_rnge("ldscrs", i__4, "ekqmgr_", (ftnlen)
5039 4158)]);
5040 }
5041 }
5042 zzekkey_(&sthan[(i__3 = seg - 1) < 200 && 0 <= i__3 ? i__3 :
5043 s_rnge("sthan", i__3, "ekqmgr_", (ftnlen)4165)], &
5044 stdscs[(i__5 = seg * 24 - 24) < 4800 && 0 <= i__5 ?
5045 i__5 : s_rnge("stdscs", i__5, "ekqmgr_", (ftnlen)4165)
5046 ], &stnrow[(i__4 = seg - 1) < 200 && 0 <= i__4 ? i__4
5047 : s_rnge("stnrow", i__4, "ekqmgr_", (ftnlen)4165)], &
5048 cjsize, lcidx, ldscrs, ops, dtype, eqryc, cbegs,
5049 cends, dvals, ivals, activv, &key, keydsc, &begidx, &
5050 endidx, &keyfnd, eqryc_len);
5051
5052 /* ZZEKKEY has updated ACTIVV to reflect the application */
5053 /* of constraints that were used to determine BEGIDX and */
5054 /* ENDIDX. */
5055
5056 if (keyfnd) {
5057 indexd = TRUE_;
5058 } else {
5059
5060 /* A key column could not be determined from the */
5061 /* active constraints. We'll use the first column of */
5062 /* the segment as the key column. */
5063
5064 indexd = FALSE_;
5065 begidx = 1;
5066 endidx = stnrow[(i__3 = seg - 1) < 200 && 0 <= i__3 ?
5067 i__3 : s_rnge("stnrow", i__3, "ekqmgr_", (ftnlen)
5068 4193)];
5069 }
5070
5071 /* Whether or not we have any matching rows, we'll need */
5072 /* to record how many we have. Save the offset from the */
5073 /* join row set base for the pointer to the row vectors. */
5074 /* The row vector count follows this pointer. */
5075
5076 ptroff = nsv + 4 + (nseg - 1 << 1) + 1;
5077 if (endidx >= begidx) {
5078
5079 /* Initialize the count of matching rows for this */
5080 /* segment. The current stack top is the base address */
5081 /* for the row vectors; save the offset of this */
5082 /* address from the join row set's base. */
5083 /* Also compute the base address of the segment vector */
5084 /* for the current segment. */
5085
5086 nmatch = 0;
5087 zzekstop_(&rwvbas);
5088 i__6 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 :
5089 s_rnge("rbas", i__3, "ekqmgr_", (ftnlen)4218)] +
5090 ptroff;
5091 i__7 = rbas[(i__5 = t - 1) < 10 && 0 <= i__5 ? i__5 :
5092 s_rnge("rbas", i__5, "ekqmgr_", (ftnlen)4218)] +
5093 ptroff;
5094 i__8 = rwvbas - rbas[(i__4 = t - 1) < 10 && 0 <= i__4 ?
5095 i__4 : s_rnge("rbas", i__4, "ekqmgr_", (ftnlen)
5096 4218)];
5097 zzeksupd_(&i__6, &i__7, &i__8);
5098
5099 /* Count the active constraints. While we're at it, */
5100 /* fill in the descriptor lists LDSCRS and RDSCRS */
5101 /* with, respectively, the descriptors for the columns */
5102 /* on the left hand sides and right hand sides of */
5103 /* these constraints. */
5104
5105 cleari_(&c__11000, ldscrs);
5106 cleari_(&c__11000, rdscrs);
5107 nact = 0;
5108 i__3 = cjsize;
5109 for (i__ = 1; i__ <= i__3; ++i__) {
5110 if (activc[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ?
5111 i__5 : s_rnge("activc", i__5, "ekqmgr_", (
5112 ftnlen)4234)] || activv[(i__4 = i__ - 1) <
5113 1000 && 0 <= i__4 ? i__4 : s_rnge("activv",
5114 i__4, "ekqmgr_", (ftnlen)4234)]) {
5115 ++nact;
5116
5117 /* Look up the column descriptor for this */
5118 /* constraint. */
5119 j = stdtpt[(i__5 = seg - 1) < 200 && 0 <= i__5 ?
5120 i__5 : s_rnge("stdtpt", i__5, "ekqmgr_", (
5121 ftnlen)4241)];
5122 i__4 = lcidx[(i__5 = i__ - 1) < 1000 && 0 <= i__5
5123 ? i__5 : s_rnge("lcidx", i__5, "ekqmgr_",
5124 (ftnlen)4243)];
5125 for (k = 2; k <= i__4; ++k) {
5126 j = lnknxt_(&j, dtpool);
5127 }
5128 movei_(&dtdscs[(i__4 = j * 11 - 11) < 110000 && 0
5129 <= i__4 ? i__4 : s_rnge("dtdscs", i__4,
5130 "ekqmgr_", (ftnlen)4247)], &c__11, &
5131 ldscrs[(i__5 = i__ * 11 - 11) < 11000 &&
5132 0 <= i__5 ? i__5 : s_rnge("ldscrs", i__5,
5133 "ekqmgr_", (ftnlen)4247)]);
5134 j = stdtpt[(i__4 = seg - 1) < 200 && 0 <= i__4 ?
5135 i__4 : s_rnge("stdtpt", i__4, "ekqmgr_", (
5136 ftnlen)4250)];
5137 i__5 = rcidx[(i__4 = i__ - 1) < 1000 && 0 <= i__4
5138 ? i__4 : s_rnge("rcidx", i__4, "ekqmgr_",
5139 (ftnlen)4252)];
5140 for (k = 2; k <= i__5; ++k) {
5141 j = lnknxt_(&j, dtpool);
5142 }
5143 movei_(&dtdscs[(i__5 = j * 11 - 11) < 110000 && 0
5144 <= i__5 ? i__5 : s_rnge("dtdscs", i__5,
5145 "ekqmgr_", (ftnlen)4256)], &c__11, &
5146 rdscrs[(i__4 = i__ * 11 - 11) < 11000 &&
5147 0 <= i__4 ? i__4 : s_rnge("rdscrs", i__4,
5148 "ekqmgr_", (ftnlen)4256)]);
5149 }
5150 }
5151 if (nact > 0) {
5152
5153 /* There are still active constraints left, so */
5154 /* proceed linearly through the remaining rows, */
5155 /* testing each one against these constraints. Add */
5156 /* matching rows to the current join row set. */
5157
5158 i__3 = endidx;
5159 for (r__ = begidx; r__ <= i__3; ++r__) {
5160 if (indexd) {
5161 zzekixlk_(&sthan[(i__5 = seg - 1) < 200 && 0
5162 <= i__5 ? i__5 : s_rnge("sthan", i__5,
5163 "ekqmgr_", (ftnlen)4275)], keydsc, &
5164 r__, &rowidx);
5165 } else {
5166
5167 /* Look up the record pointer for row R. */
5168
5169 zzekrplk_(&sthan[(i__5 = seg - 1) < 200 && 0
5170 <= i__5 ? i__5 : s_rnge("sthan", i__5,
5171 "ekqmgr_", (ftnlen)4283)], &stdscs[(
5172 i__4 = seg * 24 - 24) < 4800 && 0 <=
5173 i__4 ? i__4 : s_rnge("stdscs", i__4,
5174 "ekqmgr_", (ftnlen)4283)], &r__, &
5175 rowidx);
5176 }
5177
5178 /* Test the row against both value and column */
5179 /* constraints. For now, we supply an array */
5180 /* of default column entry element indices. */
5181
5182 vmtch = zzekrmch_(&cjsize, activv, &sthan[(i__5 =
5183 seg - 1) < 200 && 0 <= i__5 ? i__5 :
5184 s_rnge("sthan", i__5, "ekqmgr_", (ftnlen)
5185 4294)], &stdscs[(i__4 = seg * 24 - 24) <
5186 4800 && 0 <= i__4 ? i__4 : s_rnge("stdscs"
5187 , i__4, "ekqmgr_", (ftnlen)4294)], ldscrs,
5188 &rowidx, lelts, ops, dtype, eqryc, cbegs,
5189 cends, dvals, ivals, eqryc_len);
5190 cmtch = TRUE_;
5191
5192 /* Note that ZZEKVMCH expects a set of inputs */
5193 /* that are not really parallel to those */
5194 /* expected by ZZEKRMCH. We feed the */
5195 /* column comparison constraints to ZZEKVMCH */
5196 /* one at a time. */
5197
5198 i__5 = cjsize;
5199 for (j = 1; j <= i__5; ++j) {
5200 cmtch = cmtch && zzekvmch_(&c__1, &activc[(
5201 i__4 = j - 1) < 1000 && 0 <= i__4 ?
5202 i__4 : s_rnge("activc", i__4, "ekqmg"
5203 "r_", (ftnlen)4313)], &sthan[(i__6 =
5204 seg - 1) < 200 && 0 <= i__6 ? i__6 :
5205 s_rnge("sthan", i__6, "ekqmgr_", (
5206 ftnlen)4313)], &stdscs[(i__7 = seg *
5207 24 - 24) < 4800 && 0 <= i__7 ? i__7 :
5208 s_rnge("stdscs", i__7, "ekqmgr_", (
5209 ftnlen)4313)], &ldscrs[(i__8 = j * 11
5210 - 11) < 11000 && 0 <= i__8 ? i__8 :
5211 s_rnge("ldscrs", i__8, "ekqmgr_", (
5212 ftnlen)4313)], &rowidx, &c__1, &ops[(
5213 i__9 = j - 1) < 1000 && 0 <= i__9 ?
5214 i__9 : s_rnge("ops", i__9, "ekqmgr_",
5215 (ftnlen)4313)], &sthan[(i__10 = seg -
5216 1) < 200 && 0 <= i__10 ? i__10 :
5217 s_rnge("sthan", i__10, "ekqmgr_", (
5218 ftnlen)4313)], &stdscs[(i__11 = seg *
5219 24 - 24) < 4800 && 0 <= i__11 ? i__11
5220 : s_rnge("stdscs", i__11, "ekqmgr_", (
5221 ftnlen)4313)], &rdscrs[(i__12 = j *
5222 11 - 11) < 11000 && 0 <= i__12 ?
5223 i__12 : s_rnge("rdscrs", i__12, "ekq"
5224 "mgr_", (ftnlen)4313)], &rowidx, &c__1)
5225 ;
5226 }
5227 if (cmtch && vmtch) {
5228
5229 /* Push the `augmented row vector' for the */
5230 /* current row onto the stack. In this case, */
5231 /* of course, the augmented row vector is */
5232 /* trivial: it consists of the row number, */
5233 /* followed by the base address of the parent */
5234 /* segment vector. */
5235
5236 ++nmatch;
5237 zzekspsh_(&c__1, &rowidx);
5238 i__4 = sgvbas - rbas[(i__5 = t - 1) < 10 && 0
5239 <= i__5 ? i__5 : s_rnge("rbas", i__5,
5240 "ekqmgr_", (ftnlen)4342)];
5241 zzekspsh_(&c__1, &i__4);
5242 }
5243 }
5244 } else {
5245
5246 /* All the rows indicated by BEGIDX and ENDIDX */
5247 /* match the constraints. This code section should */
5248 /* be upgraded to transfer the row numbers in */
5249 /* chunks. */
5250
5251 nmatch = endidx - begidx + 1;
5252 i__3 = endidx;
5253 for (r__ = begidx; r__ <= i__3; ++r__) {
5254 if (indexd) {
5255
5256 /* Look up the record pointer for row R */
5257 /* from the column index. */
5258
5259 zzekixlk_(&sthan[(i__5 = seg - 1) < 200 && 0
5260 <= i__5 ? i__5 : s_rnge("sthan", i__5,
5261 "ekqmgr_", (ftnlen)4366)], keydsc, &
5262 r__, &rowidx);
5263 } else {
5264
5265 /* Look up the record pointer for row R. */
5266
5267 zzekrplk_(&sthan[(i__5 = seg - 1) < 200 && 0
5268 <= i__5 ? i__5 : s_rnge("sthan", i__5,
5269 "ekqmgr_", (ftnlen)4374)], &stdscs[(
5270 i__4 = seg * 24 - 24) < 4800 && 0 <=
5271 i__4 ? i__4 : s_rnge("stdscs", i__4,
5272 "ekqmgr_", (ftnlen)4374)], &r__, &
5273 rowidx);
5274 }
5275 zzekspsh_(&c__1, &rowidx);
5276 i__4 = sgvbas - rbas[(i__5 = t - 1) < 10 && 0 <=
5277 i__5 ? i__5 : s_rnge("rbas", i__5, "ekqm"
5278 "gr_", (ftnlen)4382)];
5279 zzekspsh_(&c__1, &i__4);
5280 }
5281 }
5282
5283 /* Fill in the row count for this segment in the join row */
5284 /* set. */
5285
5286 i__4 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 :
5287 s_rnge("rbas", i__3, "ekqmgr_", (ftnlen)4392)] +
5288 ptroff + 1;
5289 i__6 = rbas[(i__5 = t - 1) < 10 && 0 <= i__5 ? i__5 :
5290 s_rnge("rbas", i__5, "ekqmgr_", (ftnlen)4392)] +
5291 ptroff + 1;
5292 zzeksupd_(&i__4, &i__6, &nmatch);
5293 }
5294
5295 /* Take a look at the next segment. Update the total count */
5296 /* of matching rows for this table. */
5297
5298 seg = lnknxt_(&seg, stpool);
5299 rtotal += nmatch;
5300 }
5301
5302 /* Fill in the size and count information for the join row set. */
5303
5304 zzekstop_(&top);
5305 rsize[(i__3 = t - 1) < 200 && 0 <= i__3 ? i__3 : s_rnge("rsize",
5306 i__3, "ekqmgr_", (ftnlen)4410)] = top - rbas[(i__5 = t -
5307 1) < 10 && 0 <= i__5 ? i__5 : s_rnge("rbas", i__5, "ekqm"
5308 "gr_", (ftnlen)4410)];
5309 i__6 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
5310 "rbas", i__3, "ekqmgr_", (ftnlen)4412)] + 1;
5311 i__7 = rbas[(i__5 = t - 1) < 10 && 0 <= i__5 ? i__5 : s_rnge(
5312 "rbas", i__5, "ekqmgr_", (ftnlen)4412)] + 1;
5313 zzeksupd_(&i__6, &i__7, &rsize[(i__4 = t - 1) < 200 && 0 <= i__4 ?
5314 i__4 : s_rnge("rsize", i__4, "ekqmgr_", (ftnlen)4412)]);
5315 i__4 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
5316 "rbas", i__3, "ekqmgr_", (ftnlen)4413)] + 2;
5317 i__6 = rbas[(i__5 = t - 1) < 10 && 0 <= i__5 ? i__5 : s_rnge(
5318 "rbas", i__5, "ekqmgr_", (ftnlen)4413)] + 2;
5319 zzeksupd_(&i__4, &i__6, &rtotal);
5320
5321 /* Compress out any empty segment vectors from the join row */
5322 /* set. */
5323
5324 zzekjsqz_(&rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
5325 "rbas", i__3, "ekqmgr_", (ftnlen)4419)]);
5326
5327 /* At this point, we've filled in the entire join row set for */
5328 /* table T. */
5329
5330 }
5331
5332 /* Join the trivial join row sets, producing a final join row set */
5333 /* for the current conjunction. Retain the base address of this */
5334 /* join row set, if it is non-empty. Update the size of the join */
5335 /* row set union. */
5336
5337
5338 resbas = rbas[0];
5339 i__2 = ntab;
5340 for (t = 2; t <= i__2; ++t) {
5341
5342 /* Arm the join constraints! Turn on the constraints that */
5343 /* have the Tth table on the one side, and tables */
5344 /* 1, 2, ... , T on the other. */
5345
5346 i__3 = cjsize;
5347 for (i__ = 1; i__ <= i__3; ++i__) {
5348 activc[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ? i__5 : s_rnge(
5349 "activc", i__5, "ekqmgr_", (ftnlen)4444)] = FALSE_;
5350 if (cnstyp[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ? i__5 :
5351 s_rnge("cnstyp", i__5, "ekqmgr_", (ftnlen)4446)] == 1)
5352 {
5353 l = ltbidx[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ? i__5 :
5354 s_rnge("ltbidx", i__5, "ekqmgr_", (ftnlen)4448)];
5355 r__ = rtbidx[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ? i__5 :
5356 s_rnge("rtbidx", i__5, "ekqmgr_", (ftnlen)4449)];
5357 if (l >= 1 && l <= t && r__ >= 1 && r__ <= t && l != r__
5358 && (r__ == t || l == t)) {
5359 activc[(i__5 = i__ - 1) < 1000 && 0 <= i__5 ? i__5 :
5360 s_rnge("activc", i__5, "ekqmgr_", (ftnlen)
5361 4459)] = TRUE_;
5362 }
5363 }
5364 }
5365
5366 /* The base address of the first join row set is the base */
5367 /* address of the result of the previous join. The first time */
5368 /* through, the base of the join row set for table 1 is used. */
5369
5370 if (t == 2) {
5371 jbase1 = rbas[0];
5372 } else {
5373 jbase1 = resbas;
5374 }
5375 jbase2 = rbas[(i__3 = t - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge(
5376 "rbas", i__3, "ekqmgr_", (ftnlen)4478)];
5377 zzekjoin_(&jbase1, &jbase2, &cjsize, activc, ltbidx, lcidx, lelts,
5378 ops, rtbidx, rcidx, relts, sthan, stdscs, stdtpt, dtpool,
5379 dtdscs, &resbas, &jsize);
5380 zzekjsqz_(&resbas);
5381 }
5382
5383 /* At this point, we've found the matching rows for the current */
5384 /* query conjunction. Update the size of the join row set union */
5385 /* corresponding to the current query. Save the base address of */
5386 /* the final join row set. Update the total number of matching */
5387 /* rows in the join row set union. */
5388
5389 ++usize;
5390 ubase[(i__2 = usize - 1) < 200 && 0 <= i__2 ? i__2 : s_rnge("ubase",
5391 i__2, "ekqmgr_", (ftnlen)4498)] = resbas;
5392 i__2 = resbas + 2;
5393 i__3 = resbas + 2;
5394 zzeksrd_(&i__2, &i__3, &cjrows);
5395 unrows += cjrows;
5396
5397 /* Remove redundant row vectors from the join row set union. */
5398 /* These row vectors may arise in the execution of queries whose */
5399 /* WHERE clauses contain multiple conjunctions. */
5400
5401 zzekweed_(&usize, ubase, &unrows);
5402
5403 /* Initialize the addressing function for the current join row */
5404 /* set union. */
5405
5406 if (usize > 0) {
5407 zzekvset_(&usize, ubase);
5408 }
5409 }
5410
5411 /* At this point, we've formed the join row set union that */
5412 /* represents the set of row vectors matching the entire query. */
5413
5414 *nmrows = unrows;
5415
5416 /* Get the tables and columns of from the SELECT clause. For */
5417 /* each qualifying table, we need the index in the FROM clause */
5418 /* of that table. For each column, we need the column table */
5419 /* index. */
5420
5421 i__1 = nsel;
5422 for (i__ = 1; i__ <= i__1; ++i__) {
5423 zzekqsel_(eqryi, eqryc, &i__, &lxbeg, &lxend, tabnam, &tabidx, colnam,
5424 &k, eqryc_len, (ftnlen)64, (ftnlen)32);
5425
5426 /* Locate the column's attribute information. Retain the column's */
5427 /* index within the parent table's column list. */
5428
5429 tab = tptvec[(i__2 = tabidx + 5) < 16 && 0 <= i__2 ? i__2 : s_rnge(
5430 "tptvec", i__2, "ekqmgr_", (ftnlen)4542)];
5431 j = tbctpt[(i__2 = tab - 1) < 100 && 0 <= i__2 ? i__2 : s_rnge("tbct"
5432 "pt", i__2, "ekqmgr_", (ftnlen)4543)];
5433 col = 0;
5434 fnd = FALSE_;
5435 while(j > 0 && ! fnd) {
5436 ++col;
5437 if (s_cmp(ctnams + (((i__2 = j - 1) < 500 && 0 <= i__2 ? i__2 :
5438 s_rnge("ctnams", i__2, "ekqmgr_", (ftnlen)4551)) << 5),
5439 colnam, (ftnlen)32, (ftnlen)32) == 0) {
5440 fnd = TRUE_;
5441 } else {
5442 j = lnknxt_(&j, ctpool);
5443 }
5444 }
5445 if (! fnd) {
5446 setmsg_("# is not name of a column in FROM table #.", (ftnlen)42);
5447 errch_("#", colnam, (ftnlen)1, (ftnlen)32);
5448 errint_("#", &tabidx, (ftnlen)1);
5449 sigerr_("SPICE(BUG)", (ftnlen)10);
5450 chkout_("EKSRCH", (ftnlen)6);
5451 return 0;
5452 }
5453 selctp[(i__2 = i__ - 1) < 50 && 0 <= i__2 ? i__2 : s_rnge("selctp",
5454 i__2, "ekqmgr_", (ftnlen)4568)] = j;
5455 selcol[(i__2 = i__ - 1) < 50 && 0 <= i__2 ? i__2 : s_rnge("selcol",
5456 i__2, "ekqmgr_", (ftnlen)4569)] = col;
5457 seltab[(i__2 = i__ - 1) < 50 && 0 <= i__2 ? i__2 : s_rnge("seltab",
5458 i__2, "ekqmgr_", (ftnlen)4570)] = tabidx;
5459 }
5460
5461 /* Enable sorting of the matching row vectors, if necessary. The */
5462 /* first fetch request will invoke the sort. */
5463
5464 dosort = norder > 0 && *nmrows > 0;
5465 sorted = FALSE_;
5466 if (dosort) {
5467 i__1 = norder;
5468 for (i__ = 1; i__ <= i__1; ++i__) {
5469 zzekqord_(eqryi, eqryc, &i__, tabnam, &otabs[(i__2 = i__ - 1) <
5470 10 && 0 <= i__2 ? i__2 : s_rnge("otabs", i__2, "ekqmgr_",
5471 (ftnlen)4585)], colnam, &ocols[(i__3 = i__ - 1) < 10 && 0
5472 <= i__3 ? i__3 : s_rnge("ocols", i__3, "ekqmgr_", (ftnlen)
5473 4585)], &sense[(i__5 = i__ - 1) < 10 && 0 <= i__5 ? i__5 :
5474 s_rnge("sense", i__5, "ekqmgr_", (ftnlen)4585)],
5475 eqryc_len, (ftnlen)64, (ftnlen)32);
5476 }
5477 }
5478 chkout_("EKSRCH", (ftnlen)6);
5479 return 0;
5480 /* $Procedure EKNELT ( EK, get number of elements in column entry ) */
5481
5482 L_eknelt:
5483 /* $ Abstract */
5484
5485 /* Return the number of elements in a specified column entry in */
5486 /* the current row. */
5487
5488 /* $ Disclaimer */
5489
5490 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
5491 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
5492 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
5493 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
5494 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
5495 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
5496 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
5497 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
5498 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
5499 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
5500
5501 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
5502 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
5503 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
5504 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
5505 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
5506 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
5507
5508 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
5509 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
5510 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
5511 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
5512
5513 /* $ Required_Reading */
5514
5515 /* EK */
5516
5517 /* $ Keywords */
5518
5519 /* EK */
5520
5521 /* $ Declarations */
5522
5523 /* INTEGER SELIDX */
5524 /* INTEGER ROW */
5525 /* INTEGER NELT */
5526
5527 /* $ Brief_I/O */
5528
5529 /* Variable I/O Description */
5530 /* -------- --- -------------------------------------------------- */
5531 /* SELIDX I Index of parent column in SELECT clause. */
5532 /* ROW I Row containing element. */
5533 /* NELT O Number of elements in entry in current row. */
5534
5535 /* $ Detailed_Input */
5536
5537 /* SELIDX is the SELECT clause index of the column to */
5538 /* fetch from. */
5539
5540 /* ROW is the index of the row containing the element. */
5541 /* This number refers to a member of the set of rows */
5542 /* matching a query. ROW must be in the range */
5543
5544 /* 1 : NMROWS */
5545
5546 /* where NMROWS is the matching row count returned */
5547 /* by EKSRCH. */
5548
5549 /* $ Detailed_Output */
5550
5551 /* NELT is the number of elements in the column entry */
5552 /* belonging to the specified column in the current */
5553 /* row. */
5554
5555 /* Null entries in variable-size columns are */
5556 /* considered to have size 1. */
5557
5558 /* $ Parameters */
5559
5560 /* None. */
5561
5562 /* $ Exceptions */
5563
5564 /* 1) If this routine is called when no E-kernels have been loaded, */
5565 /* the error SPICE(NOLOADEDFILES) is signaled. */
5566
5567 /* 2) If SELIDX is outside of the range established by the */
5568 /* last query passed to EKSRCH, the error SPICE(INVALIDINDEX) */
5569 /* will be signaled. */
5570
5571 /* 3) If ROW is outside of the range established by the */
5572 /* last query passed to EKSRCH, the error SPICE(INVALIDINDEX) */
5573 /* will be signaled. */
5574
5575 /* $ Files */
5576
5577 /* See the header of EKQMGR for a description of files used */
5578 /* by this routine. */
5579
5580 /* $ Particulars */
5581
5582 /* This routine is meant to be used in conjunction with the EKQMGR */
5583 /* fetch entry points EKGC, EKGD, and EKGI. This routine */
5584 /* allows the caller of those routines to determine appropriate */
5585 /* loop bounds to use to fetch each column entry in the current row. */
5586
5587 /* $ Examples */
5588
5589 /* 1) Suppose the EK table TAB contains the following columns: */
5590
5591
5592 /* Column name Data Type Size */
5593 /* ----------- --------- ---- */
5594 /* IARRAY INT 10 */
5595 /* DARRAY DP VARIABLE */
5596 /* CARRAY CHR VARIABLE */
5597
5598
5599 /* Suppose the query */
5600
5601 /* QUERY = 'SELECT IARRAY, DARRAY, CARRAY FROM TAB' */
5602
5603 /* is issued to EKFIND via the call */
5604
5605 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
5606
5607 /* To fetch and dump column values from the rows that satisfy the */
5608 /* query, the loop below could be used. Note that we don't check */
5609 /* the FOUND flags returned by the fetch routines since we know */
5610 /* in advance how many elements are contained in each column */
5611 /* entry we fetch. */
5612
5613
5614 /* DO ROW = 1, NMROWS */
5615
5616 /* WRITE (*,*) ' ' */
5617 /* WRITE (*,*) 'ROW = ', ROW */
5618 /* WRITE (*,*) ' ' */
5619
5620 /* C */
5621 /* C Fetch values from column IARRAY in the current */
5622 /* C row. Since IARRAY was the first column selected, */
5623 /* C the selection index SELIDX is set to 1. */
5624 /* C */
5625 /* SELIDX = 1 */
5626
5627 /* ELTIDX = 1 */
5628 /* ISNULL = .FALSE. */
5629
5630 /* DO WHILE ( ( ELTIDX .LE. 10 ) .AND. .NOT. ISNULL ) */
5631 /* C */
5632 /* C If the column entry is null, we'll be kicked */
5633 /* C out of this loop after the first iteration. */
5634 /* C */
5635 /* CALL EKGI ( SELIDX, ROW, ELTIDX, */
5636 /* IVALS(ELTIDX), ISNULL, FOUND ) */
5637
5638 /* ELTIDX = ELTIDX + 1 */
5639
5640 /* END DO */
5641
5642 /* WRITE (*,*) ' ' */
5643 /* WRITE (*,*) 'COLUMN = IARRAY' */
5644 /* WRITE (*,*) ' ' */
5645
5646 /* IF ( ISNULL ) THEN */
5647 /* WRITE (*,*) '<Null>' */
5648 /* ELSE */
5649 /* WRITE (*,*) ( IVALS(I), I = 1, 10 ) */
5650 /* END IF */
5651
5652 /* C */
5653 /* C Fetch values from column DARRAY in the current */
5654 /* C row. Since DARRAY contains variable-size array */
5655 /* C elements, we call EKNELT to determine how many */
5656 /* C elements to fetch. */
5657 /* C */
5658 /* SELIDX = 2 */
5659
5660 /* CALL EKNELT ( SELIDX, ROW, NELT ) */
5661
5662 /* ELTIDX = 1 */
5663 /* ISNULL = .FALSE. */
5664
5665 /* DO WHILE ( ( ELTIDX .LE. NELT ) */
5666 /* . .AND. ( .NOT. ISNULL ) ) */
5667
5668 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
5669 /* DVALS(ELTIDX), ISNULL, FOUND ) */
5670
5671 /* ELTIDX = ELTIDX + 1 */
5672
5673 /* END DO */
5674
5675 /* WRITE (*,*) ' ' */
5676 /* WRITE (*,*) 'COLUMN = DARRAY' */
5677 /* WRITE (*,*) ' ' */
5678
5679 /* IF ( ISNULL ) THEN */
5680 /* WRITE (*,*) '<Null>' */
5681 /* ELSE */
5682 /* WRITE (*,*) ( DVALS(I), I = 1, NELT ) */
5683 /* END IF */
5684
5685 /* C */
5686 /* C Fetch values from column CARRAY in the current */
5687 /* C row. */
5688 /* C */
5689 /* SELIDX = 3 */
5690 /* CALL EKNELT ( SELIDX, ROW, NELT ) */
5691
5692 /* ELTIDX = 1 */
5693 /* ISNULL = .FALSE. */
5694
5695 /* DO WHILE ( ( ELTIDX .LE. NELT ) */
5696 /* . .AND. ( .NOT. ISNULL ) ) */
5697
5698 /* CALL EKGC ( SELIDX, ROW, ELTIDX, */
5699 /* CVALS(ELTIDX), ISNULL, FOUND ) */
5700
5701 /* ELTIDX = ELTIDX + 1 */
5702
5703 /* END DO */
5704
5705 /* WRITE (*,*) ' ' */
5706 /* WRITE (*,*) 'COLUMN = CARRAY' */
5707 /* WRITE (*,*) ' ' */
5708
5709 /* IF ( ISNULL ) THEN */
5710 /* WRITE (*,*) '<Null>' */
5711 /* ELSE */
5712 /* WRITE (*,*) ( CVALS(I), I = 1, NELT ) */
5713 /* END IF */
5714
5715 /* END DO */
5716
5717
5718 /* $ Restrictions */
5719
5720 /* None. */
5721
5722 /* $ Literature_References */
5723
5724 /* None. */
5725
5726 /* $ Author_and_Institution */
5727
5728 /* N.J. Bachman (JPL) */
5729
5730 /* $ Version */
5731
5732 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
5733
5734 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
5735 /* it now has its link count reset to 1 via a call to EKCLS. */
5736
5737 /* - SPICELIB Version 1.2.0, 12-FEB-1999 (NJB) */
5738
5739 /* Bug fix: There was a error handling branch that called CHKOUT */
5740 /* where CHKIN should have been called. This has been fixed. */
5741
5742 /* - SPICELIB Version 1.1.0, 09-JUL-1996 (NJB) */
5743
5744 /* Bug fix: EKNELT now initiates a sort operation if sorted */
5745 /* outputs are required and EKNELT is called after query */
5746 /* resolution but before the fetch routines. Also, addressing */
5747 /* for sorted query results has been fixed. */
5748
5749 /* Misspelling of "issued" was fixed. Previous version line was */
5750 /* changed from "Beta" to "SPICELIB." */
5751
5752
5753 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
5754
5755 /* -& */
5756 /* $ Index_Entries */
5757
5758 /* return the number of elements in a column entry */
5759
5760 /* -& */
5761 /* $ Revisions */
5762
5763 /* - SPICELIB Version 1.2.0, 12-FEB-1999 (NJB) */
5764
5765 /* Bug fix: There was a error handling branch that called CHKOUT */
5766 /* where CHKIN should have been called. This has been fixed. */
5767
5768 /* - SPICELIB Version 1.1.0, 09-JUL-1996 (NJB) */
5769
5770 /* Bug fix: EKNELT now initiates a sort operation if sorted */
5771 /* outputs are required and EKNELT is called after query */
5772 /* resolution but before the fetch routines. Also, addressing */
5773 /* for sorted query results has been fixed. The fix involved */
5774 /* copying the sort invocation and addressing code from the */
5775 /* fetch routines. */
5776
5777 /* Misspelling of "issued" was fixed. Previous version line was */
5778 /* changed from "Beta" to "SPICELIB." */
5779
5780 /* -& */
5781
5782 /* Use discovery check-in for speed. */
5783
5784 if (return_()) {
5785 return 0;
5786 }
5787
5788 /* The request doesn't make sense if no files are loaded. A sure */
5789 /* symptom of this problem is that the file list is empty. */
5790
5791 if (fthead <= 0) {
5792 chkin_("EKNELT", (ftnlen)6);
5793 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
5794 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
5795 chkout_("EKNELT", (ftnlen)6);
5796 return 0;
5797 }
5798
5799 /* The row number must be valid, or we can't proceed. */
5800
5801 if (*row < 1 || *row > unrows) {
5802 chkin_("EKNELT", (ftnlen)6);
5803 setmsg_("Row indices for query result range from 1 to #; requested r"
5804 "ow index was #.", (ftnlen)74);
5805 errint_("#", &unrows, (ftnlen)1);
5806 errint_("#", row, (ftnlen)1);
5807 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
5808 chkout_("EKNELT", (ftnlen)6);
5809 return 0;
5810 }
5811
5812 /* Make sure the SELECT clause column index is valid. */
5813
5814 if (*selidx < 1 || *selidx > nsel) {
5815 chkin_("EKNELT", (ftnlen)6);
5816 setmsg_("The SELECT column index # is out of the valid range 1:#", (
5817 ftnlen)55);
5818 errint_("#", selidx, (ftnlen)1);
5819 errint_("#", &ntab, (ftnlen)1);
5820 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
5821 chkout_("EKNELT", (ftnlen)6);
5822 return 0;
5823 }
5824
5825 /* If it hasn't been done yet, and if it needs to be done, sort the */
5826 /* matching row vectors. */
5827
5828 if (dosort) {
5829 zzekjsrt_(&usize, ubase, &norder, otabs, ocols, oelts, sense, sthan,
5830 stdscs, stdtpt, dtpool, dtdscs, &ordbas);
5831 dosort = FALSE_;
5832 sorted = TRUE_;
5833 }
5834
5835 /* Look up the segment vector and row vector for the current row. */
5836
5837 if (sorted) {
5838 i__1 = ordbas + *row;
5839 i__2 = ordbas + *row;
5840 zzeksrd_(&i__1, &i__2, &i__);
5841 zzekvcal_(&i__, &rwvbas, &sgvbas);
5842 } else {
5843 zzekvcal_(row, &rwvbas, &sgvbas);
5844 }
5845 i__1 = rwvbas + 1;
5846 i__2 = rwvbas + ntab;
5847 zzeksrd_(&i__1, &i__2, rowvec);
5848 i__1 = sgvbas + 1;
5849 i__2 = sgvbas + ntab;
5850 zzeksrd_(&i__1, &i__2, segvec);
5851 tabidx = seltab[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
5852 "seltab", i__1, "ekqmgr_", (ftnlen)4983)];
5853 rowidx = rowvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge(
5854 "rowvec", i__1, "ekqmgr_", (ftnlen)4984)];
5855 seg = segvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("segv"
5856 "ec", i__1, "ekqmgr_", (ftnlen)4985)];
5857 col = selcol[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge("sel"
5858 "col", i__1, "ekqmgr_", (ftnlen)4986)];
5859 colptr = stdtpt[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("std"
5860 "tpt", i__1, "ekqmgr_", (ftnlen)4988)];
5861 i__1 = col;
5862 for (i__ = 2; i__ <= i__1; ++i__) {
5863 colptr = lnknxt_(&colptr, dtpool);
5864 }
5865 *nelt = zzekesiz_(&sthan[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 :
5866 s_rnge("sthan", i__1, "ekqmgr_", (ftnlen)4994)], &stdscs[(i__2 =
5867 seg * 24 - 24) < 4800 && 0 <= i__2 ? i__2 : s_rnge("stdscs", i__2,
5868 "ekqmgr_", (ftnlen)4994)], &dtdscs[(i__3 = colptr * 11 - 11) <
5869 110000 && 0 <= i__3 ? i__3 : s_rnge("dtdscs", i__3, "ekqmgr_", (
5870 ftnlen)4994)], &rowidx);
5871 return 0;
5872 /* $Procedure EKGC ( EK, get event data, character ) */
5873
5874 L_ekgc:
5875 /* $ Abstract */
5876
5877 /* Return an element of an entry in a column of character */
5878 /* type in a specified row. */
5879
5880 /* $ Disclaimer */
5881
5882 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
5883 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
5884 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
5885 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
5886 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
5887 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
5888 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
5889 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
5890 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
5891 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
5892
5893 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
5894 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
5895 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
5896 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
5897 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
5898 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
5899
5900 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
5901 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
5902 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
5903 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
5904
5905 /* $ Required_Reading */
5906
5907 /* EK */
5908
5909 /* $ Keywords */
5910
5911 /* ASSIGNMENT */
5912 /* EK */
5913
5914 /* $ Declarations */
5915
5916 /* INTEGER SELIDX */
5917 /* INTEGER ROW */
5918 /* INTEGER ELMENT */
5919 /* CHARACTER*(*) CDATA */
5920 /* LOGICAL NULL */
5921 /* LOGICAL FOUND */
5922
5923 /* $ Brief_I/O */
5924
5925 /* Variable I/O Description */
5926 /* -------- --- -------------------------------------------------- */
5927 /* SELIDX I Index of parent column in SELECT clause. */
5928 /* ROW I Row to fetch from. */
5929 /* ELMENT I Index of element, within column entry, to fetch. */
5930 /* CDATA O Character string element of column entry. */
5931 /* NULL O Flag indicating whether column entry was null. */
5932 /* FOUND O Flag indicating whether column was present in row. */
5933
5934 /* $ Detailed_Input */
5935
5936 /* SELIDX is the SELECT clause index of the column to */
5937 /* fetch from. */
5938
5939 /* ROW is the output row containing the entry to fetch */
5940 /* from. */
5941
5942 /* ELMENT is the index of the element of the column entry */
5943 /* to fetch. The normal range of ELMENT is from 1 to */
5944 /* the size of the column's entry, but ELMENT is */
5945 /* allowed to exceed the number of elements in the */
5946 /* column entry; if it does, FOUND is returned .FALSE. */
5947 /* This allows the caller to read data from the column */
5948 /* entry in a loop without checking the number of */
5949 /* available elements first. */
5950
5951 /* Null values in variable-sized columns are */
5952 /* considered to have size 1. */
5953
5954 /* $ Detailed_Output */
5955
5956 /* CDATA is the requested element of the specified column */
5957 /* entry. If the entry is null, CDATA is undefined. */
5958
5959 /* If CDATA is too short to accommodate the requested */
5960 /* column entry element, the element is truncated on */
5961 /* the right to fit CDATA. If CDATA is longer than */
5962 /* the element, CDATA is returned blank-padded on */
5963 /* the right. */
5964
5965 /* NULL is a logical flag indicating whether the entry */
5966 /* belonging to the specified column in the specified */
5967 /* row is null. */
5968
5969 /* FOUND is a logical flag indicating whether the specified */
5970 /* element was found. If the element does not exist, */
5971 /* FOUND is returned .FALSE. */
5972
5973 /* $ Parameters */
5974
5975 /* None. */
5976
5977 /* $ Exceptions */
5978
5979 /* 1) If the input argument ELMENT is less than 1, FOUND is returned */
5980 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
5981 /* However, ELMENT is allowed to be greater than the number of */
5982 /* elements in the specified column entry; this allows the caller */
5983 /* to read data from the column entry in a loop without checking */
5984 /* the number of available elements first. If ELMENT is greater */
5985 /* than the number of available elements, FOUND is returned */
5986 /* .FALSE. */
5987
5988 /* 2) If SELIDX is outside of the range established by the */
5989 /* last query passed to EKSRCH, the error SPICE(INVALIDINDEX) */
5990 /* will be signaled. */
5991
5992 /* 3) If the input argument ROW is less than 1 or greater than */
5993 /* the number of rows matching the query, FOUND is returned */
5994 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
5995
5996 /* 4) If the specified column does not have character type, the */
5997 /* error SPICE(INVALIDTYPE) is signaled. */
5998
5999 /* 5) If this routine is called when no E-kernels have been loaded, */
6000 /* the error SPICE(NOLOADEDFILES) is signaled. */
6001
6002 /* $ Files */
6003
6004 /* See the header of EKQMGR for a description of files used */
6005 /* by this routine. */
6006
6007 /* $ Particulars */
6008
6009 /* This routine allows retrieval of data from character columns. */
6010
6011 /* This routine returns one element at a time in order to save the */
6012 /* caller from imposing a limit on the size of the column entries */
6013 /* that can be handled. */
6014
6015 /* $ Examples */
6016
6017 /* 1) Suppose the EK table TAB contains the following columns: */
6018
6019 /* Column name Data Type Size */
6020 /* ----------- --------- ---- */
6021 /* CHR_COL_1 CHR 1 */
6022 /* CHR_COL_2 CHR VARIABLE */
6023 /* CHR_COL_3 CHR 10 */
6024
6025
6026 /* Suppose the query */
6027
6028 /* QUERY = 'SELECT CHR_COL_1 FROM TAB' */
6029
6030 /* is issued to EKFIND via the call */
6031
6032 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
6033
6034 /* To fetch and dump column values from the rows that satisfy the */
6035 /* query, the loop below could be used. Note that we don't check */
6036 /* the FOUND flags returned by EKGC since we know that every */
6037 /* entry in column CHR_COL_1 contains one element. */
6038
6039 /* C */
6040 /* C Since CHR_COL_1was the first column selected, */
6041 /* C the selection index SELIDX is set to 1. */
6042 /* C The column is scalar, so the element index ELTIDX */
6043 /* C is set to 1. The variable NMROWS is the number of */
6044 /* C matching rows returned by EKFIND. */
6045 /* C */
6046
6047 /* SELIDX = 1 */
6048 /* ELTIDX = 1 */
6049
6050 /* DO ROW = 1, NMROWS */
6051
6052 /* WRITE (*,*) ' ' */
6053 /* WRITE (*,*) 'ROW = ', ROW */
6054 /* WRITE (*,*) ' ' */
6055
6056 /* C */
6057 /* C Fetch values from column CHR_COL_1. */
6058 /* C */
6059 /* CALL EKGC ( SELIDX, ROW, ELTIDX, */
6060 /* CVAL, ISNULL, FOUND ) */
6061
6062 /* IF ( ISNULL ) THEN */
6063 /* WRITE (*,*) '<Null>' */
6064 /* ELSE */
6065 /* WRITE (*,*) CVAL */
6066 /* END IF */
6067
6068 /* END DO */
6069
6070
6071
6072 /* 2) Suppose the EK table TAB is as in example 1, and we issue */
6073 /* the query */
6074
6075 /* QUERY = 'SELECT CHR_COL_1, CHR_COL_2, CHR_COL_3 FROM TAB' */
6076
6077 /* to EKFIND via the call */
6078
6079 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
6080
6081 /* To fetch and dump column values from the rows that satisfy the */
6082 /* query, the loop below could be used. Note that we don't check */
6083 /* the FOUND flags returned by EKGC since we know in advance how */
6084 /* many elements are contained in each column entry we fetch. */
6085
6086
6087 /* DO ROW = 1, NMROWS */
6088
6089 /* WRITE (*,*) ' ' */
6090 /* WRITE (*,*) 'ROW = ', ROW */
6091 /* WRITE (*,*) ' ' */
6092
6093 /* C */
6094 /* C Fetch values from column CHR_COL_1. Since */
6095 /* C CHR_COL_1 was the first column selected, the */
6096 /* C selection index SELIDX is set to 1. */
6097 /* C */
6098 /* SELIDX = 1 */
6099 /* ELTIDX = 1 */
6100 /* CALL EKGC ( SELIDX, ROW, ELTIDX, */
6101 /* CVALS(1), ISNULL, FOUND ) */
6102
6103 /* WRITE (*,*) ' ' */
6104 /* WRITE (*,*) 'COLUMN = CHR_COL_1' */
6105 /* WRITE (*,*) ' ' */
6106
6107 /* IF ( ISNULL ) THEN */
6108 /* WRITE (*,*) '<Null>' */
6109 /* ELSE */
6110 /* WRITE (*,*) CVALS(1) */
6111 /* END IF */
6112
6113 /* C */
6114 /* C Fetch values from column CHR_COL_2 in the current */
6115 /* C row. Since CHR_COL_2 contains variable-size array */
6116 /* C elements, we call EKNELT to determine how many */
6117 /* C elements to fetch. */
6118 /* C */
6119 /* SELIDX = 2 */
6120 /* CALL EKNELT ( SELIDX, ROW, NELT ) */
6121
6122 /* ELTIDX = 1 */
6123 /* ISNULL = .FALSE. */
6124
6125 /* DO WHILE ( ( ELTIDX .LE. NELT ) */
6126 /* . .AND. ( .NOT. ISNULL ) ) */
6127
6128 /* CALL EKGC ( SELIDX, ROW, ELTIDX, */
6129 /* CVALS(ELTIDX), ISNULL, FOUND ) */
6130
6131 /* ELTIDX = ELTIDX + 1 */
6132
6133 /* C */
6134 /* C If the column entry is null, we'll be kicked */
6135 /* C out of this loop after the first iteration. */
6136 /* C */
6137 /* END DO */
6138
6139 /* WRITE (*,*) ' ' */
6140 /* WRITE (*,*) 'COLUMN = CHR_COL_2' */
6141 /* WRITE (*,*) ' ' */
6142
6143 /* IF ( ISNULL ) THEN */
6144 /* WRITE (*,*) '<Null>' */
6145 /* ELSE */
6146 /* WRITE (*,*) ( CVALS(I), I = 1, NELT ) */
6147 /* END IF */
6148
6149 /* C */
6150 /* C Fetch values from column CHR_COL_3 in the current */
6151 /* C row. We need not call EKNELT since we know how */
6152 /* C many elements are in each column entry. */
6153 /* C */
6154 /* SELIDX = 3 */
6155 /* ELTIDX = 1 */
6156 /* ISNULL = .FALSE. */
6157
6158 /* DO WHILE ( ( ELTIDX .LE. 10 ) */
6159 /* . .AND. ( .NOT. ISNULL ) ) */
6160
6161 /* CALL EKGC ( SELIDX, ROW, ELTIDX, */
6162 /* CVALS(ELTIDX), ISNULL, FOUND ) */
6163
6164 /* ELTIDX = ELTIDX + 1 */
6165
6166 /* END DO */
6167
6168 /* WRITE (*,*) ' ' */
6169 /* WRITE (*,*) 'COLUMN = CHR_COL_3' */
6170 /* WRITE (*,*) ' ' */
6171
6172 /* IF ( ISNULL ) THEN */
6173 /* WRITE (*,*) '<Null>' */
6174 /* ELSE */
6175 /* WRITE (*,*) ( CVALS(I), I = 1, 10 ) */
6176 /* END IF */
6177
6178 /* END DO */
6179
6180
6181 /* 3) See the $Examples section of the umbrella routine EKQMGR */
6182 /* for an example in which the names and data types of the */
6183 /* columns from which to fetch data are not known in advance. */
6184
6185 /* $ Restrictions */
6186
6187 /* None. */
6188
6189 /* $ Literature_References */
6190
6191 /* None. */
6192
6193 /* $ Author_and_Institution */
6194
6195 /* N.J. Bachman (JPL) */
6196
6197 /* $ Version */
6198
6199 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
6200
6201 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
6202 /* it now has its link count reset to 1 via a call to EKCLS. */
6203
6204 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
6205
6206 /* Redundant CHKIN call removed from SELIDX error check. */
6207 /* Misspelling of "issued" was fixed. Previous version line */
6208 /* was changed from "Beta" to "SPICELIB." */
6209
6210 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
6211
6212 /* -& */
6213 /* $ Index_Entries */
6214
6215 /* fetch element from character column entry */
6216
6217 /* -& */
6218 /* $ Revisions */
6219
6220 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
6221
6222 /* Redundant CHKIN call removed from SELIDX error check. */
6223 /* Misspelling of "issued" was fixed. Previous version line */
6224 /* was changed from "Beta" to "SPICELIB." */
6225
6226 /* -& */
6227
6228 /* Standard SPICE error handling. */
6229
6230 if (return_()) {
6231 return 0;
6232 } else {
6233 chkin_("EKGC", (ftnlen)4);
6234 }
6235
6236 /* Nothing found yet. */
6237
6238 *found = FALSE_;
6239
6240 /* There nothing to fetch if no files are loaded. A sure */
6241 /* symptom of this problem is that the file list is empty. */
6242
6243 if (fthead <= 0) {
6244 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
6245 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
6246 chkout_("EKGC", (ftnlen)4);
6247 return 0;
6248 }
6249
6250 /* The row number must be valid, or we can't proceed. */
6251
6252 if (*row < 1 || *row > unrows) {
6253 setmsg_("Row indices for query result range from 1 to #; requested r"
6254 "ow index was #.", (ftnlen)74);
6255 errint_("#", &unrows, (ftnlen)1);
6256 errint_("#", row, (ftnlen)1);
6257 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6258 chkout_("EKGC", (ftnlen)4);
6259 return 0;
6260 }
6261
6262 /* The element index must be positive. */
6263
6264 if (*elment < 1) {
6265 setmsg_("ELMENT must be positive but was #.", (ftnlen)34);
6266 errint_("#", elment, (ftnlen)1);
6267 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6268 chkout_("EKGC", (ftnlen)4);
6269 return 0;
6270 }
6271
6272 /* Make sure the SELECT clause column index is valid. */
6273
6274 if (*selidx < 1 || *selidx > nsel) {
6275 setmsg_("The SELECT column index # is out of the valid range 1:#", (
6276 ftnlen)55);
6277 errint_("#", selidx, (ftnlen)1);
6278 errint_("#", &ntab, (ftnlen)1);
6279 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6280 chkout_("EKGC", (ftnlen)4);
6281 return 0;
6282 }
6283
6284 /* COL is the column's index within the parent */
6285 /* table's column list. */
6286
6287 tabidx = seltab[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
6288 "seltab", i__1, "ekqmgr_", (ftnlen)5434)];
6289 col = selcol[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge("sel"
6290 "col", i__1, "ekqmgr_", (ftnlen)5435)];
6291 colptr = selctp[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
6292 "selctp", i__1, "ekqmgr_", (ftnlen)5436)];
6293 tab = tptvec[(i__1 = tabidx + 5) < 16 && 0 <= i__1 ? i__1 : s_rnge("tptv"
6294 "ec", i__1, "ekqmgr_", (ftnlen)5437)];
6295
6296 /* Make sure the column has character type. */
6297
6298 if (cttyps[(i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 : s_rnge("cttyps"
6299 , i__1, "ekqmgr_", (ftnlen)5442)] != 1) {
6300 setmsg_("Column # has data type #.", (ftnlen)25);
6301 errch_("#", ctnams + (((i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 :
6302 s_rnge("ctnams", i__1, "ekqmgr_", (ftnlen)5445)) << 5), (
6303 ftnlen)1, (ftnlen)32);
6304 errch_("#", chtype + (((i__2 = cttyps[(i__1 = colptr - 1) < 500 && 0
6305 <= i__1 ? i__1 : s_rnge("cttyps", i__1, "ekqmgr_", (ftnlen)
6306 5446)] - 1) < 4 && 0 <= i__2 ? i__2 : s_rnge("chtype", i__2,
6307 "ekqmgr_", (ftnlen)5446)) << 2), (ftnlen)1, (ftnlen)4);
6308 sigerr_("SPICE(INVALIDTYPE)", (ftnlen)18);
6309 chkout_("EKGC", (ftnlen)4);
6310 return 0;
6311 }
6312
6313 /* If it hasn't been done yet, and if it needs to be done, sort the */
6314 /* matching row vectors. */
6315
6316 if (dosort) {
6317 zzekjsrt_(&usize, ubase, &norder, otabs, ocols, oelts, sense, sthan,
6318 stdscs, stdtpt, dtpool, dtdscs, &ordbas);
6319 dosort = FALSE_;
6320 sorted = TRUE_;
6321 }
6322
6323 /* Look up the segment vector and row vector for the current row. */
6324
6325 if (sorted) {
6326 i__1 = ordbas + *row;
6327 i__2 = ordbas + *row;
6328 zzeksrd_(&i__1, &i__2, &i__);
6329 zzekvcal_(&i__, &rwvbas, &sgvbas);
6330 } else {
6331 zzekvcal_(row, &rwvbas, &sgvbas);
6332 }
6333 i__1 = rwvbas + 1;
6334 i__2 = rwvbas + ntab;
6335 zzeksrd_(&i__1, &i__2, rowvec);
6336 i__1 = sgvbas + 1;
6337 i__2 = sgvbas + ntab;
6338 zzeksrd_(&i__1, &i__2, segvec);
6339
6340 /* Identify the segment containing the column entry of interest. */
6341 /* Obtain the column descriptor for the column. */
6342
6343 rowidx = rowvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge(
6344 "rowvec", i__1, "ekqmgr_", (ftnlen)5484)];
6345 seg = segvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("segv"
6346 "ec", i__1, "ekqmgr_", (ftnlen)5485)];
6347 j = stdtpt[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("stdtpt",
6348 i__1, "ekqmgr_", (ftnlen)5487)];
6349 i__1 = col;
6350 for (i__ = 2; i__ <= i__1; ++i__) {
6351 j = lnknxt_(&j, dtpool);
6352 }
6353
6354 /* Look up the element. */
6355
6356 zzekrsc_(&sthan[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("sth"
6357 "an", i__1, "ekqmgr_", (ftnlen)5496)], &stdscs[(i__2 = seg * 24 -
6358 24) < 4800 && 0 <= i__2 ? i__2 : s_rnge("stdscs", i__2, "ekqmgr_",
6359 (ftnlen)5496)], &dtdscs[(i__3 = j * 11 - 11) < 110000 && 0 <=
6360 i__3 ? i__3 : s_rnge("dtdscs", i__3, "ekqmgr_", (ftnlen)5496)], &
6361 rowidx, elment, &cvlen, cdata, null, found, cdata_len);
6362 chkout_("EKGC", (ftnlen)4);
6363 return 0;
6364 /* $Procedure EKGD ( EK, get event data, double precision ) */
6365
6366 L_ekgd:
6367 /* $ Abstract */
6368
6369 /* Return an element of an entry in a column of double precision */
6370 /* or `time' type in a specified row. */
6371
6372 /* $ Disclaimer */
6373
6374 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
6375 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
6376 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
6377 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
6378 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
6379 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
6380 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
6381 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
6382 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
6383 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
6384
6385 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
6386 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
6387 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
6388 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
6389 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
6390 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
6391
6392 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
6393 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
6394 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
6395 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
6396
6397 /* $ Required_Reading */
6398
6399 /* EK */
6400
6401 /* $ Keywords */
6402
6403 /* ASSIGNMENT */
6404 /* EK */
6405
6406 /* $ Declarations */
6407
6408 /* INTEGER SELIDX */
6409 /* INTEGER ROW */
6410 /* INTEGER ELMENT */
6411 /* DOUBLE PRECISION DDATA */
6412 /* LOGICAL NULL */
6413 /* LOGICAL FOUND */
6414
6415 /* $ Brief_I/O */
6416
6417 /* Variable I/O Description */
6418 /* -------- --- -------------------------------------------------- */
6419 /* SELIDX I Index of parent column in SELECT clause. */
6420 /* ROW I Row to fetch from. */
6421 /* ELMENT I Index of element, within column entry, to fetch. */
6422 /* DDATA O D.p. element of column entry. */
6423 /* NULL O Flag indicating whether column entry was null. */
6424 /* FOUND O Flag indicating whether column was present in row. */
6425
6426 /* $ Detailed_Input */
6427
6428 /* SELIDX is the SELECT clause index of the column to */
6429 /* fetch from. */
6430
6431 /* ROW is the output row containing the entry to fetch */
6432 /* from. */
6433
6434 /* ELMENT is the index of the element of the column entry */
6435 /* to fetch. The normal range of ELMENT is from 1 to */
6436 /* the size of the column's entry, but ELMENT is */
6437 /* allowed to exceed the number of elements in the */
6438 /* column entry; if it does, FOUND is returned .FALSE. */
6439 /* This allows the caller to read data from the column */
6440 /* entry in a loop without checking the number of */
6441 /* available elements first. */
6442
6443 /* Null values in variable-sized columns are */
6444 /* considered to have size 1. */
6445
6446 /* $ Detailed_Output */
6447
6448 /* DDATA is the requested element of the specified column */
6449 /* entry. If the entry is null, DDATA is undefined. */
6450
6451 /* NULL is a logical flag indicating whether the entry */
6452 /* belonging to the specified column in the specified */
6453 /* row is null. */
6454
6455 /* FOUND is a logical flag indicating whether the specified */
6456 /* element was found. If the element does not exist, */
6457 /* FOUND is returned .FALSE. */
6458
6459 /* $ Parameters */
6460
6461 /* None. */
6462
6463 /* $ Exceptions */
6464
6465 /* 1) If the input argument ELMENT is less than 1, FOUND is returned */
6466 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
6467 /* However, ELMENT is allowed to be greater than the number of */
6468 /* elements in the specified column entry; this allows the caller */
6469 /* to read data from the column entry in a loop without checking */
6470 /* the number of available elements first. If ELMENT is greater */
6471 /* than the number of available elements, FOUND is returned */
6472 /* .FALSE. */
6473
6474 /* 2) If SELIDX is outside of the range established by the */
6475 /* last query passed to EKSRCH, the error SPICE(INVALIDINDEX) */
6476 /* will be signaled. */
6477
6478 /* 3) If the input argument ROW is less than 1 or greater than */
6479 /* the number of rows matching the query, FOUND is returned */
6480 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
6481
6482 /* 4) If the specified column does not have DP or TIME type, the */
6483 /* error SPICE(INVALIDTYPE) is signaled. */
6484
6485 /* 5) If this routine is called when no E-kernels have been loaded, */
6486 /* the error SPICE(NOLOADEDFILES) is signaled. */
6487
6488 /* $ Files */
6489
6490 /* See the header of EKQMGR for a description of files used */
6491 /* by this routine. */
6492
6493 /* $ Particulars */
6494
6495 /* This routine allows retrieval of data from double precision or */
6496 /* `time' columns. */
6497
6498 /* This routine returns one element at a time in order to save the */
6499 /* caller from imposing a limit on the size of the column entries */
6500 /* that can be handled. */
6501
6502 /* $ Examples */
6503
6504 /* 1) Suppose the EK table TAB contains the following columns: */
6505
6506 /* Column name Data Type Size */
6507 /* ----------- --------- ---- */
6508 /* DP_COL_1 DP 1 */
6509 /* DP_COL_2 DP VARIABLE */
6510 /* DP_COL_3 DP 10 */
6511 /* TIME TIME 1 */
6512
6513
6514 /* Suppose the query */
6515
6516 /* QUERY = 'SELECT DP_COL_1 FROM TAB' */
6517
6518 /* is issued to EKFIND via the call */
6519
6520 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
6521
6522 /* To fetch and dump column values from the rows that satisfy the */
6523 /* query, the loop below could be used. Note that we don't check */
6524 /* the FOUND flags returned by EKGD since we know that every */
6525 /* entry in column DP_COL_1 contains one element. */
6526
6527 /* C */
6528 /* C Since DP_COL_1was the first column selected, */
6529 /* C the selection index SELIDX is set to 1. */
6530 /* C The column is scalar, so the element index ELTIDX */
6531 /* C is set to 1. The variable NMROWS is the number of */
6532 /* C matching rows returned by EKFIND. */
6533 /* C */
6534
6535 /* SELIDX = 1 */
6536 /* ELTIDX = 1 */
6537
6538 /* DO ROW = 1, NMROWS */
6539
6540 /* WRITE (*,*) ' ' */
6541 /* WRITE (*,*) 'ROW = ', ROW */
6542 /* WRITE (*,*) ' ' */
6543
6544 /* C */
6545 /* C Fetch values from column DP_COL_1. */
6546 /* C */
6547 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
6548 /* DVAL, ISNULL, FOUND ) */
6549
6550 /* IF ( ISNULL ) THEN */
6551 /* WRITE (*,*) '<Null>' */
6552 /* ELSE */
6553 /* WRITE (*,*) DVAL */
6554 /* END IF */
6555
6556 /* END DO */
6557
6558
6559 /* 2) Suppose the EK table TAB is as in example 1, and we issue */
6560 /* the query */
6561
6562 /* QUERY = 'SELECT TIME FROM TAB' */
6563
6564 /* to EKFIND via the call */
6565
6566 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
6567
6568 /* We wish to dump the time values as UTC calendar dates. */
6569 /* The code fragment below carries out this task. We assume */
6570 /* a leapseconds kernel is loaded. The variable UTC shown */
6571 /* below should be declared as a character string. */
6572
6573 /* SELIDX = 1 */
6574 /* ELTIDX = 1 */
6575
6576 /* DO ROW = 1, NMROWS */
6577
6578 /* WRITE (*,*) ' ' */
6579 /* WRITE (*,*) 'ROW = ', ROW */
6580 /* WRITE (*,*) ' ' */
6581
6582 /* C */
6583 /* C Fetch values from column TIME. */
6584 /* C */
6585 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
6586 /* DVAL, ISNULL, FOUND ) */
6587
6588 /* IF ( ISNULL ) THEN */
6589 /* WRITE (*,*) '<Null>' */
6590 /* ELSE */
6591 /* CALL ET2UTC ( DVAL, 'C', 3, UTC ) */
6592 /* WRITE (*,*) UTC */
6593 /* END IF */
6594
6595 /* END DO */
6596
6597
6598 /* 3) Suppose the EK table TAB is as in example 1, and we issue */
6599 /* the query */
6600
6601 /* QUERY = 'SELECT DP_COL_1, DP_COL_2, DP_COL_3 FROM TAB' */
6602
6603 /* to EKFIND via the call */
6604
6605 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
6606
6607 /* To fetch and dump column values from the rows that satisfy the */
6608 /* query, the loop below could be used. Note that we don't check */
6609 /* the FOUND flags returned by EKGD since we know in advance how */
6610 /* many elements are contained in each column entry we fetch. */
6611
6612 /* DO ROW = 1, NMROWS */
6613
6614 /* WRITE (*,*) ' ' */
6615 /* WRITE (*,*) 'ROW = ', ROW */
6616 /* WRITE (*,*) ' ' */
6617
6618 /* C */
6619 /* C Fetch values from column DP_COL_1. Since */
6620 /* C DP_COL_1was the first column selected, the */
6621 /* C selection index SELIDX is set to 1. */
6622 /* C */
6623 /* SELIDX = 1 */
6624 /* ELTIDX = 1 */
6625 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
6626 /* DVALS(1), ISNULL, FOUND ) */
6627
6628 /* WRITE (*,*) ' ' */
6629 /* WRITE (*,*) 'COLUMN = DP_COL_1' */
6630 /* WRITE (*,*) ' ' */
6631
6632 /* IF ( ISNULL ) THEN */
6633 /* WRITE (*,*) '<Null>' */
6634 /* ELSE */
6635 /* WRITE (*,*) DVALS(1) */
6636 /* END IF */
6637
6638 /* C */
6639 /* C Fetch values from column DP_COL_2 in the current */
6640 /* C row. Since DP_COL_2 contains variable-size array */
6641 /* C elements, we call EKNELT to determine how many */
6642 /* C elements to fetch. */
6643 /* C */
6644 /* SELIDX = 2 */
6645 /* CALL EKNELT ( SELIDX, ROW, NELT ) */
6646
6647 /* ELTIDX = 1 */
6648 /* ISNULL = .FALSE. */
6649
6650 /* DO WHILE ( ( ELTIDX .LE. NELT ) */
6651 /* . .AND. ( .NOT. ISNULL ) ) */
6652
6653 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
6654 /* DVALS(ELTIDX), ISNULL, FOUND ) */
6655
6656 /* ELTIDX = ELTIDX + 1 */
6657
6658 /* C */
6659 /* C If the column entry is null, we'll be kicked */
6660 /* C out of this loop after the first iteration. */
6661 /* C */
6662 /* END DO */
6663
6664 /* WRITE (*,*) ' ' */
6665 /* WRITE (*,*) 'COLUMN = DP_COL_2' */
6666 /* WRITE (*,*) ' ' */
6667
6668 /* IF ( ISNULL ) THEN */
6669 /* WRITE (*,*) '<Null>' */
6670 /* ELSE */
6671 /* WRITE (*,*) ( DVALS(I), I = 1, NELT ) */
6672 /* END IF */
6673
6674 /* C */
6675 /* C Fetch values from column DP_COL_3 in the current */
6676 /* C row. We need not call EKNELT since we know how */
6677 /* C many elements are in each column entry. */
6678 /* C */
6679 /* SELIDX = 3 */
6680 /* ELTIDX = 1 */
6681 /* ISNULL = .FALSE. */
6682
6683 /* DO WHILE ( ( ELTIDX .LE. 10 ) */
6684 /* . .AND. ( .NOT. ISNULL ) ) */
6685
6686 /* CALL EKGD ( SELIDX, ROW, ELTIDX, */
6687 /* DVALS(ELTIDX), ISNULL, FOUND ) */
6688
6689 /* ELTIDX = ELTIDX + 1 */
6690
6691 /* END DO */
6692
6693 /* WRITE (*,*) ' ' */
6694 /* WRITE (*,*) 'COLUMN = DP_COL_3' */
6695 /* WRITE (*,*) ' ' */
6696
6697 /* IF ( ISNULL ) THEN */
6698 /* WRITE (*,*) '<Null>' */
6699 /* ELSE */
6700 /* WRITE (*,*) ( DVALS(I), I = 1, 10 ) */
6701 /* END IF */
6702
6703 /* END DO */
6704
6705
6706 /* 4) See the $Examples section of the umbrella routine EKQMGR */
6707 /* for an example in which the names and data types of the */
6708 /* columns from which to fetch data are not known in advance. */
6709
6710 /* $ Restrictions */
6711
6712 /* None. */
6713
6714 /* $ Literature_References */
6715
6716 /* None. */
6717
6718 /* $ Author_and_Institution */
6719
6720 /* N.J. Bachman (JPL) */
6721
6722 /* $ Version */
6723
6724 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
6725
6726 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
6727 /* it now has its link count reset to 1 via a call to EKCLS. */
6728
6729 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
6730
6731 /* Redundant CHKIN call removed from SELIDX error check. */
6732 /* Misspelling of "issued" was fixed. Previous version line */
6733 /* was changed from "Beta" to "SPICELIB." */
6734
6735 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
6736
6737 /* -& */
6738 /* $ Index_Entries */
6739
6740 /* fetch element from double precision column entry */
6741
6742 /* -& */
6743 /* $ Revisions */
6744
6745 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
6746
6747 /* Redundant CHKIN call removed from SELIDX error check. */
6748 /* Misspelling of "issued" was fixed. Previous version line */
6749 /* was changed from "Beta" to "SPICELIB." */
6750
6751 /* -& */
6752
6753 /* Standard SPICE error handling. */
6754
6755 if (return_()) {
6756 return 0;
6757 } else {
6758 chkin_("EKGD", (ftnlen)4);
6759 }
6760
6761 /* Nothing found yet. */
6762
6763 *found = FALSE_;
6764
6765 /* There nothing to fetch if no files are loaded. A sure */
6766 /* symptom of this problem is that the file list is empty. */
6767
6768 if (fthead <= 0) {
6769 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
6770 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
6771 chkout_("EKGD", (ftnlen)4);
6772 return 0;
6773 }
6774
6775 /* The row number must be valid, or we can't proceed. */
6776
6777 if (*row < 1 || *row > unrows) {
6778 setmsg_("Row indices for query result range from 1 to #; requested r"
6779 "ow index was #.", (ftnlen)74);
6780 errint_("#", &unrows, (ftnlen)1);
6781 errint_("#", row, (ftnlen)1);
6782 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6783 chkout_("EKGD", (ftnlen)4);
6784 return 0;
6785 }
6786
6787 /* The element index must be positive. */
6788
6789 if (*elment < 1) {
6790 setmsg_("ELMENT must be positive but was #.", (ftnlen)34);
6791 errint_("#", elment, (ftnlen)1);
6792 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6793 chkout_("EKGD", (ftnlen)4);
6794 return 0;
6795 }
6796
6797 /* Make sure the SELECT clause column index is valid. */
6798
6799 if (*selidx < 1 || *selidx > nsel) {
6800 setmsg_("The SELECT column index # is out of the valid range 1:#", (
6801 ftnlen)55);
6802 errint_("#", selidx, (ftnlen)1);
6803 errint_("#", &ntab, (ftnlen)1);
6804 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
6805 chkout_("EKGD", (ftnlen)4);
6806 return 0;
6807 }
6808
6809 /* COL is the column's index within the parent */
6810 /* table's column list. */
6811
6812 tabidx = seltab[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
6813 "seltab", i__1, "ekqmgr_", (ftnlen)5978)];
6814 col = selcol[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge("sel"
6815 "col", i__1, "ekqmgr_", (ftnlen)5979)];
6816 colptr = selctp[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
6817 "selctp", i__1, "ekqmgr_", (ftnlen)5980)];
6818 tab = tptvec[(i__1 = tabidx + 5) < 16 && 0 <= i__1 ? i__1 : s_rnge("tptv"
6819 "ec", i__1, "ekqmgr_", (ftnlen)5981)];
6820
6821 /* Make sure the column has double precision or `time' type. */
6822
6823 if (cttyps[(i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 : s_rnge("cttyps"
6824 , i__1, "ekqmgr_", (ftnlen)5986)] != 2 && cttyps[(i__2 = colptr -
6825 1) < 500 && 0 <= i__2 ? i__2 : s_rnge("cttyps", i__2, "ekqmgr_", (
6826 ftnlen)5986)] != 4) {
6827 setmsg_("Column # has data type #.", (ftnlen)25);
6828 errch_("#", ctnams + (((i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 :
6829 s_rnge("ctnams", i__1, "ekqmgr_", (ftnlen)5990)) << 5), (
6830 ftnlen)1, (ftnlen)32);
6831 errch_("#", chtype + (((i__2 = cttyps[(i__1 = colptr - 1) < 500 && 0
6832 <= i__1 ? i__1 : s_rnge("cttyps", i__1, "ekqmgr_", (ftnlen)
6833 5991)] - 1) < 4 && 0 <= i__2 ? i__2 : s_rnge("chtype", i__2,
6834 "ekqmgr_", (ftnlen)5991)) << 2), (ftnlen)1, (ftnlen)4);
6835 sigerr_("SPICE(INVALIDTYPE)", (ftnlen)18);
6836 chkout_("EKGD", (ftnlen)4);
6837 return 0;
6838 }
6839
6840 /* If it hasn't been done yet, and if it needs to be done, sort the */
6841 /* matching row vectors. */
6842
6843 if (dosort) {
6844 zzekjsrt_(&usize, ubase, &norder, otabs, ocols, oelts, sense, sthan,
6845 stdscs, stdtpt, dtpool, dtdscs, &ordbas);
6846 dosort = FALSE_;
6847 sorted = TRUE_;
6848 }
6849
6850 /* Look up the segment vector and row vector for the current row. */
6851
6852 if (sorted) {
6853 i__1 = ordbas + *row;
6854 i__2 = ordbas + *row;
6855 zzeksrd_(&i__1, &i__2, &i__);
6856 zzekvcal_(&i__, &rwvbas, &sgvbas);
6857 } else {
6858 zzekvcal_(row, &rwvbas, &sgvbas);
6859 }
6860 i__1 = rwvbas + 1;
6861 i__2 = rwvbas + ntab;
6862 zzeksrd_(&i__1, &i__2, rowvec);
6863 i__1 = sgvbas + 1;
6864 i__2 = sgvbas + ntab;
6865 zzeksrd_(&i__1, &i__2, segvec);
6866
6867 /* Identify the segment containing the column entry of interest. */
6868 /* Obtain the column descriptor for the column. */
6869
6870 rowidx = rowvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge(
6871 "rowvec", i__1, "ekqmgr_", (ftnlen)6029)];
6872 seg = segvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("segv"
6873 "ec", i__1, "ekqmgr_", (ftnlen)6030)];
6874 j = stdtpt[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("stdtpt",
6875 i__1, "ekqmgr_", (ftnlen)6032)];
6876 i__1 = col;
6877 for (i__ = 2; i__ <= i__1; ++i__) {
6878 j = lnknxt_(&j, dtpool);
6879 }
6880
6881 /* Look up the element. */
6882
6883 zzekrsd_(&sthan[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("sth"
6884 "an", i__1, "ekqmgr_", (ftnlen)6041)], &stdscs[(i__2 = seg * 24 -
6885 24) < 4800 && 0 <= i__2 ? i__2 : s_rnge("stdscs", i__2, "ekqmgr_",
6886 (ftnlen)6041)], &dtdscs[(i__3 = j * 11 - 11) < 110000 && 0 <=
6887 i__3 ? i__3 : s_rnge("dtdscs", i__3, "ekqmgr_", (ftnlen)6041)], &
6888 rowidx, elment, ddata, null, found);
6889 chkout_("EKGD", (ftnlen)4);
6890 return 0;
6891 /* $Procedure EKGI ( EK, get event data, integer ) */
6892
6893 L_ekgi:
6894 /* $ Abstract */
6895
6896 /* Return an element of an entry in a column of integer */
6897 /* type in a specified row. */
6898
6899 /* $ Disclaimer */
6900
6901 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
6902 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
6903 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
6904 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
6905 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
6906 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
6907 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
6908 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
6909 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
6910 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
6911
6912 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
6913 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
6914 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
6915 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
6916 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
6917 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
6918
6919 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
6920 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
6921 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
6922 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
6923
6924 /* $ Required_Reading */
6925
6926 /* EK */
6927
6928 /* $ Keywords */
6929
6930 /* ASSIGNMENT */
6931 /* EK */
6932
6933 /* $ Declarations */
6934
6935 /* INTEGER SELIDX */
6936 /* INTEGER ROW */
6937 /* INTEGER ELMENT */
6938 /* INTEGER IDATA */
6939 /* LOGICAL NULL */
6940 /* LOGICAL FOUND */
6941
6942 /* $ Brief_I/O */
6943
6944 /* Variable I/O Description */
6945 /* -------- --- -------------------------------------------------- */
6946 /* SELIDX I Index of parent column in SELECT clause. */
6947 /* ROW I Row to fetch from. */
6948 /* ELMENT I Index of element, within column entry, to fetch. */
6949 /* IDATA O Integer element of column entry. */
6950 /* NULL O Flag indicating whether column entry was null. */
6951 /* FOUND O Flag indicating whether column was present in row. */
6952
6953 /* $ Detailed_Input */
6954
6955 /* SELIDX is the SELECT clause index of the column to */
6956 /* fetch from. */
6957
6958 /* ROW is the output row containing the entry to fetch */
6959 /* from. */
6960
6961 /* ELMENT is the index of the element of the column entry */
6962 /* to fetch. The normal range of ELMENT is from 1 to */
6963 /* the size of the column's entry, but ELMENT is */
6964 /* allowed to exceed the number of elements in the */
6965 /* column entry; if it does, FOUND is returned .FALSE. */
6966 /* This allows the caller to read data from the column */
6967 /* entry in a loop without checking the number of */
6968 /* available elements first. */
6969
6970 /* Null values in variable-sized columns are */
6971 /* considered to have size 1. */
6972
6973 /* $ Detailed_Output */
6974
6975 /* IDATA is the requested element of the specified column */
6976 /* entry. If the entry is null, IDATA is undefined. */
6977
6978 /* NULL is a logical flag indicating whether the entry */
6979 /* belonging to the specified column in the specified */
6980 /* row is null. */
6981
6982 /* FOUND is a logical flag indicating whether the specified */
6983 /* element was found. If the element does not exist, */
6984 /* FOUND is returned .FALSE. */
6985
6986 /* $ Parameters */
6987
6988 /* None. */
6989
6990 /* $ Exceptions */
6991
6992 /* 1) If the input argument ELMENT is less than 1, FOUND is returned */
6993 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
6994 /* However, ELMENT is allowed to be greater than the number of */
6995 /* elements in the specified column entry; this allows the caller */
6996 /* to read data from the column entry in a loop without checking */
6997 /* the number of available elements first. If ELMENT is greater */
6998 /* than the number of available elements, FOUND is returned */
6999 /* .FALSE. */
7000
7001 /* 2) If SELIDX is outside of the range established by the */
7002 /* last query passed to EKSRCH, the error SPICE(INVALIDINDEX) */
7003 /* will be signaled. */
7004
7005 /* 3) If the input argument ROW is less than 1 or greater than */
7006 /* the number of rows matching the query, FOUND is returned */
7007 /* .FALSE., and the error SPICE(INVALIDINDEX) is signaled. */
7008
7009 /* 4) If the specified column does not have integer type, the */
7010 /* error SPICE(INVALIDTYPE) is signaled. */
7011
7012 /* 5) If this routine is called when no E-kernels have been loaded, */
7013 /* the error SPICE(NOLOADEDFILES) is signaled. */
7014
7015 /* $ Files */
7016
7017 /* See the header of EKQMGR for a description of files used */
7018 /* by this routine. */
7019
7020 /* $ Particulars */
7021
7022 /* This routine allows retrieval of data from integer columns. */
7023
7024 /* This routine returns one element at a time in order to save the */
7025 /* caller from imposing a limit on the size of the column entries */
7026 /* that can be handled. */
7027
7028 /* $ Examples */
7029
7030 /* 1) Suppose the EK table TAB contains the following columns: */
7031
7032 /* Column name Data Type Size */
7033 /* ----------- --------- ---- */
7034 /* INT_COL_1 INT 1 */
7035 /* INT_COL_2 INT VARIABLE */
7036 /* INT_COL_3 INT 10 */
7037
7038
7039 /* Suppose the query */
7040
7041 /* QUERY = 'SELECT INT_COL_1 FROM TAB' */
7042
7043 /* is issued to EKFIND via the call */
7044
7045 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
7046
7047 /* To fetch and dump column values from the rows that satisfy the */
7048 /* query, the loop below could be used. Note that we don't check */
7049 /* the FOUND flags returned by EKGI since we know that every */
7050 /* entry in column INT_COL_1 contains one element. */
7051
7052 /* C */
7053 /* C Since INT_COL_1was the first column selected, */
7054 /* C the selection index SELIDX is set to 1. */
7055 /* C The column is scalar, so the element index ELTIDX */
7056 /* C is set to 1. The variable NMROWS is the number of */
7057 /* C matching rows returned by EKFIND. */
7058 /* C */
7059
7060 /* SELIDX = 1 */
7061 /* ELTIDX = 1 */
7062
7063 /* DO ROW = 1, NMROWS */
7064
7065 /* WRITE (*,*) ' ' */
7066 /* WRITE (*,*) 'ROW = ', ROW */
7067 /* WRITE (*,*) ' ' */
7068
7069 /* C */
7070 /* C Fetch values from column INT_COL_1. */
7071 /* C */
7072 /* CALL EKGI ( SELIDX, ROW, ELTIDX, */
7073 /* IVAL, ISNULL, FOUND ) */
7074
7075 /* IF ( ISNULL ) THEN */
7076 /* WRITE (*,*) '<Null>' */
7077 /* ELSE */
7078 /* WRITE (*,*) IVAL */
7079 /* END IF */
7080
7081 /* END DO */
7082
7083
7084
7085 /* 2) Suppose the EK table TAB is as in example 1, and we issue */
7086 /* the query */
7087
7088 /* QUERY = 'SELECT INT_COL_1, INT_COL_2, INT_COL_3 FROM TAB' */
7089
7090 /* to EKFIND via the call */
7091
7092 /* CALL EKFIND ( QUERY, NMROWS, ERROR, ERRMSG ) */
7093
7094 /* To fetch and dump column values from the rows that satisfy the */
7095 /* query, the loop below could be used. Note that we don't check */
7096 /* the FOUND flags returned by EKGI since we know in advance how */
7097 /* many elements are contained in each column entry we fetch. */
7098
7099
7100 /* DO ROW = 1, NMROWS */
7101
7102 /* WRITE (*,*) ' ' */
7103 /* WRITE (*,*) 'ROW = ', ROW */
7104 /* WRITE (*,*) ' ' */
7105
7106 /* C */
7107 /* C Fetch values from column INT_COL_1. Since */
7108 /* C INT_COL_1 was the first column selected, the */
7109 /* C selection index SELIDX is set to 1. */
7110 /* C */
7111 /* SELIDX = 1 */
7112 /* ELTIDX = 1 */
7113 /* CALL EKGI ( SELIDX, ROW, ELTIDX, */
7114 /* IVALS(1), ISNULL, FOUND ) */
7115
7116 /* WRITE (*,*) ' ' */
7117 /* WRITE (*,*) 'COLUMN = INT_COL_1' */
7118 /* WRITE (*,*) ' ' */
7119
7120 /* IF ( ISNULL ) THEN */
7121 /* WRITE (*,*) '<Null>' */
7122 /* ELSE */
7123 /* WRITE (*,*) IVALS(1) */
7124 /* END IF */
7125
7126 /* C */
7127 /* C Fetch values from column INT_COL_2 in the current */
7128 /* C row. Since INT_COL_2 contains variable-size array */
7129 /* C elements, we call EKNELT to determine how many */
7130 /* C elements to fetch. */
7131 /* C */
7132 /* SELIDX = 2 */
7133 /* CALL EKNELT ( SELIDX, ROW, NELT ) */
7134
7135 /* ELTIDX = 1 */
7136 /* ISNULL = .FALSE. */
7137
7138 /* DO WHILE ( ( ELTIDX .LE. NELT ) */
7139 /* . .AND. ( .NOT. ISNULL ) ) */
7140
7141 /* CALL EKGI ( SELIDX, ROW, ELTIDX, */
7142 /* IVALS(ELTIDX), ISNULL, FOUND ) */
7143
7144 /* ELTIDX = ELTIDX + 1 */
7145
7146 /* C */
7147 /* C If the column entry is null, we'll be kicked */
7148 /* C out of this loop after the first iteration. */
7149 /* C */
7150 /* END DO */
7151
7152 /* WRITE (*,*) ' ' */
7153 /* WRITE (*,*) 'COLUMN = INT_COL_2' */
7154 /* WRITE (*,*) ' ' */
7155
7156 /* IF ( ISNULL ) THEN */
7157 /* WRITE (*,*) '<Null>' */
7158 /* ELSE */
7159 /* WRITE (*,*) ( IVALS(I), I = 1, NELT ) */
7160 /* END IF */
7161
7162 /* C */
7163 /* C Fetch values from column INT_COL_3 in the current */
7164 /* C row. We need not call EKNELT since we know how */
7165 /* C many elements are in each column entry. */
7166 /* C */
7167 /* SELIDX = 3 */
7168 /* ELTIDX = 1 */
7169 /* ISNULL = .FALSE. */
7170
7171 /* DO WHILE ( ( ELTIDX .LE. 10 ) */
7172 /* . .AND. ( .NOT. ISNULL ) ) */
7173
7174 /* CALL EKGI ( SELIDX, ROW, ELTIDX, */
7175 /* IVALS(ELTIDX), ISNULL, FOUND ) */
7176
7177 /* ELTIDX = ELTIDX + 1 */
7178
7179 /* END DO */
7180
7181 /* WRITE (*,*) ' ' */
7182 /* WRITE (*,*) 'COLUMN = INT_COL_3' */
7183 /* WRITE (*,*) ' ' */
7184
7185 /* IF ( ISNULL ) THEN */
7186 /* WRITE (*,*) '<Null>' */
7187 /* ELSE */
7188 /* WRITE (*,*) ( IVALS(I), I = 1, 10 ) */
7189 /* END IF */
7190
7191 /* END DO */
7192
7193
7194 /* 3) See the $Examples section of the umbrella routine EKQMGR */
7195 /* for an example in which the names and data types of the */
7196 /* columns from which to fetch data are not known in advance. */
7197
7198 /* $ Restrictions */
7199
7200 /* None. */
7201
7202 /* $ Literature_References */
7203
7204 /* None. */
7205
7206 /* $ Author_and_Institution */
7207
7208 /* N.J. Bachman (JPL) */
7209
7210 /* $ Version */
7211
7212 /* - SPICELIB Version 2.0.1, 22-SEP-2004 (EDW) */
7213
7214 /* Edited 1.1.0 Version entry to not include */
7215 /* the token used to mark the $Procedure section. */
7216
7217 /* - SPICELIB Version 2.0.0, 16-NOV-2001 (NJB) */
7218
7219 /* Bug fix: When an already loaded kernel is opened with EKOPR, */
7220 /* it now has its link count reset to 1 via a call to EKCLS. */
7221
7222 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
7223
7224 /* Redundant CHKIN call removed from SELIDX error check. */
7225 /* Misspelling of "issued" was fixed. Previous version line */
7226 /* was changed from "Beta" to "SPICELIB." Header $Procedure */
7227 /* line was corrected to indicate integer data type. */
7228
7229 /* - SPICELIB Version 1.0.0, 23-OCT-1995 (NJB) */
7230
7231 /* -& */
7232 /* $ Index_Entries */
7233
7234 /* fetch element from integer column entry */
7235
7236 /* -& */
7237 /* $ Revisions */
7238
7239 /* - SPICELIB Version 1.1.1, 22-SEP-2004 (EDW) */
7240
7241 /* Edited 1.1.0 Version entry to not include */
7242 /* the token used to mark the $Procedure section. */
7243
7244 /* - SPICELIB Version 1.1.0, 07-JUL-1996 (NJB) */
7245
7246 /* Redundant CHKIN call removed from SELIDX error check. */
7247 /* Misspelling of "issued" was fixed. Previous version line */
7248 /* was changed from "Beta" to "SPICELIB." Header $Procedure */
7249 /* line was corrected to indicate integer data type. */
7250
7251 /* -& */
7252
7253 /* Standard SPICE error handling. */
7254
7255 if (return_()) {
7256 return 0;
7257 } else {
7258 chkin_("EKGI", (ftnlen)4);
7259 }
7260
7261 /* Nothing found yet. */
7262
7263 *found = FALSE_;
7264
7265 /* There nothing to fetch if no files are loaded. A sure */
7266 /* symptom of this problem is that the file list is empty. */
7267
7268 if (fthead <= 0) {
7269 setmsg_("No E-kernels are currently loaded.", (ftnlen)34);
7270 sigerr_("SPICE(NOLOADEDFILES)", (ftnlen)20);
7271 chkout_("EKGI", (ftnlen)4);
7272 return 0;
7273 }
7274
7275 /* The row number must be valid, or we can't proceed. */
7276
7277 if (*row < 1 || *row > unrows) {
7278 setmsg_("Row indices for query result range from 1 to #; requested r"
7279 "ow index was #.", (ftnlen)74);
7280 errint_("#", &unrows, (ftnlen)1);
7281 errint_("#", row, (ftnlen)1);
7282 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
7283 chkout_("EKGI", (ftnlen)4);
7284 return 0;
7285 }
7286
7287 /* The element index must be positive. */
7288
7289 if (*elment < 1) {
7290 setmsg_("ELMENT must be positive but was #.", (ftnlen)34);
7291 errint_("#", elment, (ftnlen)1);
7292 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
7293 chkout_("EKGI", (ftnlen)4);
7294 return 0;
7295 }
7296
7297 /* Make sure the SELECT clause column index is valid. */
7298
7299 if (*selidx < 1 || *selidx > nsel) {
7300 setmsg_("The SELECT column index # is out of the valid range 1:#", (
7301 ftnlen)55);
7302 errint_("#", selidx, (ftnlen)1);
7303 errint_("#", &ntab, (ftnlen)1);
7304 sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19);
7305 chkout_("EKGI", (ftnlen)4);
7306 return 0;
7307 }
7308
7309 /* COL is the column's index within the parent */
7310 /* table's column list. */
7311
7312 tabidx = seltab[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
7313 "seltab", i__1, "ekqmgr_", (ftnlen)6494)];
7314 col = selcol[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge("sel"
7315 "col", i__1, "ekqmgr_", (ftnlen)6495)];
7316 colptr = selctp[(i__1 = *selidx - 1) < 50 && 0 <= i__1 ? i__1 : s_rnge(
7317 "selctp", i__1, "ekqmgr_", (ftnlen)6496)];
7318 tab = tptvec[(i__1 = tabidx + 5) < 16 && 0 <= i__1 ? i__1 : s_rnge("tptv"
7319 "ec", i__1, "ekqmgr_", (ftnlen)6497)];
7320
7321 /* Make sure the column has integer type. */
7322
7323 if (cttyps[(i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 : s_rnge("cttyps"
7324 , i__1, "ekqmgr_", (ftnlen)6502)] != 3) {
7325 setmsg_("Column # has data type #.", (ftnlen)25);
7326 errch_("#", ctnams + (((i__1 = colptr - 1) < 500 && 0 <= i__1 ? i__1 :
7327 s_rnge("ctnams", i__1, "ekqmgr_", (ftnlen)6505)) << 5), (
7328 ftnlen)1, (ftnlen)32);
7329 errch_("#", chtype + (((i__2 = cttyps[(i__1 = colptr - 1) < 500 && 0
7330 <= i__1 ? i__1 : s_rnge("cttyps", i__1, "ekqmgr_", (ftnlen)
7331 6506)] - 1) < 4 && 0 <= i__2 ? i__2 : s_rnge("chtype", i__2,
7332 "ekqmgr_", (ftnlen)6506)) << 2), (ftnlen)1, (ftnlen)4);
7333 sigerr_("SPICE(INVALIDTYPE)", (ftnlen)18);
7334 chkout_("EKGI", (ftnlen)4);
7335 return 0;
7336 }
7337
7338 /* If it hasn't been done yet, and if it needs to be done, sort the */
7339 /* matching row vectors. */
7340
7341 if (dosort) {
7342 zzekjsrt_(&usize, ubase, &norder, otabs, ocols, oelts, sense, sthan,
7343 stdscs, stdtpt, dtpool, dtdscs, &ordbas);
7344 dosort = FALSE_;
7345 sorted = TRUE_;
7346 }
7347
7348 /* Look up the segment vector and row vector for the current row. */
7349
7350 if (sorted) {
7351 i__1 = ordbas + *row;
7352 i__2 = ordbas + *row;
7353 zzeksrd_(&i__1, &i__2, &i__);
7354 zzekvcal_(&i__, &rwvbas, &sgvbas);
7355 } else {
7356 zzekvcal_(row, &rwvbas, &sgvbas);
7357 }
7358 i__1 = rwvbas + 1;
7359 i__2 = rwvbas + ntab;
7360 zzeksrd_(&i__1, &i__2, rowvec);
7361 i__1 = sgvbas + 1;
7362 i__2 = sgvbas + ntab;
7363 zzeksrd_(&i__1, &i__2, segvec);
7364
7365 /* Identify the segment containing the column entry of interest. */
7366 /* Obtain the column descriptor for the column. */
7367
7368 rowidx = rowvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge(
7369 "rowvec", i__1, "ekqmgr_", (ftnlen)6544)];
7370 seg = segvec[(i__1 = tabidx - 1) < 10 && 0 <= i__1 ? i__1 : s_rnge("segv"
7371 "ec", i__1, "ekqmgr_", (ftnlen)6545)];
7372 j = stdtpt[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("stdtpt",
7373 i__1, "ekqmgr_", (ftnlen)6547)];
7374 i__1 = col;
7375 for (i__ = 2; i__ <= i__1; ++i__) {
7376 j = lnknxt_(&j, dtpool);
7377 }
7378
7379 /* Look up the element. */
7380
7381 zzekrsi_(&sthan[(i__1 = seg - 1) < 200 && 0 <= i__1 ? i__1 : s_rnge("sth"
7382 "an", i__1, "ekqmgr_", (ftnlen)6556)], &stdscs[(i__2 = seg * 24 -
7383 24) < 4800 && 0 <= i__2 ? i__2 : s_rnge("stdscs", i__2, "ekqmgr_",
7384 (ftnlen)6556)], &dtdscs[(i__3 = j * 11 - 11) < 110000 && 0 <=
7385 i__3 ? i__3 : s_rnge("dtdscs", i__3, "ekqmgr_", (ftnlen)6556)], &
7386 rowidx, elment, idata, null, found);
7387 chkout_("EKGI", (ftnlen)4);
7388 return 0;
7389 } /* ekqmgr_ */
7390
ekqmgr_(integer * cindex,integer * elment,char * eqryc,doublereal * eqryd,integer * eqryi,char * fname,integer * row,integer * selidx,char * column,integer * handle,integer * n,char * table,integer * attdsc,integer * ccount,logical * found,integer * nelt,integer * nmrows,logical * semerr,char * errmsg,char * cdata,doublereal * ddata,integer * idata,logical * null,ftnlen eqryc_len,ftnlen fname_len,ftnlen column_len,ftnlen table_len,ftnlen errmsg_len,ftnlen cdata_len)7391 /* Subroutine */ int ekqmgr_(integer *cindex, integer *elment, char *eqryc,
7392 doublereal *eqryd, integer *eqryi, char *fname, integer *row, integer
7393 *selidx, char *column, integer *handle, integer *n, char *table,
7394 integer *attdsc, integer *ccount, logical *found, integer *nelt,
7395 integer *nmrows, logical *semerr, char *errmsg, char *cdata,
7396 doublereal *ddata, integer *idata, logical *null, ftnlen eqryc_len,
7397 ftnlen fname_len, ftnlen column_len, ftnlen table_len, ftnlen
7398 errmsg_len, ftnlen cdata_len)
7399 {
7400 return ekqmgr_0_(0, cindex, elment, eqryc, eqryd, eqryi, fname, row,
7401 selidx, column, handle, n, table, attdsc, ccount, found, nelt,
7402 nmrows, semerr, errmsg, cdata, ddata, idata, null, eqryc_len,
7403 fname_len, column_len, table_len, errmsg_len, cdata_len);
7404 }
7405
eklef_(char * fname,integer * handle,ftnlen fname_len)7406 /* Subroutine */ int eklef_(char *fname, integer *handle, ftnlen fname_len)
7407 {
7408 return ekqmgr_0_(1, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7409 0, (integer *)0, fname, (integer *)0, (integer *)0, (char *)0,
7410 handle, (integer *)0, (char *)0, (integer *)0, (integer *)0, (
7411 logical *)0, (integer *)0, (integer *)0, (logical *)0, (char *)0,
7412 (char *)0, (doublereal *)0, (integer *)0, (logical *)0, (ftnint)0,
7413 fname_len, (ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0);
7414 }
7415
ekuef_(integer * handle)7416 /* Subroutine */ int ekuef_(integer *handle)
7417 {
7418 return ekqmgr_0_(2, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7419 0, (integer *)0, (char *)0, (integer *)0, (integer *)0, (char *)0,
7420 handle, (integer *)0, (char *)0, (integer *)0, (integer *)0, (
7421 logical *)0, (integer *)0, (integer *)0, (logical *)0, (char *)0,
7422 (char *)0, (doublereal *)0, (integer *)0, (logical *)0, (ftnint)0,
7423 (ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0);
7424 }
7425
ekntab_(integer * n)7426 /* Subroutine */ int ekntab_(integer *n)
7427 {
7428 return ekqmgr_0_(3, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7429 0, (integer *)0, (char *)0, (integer *)0, (integer *)0, (char *)0,
7430 (integer *)0, n, (char *)0, (integer *)0, (integer *)0, (logical
7431 *)0, (integer *)0, (integer *)0, (logical *)0, (char *)0, (char *)
7432 0, (doublereal *)0, (integer *)0, (logical *)0, (ftnint)0, (
7433 ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0);
7434 }
7435
ektnam_(integer * n,char * table,ftnlen table_len)7436 /* Subroutine */ int ektnam_(integer *n, char *table, ftnlen table_len)
7437 {
7438 return ekqmgr_0_(4, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7439 0, (integer *)0, (char *)0, (integer *)0, (integer *)0, (char *)0,
7440 (integer *)0, n, table, (integer *)0, (integer *)0, (logical *)0,
7441 (integer *)0, (integer *)0, (logical *)0, (char *)0, (char *)0, (
7442 doublereal *)0, (integer *)0, (logical *)0, (ftnint)0, (ftnint)0,
7443 (ftnint)0, table_len, (ftnint)0, (ftnint)0);
7444 }
7445
ekccnt_(char * table,integer * ccount,ftnlen table_len)7446 /* Subroutine */ int ekccnt_(char *table, integer *ccount, ftnlen table_len)
7447 {
7448 return ekqmgr_0_(5, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7449 0, (integer *)0, (char *)0, (integer *)0, (integer *)0, (char *)0,
7450 (integer *)0, (integer *)0, table, (integer *)0, ccount, (
7451 logical *)0, (integer *)0, (integer *)0, (logical *)0, (char *)0,
7452 (char *)0, (doublereal *)0, (integer *)0, (logical *)0, (ftnint)0,
7453 (ftnint)0, (ftnint)0, table_len, (ftnint)0, (ftnint)0);
7454 }
7455
ekcii_(char * table,integer * cindex,char * column,integer * attdsc,ftnlen table_len,ftnlen column_len)7456 /* Subroutine */ int ekcii_(char *table, integer *cindex, char *column,
7457 integer *attdsc, ftnlen table_len, ftnlen column_len)
7458 {
7459 return ekqmgr_0_(6, cindex, (integer *)0, (char *)0, (doublereal *)0, (
7460 integer *)0, (char *)0, (integer *)0, (integer *)0, column, (
7461 integer *)0, (integer *)0, table, attdsc, (integer *)0, (logical *
7462 )0, (integer *)0, (integer *)0, (logical *)0, (char *)0, (char *)
7463 0, (doublereal *)0, (integer *)0, (logical *)0, (ftnint)0, (
7464 ftnint)0, column_len, table_len, (ftnint)0, (ftnint)0);
7465 }
7466
eksrch_(integer * eqryi,char * eqryc,doublereal * eqryd,integer * nmrows,logical * semerr,char * errmsg,ftnlen eqryc_len,ftnlen errmsg_len)7467 /* Subroutine */ int eksrch_(integer *eqryi, char *eqryc, doublereal *eqryd,
7468 integer *nmrows, logical *semerr, char *errmsg, ftnlen eqryc_len,
7469 ftnlen errmsg_len)
7470 {
7471 return ekqmgr_0_(7, (integer *)0, (integer *)0, eqryc, eqryd, eqryi, (
7472 char *)0, (integer *)0, (integer *)0, (char *)0, (integer *)0, (
7473 integer *)0, (char *)0, (integer *)0, (integer *)0, (logical *)0,
7474 (integer *)0, nmrows, semerr, errmsg, (char *)0, (doublereal *)0,
7475 (integer *)0, (logical *)0, eqryc_len, (ftnint)0, (ftnint)0, (
7476 ftnint)0, errmsg_len, (ftnint)0);
7477 }
7478
eknelt_(integer * selidx,integer * row,integer * nelt)7479 /* Subroutine */ int eknelt_(integer *selidx, integer *row, integer *nelt)
7480 {
7481 return ekqmgr_0_(8, (integer *)0, (integer *)0, (char *)0, (doublereal *)
7482 0, (integer *)0, (char *)0, row, selidx, (char *)0, (integer *)0,
7483 (integer *)0, (char *)0, (integer *)0, (integer *)0, (logical *)0,
7484 nelt, (integer *)0, (logical *)0, (char *)0, (char *)0, (
7485 doublereal *)0, (integer *)0, (logical *)0, (ftnint)0, (ftnint)0,
7486 (ftnint)0, (ftnint)0, (ftnint)0, (ftnint)0);
7487 }
7488
ekgc_(integer * selidx,integer * row,integer * elment,char * cdata,logical * null,logical * found,ftnlen cdata_len)7489 /* Subroutine */ int ekgc_(integer *selidx, integer *row, integer *elment,
7490 char *cdata, logical *null, logical *found, ftnlen cdata_len)
7491 {
7492 return ekqmgr_0_(9, (integer *)0, elment, (char *)0, (doublereal *)0, (
7493 integer *)0, (char *)0, row, selidx, (char *)0, (integer *)0, (
7494 integer *)0, (char *)0, (integer *)0, (integer *)0, found, (
7495 integer *)0, (integer *)0, (logical *)0, (char *)0, cdata, (
7496 doublereal *)0, (integer *)0, null, (ftnint)0, (ftnint)0, (ftnint)
7497 0, (ftnint)0, (ftnint)0, cdata_len);
7498 }
7499
ekgd_(integer * selidx,integer * row,integer * elment,doublereal * ddata,logical * null,logical * found)7500 /* Subroutine */ int ekgd_(integer *selidx, integer *row, integer *elment,
7501 doublereal *ddata, logical *null, logical *found)
7502 {
7503 return ekqmgr_0_(10, (integer *)0, elment, (char *)0, (doublereal *)0, (
7504 integer *)0, (char *)0, row, selidx, (char *)0, (integer *)0, (
7505 integer *)0, (char *)0, (integer *)0, (integer *)0, found, (
7506 integer *)0, (integer *)0, (logical *)0, (char *)0, (char *)0,
7507 ddata, (integer *)0, null, (ftnint)0, (ftnint)0, (ftnint)0, (
7508 ftnint)0, (ftnint)0, (ftnint)0);
7509 }
7510
ekgi_(integer * selidx,integer * row,integer * elment,integer * idata,logical * null,logical * found)7511 /* Subroutine */ int ekgi_(integer *selidx, integer *row, integer *elment,
7512 integer *idata, logical *null, logical *found)
7513 {
7514 return ekqmgr_0_(11, (integer *)0, elment, (char *)0, (doublereal *)0, (
7515 integer *)0, (char *)0, row, selidx, (char *)0, (integer *)0, (
7516 integer *)0, (char *)0, (integer *)0, (integer *)0, found, (
7517 integer *)0, (integer *)0, (logical *)0, (char *)0, (char *)0, (
7518 doublereal *)0, idata, null, (ftnint)0, (ftnint)0, (ftnint)0, (
7519 ftnint)0, (ftnint)0, (ftnint)0);
7520 }
7521
7522