1 /* zzgapool.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__0 = 0;
11
12 /* $Procedure ZZGAPOOL ( Private: get agent set for watched variable ) */
zzgapool_(char * varnam,char * wtvars,integer * wtptrs,integer * wtpool,char * wtagnt,char * agtset,ftnlen varnam_len,ftnlen wtvars_len,ftnlen wtagnt_len,ftnlen agtset_len)13 /* Subroutine */ int zzgapool_(char *varnam, char *wtvars, integer *wtptrs,
14 integer *wtpool, char *wtagnt, char *agtset, ftnlen varnam_len,
15 ftnlen wtvars_len, ftnlen wtagnt_len, ftnlen agtset_len)
16 {
17 /* System generated locals */
18 integer i__1;
19
20 /* Builtin functions */
21 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
22
23 /* Local variables */
24 integer node;
25 extern integer cardc_(char *, ftnlen);
26 extern /* Subroutine */ int chkin_(char *, ftnlen);
27 extern integer sizec_(char *, ftnlen);
28 extern /* Subroutine */ int scardc_(integer *, char *, ftnlen), validc_(
29 integer *, integer *, char *, ftnlen);
30 extern integer bsrchc_(char *, integer *, char *, ftnlen, ftnlen);
31 integer nfetch;
32 extern /* Subroutine */ int chkout_(char *, ftnlen);
33 extern integer lnknxt_(integer *, integer *);
34 extern logical return_(void);
35 integer loc;
36
37 /* $ Abstract */
38
39 /* SPICE Private routine intended solely for the support of SPICE */
40 /* routines. Users should not call this routine directly due to the */
41 /* volatile nature of this routine. */
42
43 /* Return a SPICE set containing the names of agents watching */
44 /* a specified kernel variable. */
45
46 /* $ Disclaimer */
47
48 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
49 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
50 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
51 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
52 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
53 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
54 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
55 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
56 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
57 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
58
59 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
60 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
61 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
62 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
63 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
64 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
65
66 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
67 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
68 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
69 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
70
71 /* $ Required_Reading */
72
73 /* KERNEL */
74
75 /* $ Keywords */
76
77 /* KERNEL */
78 /* PRIVATE */
79 /* UTILITY */
80
81 /* $ Declarations */
82 /* $ Brief_I/O */
83
84 /* VARIABLE I/O DESCRIPTION */
85 /* -------- --- -------------------------------------------------- */
86 /* VARNAM I Kernel variable name. */
87 /* WTVARS I Watched kernel variable set. */
88 /* WTPTRS I Pointers from variables into the watch pool. */
89 /* WTPOOL I Watch pool used for managing agent names. */
90 /* WTAGNT I Array of agent names. */
91 /* AGTSET O Set of agents for VARNAM. */
92
93 /* $ Detailed_Input */
94
95 /* VARNAM is the name of a kernel variable. */
96
97 /* WTVARS is a SPICE set containing the contents of the kernel */
98 /* pool watcher system's set WTVARS. */
99
100 /* WTPTRS is an array containing the contents of the kernel */
101 /* pool watcher system's array WTPTRS. */
102
103 /* WTPOOL is a SPICE doubly linked list pool containing the */
104 /* contents of the kernel pool watcher system's pool */
105 /* WTPOOL. */
106
107 /* WTAGNT is an array containing the contents of the kernel */
108 /* pool watcher system's array WTAGNT. */
109
110 /* $ Detailed_Output */
111
112 /* AGTSET is a SPICE set containing the names of the agents */
113 /* associated with the kernel variable designated by */
114 /* VARNAM. */
115
116 /* $ Parameters */
117
118 /* None. */
119
120 /* $ Exceptions */
121
122 /* 1) If the output set AGTSET is too small to hold the set of */
123 /* agents watching VARNAM, the error will be diagnosed by routines */
124 /* in the call tree of this routine. */
125
126 /* $ Files */
127
128 /* None. */
129
130 /* $ Particulars */
131
132 /* This routine is not part of the SPICELIB API. This routine */
133 /* may be removed in a later version of the SPICE Toolkit, or */
134 /* its interface may change. */
135
136 /* SPICE-based application code should not call this routine. */
137
138 /* $ Examples */
139
140 /* See POOL entry point SWPOOL. */
141
142 /* $ Restrictions */
143
144 /* 1) This is a private routine. See $Particulars above. */
145
146 /* 2) Contents of the input arrays are assumed to be valid. */
147 /* The output returned by this routine is meaningless */
148 /* otherwise. */
149
150 /* $ Literature_References */
151
152 /* None. */
153
154 /* $ Author_and_Institution */
155
156 /* N.J. Bachman (JPL) */
157
158 /* $ Version */
159
160 /* - SPICELIB Version 1.0.0, 17-MAR-2009 (NJB) */
161
162 /* -& */
163 /* $ Index_Entries */
164
165 /* get agent set for watched kernel variable */
166
167 /* -& */
168 /* $ Revisions */
169
170 /* None. */
171
172 /* -& */
173
174 /* SPICELIB functions */
175
176
177 /* Local variables */
178
179 if (return_()) {
180 return 0;
181 }
182 chkin_("ZZGAPOOL", (ftnlen)8);
183
184 /* The output agent set is empty until we find any */
185 /* agents. */
186
187 scardc_(&c__0, agtset, agtset_len);
188
189 /* Find the location of VARNAM in the set of watched */
190 /* variables. */
191
192 i__1 = cardc_(wtvars, wtvars_len);
193 loc = bsrchc_(varnam, &i__1, wtvars + wtvars_len * 6, varnam_len,
194 wtvars_len);
195 if (loc == 0) {
196
197 /* This variable is not watched. The agent set is */
198 /* empty. */
199
200 chkout_("ZZGAPOOL", (ftnlen)8);
201 return 0;
202 }
203
204 /* Set NODE to the head node of the agent list for VARNAM. */
205 /* Traverse the agent list for VARNAM. Collect the agents */
206 /* as an unordered list, then turn the list into a set. */
207
208 node = wtptrs[loc - 1];
209 nfetch = 0;
210 while(node > 0) {
211 ++nfetch;
212 s_copy(agtset + (nfetch + 5) * agtset_len, wtagnt + (node - 1) *
213 wtagnt_len, agtset_len, wtagnt_len);
214 node = lnknxt_(&node, wtpool);
215 }
216 i__1 = sizec_(agtset, agtset_len);
217 validc_(&i__1, &nfetch, agtset, agtset_len);
218 chkout_("ZZGAPOOL", (ftnlen)8);
219 return 0;
220 } /* zzgapool_ */
221
222