1 /* sctran.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__1 = 1;
11
12 /* $Procedure SCTRAN ( SCLK name/ID code translation ) */
sctran_0_(int n__,char * clknam,integer * clkid,logical * found,ftnlen clknam_len)13 /* Subroutine */ int sctran_0_(int n__, char *clknam, integer *clkid, logical
14 *found, ftnlen clknam_len)
15 {
16 /* System generated locals */
17 integer i__1;
18
19 /* Builtin functions */
20 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
21
22 /* Local variables */
23 extern integer posr_(char *, char *, integer *, ftnlen, ftnlen);
24 extern /* Subroutine */ int chkin_(char *, ftnlen), ucase_(char *, char *,
25 ftnlen, ftnlen);
26 extern integer rtrim_(char *, ftnlen);
27 extern /* Subroutine */ int bodn2c_(char *, integer *, logical *, ftnlen),
28 bodc2n_(integer *, char *, logical *, ftnlen), sigerr_(char *,
29 ftnlen);
30 char tmpnam[32];
31 extern /* Subroutine */ int chkout_(char *, ftnlen), suffix_(char *,
32 integer *, char *, ftnlen, ftnlen);
33 extern logical return_(void);
34 integer loc;
35
36 /* $ Abstract */
37
38 /* Convert between SCLK name strings and ID codes. */
39
40 /* $ Disclaimer */
41
42 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
43 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
44 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
45 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
46 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
47 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
48 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
49 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
50 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
51 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
52
53 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
54 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
55 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
56 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
57 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
58 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
59
60 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
61 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
62 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
63 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
64
65 /* $ Required_Reading */
66
67 /* SCLK */
68
69 /* $ Keywords */
70
71 /* CONVERSION */
72 /* PARSING */
73 /* SCLK */
74 /* TIME */
75 /* UTILITY */
76
77 /* $ Declarations */
78 /* $ Brief_I/O */
79
80 /* Variable I/O Entry */
81 /* -------- --- -------------------------------------------------- */
82 /* CLKNAM I-O SCID2N, SCN2ID */
83 /* CLKID I-O SCID2N, SCN2ID */
84 /* FOUND O SCID2N, SCN2ID */
85 /* MAXLEN P All */
86
87 /* $ Detailed_Input */
88
89 /* See the entry points for a discussion of their arguments. */
90
91 /* $ Detailed_Output */
92
93 /* See the entry points for a discussion of their arguments. */
94
95 /* $ Parameters */
96
97 /* MAXLEN is the maximum allowed length, in characters, of a */
98 /* string containing the name of a spacecraft clock. */
99
100 /* $ Exceptions */
101
102 /* 1) This is an umbrella subroutine that contains declarations */
103 /* for its entry points. This routine should never be called */
104 /* directly. If it is, the error SPICE(BOGUSENTRY) will be */
105 /* signaled. */
106
107
108 /* See the entry points for a discussion of exceptions specific to */
109 /* those routines. */
110
111 /* $ Files */
112
113 /* None. */
114
115 /* $ Particulars */
116
117 /* This set of subroutines centralizes the mapping between */
118 /* spacecraft clock names and their corresponding NAIF integer */
119 /* codes. Translation between these names and codes is frequently */
120 /* required by user interface functions. */
121
122 /* The set of supported clocks is identical to the set of spacecraft */
123 /* supported by BODTRN. The mapping may be extended by calling */
124 /* BODDEF. */
125
126 /* $ Examples */
127
128 /* See the entry points for examples of their usage. */
129
130 /* $ Restrictions */
131
132 /* None. */
133
134 /* $ Literature_References */
135
136 /* None. */
137
138 /* $ Author_and_Institution */
139
140 /* N.J. Bachman (JPL) */
141
142 /* $ Version */
143
144 /* - SPICELIB Version 1.2.0, 29-OCT-2001 (NJB) */
145
146 /* Bug fix: modified algorithm to handle case where string */
147 /* "SCLK" appears in SCLK name. */
148
149 /* - SPICELIB Version 1.1.0, 25-FEB-2000 (NJB) */
150
151 /* Updated to use BODTRN for SCLK name/code mapping. */
152
153 /* - Beta Version 1.0.0, 17-NOV-1995 (NJB) */
154
155 /* -& */
156 /* $ Index_Entries */
157
158 /* convert between SCLK ID codes and names */
159
160 /* -& */
161 /* $ Revisions */
162
163 /* - SPICELIB Version 1.2.0, 12-AUG-2001 (NJB) */
164
165 /* Bug fix: modified algorithm to handle case where string */
166 /* "SCLK" appears in SCLK name. SCN2ID now uses POSR to locate */
167 /* the substring "SCLK" in the input string. */
168
169 /* -& */
170
171 /* SPICELIB functions */
172
173
174 /* Local variables */
175
176
177 /* Standard SPICE error handling. */
178
179 switch(n__) {
180 case 1: goto L_scn2id;
181 case 2: goto L_scid2n;
182 }
183
184 if (return_()) {
185 return 0;
186 } else {
187 chkin_("SCTRAN", (ftnlen)6);
188 }
189 sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17);
190 chkout_("SCTRAN", (ftnlen)6);
191 return 0;
192 /* $Procedure SCN2ID ( SCLK name to ID code ) */
193
194 L_scn2id:
195 /* $ Abstract */
196
197 /* Convert an SCLK name string to a NAIF integer code. */
198
199 /* $ Disclaimer */
200
201 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
202 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
203 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
204 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
205 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
206 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
207 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
208 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
209 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
210 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
211
212 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
213 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
214 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
215 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
216 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
217 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
218
219 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
220 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
221 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
222 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
223
224 /* $ Required_Reading */
225
226 /* SCLK */
227
228 /* $ Keywords */
229
230 /* CONVERSION */
231 /* PARSING */
232 /* SCLK */
233 /* TIME */
234 /* UTILITY */
235
236 /* $ Declarations */
237
238 /* CHARACTER*(*) CLKNAM */
239 /* INTEGER CLKID */
240 /* LOGICAL FOUND */
241
242 /* $ Brief_I/O */
243
244 /* Variable I/O Description */
245 /* -------- --- -------------------------------------------------- */
246 /* CLKNAM I String giving spacecraft clock name. */
247 /* CLKID O NAIF integer code of spacecraft clock. */
248 /* FOUND O Flag indicating whether item was found. */
249
250 /* $ Detailed_Input */
251
252 /* CLKNAM is a short string identifying the spacecraft */
253 /* clock of interest. The form of the string */
254 /* is: */
255
256 /* <spacecraft name or acronym> SCLK */
257
258 /* for example */
259
260 /* VGR1 SCLK */
261 /* VOYAGER 1 SCLK */
262 /* GLL SCLK */
263 /* GALILEO ORBITER SCLK */
264
265 /* Case and white space (including embedded white */
266 /* space) are not significant. */
267
268 /* $ Detailed_Output */
269
270 /* CLKID is the NAIF integer code associated with the */
271 /* input clock. CLKID is defined only if the */
272 /* output flag FOUND is returned .TRUE. */
273
274 /* FOUND is a logical flag indicating whether the input */
275 /* string specified a clock known to this routine. */
276
277 /* $ Parameters */
278
279 /* None. */
280
281 /* $ Exceptions */
282
283 /* Error free. */
284
285 /* 1) If the input name is not recognized, FOUND is set to .FALSE. */
286 /* CLKID is not modified. */
287
288 /* 2) If the input name is recognized but does not refer to a */
289 /* spacecraft, no error is signaled. For example, the string */
290 /* 'JUPITER BARYCENTER SCLK' maps to the code 5. */
291
292 /* $ Files */
293
294 /* None. */
295
296 /* $ Particulars */
297
298 /* SCN2ID provides a means of mapping human-readable clock names */
299 /* to integer codes used by the SPICELIB SCLK routines to */
300 /* identify spacecraft clocks. */
301
302 /* $ Examples */
303
304 /* 1) Look up the spacecraft clock code for the Galileo orbiter. */
305
306 /* CALL SCN2ID ( 'GLL SCLK', CLKID, FOUND ) */
307
308 /* The outputs will be */
309
310 /* CLKID = -77 */
311 /* FOUND = .TRUE. */
312
313 /* $ Restrictions */
314
315 /* None. */
316
317 /* $ Literature_References */
318
319 /* None. */
320
321 /* $ Author_and_Institution */
322
323 /* N.J. Bachman (JPL) */
324
325 /* $ Version */
326
327 /* - SPICELIB Version 1.2.0, 12-AUG-2001 (NJB) */
328
329 /* Bug fix: modified algorithm to handle case where string */
330 /* "SCLK" appears in SCLK name. */
331
332 /* - SPICELIB Version 1.1.0, 25-FEB-2000 (NJB) */
333
334 /* Updated to use BODTRN for SCLK name/code mapping. */
335
336 /* - Beta Version 1.0.0, 17-NOV-1995 (NJB) */
337
338
339 /* -& */
340 /* $ Index_Entries */
341
342 /* convert an SCLK name to an SCLK ID code */
343
344 /* -& */
345 /* $ Revisions */
346
347 /* - SPICELIB Version 1.2.0, 29-OCT-2001 (NJB) */
348
349 /* Bug fix: modified algorithm to handle case where string */
350 /* "SCLK" appears in SCLK name. SCN2ID now uses POSR to locate */
351 /* the substring "SCLK" in the input string. */
352
353 /* -& */
354
355 /* Convert name to upper case. */
356
357 ucase_(clknam, tmpnam, clknam_len, (ftnlen)32);
358
359 /* Remove the final occurrence of the string 'SCLK' from */
360 /* the input name. */
361
362 i__1 = rtrim_(tmpnam, (ftnlen)32);
363 loc = posr_(tmpnam, "SCLK", &i__1, (ftnlen)32, (ftnlen)4);
364 if (loc > 0) {
365 s_copy(tmpnam + (loc - 1), " ", (ftnlen)4, (ftnlen)1);
366 }
367 bodn2c_(tmpnam, clkid, found, (ftnlen)32);
368 return 0;
369 /* $Procedure SCID2N ( SCLK ID code to name ) */
370
371 L_scid2n:
372 /* $ Abstract */
373
374 /* Convert a NAIF integer code for a spacecraft clock to an SCLK name */
375 /* string. */
376
377 /* $ Disclaimer */
378
379 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
380 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
381 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
382 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
383 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
384 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
385 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
386 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
387 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
388 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
389
390 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
391 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
392 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
393 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
394 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
395 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
396
397 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
398 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
399 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
400 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
401
402 /* $ Required_Reading */
403
404 /* SCLK */
405
406 /* $ Keywords */
407
408 /* CONVERSION */
409 /* PARSING */
410 /* SCLK */
411 /* TIME */
412 /* UTILITY */
413
414 /* $ Declarations */
415
416 /* INTEGER CLKID */
417 /* CHARACTER*(*) CLKNAM */
418 /* LOGICAL FOUND */
419
420 /* $ Brief_I/O */
421
422 /* Variable I/O Description */
423 /* -------- --- -------------------------------------------------- */
424 /* CLKID I NAIF integer code of spacecraft clock. */
425 /* CLKNAM O String giving spacecraft clock name. */
426 /* FOUND O Flag indicating whether item was found. */
427
428 /* $ Detailed_Input */
429
430 /* CLKID is the NAIF integer code of a spacecraft clock of */
431 /* interest. */
432
433 /* $ Detailed_Output */
434
435 /* CLKNAM is a short, human-readable string identifying */
436 /* the specified spacecraft clock. The returned */
437 /* string has the form */
438
439 /* <spacecraft name or acronym> SCLK */
440
441 /* where the spacecraft name is the same string */
442 /* returned by BODC2N when CLKID is supplied as the */
443 /* input code. */
444
445 /* CLKNAM is defined only if the output flag FOUND is */
446 /* returned .TRUE. */
447
448 /* FOUND is a logical flag indicating whether the input */
449 /* code specified a clock known to this routine. */
450
451 /* $ Parameters */
452
453 /* None. */
454
455 /* $ Exceptions */
456
457 /* Error free. */
458
459 /* 1) If the input code is not recognized, FOUND is set to .FALSE. */
460 /* CLKNAM is not modified. */
461
462 /* 2) If the input code is recognized but does not refer to a */
463 /* spacecraft, no error is signaled. For example, the code */
464 /* 5 maps to the string 'JUPITER BARYCENTER SCLK'. */
465
466 /* $ Files */
467
468 /* None. */
469
470 /* $ Particulars */
471
472 /* This routine converts a NAIF spacecraft clock code to a human- */
473 /* readable string. This function is useful for constructing */
474 /* messages. */
475
476 /* $ Examples */
477
478 /* 1) Look up the spacecraft clock name for code -77. */
479
480 /* CALL SCID2N ( -77, CLKNAM, FOUND ) */
481
482 /* The outputs will be */
483
484 /* CLKNAM = 'GALILEO ORBITER SCLK' */
485 /* FOUND = .TRUE. */
486
487 /* $ Restrictions */
488
489 /* None. */
490
491 /* $ Literature_References */
492
493 /* None. */
494
495 /* $ Author_and_Institution */
496
497 /* N.J. Bachman (JPL) */
498
499 /* $ Version */
500
501 /* - SPICELIB Version 1.1.0, 25-FEB-2000 (NJB) */
502
503 /* Updated to use BODTRN for SCLK name/code mapping. */
504
505 /* - Beta Version 1.0.0, 17-NOV-1995 (NJB) */
506
507
508 /* -& */
509 /* $ Index_Entries */
510
511 /* convert an SCLK name to an SCLK ID code */
512
513 /* -& */
514 bodc2n_(clkid, clknam, found, clknam_len);
515 if (! (*found)) {
516 return 0;
517 }
518 suffix_("SCLK", &c__1, clknam, (ftnlen)4, clknam_len);
519 return 0;
520 } /* sctran_ */
521
sctran_(char * clknam,integer * clkid,logical * found,ftnlen clknam_len)522 /* Subroutine */ int sctran_(char *clknam, integer *clkid, logical *found,
523 ftnlen clknam_len)
524 {
525 return sctran_0_(0, clknam, clkid, found, clknam_len);
526 }
527
scn2id_(char * clknam,integer * clkid,logical * found,ftnlen clknam_len)528 /* Subroutine */ int scn2id_(char *clknam, integer *clkid, logical *found,
529 ftnlen clknam_len)
530 {
531 return sctran_0_(1, clknam, clkid, found, clknam_len);
532 }
533
scid2n_(integer * clkid,char * clknam,logical * found,ftnlen clknam_len)534 /* Subroutine */ int scid2n_(integer *clkid, char *clknam, logical *found,
535 ftnlen clknam_len)
536 {
537 return sctran_0_(2, clknam, clkid, found, clknam_len);
538 }
539
540