1 /* zzpini.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* $Procedure ZZPINI ( Private --- kernel pool initialization ) */
zzpini_(logical * first,integer * maxvar,integer * maxval,integer * maxlin,char * begdat,char * begtxt,integer * nmpool,integer * dppool,integer * chpool,integer * namlst,integer * datlst,integer * maxagt,integer * mxnote,char * wtvars,integer * wtptrs,integer * wtpool,char * wtagnt,char * agents,char * active,char * notify,integer * subctr,ftnlen begdat_len,ftnlen begtxt_len,ftnlen wtvars_len,ftnlen wtagnt_len,ftnlen agents_len,ftnlen active_len,ftnlen notify_len)9 /* Subroutine */ int zzpini_(logical *first, integer *maxvar, integer *maxval,
10 integer *maxlin, char *begdat, char *begtxt, integer *nmpool,
11 integer *dppool, integer *chpool, integer *namlst, integer *datlst,
12 integer *maxagt, integer *mxnote, char *wtvars, integer *wtptrs,
13 integer *wtpool, char *wtagnt, char *agents, char *active, char *
14 notify, integer *subctr, ftnlen begdat_len, ftnlen begtxt_len, ftnlen
15 wtvars_len, ftnlen wtagnt_len, ftnlen agents_len, ftnlen active_len,
16 ftnlen notify_len)
17 {
18 /* System generated locals */
19 integer namlst_dim1, datlst_dim1, i__1, i__2;
20
21 /* Builtin functions */
22 integer s_rnge(char *, integer, char *, integer);
23 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
24
25 /* Local variables */
26 extern /* Subroutine */ int zzctrsin_(integer *);
27 integer i__;
28 extern /* Subroutine */ int chkin_(char *, ftnlen);
29 integer dummy;
30 extern logical failed_(void);
31 extern /* Subroutine */ int clearc_(integer *, char *, ftnlen), cleari_(
32 integer *, integer *), lnkini_(integer *, integer *);
33 extern integer touchi_(integer *);
34 extern /* Subroutine */ int ssizec_(integer *, char *, ftnlen), chkout_(
35 char *, ftnlen);
36 extern integer zzshsh_(integer *);
37
38 /* $ Abstract */
39
40 /* SPICE Private routine intended solely for the support of SPICE */
41 /* routines. Users should not call this routine directly due */
42 /* to the volatile nature of this routine. */
43
44 /* This routine initializes the data structures needed for */
45 /* maintaining the kernel pool and initializes the hash function */
46 /* used for the name list in the kernel pool. */
47
48 /* $ Disclaimer */
49
50 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
51 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
52 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
53 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
54 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
55 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
56 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
57 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
58 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
59 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
60
61 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
62 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
63 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
64 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
65 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
66 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
67
68 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
69 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
70 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
71 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
72
73 /* $ Required_Reading */
74
75 /* None. */
76
77 /* $ Keywords */
78
79 /* PRIVATE UTILITY */
80
81 /* $ Declarations */
82 /* $ Abstract */
83
84 /* This include file defines the dimension of the counter */
85 /* array used by various SPICE subsystems to uniquely identify */
86 /* changes in their states. */
87
88 /* $ Disclaimer */
89
90 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
91 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
92 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
93 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
94 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
95 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
96 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
97 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
98 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
99 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
100
101 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
102 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
103 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
104 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
105 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
106 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
107
108 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
109 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
110 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
111 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
112
113 /* $ Parameters */
114
115 /* CTRSIZ is the dimension of the counter array used by */
116 /* various SPICE subsystems to uniquely identify */
117 /* changes in their states. */
118
119 /* $ Author_and_Institution */
120
121 /* B.V. Semenov (JPL) */
122
123 /* $ Literature_References */
124
125 /* None. */
126
127 /* $ Version */
128
129 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
130
131 /* -& */
132
133 /* End of include file. */
134
135 /* $ Brief_I/O */
136
137 /* VARIABLE I/O DESCRIPTION */
138 /* -------- --- -------------------------------------------------- */
139 /* FIRST I/O Used to determine if this is the first pass */
140 /* MAXVAR I Maximum number of variables in the pool */
141 /* MAXVAL I Maximum number of d.p. values in the pool */
142 /* MAXLIN I Maximum number of string values in the pool */
143 /* BEGDAT O Marker used to begin data section of a kernel */
144 /* BEGTXT O Marker used to begin text section of a kernel */
145 /* NMPOOL O Linked list for resolving hash collisions of names */
146 /* DPPOOL O Linked list for maintaining d.p. values. */
147 /* CHPOOL O Linked list for maintaining string values */
148 /* NAMLST O Heads of collision resolution lists */
149 /* DATLST O Heads of data values lists */
150 /* MAXAGT I Maximum number of agents that can be supported */
151 /* MXNOTE I Maximum number of agents that can be notified */
152 /* WTPTR O Name array of watcher symbol table */
153 /* WATPTR O Pointer array of watcher symbol table */
154 /* WATVAL O Values array of watcher symbol table. */
155 /* AGENTS O Set of agents */
156 /* ACTIVE O Watchers that are active. */
157 /* NOTIFY O Agents to notify */
158 /* SUBCTR O POOL state counter. */
159
160 /* $ Detailed_Input */
161
162 /* FIRST is a logical indicating whether or not this is */
163 /* the first call to this routine. If FIRST is .TRUE. */
164 /* the various items are initialized and FIRST is */
165 /* set to .FALSE. If FIRST is .FALSE. no action is */
166 /* taken by this routine. */
167
168 /* MAXVAR is the maximum number of variables that the */
169 /* kernel pool may contain at any one time. */
170
171
172 /* MAXVAL is the maximum number of distinct values that */
173 /* may belong to the variables in the kernel pool. */
174
175 /* MAXLIN is the maximum number of character strings that */
176 /* can be stored as data for kernel pool variables. */
177
178 /* MXNOTE is the maximum number of distinct variable-agents */
179 /* pairs that can be maintained by the kernel pool. */
180 /* (A variable is "paired" with an agent, if that agent */
181 /* is to be notified whenever the variable is updated.) */
182
183 /* MAXAGT is the maximum number of agents that can be kept */
184 /* on the distribution list for notification of updates */
185 /* to kernel variables. */
186
187 /* $ Detailed_Output */
188
189 /* FIRST is set to .FALSE. on output. */
190
191 /* BEGDAT Marker used to begin data section of a kernel */
192
193 /* BEGTXT Marker used to begin text section of a kernel */
194
195 /* NMPOOL Linked list pool for resolving hash collisions */
196 /* of names of kernel pool variables. Each list */
197 /* other than the free list, is a sequence of pointers */
198 /* to names that have the same hash value. On output */
199 /* from this routine all nodes of the pool are in the */
200 /* free list. */
201
202 /* DPPOOL Linked list pool for maintaining d.p. values. */
203 /* On output all nodes in the pool are in the free list */
204 /* of DPPOOL */
205
206 /* CHPOOL Linked list pool for maintaining string values. */
207 /* On output all nodes in the pool are in the free list */
208 /* of CHPOOL */
209
210 /* NAMLST is an array that contains the heads of lists from */
211 /* NMPOOL. NAMLST( ZZHASH( NAME ) ) points to the head */
212 /* of the first name in the collision resolution list */
213 /* for NAME. If there is no head for the collision */
214 /* resolution list for NAME (i.e. no name with the */
215 /* same hash value as name has been stored) */
216 /* NAMLST( ZZHASH(NAME) ) will be zero. On output from */
217 /* this routine all values in NAMLST are set to zero. */
218
219 /* DATLST is an array that contains the "heads" of lists of */
220 /* pointers to the values associated with a variable. */
221 /* Suppose that NAME has been located in the list of */
222 /* variable names at location LOC. Then DATLST(LOC) */
223 /* is the head node of the list of pointers to the */
224 /* values of NAME. If DATLST(LOC) is positive then */
225 /* the values are d.p.'s If the value of DATLST(LOC) */
226 /* is negative, the values are strings. The absolute */
227 /* value of DATLST(LOC) is the head node to the list */
228 /* of values associated with NAME. If DATLST(LOC) is */
229 /* zero then no values have been assigned to the variable */
230 /* NAME. On output all entries of DATLST are set to */
231 /* zero. */
232
233 /* WTPTR is a symbol table of variables to watch for. WTPTR */
234 /* WATPTR contains the names of variables to watch. The */
235 /* WATVAL values associated with a name are the names of agents */
236 /* that have requested that the variable be watched. */
237
238 /* AGENTS Agents contains the list of agents that need to be */
239 /* notified about updates to their variables. */
240
241 /* ACTIVE A temporary set. */
242 /* NOTIFY A temporary set. */
243
244 /* SUBCTR Initialized POOL state counter. */
245
246 /* $ Parameters */
247
248 /* None. */
249
250 /* $ Exceptions */
251
252 /* None. */
253
254 /* $ Files */
255
256 /* None. */
257
258 /* $ Particulars */
259
260 /* This is a utility routine that centralizes the initialization */
261 /* code that is common to all entry points of POOL. */
262
263 /* $ Examples */
264
265 /* See POOL. */
266
267 /* $ Restrictions */
268
269 /* None. */
270
271 /* $ Literature_References */
272
273 /* None. */
274
275 /* $ Author_and_Institution */
276
277 /* N.J. Bachman (JPL) */
278 /* W.L. Taber (JPL) */
279 /* B.V. Semenov (JPL) */
280
281 /* $ Version */
282
283 /* - SPICELIB Version 3.0.0, 30-JUL-2013 (BVS) */
284
285 /* Added POOL state counter to the argument list, and included */
286 /* 'zzctr.inc' to provide the counter array dimension. */
287
288 /* - SPICELIB Version 2.0.0, 19-MAR-2009 (NJB) */
289
290 /* Argument list was changed to accommodate re-implementation */
291 /* of watcher system. Initialization tasks performed by this */
292 /* routine were updated accordingly. */
293
294 /* - SPICELIB Version 1.1.0, 13-OCT-1995 (WLT) */
295
296 /* An integer variable was renamed to better indicate */
297 /* its role in the routine and to make maintenance a bit */
298 /* easier */
299
300 /* - SPICELIB Version 1.0.0, 20-SEP-1995 (WLT) */
301
302 /* -& */
303 /* $ Revisions */
304
305 /* - SPICELIB Version 1.1.0, 13-OCT-1995 (WLT) */
306
307 /* An integer variable was renamed to better indicate */
308 /* its role in the routine and to make maintenance a bit */
309 /* easier. The integer variable was 'DONE' which looks */
310 /* a lot like a logical. It's been changed to 'DUMMY'. */
311
312 /* -& */
313
314 /* SPICELIB Functions. */
315
316
317 /* Local parameters */
318
319
320 /* Local variables */
321
322 /* Parameter adjustments */
323 datlst_dim1 = *maxvar;
324 namlst_dim1 = *maxvar;
325
326 /* Function Body */
327 if (*first) {
328 chkin_("ZZPINI", (ftnlen)6);
329 i__1 = *maxvar;
330 for (i__ = 1; i__ <= i__1; ++i__) {
331 namlst[(i__2 = i__ - 1) < namlst_dim1 && 0 <= i__2 ? i__2 :
332 s_rnge("namlst", i__2, "zzpini_", (ftnlen)305)] = 0;
333 datlst[(i__2 = i__ - 1) < datlst_dim1 && 0 <= i__2 ? i__2 :
334 s_rnge("datlst", i__2, "zzpini_", (ftnlen)306)] = 0;
335 }
336
337 /* Set up hash function. Use TOUCHI to suppress */
338 /* compiler warnings. */
339
340 dummy = zzshsh_(maxvar);
341 dummy = touchi_(&dummy);
342 s_copy(begdat, "\\begindata", begdat_len, (ftnlen)10);
343 s_copy(begtxt, "\\begintext", begtxt_len, (ftnlen)10);
344 lnkini_(maxvar, nmpool);
345 lnkini_(maxval, dppool);
346 lnkini_(maxlin, chpool);
347 ssizec_(maxvar, wtvars, wtvars_len);
348 cleari_(maxvar, wtptrs);
349 lnkini_(mxnote, wtpool);
350 clearc_(mxnote, wtagnt, wtagnt_len);
351 ssizec_(mxnote, agents, agents_len);
352 ssizec_(mxnote, active, active_len);
353 ssizec_(mxnote, notify, notify_len);
354 zzctrsin_(subctr);
355 if (! failed_()) {
356 *first = FALSE_;
357 }
358 chkout_("ZZPINI", (ftnlen)6);
359 return 0;
360 }
361 return 0;
362 } /* zzpini_ */
363
364