1 /* sctype.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 static integer c__1 = 1;
12
13 /* $Procedure SCTYPE ( SCLK type ) */
sctype_(integer * sc)14 integer sctype_(integer *sc)
15 {
16 /* Initialized data */
17
18 static logical first = TRUE_;
19 static logical nodata = TRUE_;
20 static integer oldsc = 0;
21
22 /* System generated locals */
23 integer ret_val, i__1;
24
25 /* Builtin functions */
26 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
27
28 /* Local variables */
29 static integer type__;
30 extern /* Subroutine */ int zzcvpool_(char *, integer *, logical *,
31 ftnlen), zzctruin_(integer *);
32 integer n;
33 extern /* Subroutine */ int scli01_(char *, integer *, integer *, integer
34 *, integer *, ftnlen), chkin_(char *, ftnlen), repmi_(char *,
35 char *, integer *, char *, ftnlen, ftnlen, ftnlen);
36 extern logical failed_(void);
37 char kvname[60];
38 logical update;
39 extern /* Subroutine */ int chkout_(char *, ftnlen), suffix_(char *,
40 integer *, char *, ftnlen, ftnlen);
41 extern logical return_(void);
42 static integer usrctr[2];
43 extern /* Subroutine */ int swpool_(char *, integer *, char *, ftnlen,
44 ftnlen);
45
46 /* $ Abstract */
47
48 /* Return the spacecraft clock type for a specified spacecraft. */
49
50 /* $ Disclaimer */
51
52 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
53 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
54 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
55 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
56 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
57 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
58 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
59 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
60 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
61 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
62
63 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
64 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
65 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
66 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
67 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
68 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
69
70 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
71 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
72 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
73 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
74
75 /* $ Required_Reading */
76
77 /* SCLK */
78
79 /* $ Keywords */
80
81 /* TIME */
82
83 /* $ Declarations */
84 /* $ Abstract */
85
86 /* This include file defines the dimension of the counter */
87 /* array used by various SPICE subsystems to uniquely identify */
88 /* changes in their states. */
89
90 /* $ Disclaimer */
91
92 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
93 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
94 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
95 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
96 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
97 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
98 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
99 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
100 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
101 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
102
103 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
104 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
105 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
106 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
107 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
108 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
109
110 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
111 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
112 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
113 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
114
115 /* $ Parameters */
116
117 /* CTRSIZ is the dimension of the counter array used by */
118 /* various SPICE subsystems to uniquely identify */
119 /* changes in their states. */
120
121 /* $ Author_and_Institution */
122
123 /* B.V. Semenov (JPL) */
124
125 /* $ Literature_References */
126
127 /* None. */
128
129 /* $ Version */
130
131 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
132
133 /* -& */
134
135 /* End of include file. */
136
137 /* $ Brief_I/O */
138
139 /* Variable I/O Description */
140 /* -------- --- -------------------------------------------------- */
141 /* SC I NAIF spacecraft ID code. */
142
143 /* The function returns the spacecraft clock type associated with the */
144 /* spacecraft specified by SC. */
145
146 /* $ Detailed_Input */
147
148 /* SC is a NAIF ID code for a spacecraft, whose */
149 /* spacecraft clock `type' is desired. */
150
151 /* $ Detailed_Output */
152
153 /* The function returns the spacecraft clock type associated with the */
154 /* spacecraft specified by SC. */
155
156 /* $ Parameters */
157
158 /* None. */
159
160 /* $ Exceptions */
161
162 /* 1) If the kernel variable that assigns a SCLK type to the */
163 /* spacecraft specified by SC is not found in the kernel pool, */
164 /* the error is diagnosed by routines called by this routine. */
165 /* SCTYPE returns the value 0 in this case. */
166
167 /* $ Files */
168
169 /* None. */
170
171 /* $ Particulars */
172
173 /* The raison d'etre of this routine is that it consolidates the code */
174 /* that maps spacecraft ID's to clock types. While any routine may */
175 /* call SCTYPE, it is unlikely that there will be a need for */
176 /* non-SPICELIB routines to call this routine directly. */
177
178 /* $ Examples */
179
180 /* 1) Find the SCLK type for Galileo. */
181
182 /* During program initialization, we load a SCLK kernel file */
183 /* into the kernel pool. We will pretend that the name of */
184 /* this file is GLLSCLK.KER. You must use the actual name of */
185 /* an SCLK kernel that is accessible by your program to try */
186 /* this example. */
187
188 /* C */
189 /* C Load the SCLK kernel. */
190 /* C */
191 /* CALL FURNSH ( 'GLLSCLK.KER' ) */
192 /* . */
193 /* . */
194 /* . */
195 /* C */
196 /* C Print out the clock type for Galileo. */
197 /* C */
198 /* TYPE = SCTYPE ( -77 ) */
199
200 /* PRINT *, 'Galileo clock type is ', TYPE */
201
202
203 /* 2) Find the SCLK type for Mars Observer. */
204
205
206 /* C */
207 /* C Load the SCLK kernel. */
208 /* C */
209 /* CALL FURNSH ( 'MOSCLK.KER' ) */
210 /* . */
211 /* . */
212 /* . */
213 /* C */
214 /* C Print out the clock type for Mars Observer. */
215 /* C */
216 /* TYPE = SCTYPE ( -94 ) */
217
218 /* PRINT *, 'Mars Observer clock type is ', TYPE */
219
220 /* $ Restrictions */
221
222 /* This routine assumes that an SCLK kernel appropriate to the */
223 /* spacecraft specified by SC has been loaded into the kernel pool. */
224
225 /* $ Literature_References */
226
227 /* None. */
228
229 /* $ Author_and_Institution */
230
231 /* N.J. Bachman (JPL) */
232 /* J.M. Lynch (JPL) */
233 /* B.V. Semenov (JPL) */
234
235 /* $ Version */
236
237 /* - SPICELIB Version 1.3.0, 09-SEP-2013 (BVS) */
238
239 /* Updated to keep track of the POOL counter and call ZZCVPOOL. */
240
241 /* - SPICELIB Version 1.2.0, 05-MAR-2009 (NJB) */
242
243 /* Bug fix: this routine now keeps track of whether its */
244 /* kernel pool look-up succeeded. If not, a kernel pool */
245 /* lookup is attempted on the next call to this routine. */
246
247 /* - SPICELIB Version 1.1.1, 22-AUG-2006 (EDW) */
248
249 /* Replaced references to LDPOOL with references */
250 /* to FURNSH. */
251
252 /* - SPICELIB Version 1.1.0, 22-MAR-1993 (JML) */
253
254 /* 1) The routine now uses the kernel pool watch capability. */
255
256 /* 2) The routine now returns a value of zero if RETURN is */
257 /* true on entry. */
258
259 /* - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
260
261 /* Comment section for permuted index source lines was added */
262 /* following the header. */
263
264 /* - SPICELIB Version 1.0.0, 04-SEP-1990 (NJB) */
265
266 /* -& */
267 /* $ Index_Entries */
268
269 /* spacecraft_clock type */
270
271 /* -& */
272
273 /* SPICELIB functions */
274
275
276 /* Local parameters */
277
278
279 /* Local variables */
280
281
282 /* Saved variables */
283
284
285 /* Initial values */
286
287
288 /* Standard SPICE error handling. */
289
290 if (return_()) {
291 ret_val = 0;
292 return ret_val;
293 }
294 chkin_("SCTYPE", (ftnlen)6);
295
296 /* On the first pass through the subroutine, or if the spacecraft */
297 /* ID code changes, set a watch on the SCLK kernel variable for */
298 /* the current clock type. */
299
300 if (first || *sc != oldsc) {
301
302 /* Construct the name of the kernel variable that is needed. */
303
304 s_copy(kvname, "SCLK_DATA_TYPE", (ftnlen)60, (ftnlen)14);
305 suffix_("_#", &c__0, kvname, (ftnlen)2, (ftnlen)60);
306 i__1 = -(*sc);
307 repmi_(kvname, "#", &i__1, kvname, (ftnlen)60, (ftnlen)1, (ftnlen)60);
308
309 /* Set a watch on the kernel variable needed. */
310
311 swpool_("SCTYPE", &c__1, kvname, (ftnlen)6, (ftnlen)60);
312
313 /* Keep track of the last spacecraft ID encountered. */
314
315 oldsc = *sc;
316
317 /* Initialize the local POOL counter to user value. */
318
319 zzctruin_(usrctr);
320 first = FALSE_;
321 }
322
323 /* If the kernel pool variable that this routine uses has */
324 /* been updated, or if the spacecraft id code changes, look */
325 /* up the new value from the kernel pool. */
326
327 zzcvpool_("SCTYPE", usrctr, &update, (ftnlen)6);
328 if (update || nodata) {
329
330 /* Find the clock type for the specified mission. */
331
332 type__ = 0;
333 scli01_("SCLK_DATA_TYPE", sc, &c__1, &n, &type__, (ftnlen)14);
334 if (failed_()) {
335 nodata = TRUE_;
336 ret_val = 0;
337 chkout_("SCTYPE", (ftnlen)6);
338 return ret_val;
339 }
340 nodata = FALSE_;
341 }
342 ret_val = type__;
343 chkout_("SCTYPE", (ftnlen)6);
344 return ret_val;
345 } /* sctype_ */
346
347