1 /* trcpkg.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__5 = 5;
11 static integer c__3 = 3;
12 static integer c__1 = 1;
13 static integer c__0 = 0;
14
15 /* $Procedure TRCPKG ( Trace package ) */
trcpkg_0_(int n__,integer * depth,integer * index,char * module,char * trace,char * name__,ftnlen module_len,ftnlen trace_len,ftnlen name_len)16 /* Subroutine */ int trcpkg_0_(int n__, integer *depth, integer *index, char *
17 module, char *trace, char *name__, ftnlen module_len, ftnlen
18 trace_len, ftnlen name_len)
19 {
20 /* Initialized data */
21
22 static logical notrc = FALSE_;
23 static integer frzcnt = 0;
24 static integer frzovr = 0;
25 static integer maxdep = 0;
26 static integer modcnt = 0;
27 static integer ovrflw = 0;
28
29 /* System generated locals */
30 address a__1[5], a__2[3];
31 integer i__1, i__2, i__3[5], i__4[3], i__5;
32 char ch__1[149], ch__2[64];
33
34 /* Builtin functions */
35 integer s_rnge(char *, integer, char *, integer);
36 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
37 integer i_len(char *, ftnlen), s_cmp(char *, char *, ftnlen, ftnlen);
38 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
39
40 /* Local variables */
41 integer i__, l;
42 static char stack[32*100];
43 integer first;
44 extern integer rtrim_(char *, ftnlen);
45 extern logical failed_(void);
46 char device[255];
47 extern /* Subroutine */ int getact_(integer *);
48 integer action;
49 extern /* Subroutine */ int getdev_(char *, ftnlen);
50 char tmpnam[80];
51 extern integer frstnb_(char *, ftnlen);
52 extern /* Subroutine */ int wrline_(char *, char *, ftnlen, ftnlen);
53 static char frozen[32*100];
54 extern /* Subroutine */ int suffix_(char *, integer *, char *, ftnlen,
55 ftnlen);
56 char string[11];
57 extern /* Subroutine */ int intstr_(integer *, char *, ftnlen);
58
59 /* $ Abstract */
60
61 /* Maintain a trace of subroutine calls for error messages. */
62
63 /* $ Disclaimer */
64
65 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
66 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
67 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
68 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
69 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
70 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
71 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
72 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
73 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
74 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
75
76 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
77 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
78 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
79 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
80 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
81 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
82
83 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
84 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
85 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
86 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
87
88 /* $ Required_Reading */
89
90 /* ERROR */
91
92 /* $ Keywords */
93
94 /* ERROR */
95
96 /* $ Declarations */
97 /* $ Brief_I/O */
98
99 /* VARIABLE I/O ENTRY */
100 /* -------- --- -------------------------------------------------- */
101
102 /* DEPTH O TRCDEP */
103 /* DEPTH O TRCMXD */
104 /* INDEX I TRCNAM */
105 /* NAME O TRCNAM */
106 /* MODULE I CHKIN, CHKOUT */
107 /* TRACE O QCKTRC */
108
109 /* FILEN P */
110 /* NAMLEN P */
111 /* MAXMOD P */
112
113 /* $ Detailed_Input */
114
115 /* See the ENTRY points for discussions of their arguments. */
116
117 /* $ Detailed_Output */
118
119 /* See the ENTRY points for discussions of their arguments. */
120
121 /* $ Parameters */
122
123 /* FILEN is the maximum length of a file name. */
124
125 /* NAMLEN is the maximum length of the significant */
126 /* portion of a module name. */
127
128 /* MAXMOD is the maximum storage depth for names in the */
129 /* traceback stack. */
130
131 /* $ Exceptions */
132
133 /* 1) If TRCPKG is called directly, the error SPICE(BOGUSENTRY) is */
134 /* signaled. */
135
136 /* $ Files */
137
138 /* None. */
139
140 /* $ Particulars */
141
142 /* The entry points declared in this routine are: */
143
144 /* CHKIN */
145 /* CHKOUT */
146 /* TRCDEP */
147 /* TRCMXD */
148 /* TRCNAM */
149 /* QCKTRC */
150 /* FREEZE */
151 /* TRCOFF */
152
153 /* This routine serves as an umbrella that allows the entry */
154 /* points to share data. TRCPKG should never be called directly. */
155
156 /* See the subroutine ERRACT for descriptions of the error actions */
157 /* and codes. */
158
159 /* $ Examples */
160
161 /* See the entry points CHKIN, CHKOUT, TRCDEP, TRCMXD, TRCNAM, */
162 /* QCKTRC, FREEZE, and TRCOFF for examples. */
163
164 /* $ Restrictions */
165
166 /* None. */
167
168 /* $ Literature_References */
169
170 /* None. */
171
172 /* $ Author_and_Institution */
173
174 /* N.J. Bachman (JPL) */
175 /* K.R. Gehringer (JPL) */
176 /* H.A. Neilan (JPL) */
177 /* B.V. Semenov (JPL) */
178
179 /* $ Version */
180
181 /* - SPICELIB Version 4.26.0, 10-MAR-2014 (BVS) */
182
183 /* Updated for SUN-SOLARIS-64BIT-INTEL. */
184
185 /* - SPICELIB Version 4.25.0, 10-MAR-2014 (BVS) */
186
187 /* Updated for PC-LINUX-64BIT-IFORT. */
188
189 /* - SPICELIB Version 4.24.0, 10-MAR-2014 (BVS) */
190
191 /* Updated for PC-CYGWIN-GFORTRAN. */
192
193 /* - SPICELIB Version 4.23.0, 10-MAR-2014 (BVS) */
194
195 /* Updated for PC-CYGWIN-64BIT-GFORTRAN. */
196
197 /* - SPICELIB Version 4.22.0, 10-MAR-2014 (BVS) */
198
199 /* Updated for PC-CYGWIN-64BIT-GCC_C. */
200
201 /* - SPICELIB Version 4.21.0, 29-JUL-2013 (BVS) */
202
203 /* Changed logic in the CHKIN and CHKOUT entries to check if the */
204 /* first character of the input value is not a space and, if so, */
205 /* bypass the call to FRSTNB. This change speeds up the execution */
206 /* by ~20%. */
207
208 /* - SPICELIB Version 4.20.0, 13-MAY-2010 (BVS) */
209
210 /* Updated for SUN-SOLARIS-INTEL. */
211
212 /* - SPICELIB Version 4.19.0, 13-MAY-2010 (BVS) */
213
214 /* Updated for SUN-SOLARIS-INTEL-CC_C. */
215
216 /* - SPICELIB Version 4.18.0, 13-MAY-2010 (BVS) */
217
218 /* Updated for SUN-SOLARIS-INTEL-64BIT-CC_C. */
219
220 /* - SPICELIB Version 4.17.0, 13-MAY-2010 (BVS) */
221
222 /* Updated for SUN-SOLARIS-64BIT-NATIVE_C. */
223
224 /* - SPICELIB Version 4.16.0, 13-MAY-2010 (BVS) */
225
226 /* Updated for PC-WINDOWS-64BIT-IFORT. */
227
228 /* - SPICELIB Version 4.15.0, 13-MAY-2010 (BVS) */
229
230 /* Updated for PC-LINUX-64BIT-GFORTRAN. */
231
232 /* - SPICELIB Version 4.14.0, 13-MAY-2010 (BVS) */
233
234 /* Updated for PC-64BIT-MS_C. */
235
236 /* - SPICELIB Version 4.13.0, 13-MAY-2010 (BVS) */
237
238 /* Updated for MAC-OSX-64BIT-INTEL_C. */
239
240 /* - SPICELIB Version 4.12.0, 13-MAY-2010 (BVS) */
241
242 /* Updated for MAC-OSX-64BIT-IFORT. */
243
244 /* - SPICELIB Version 4.11.0, 13-MAY-2010 (BVS) */
245
246 /* Updated for MAC-OSX-64BIT-GFORTRAN. */
247
248 /* - SPICELIB Version 4.10.0, 18-MAR-2009 (BVS) */
249
250 /* Updated for PC-LINUX-GFORTRAN. */
251
252 /* - SPICELIB Version 4.9.0, 18-MAR-2009 (BVS) */
253
254 /* Updated for MAC-OSX-GFORTRAN. */
255
256 /* - SPICELIB Version 4.8.0, 19-FEB-2008 (BVS) */
257
258 /* Updated for PC-LINUX-IFORT. */
259
260 /* - SPICELIB Version 4.7.0, 14-NOV-2006 (BVS) */
261
262 /* Updated for PC-LINUX-64BIT-GCC_C. */
263
264 /* - SPICELIB Version 4.6.0, 14-NOV-2006 (BVS) */
265
266 /* Updated for MAC-OSX-INTEL_C. */
267
268 /* - SPICELIB Version 4.5.0, 14-NOV-2006 (BVS) */
269
270 /* Updated for MAC-OSX-IFORT. */
271
272 /* - SPICELIB Version 4.4.0, 14-NOV-2006 (BVS) */
273
274 /* Updated for PC-WINDOWS-IFORT. */
275
276 /* - SPICELIB Version 4.3.0, 26-OCT-2005 (BVS) */
277
278 /* Updated for SUN-SOLARIS-64BIT-GCC_C. */
279
280 /* - SPICELIB Version 4.2.0, 03-JAN-2005 (BVS) */
281
282 /* Updated for PC-CYGWIN_C. */
283
284 /* - SPICELIB Version 4.1.0, 03-JAN-2005 (BVS) */
285
286 /* Updated for PC-CYGWIN. */
287
288 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
289
290 /* Added MAC-OSX environments. */
291
292 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
293
294 /* The environment lines were expanded so that the supported */
295 /* environments are now explicitly given. New */
296 /* environments are WIN-NT */
297
298 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
299
300 /* CSPICE environments were added. Some typos were corrected. */
301
302 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
303
304 /* The environment lines were expanded so that the supported */
305 /* environments are now explicitly given. New */
306 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
307
308 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
309
310 /* The environment lines were expanded so that the supported */
311 /* environments are now explicitly given. Previously, */
312 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
313 /* by the environment label SUN. */
314
315 /* - SPICELIB Version 4.0.0, 07-APR-1998 (NJB) */
316
317 /* Module was updated for the PC-LINUX platform. */
318
319 /* Bug fix: the previous version of entry point CHKOUT failed to */
320 /* make a correct module name comparison when the input name */
321 /* exceeded NAMLEN characters in length. Now only the initial */
322 /* NAMLEN non-blank characters (at most) of the input name are */
323 /* used in the comparison. */
324
325 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
326
327 /* The structure of this routine has completely changed. A stack, */
328 /* implemented as an array of character strings, is now used to */
329 /* store subroutine names that use the CHKIN and CHKOUT entry */
330 /* points. This change simplified the individual entry points as */
331 /* well as speeding up the process of checking in and checking */
332 /* out. */
333
334 /* The error action mechanism has been changed as well. GETACT */
335 /* now uses an integer code rather than a short character */
336 /* string to represent the error action. The entry points affected */
337 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
338
339 /* - SPICELIB Version 2.0.0, 11-NOV-1993 (HAN) */
340
341 /* Module was updated to include the values for FILEN and */
342 /* NAMLEN for the Silicon Graphics, DEC Alpha-OSF/1, and */
343 /* NeXT platforms. The previous value of 256 for Unix */
344 /* platforms was changed to 255. */
345
346 /* - SPICELIB Version 1.3.0, 23-OCT-1992 (NJB) */
347
348 /* Bug fix made to routine QCKTRC: a section of code which */
349 /* itself is exercised only if a bug is present inserted the */
350 /* wrong variable into an error message. */
351
352 /* - SPICELIB Version 1.2.0, 12-OCT-1992 (HAN) */
353
354 /* Module was updated to include the values of the parameters */
355 /* for the Hewlett Packard UX 9000/750 environment. */
356
357 /* - SPICELIB Version 1.1.1, 10-MAR-1992 (WLT) */
358
359 /* Comment section for permuted index source lines was added */
360 /* following the header. */
361
362 /* - SPICELIB Version 1.1.0, 18-JUN-1990 (NJB) */
363
364 /* Added declarations for trace disabling. Re-organized */
365 /* declarations. Updated comments. */
366
367 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
368
369 /* -& */
370 /* $ Index_Entries */
371
372 /* None. */
373
374 /* -& */
375 /* $ Revisions */
376
377 /* - SPICELIB Version 4.0.0, 07-APR-1998 (NJB) */
378
379 /* Module was updated for the PC-LINUX platform. */
380
381 /* Bug fix: the previous version of entry point CHKOUT failed to */
382 /* make a correct module name comparison when the input name */
383 /* exceeded NAMLEN characters in length. Now only the initial */
384 /* NAMLEN non-blank characters (at most) of the input name are */
385 /* used in the comparison. */
386
387 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
388
389 /* The structure of this routine has completely changed. A stack, */
390 /* implemented as an array of character strings, is now used to */
391 /* store subroutine names that use the CHKIN and CHKOUT entry */
392 /* points. This change simplified the individual entry points as */
393 /* well as speeding up the process of checking in and checking */
394 /* out. */
395
396 /* The error action mechanism has been changed as well. GETACT */
397 /* now uses an integer code rather than a short character */
398 /* string to represent the error action. The entry points affected */
399 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
400
401 /* - SPICELIB Version 2.0.0, 11-NOV-1993 (HAN) */
402
403 /* Module was updated to include the values for FILEN and */
404 /* NAMLEN for the Silicon Graphics, DEC Alpha-OSF/1, and */
405 /* NeXT platforms. The previous value of 256 for Unix */
406 /* platforms was changed to 255. */
407
408 /* - SPICELIB Version 1.3.0, 23-OCT-1992 (NJB) */
409
410 /* Bug fix made to routine QCKTRC: a section of code which */
411 /* itself is exercised only if a bug is present inserted the */
412 /* wrong variable into an error message. */
413
414 /* - SPICELIB Version 1.2.0, 12-OCT-1992 (HAN) */
415
416 /* Module was updated to include the values of the parameters */
417 /* for the Hewlett Packard UX 9000/750 environment. */
418
419 /* The code was also reformatted so that a utility program can */
420 /* create the source file for a specific environment given a */
421 /* master source file. */
422
423
424 /* - SPICELIB Version 1.1.0, 18-JUN-1990 (NJB) */
425
426 /* Added declarations for trace disabling. Re-organized */
427 /* declarations. Updated comments to reflect inclusion */
428 /* of the new entry point TRCOFF. Also updated the header */
429 /* to make the style more parallel to other SPICELIB */
430 /* umbrella routines. Updated the description line and */
431 /* abstract, in particular. */
432
433 /* - Beta Version 1.0.1, 08-FEB-1989 (NJB) */
434
435 /* Warnings added to discourage use of this routine. */
436
437 /* -& */
438
439 /* SPICELIB functions: */
440
441
442 /* Local parameters */
443
444 /* This is the length for a local temporary string used to help */
445 /* format error messages. It and the character string are only */
446 /* present to avoid real or potential problems with pedantic */
447 /* FORTRAN compilers. 80 characters should be more than sufficient */
448 /* to contain a module name. */
449
450
451 /* The integer mnemonic for the RETURN error action. */
452
453
454 /* Local Variables: */
455
456
457 /* Saved variables: */
458
459
460 /* Initial values: */
461
462 switch(n__) {
463 case 1: goto L_chkin;
464 case 2: goto L_chkout;
465 case 3: goto L_trcdep;
466 case 4: goto L_trcmxd;
467 case 5: goto L_trcnam;
468 case 6: goto L_qcktrc;
469 case 7: goto L_freeze;
470 case 8: goto L_trcoff;
471 }
472
473
474 /* Executable Code: */
475
476 wrline_("SCREEN", "SPICE(BOGUSENTRY)", (ftnlen)6, (ftnlen)17);
477 wrline_("SCREEN", "TRCPKG: You have called an entry that performs no run"
478 "-time function. ", (ftnlen)6, (ftnlen)69);
479 return 0;
480 /* $Procedure CHKIN ( Module Check In ) */
481
482 L_chkin:
483 /* $ Abstract */
484
485 /* Inform the SPICELIB error handling mechanism of entry into a */
486 /* routine. */
487
488 /* $ Disclaimer */
489
490 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
491 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
492 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
493 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
494 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
495 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
496 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
497 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
498 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
499 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
500
501 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
502 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
503 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
504 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
505 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
506 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
507
508 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
509 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
510 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
511 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
512
513 /* $ Required_Reading */
514
515 /* ERROR */
516
517 /* $ Keywords */
518
519 /* ERROR */
520
521 /* $ Declarations */
522
523 /* CHARACTER*(*) MODULE */
524
525 /* $ Brief_I/O */
526
527 /* VARIABLE I/O DESCRIPTION */
528 /* -------- --- --------------------------------------------------- */
529 /* MODULE I The name of the calling routine. */
530 /* FILEN P Maximum length of file name. */
531
532 /* $ Detailed_Input */
533
534 /* MODULE is the name of the routine calling CHKIN. The */
535 /* named routine is supposed to be `checking in' */
536 /* when it calls CHKIN; that is, the call should be */
537 /* the first executable statement following the */
538 /* reference to the function RETURN (which should be */
539 /* the first executable statement). */
540
541 /* Only the first NAMLEN non-blank characters in */
542 /* a module name are stored for use in a traceback */
543 /* by this subroutine. */
544
545 /* $ Detailed_Output */
546
547 /* None. */
548
549 /* $ Parameters */
550
551 /* FILEN is the maximum file name length that can be */
552 /* accommodated by this routine. */
553
554 /* $ Exceptions */
555
556 /* CHKIN does not signal errors; rather it writes error messages, */
557 /* so as to avoid recursion. */
558
559
560 /* 1) If the traceback storage area overflows, the short error */
561 /* message SPICE(TRACEBACKOVERFLOW) is written to the error */
562 /* output device. */
563
564 /* 2) If the input argument MODULE is blank, the short error message */
565 /* SPICE(BLANKMODULENAME) is written to the error output device. */
566
567 /* $ Files */
568
569 /* None. */
570
571 /* $ Particulars */
572
573 /* This routine is part of the SPICELIB error handling mechanism. */
574
575 /* Conceptually, the effect of this routine is to `push' the */
576 /* supplied module name onto a stack. The routine CHKOUT performs */
577 /* the inverse, or `pop', operation. */
578
579 /* Every routine that participates in the traceback scheme should */
580 /* have a call to CHKIN as the second executable statement. The */
581 /* first executable statements should be: */
582
583 /* IF ( RETURN() ) THEN */
584 /* RETURN */
585 /* ELSE */
586 /* CALL CHKIN ( module ) */
587 /* END IF */
588
589 /* Here module is the name of the routine in which this code appears. */
590
591 /* The line of code preceding the END or any RETURN statement should */
592 /* be */
593
594 /* CALL CHKOUT ( module ) */
595
596
597 /* All SPICELIB routines should call CHKIN and CHKOUT, unless they */
598 /* are classified as `error free'. Programs linked with SPICELIB */
599 /* may also use CHKIN and CHKOUT. */
600
601 /* Routines that don't call CHKIN and CHKOUT won't appear in the */
602 /* traceback. */
603
604 /* All routines that call CHKIN must also call CHKOUT, or else the */
605 /* trace mechanism will become very confused. */
606
607 /* It is possible to disable check-ins (and check-outs) by calling */
608 /* the entry point TRCOFF. CHKIN and CHKOUT will return immediately */
609 /* upon entry after TRCOFF has been called. It is not possible to */
610 /* re-enable check-ins and check-outs after calling TRCOFF. Routines */
611 /* that don't call CHKIN and CHKOUT won't appear in the traceback. */
612
613 /* $ Examples */
614
615 /* See `Particulars' for an example of how to call this routine. */
616
617 /* $ Restrictions */
618
619 /* Routines that call this routine must call CHKOUT immediately */
620 /* prior to any RETURN or END statement. */
621
622 /* Module names are assumed to have no embedded blanks. */
623
624 /* $ Literature_References */
625
626 /* None. */
627
628 /* $ Author_and_Institution */
629
630 /* K.R. Gehringer (JPL) */
631 /* N.J. Bachman (JPL) */
632 /* B.V. Semenov (JPL) */
633
634 /* $ Version */
635
636 /* - SPICELIB Version 4.1.0, 29-JUL-2013 (BVS) */
637
638 /* Changed logic to check if the first character of the input */
639 /* value is not a space and, if so, bypass the call to FRSTNB. */
640 /* This change speeds up the execution by ~20%. */
641
642 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
643
644 /* Added MAC-OSX environments. */
645
646 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
647
648 /* The environment lines were expanded so that the supported */
649 /* environments are now explicitly given. New */
650 /* environments are WIN-NT */
651
652 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
653
654 /* CSPICE environments were added. Some typos were corrected. */
655
656 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
657
658 /* The environment lines were expanded so that the supported */
659 /* environments are now explicitly given. New */
660 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
661
662 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
663
664 /* The environment lines were expanded so that the supported */
665 /* environments are now explicitly given. Previously, */
666 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
667 /* by the environment label SUN. */
668
669 /* - SPICELIB Version 4.0.0, 07-APR-1998 (NJB) */
670
671 /* Module was updated for the PC-LINUX platform. */
672
673 /* Bug fix: the previous version of entry point CHKOUT failed to */
674 /* make a correct module name comparison when the input name */
675 /* exceeded NAMLEN characters in length. Now only the initial */
676 /* NAMLEN non-blank characters (at most) of the input name are */
677 /* used in the comparison. */
678
679 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
680
681 /* The structure of this routine has completely changed. A stack, */
682 /* implemented as an array of character strings, is now used to */
683 /* store subroutine names that use the CHKIN and CHKOUT entry */
684 /* points. This change simplified the individual entry points as */
685 /* well as speeding up the process of checking in and checking */
686 /* out. */
687
688 /* The short error dealing with embedded blanks has been removed, */
689 /* since the new implementation is not hampered by Embedded */
690 /* blanks. */
691
692 /* - SPICELIB Version 2.0.1, 10-MAR-1992 (WLT) */
693
694 /* Comment section for permuted index source lines was added */
695 /* following the header. */
696
697 /* - SPICELIB Version 2.0.0, 15-JUN-1990 (NJB) */
698
699 /* Disabling of check-ins implemented. Many parts of the */
700 /* header have be re-written. Weird spacing ameliorated. */
701
702 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
703
704 /* -& */
705 /* $ Index_Entries */
706
707 /* module check in */
708
709 /* -& */
710 /* $ Revisions */
711
712 /* - SPICELIB Version 4.0.0, 07-APR-1998 (NJB) */
713
714 /* Module was updated for the PC-LINUX platform. */
715
716 /* Bug fix: the previous version of entry point CHKOUT failed to */
717 /* make a correct module name comparison when the input name */
718 /* exceeded NAMLEN characters in length. Now only the initial */
719 /* NAMLEN non-blank characters (at most) of the input name are */
720 /* used in the comparison. */
721
722 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
723
724 /* The structure of this routine has completely changed. A stack, */
725 /* implemented as an array of character strings, is now used to */
726 /* store subroutine names that use the CHKIN and CHKOUT entry */
727 /* points. This change simplified the individual entry points as */
728 /* well as speeding up the process of checking in and checking */
729 /* out. */
730
731 /* The short error dealing with embedded blanks has been removed, */
732 /* since the new implementation is not hampered by Embedded */
733 /* blanks. */
734
735 /* - SPICELIB Version 2.0.0, 15-JUN-1990 (NJB) */
736
737 /* Disabling of check-ins implemented. Many parts of the */
738 /* header have be re-written. Weird spacing ameliorated. */
739
740 /* - Beta Version 1.1.1, 10-FEB-1988 (NJB) */
741
742 /* Parameter declarations documented. Parameters section added, */
743 /* and parameter declarations listed in `Brief I/O'. */
744
745 /* - Beta Version 1.1.0, 27-OCT-1988 (NJB) */
746
747 /* Cosmetic improvement to code. Condensed a continued */
748 /* statement into one line. */
749
750 /* -& */
751
752 /* Get out immediately if tracing is disabled. */
753
754 if (notrc) {
755 return 0;
756 }
757
758 /* Get the position of the first and last non-blank characters in */
759 /* input module name, and set the length of the module name. */
760
761 if (*(unsigned char *)module != ' ') {
762 first = 1;
763 } else {
764 first = frstnb_(module, module_len);
765 }
766
767 /* Check to see if the module name is blank. */
768
769 if (first > 0) {
770
771 /* If there is room for the name, place it at the top of the */
772 /* stack. If not, increment the overflow counter and signal an */
773 /* error. */
774
775 if (modcnt < 100) {
776 ++modcnt;
777 s_copy(stack + (((i__1 = modcnt - 1) < 100 && 0 <= i__1 ? i__1 :
778 s_rnge("stack", i__1, "trcpkg_", (ftnlen)785)) << 5),
779 module + (first - 1), (ftnlen)32, module_len - (first - 1)
780 );
781 } else {
782 ++ovrflw;
783 getdev_(device, (ftnlen)255);
784 wrline_(device, "SPICE(TRACEBACKOVERFLOW)", (ftnlen)255, (ftnlen)
785 24);
786 wrline_(device, "CHKIN: The trace storage is completely full. "
787 "No further module names can be added.", (ftnlen)255, (
788 ftnlen)84);
789 }
790
791 /* Keep track of the maximum depth encountered. */
792
793 if (modcnt + ovrflw > maxdep) {
794 maxdep = modcnt + ovrflw;
795 }
796 } else {
797 getdev_(device, (ftnlen)255);
798 wrline_(device, "SPICE(BLANKMODULENAME)", (ftnlen)255, (ftnlen)22);
799 wrline_(device, "CHKIN: An attempt to check in was made without sup"
800 "plying a module name.", (ftnlen)255, (ftnlen)72);
801 }
802
803 /* We're done now, so return. */
804
805 return 0;
806 /* $Procedure CHKOUT ( Module Check Out ) */
807
808 L_chkout:
809 /* $ Abstract */
810
811 /* Inform the SPICELIB error handling mechanism of exit from a */
812 /* routine. */
813
814 /* $ Disclaimer */
815
816 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
817 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
818 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
819 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
820 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
821 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
822 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
823 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
824 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
825 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
826
827 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
828 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
829 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
830 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
831 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
832 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
833
834 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
835 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
836 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
837 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
838
839 /* $ Required_Reading */
840
841 /* ERROR */
842
843 /* $ Keywords */
844
845 /* ERROR */
846
847 /* $ Declarations */
848
849 /* CHARACTER*(*) MODULE */
850
851 /* $ Brief_I/O */
852
853 /* VARIABLE I/O DESCRIPTION */
854 /* -------- --- -------------------------------------------------- */
855 /* MODULE I The name of the calling routine. */
856 /* NAMLEN P Maximum module name length. */
857 /* FILEN P Maximum file name length. */
858
859 /* $ Detailed_Input */
860
861 /* MODULE is the name of the routine calling CHKOUT. The */
862 /* named routine is supposed to be `checking out' */
863 /* when it calls CHKOUT; that is, the call should be */
864 /* the last executable statement preceding any exit */
865 /* from the routine. */
866
867 /* Only the first NAMLEN non-blank characters in */
868 /* a module name are used when checking out. */
869
870 /* $ Detailed_Output */
871
872 /* None. */
873
874 /* $ Parameters */
875
876 /* FILEN is the maximum file name length that can be */
877 /* accommodated by this routine. */
878
879 /* NAMLEN is the maximum module name length that can be */
880 /* accommodated by this routine. */
881
882 /* $ Exceptions */
883
884 /* CHKOUT does not signal errors; rather it writes error messages, */
885 /* so as to avoid recursion. */
886
887 /* 1) If the input module name MODULE does not match the name popped */
888 /* from the trace stack, the short error message */
889 /* SPICE(NAMESDONOTMATCH) is written to the error output device. */
890
891 /* 2) If the trace stack is empty, the short error message */
892 /* SPICE(TRACESTACKEMPTY) is written to the error output device. */
893
894 /* $ Files */
895
896 /* None. */
897
898 /* $ Particulars */
899
900 /* This routine is part of the SPICELIB error handling mechanism. */
901
902 /* Conceptually, the effect of this routine is to `pop' a module */
903 /* name from a stack. The routine CHKIN performs the inverse, or */
904 /* `push' operation. */
905
906 /* Every routine that participates in the traceback scheme should */
907 /* have a call to CHKIN as the second executable statement. */
908 /* The first executable statements should be: */
909
910 /* IF ( RETURN() ) THEN */
911 /* RETURN */
912 /* ELSE */
913 /* CALL CHKIN ( module ) */
914 /* END IF */
915
916 /* Here module is the name of the routine in which this code appears. */
917
918 /* The line of code preceding the END or any RETURN statement */
919 /* should be */
920
921 /* CALL CHKOUT ( module ) */
922
923 /* All SPICELIB routines should call CHKIN and CHKOUT, unless they */
924 /* are classified as `error free'. Programs linked with SPICELIB */
925 /* may also use CHKIN and CHKOUT. */
926
927 /* Routines that don't call CHKIN and CHKOUT won't appear in the */
928 /* traceback. */
929
930 /* All routines that call CHKIN must also call CHKOUT, or else the */
931 /* trace mechanism will become very confused. */
932
933 /* It is possible to disable check-ins (and check-outs) by calling */
934 /* the entry point TRCOFF. CHKIN and CHKOUT will return immediately */
935 /* upon entry after TRCOFF has been called. It is not possible to */
936 /* re-enable check-ins and check-outs after calling TRCOFF. Routines */
937 /* that don't call CHKIN and CHKOUT won't appear in the traceback. */
938
939 /* $ Examples */
940
941 /* 1) Call CHKOUT before a RETURN statement: */
942
943 /* IF ( FAILED() ) THEN */
944 /* CALL CHKOUT ( module ) */
945 /* RETURN */
946 /* END IF */
947
948
949 /* 2) Call CHKOUT before an END statement: */
950
951 /* CALL CHKOUT ( module ) */
952 /* END */
953
954
955 /* 3) Only ONE call to CHKOUT is needed here: */
956
957 /* CALL CHKOUT ( module ) */
958 /* RETURN */
959 /* END */
960
961 /* $ Restrictions */
962
963 /* Routines that call this routine must call CHKIN as the second */
964 /* executable statement. (The first is a call to RETURN). */
965
966 /* $ Literature_References */
967
968 /* None. */
969
970 /* $ Author_and_Institution */
971
972 /* N.J. Bachman (JPL) */
973 /* K.R. Gehringer (JPL) */
974 /* B.V. Semenov (JPL) */
975
976 /* $ Version */
977
978 /* - SPICELIB Version 4.1.0, 29-JUL-2013 (BVS) */
979
980 /* Changed logic to check if the first character of the input */
981 /* value is not a space and, if so, bypass the call to FRSTNB. */
982 /* This change speeds up the execution by ~20%. */
983
984 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
985
986 /* Added MAC-OSX environments. */
987
988 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
989
990 /* The environment lines were expanded so that the supported */
991 /* environments are now explicitly given. New */
992 /* environments are WIN-NT */
993
994 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
995
996 /* CSPICE environments were added. Some typos were corrected. */
997
998 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
999
1000 /* The environment lines were expanded so that the supported */
1001 /* environments are now explicitly given. New */
1002 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
1003
1004 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
1005
1006 /* The environment lines were expanded so that the supported */
1007 /* environments are now explicitly given. Previously, */
1008 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
1009 /* by the environment label SUN. */
1010
1011 /* - SPICELIB Version 4.0.0, 30-OCT-1997 (NJB) */
1012
1013 /* Module was updated for the PC-LINUX platform. */
1014
1015 /* Bug fix: The previous version failed to make a correct */
1016 /* module name comparison when the input name exceeded NAMLEN */
1017 /* characters in length. Now only the initial NAMLEN non-blank */
1018 /* characters (at most) of the input name are used in the */
1019 /* comparison. */
1020
1021 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
1022
1023 /* The structure of this routine has completely changed. A stack, */
1024 /* implemented as an array of character strings, is now used to */
1025 /* store subroutine names that use the CHKIN and CHKOUT entry */
1026 /* points. This change simplified the individual entry points as */
1027 /* well as speeding up the process of checking in and checking */
1028 /* out. */
1029
1030 /* - SPICELIB Version 2.0.1, 10-MAR-1992 (WLT) */
1031
1032 /* Comment section for permuted index source lines was added */
1033 /* following the header. */
1034
1035 /* - SPICELIB Version 2.0.0, 15-JUN-1990 (NJB) */
1036
1037 /* Disabling of check-ins implemented. Many parts of the */
1038 /* header have be re-written. Weird spacing ameliorated. */
1039 /* Removed a bug check. Short error messages made more */
1040 /* specific. */
1041
1042 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
1043
1044 /* -& */
1045 /* $ Index_Entries */
1046
1047 /* module check out */
1048
1049 /* -& */
1050 /* $ Revisions */
1051
1052 /* - SPICELIB Version 4.0.0, 30-OCT-1997 (NJB) */
1053
1054 /* Module was updated for the PC-LINUX platform. */
1055
1056 /* Bug fix: The previous version failed to make a correct */
1057 /* module name comparison when the input name exceeded NAMLEN */
1058 /* characters in length. Now only the initial NAMLEN non-blank */
1059 /* characters (at most) of the input name are used in the */
1060 /* comparison. */
1061
1062 /* - SPICELIB Version 3.0.0, 12-MAR-1996 (KRG) */
1063
1064 /* The structure of this routine has completely changed. A stack, */
1065 /* implemented as an array of character strings, is now used to */
1066 /* store subroutine names that use the CHKIN and CHKOUT entry */
1067 /* points. This change simplified the individual entry points as */
1068 /* well as speeding up the process of checking in and checking */
1069 /* out. */
1070
1071 /* - SPICELIB Version 2.0.0, 15-JUN-1990 (NJB) */
1072
1073 /* Disabling of check-ins implemented. Many parts of the */
1074 /* header have be re-written. Weird spacing ameliorated. */
1075 /* Removed a bug check. Short error messages changed from */
1076 /* SPICE(INVALIDCHECKOUT) to SPICE(NAMESDONOTMATCH) and */
1077 /* SPICE(TRACESTACKEMPTY). */
1078
1079 /* - Beta Version 1.1.1, 10-FEB-1988 (NJB) */
1080
1081 /* Parameter declarations documented. Parameters section added, */
1082 /* and parameter declarations listed in `Brief I/O'. */
1083
1084 /* - Beta Version 1.1.0, 27-OCT-1988 (NJB) */
1085
1086 /* Cosmetic improvement to code. Removed a blank line */
1087 /* separating the first line of a statement from the next */
1088 /* continuation line, and condensed and re-organized */
1089 /* the statement. Note: the precompiler failed to properly */
1090 /* convert the original statement into standard FORTRAN. */
1091
1092 /* -& */
1093
1094 /* Get out immediately if tracing is disabled. */
1095
1096 if (notrc) {
1097 return 0;
1098 }
1099
1100 /* Check to be sure we can remove a module name from the stack, */
1101 /* i.e., that we have not overflowed. */
1102
1103 if (ovrflw == 0) {
1104
1105 /* We are not in overflow mode, compare the module name on */
1106 /* the top of the stack with the module name passed to us. If */
1107 /* they differ, it's an error. Regardless, we decrement the */
1108 /* module count. */
1109
1110 if (modcnt > 0) {
1111
1112 /* Make the comparison using at most NAMLEN characters of the */
1113 /* initial non-blank sub-string of MODULE. */
1114
1115 if (*(unsigned char *)module != ' ') {
1116 first = 1;
1117 } else {
1118 first = frstnb_(module, module_len);
1119 }
1120 /* Computing MIN */
1121 i__1 = i_len(module, module_len), i__2 = first + 31;
1122 l = min(i__1,i__2);
1123 if (s_cmp(stack + (((i__1 = modcnt - 1) < 100 && 0 <= i__1 ? i__1
1124 : s_rnge("stack", i__1, "trcpkg_", (ftnlen)1144)) << 5),
1125 module + (first - 1), (ftnlen)32, l - (first - 1)) != 0) {
1126 s_copy(tmpnam, module + (first - 1), (ftnlen)80, module_len -
1127 (first - 1));
1128 getdev_(device, (ftnlen)255);
1129 wrline_(device, "SPICE(NAMESDONOTMATCH)", (ftnlen)255, (
1130 ftnlen)22);
1131 /* Writing concatenation */
1132 i__3[0] = 19, a__1[0] = "CHKOUT: Caller is ";
1133 i__3[1] = rtrim_(tmpnam, (ftnlen)80), a__1[1] = tmpnam;
1134 i__3[2] = 17, a__1[2] = "; popped name is ";
1135 i__3[3] = rtrim_(stack + (((i__2 = modcnt - 1) < 100 && 0 <=
1136 i__2 ? i__2 : s_rnge("stack", i__2, "trcpkg_", (
1137 ftnlen)1149)) << 5), (ftnlen)32), a__1[3] = stack + ((
1138 (i__1 = modcnt - 1) < 100 && 0 <= i__1 ? i__1 :
1139 s_rnge("stack", i__1, "trcpkg_", (ftnlen)1149)) << 5);
1140 i__3[4] = 1, a__1[4] = ".";
1141 s_cat(ch__1, a__1, i__3, &c__5, (ftnlen)149);
1142 wrline_(device, ch__1, (ftnlen)255, rtrim_(tmpnam, (ftnlen)80)
1143 + 36 + rtrim_(stack + (((i__2 = modcnt - 1) < 100 &&
1144 0 <= i__2 ? i__2 : s_rnge("stack", i__2, "trcpkg_", (
1145 ftnlen)1149)) << 5), (ftnlen)32) + 1);
1146 }
1147 --modcnt;
1148 } else {
1149 getdev_(device, (ftnlen)255);
1150 wrline_(device, "SPICE(TRACESTACKEMPTY)", (ftnlen)255, (ftnlen)22)
1151 ;
1152 wrline_(device, "CHKOUT: An attempt to check out was made when n"
1153 "o modules were checked in.", (ftnlen)255, (ftnlen)73);
1154 }
1155 } else {
1156
1157 /* Overflow case: just decrement the overflow count. */
1158
1159 --ovrflw;
1160 }
1161
1162 /* Return to the caller. */
1163
1164 return 0;
1165 /* $Procedure TRCDEP ( Traceback depth ) */
1166
1167 L_trcdep:
1168 /* $ Abstract */
1169
1170 /* Return the number of modules in the traceback representation. */
1171
1172 /* $ Disclaimer */
1173
1174 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1175 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1176 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1177 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1178 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1179 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1180 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1181 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1182 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1183 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1184
1185 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1186 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1187 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1188 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1189 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1190 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1191
1192 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1193 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1194 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1195 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1196
1197 /* $ Required_Reading */
1198
1199 /* ERROR */
1200
1201 /* $ Keywords */
1202
1203 /* ERROR */
1204
1205 /* $ Declarations */
1206
1207 /* INTEGER DEPTH */
1208
1209 /* $ Brief_I/O */
1210
1211 /* VARIABLE I/O DESCRIPTION */
1212 /* -------- --- --------------------------------------------------- */
1213
1214 /* DEPTH O The number of modules in the traceback. */
1215
1216 /* $ Detailed_Input */
1217
1218 /* None. */
1219
1220 /* $ Detailed_Output */
1221
1222 /* DEPTH Indicates the number of module names in the */
1223 /* traceback representation. */
1224
1225 /* The module names represent modules in a call chain, */
1226 /* with the first name being the top-level module, */
1227 /* and the name with index DEPTH being the lowest */
1228 /* level module. */
1229
1230 /* The meaning of the traceback depends on the state */
1231 /* of the error handling mechanism. There are two */
1232 /* cases: */
1233
1234 /* 1. In 'RETURN' mode, when an error is */
1235 /* signaled, the traceback at that point is */
1236 /* saved. TRCDEP, TRCNAM, and QCKTRC will */
1237 /* return values pertaining to the saved */
1238 /* traceback. */
1239
1240 /* 2. In all other modes, the traceback represents */
1241 /* the CURRENT call chain. TRCDEP, TRCNAM, */
1242 /* and QCKTRC will return values pertaining to */
1243 /* the current trace representation. */
1244
1245 /* $ Parameters */
1246
1247 /* None. */
1248
1249 /* $ Exceptions */
1250
1251 /* Error free. */
1252
1253 /* $ Files */
1254
1255 /* None. */
1256
1257 /* $ Particulars */
1258
1259 /* This routine is part of the SPICELIB error handling mechanism. */
1260
1261 /* $ Examples */
1262
1263 /* 1) You can use this routine, together with TRCNAM, to create a */
1264 /* traceback report. We might wish to create such a report when */
1265 /* we have detected an error condition (see FAILED). */
1266
1267 /* In this example, we assume that the error has already been */
1268 /* detected, and that we wish to create a traceback report. We */
1269 /* assume the existence of two user-supplied routines: */
1270
1271 /* USER_TRACE_FORMAT -- creates a traceback report in the */
1272 /* format preferred by the user */
1273
1274 /* USER_TRACE_INIT -- indicates that a traceback report */
1275 /* is to be created; it also */
1276 /* indicates how many module names */
1277 /* will be in the report */
1278
1279 /* C */
1280 /* C Get the trace depth, and retrieve that number of */
1281 /* C module names from the traceback representation. */
1282 /* C Call USER_TRACE_INIT to indicate that a traceback */
1283 /* C report is to be created containing `DEPTH' */
1284 /* C number of module names. Input each of these names, */
1285 /* C as they are retrieved, to USER_TRACE_FORMAT. */
1286 /* C */
1287
1288 /* CALL TRCDEP ( DEPTH ) */
1289
1290 /* CALL USER_TRACE_INIT ( DEPTH ) */
1291
1292
1293 /* DO INDEX = 1, DEPTH */
1294
1295 /* CALL TRCNAM ( INDEX, MODULE ) */
1296
1297 /* CALL USER_TRACE_FORMAT ( MODULE ) */
1298
1299 /* END DO */
1300
1301 /* $ Restrictions */
1302
1303 /* None. */
1304
1305 /* $ Literature_References */
1306
1307 /* None. */
1308
1309 /* $ Author_and_Institution */
1310
1311 /* N.J. Bachman (JPL) */
1312 /* K.R. Gehringer (JPL) */
1313
1314 /* $ Version */
1315
1316 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
1317
1318 /* Added MAC-OSX environments. */
1319
1320 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
1321
1322 /* The environment lines were expanded so that the supported */
1323 /* environments are now explicitly given. New */
1324 /* environments are WIN-NT */
1325
1326 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
1327
1328 /* CSPICE environments were added. Some typos were corrected. */
1329
1330 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
1331
1332 /* The environment lines were expanded so that the supported */
1333 /* environments are now explicitly given. New */
1334 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
1335
1336 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
1337
1338 /* The environment lines were expanded so that the supported */
1339 /* environments are now explicitly given. Previously, */
1340 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
1341 /* by the environment label SUN. */
1342
1343 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
1344
1345 /* The structure of this routine has completely changed. A stack, */
1346 /* implemented as an array of character strings, is now used to */
1347 /* store subroutine names that use the CHKIN and CHKOUT entry */
1348 /* points. This change simplified the individual entry points as */
1349 /* well as speeding up the process of checking in and checking */
1350 /* out. */
1351
1352 /* The error action mechanism has been changed as well. GETACT */
1353 /* now uses an integer code rather than a short character */
1354 /* string to represent the error action. The entry points affected */
1355 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
1356
1357 /* - SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) */
1358
1359 /* Comment section for permuted index source lines was added */
1360 /* following the header. */
1361
1362 /* - SPICELIB Version 1.0.1, 15-JUN-1990 (NJB) */
1363
1364 /* Some comments updated. Some cosmetic changes too. */
1365
1366 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
1367
1368 /* -& */
1369 /* $ Index_Entries */
1370
1371 /* traceback depth */
1372
1373 /* -& */
1374 /* $ Revisions */
1375
1376 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
1377
1378 /* The structure of this routine has completely changed. A stack, */
1379 /* implemented as an array of character strings, is now used to */
1380 /* store subroutine names that use the CHKIN and CHKOUT entry */
1381 /* points. This change simplified the individual entry points as */
1382 /* well as speeding up the process of checking in and checking */
1383 /* out. */
1384
1385 /* The error action mechanism has been changed as well. GETACT */
1386 /* now uses an integer code rather than a short character */
1387 /* string to represent the error action. The entry points affected */
1388 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
1389
1390 /* - SPICELIB Version 1.0.1, 15-JUN-1990 (NJB) */
1391
1392 /* Some comments updated. Some cosmetic changes too. */
1393 /* -& */
1394
1395 /* Find the error handling mode. */
1396
1397 getact_(&action);
1398
1399 /* If we're in 'RETURN' mode, and an error has occurred, we want to */
1400 /* use the frozen version of the traceback. Otherwise, we want to */
1401 /* get the use the current module stack depth. */
1402
1403 if (action == 3 && failed_()) {
1404 *depth = frzcnt + frzovr;
1405 } else {
1406 *depth = modcnt + ovrflw;
1407 }
1408
1409 /* Return to the caller. */
1410
1411 return 0;
1412 /* $Procedure TRCMXD ( Maximum traceback depth encountered. ) */
1413
1414 L_trcmxd:
1415 /* $ Abstract */
1416
1417 /* Return the maximum number of modules encountered in the */
1418 /* traceback so far. */
1419
1420 /* $ Disclaimer */
1421
1422 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1423 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1424 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1425 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1426 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1427 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1428 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1429 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1430 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1431 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1432
1433 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1434 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1435 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1436 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1437 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1438 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1439
1440 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1441 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1442 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1443 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1444
1445 /* $ Required_Reading */
1446
1447 /* ERROR */
1448
1449 /* $ Keywords */
1450
1451 /* ERROR */
1452
1453 /* $ Declarations */
1454
1455 /* INTEGER DEPTH */
1456
1457 /* $ Brief_I/O */
1458
1459 /* VARIABLE I/O DESCRIPTION */
1460 /* -------- --- --------------------------------------------------- */
1461
1462 /* DEPTH O The maximum number of modules encountered. */
1463
1464 /* $ Detailed_Input */
1465
1466 /* None. */
1467
1468 /* $ Detailed_Output */
1469
1470 /* DEPTH Indicates the maximum number of module */
1471 /* names encountered in the traceback stack. */
1472 /* This would be the longest call chain that */
1473 /* occurred during the run of a program. */
1474
1475 /* $ Parameters */
1476
1477 /* None. */
1478
1479 /* $ Exceptions */
1480
1481 /* Error free. */
1482
1483 /* $ Files */
1484
1485 /* None. */
1486
1487 /* $ Particulars */
1488
1489 /* This routine is part of the SPICELIB error handling mechanism. */
1490
1491 /* $ Examples */
1492
1493 /* 1) You can use this routine to determine the length of the */
1494 /* longest sequence of subroutine calls in a program. Suppose */
1495 /* that you have a program, PROGRAM, that uses the SPICELIB */
1496 /* error handling with CHKIN and CHKOUT, and has three */
1497 /* subroutines, SUB_A, SUB_B, and SUB_C. The program and */
1498 /* subroutines have the following relationships: */
1499
1500 /* PROGRAM calls SUB_A and SUB_C */
1501 /* SUB_C calls SUB_B */
1502
1503 /* If at the end of the program you were to call TRCMXD, */
1504
1505 /* CALL TRCMXD ( MAXDEP ) */
1506
1507 /* to obtain the maximum depth reached, MAXDEP would have a */
1508 /* value of three (3), because the program checked in, SUB_C */
1509 /* checked in, and SUB_B checked in during the longest call */
1510 /* chain in the program. */
1511
1512 /* $ Restrictions */
1513
1514 /* None. */
1515
1516 /* $ Literature_References */
1517
1518 /* None. */
1519
1520 /* $ Author_and_Institution */
1521
1522 /* K.R. Gehringer (JPL) */
1523
1524 /* $ Version */
1525
1526 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
1527
1528 /* Added MAC-OSX environments. */
1529
1530 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
1531
1532 /* The environment lines were expanded so that the supported */
1533 /* environments are now explicitly given. New */
1534 /* environments are WIN-NT */
1535
1536 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
1537
1538 /* CSPICE environments were added. Some typos were corrected. */
1539
1540 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
1541
1542 /* The environment lines were expanded so that the supported */
1543 /* environments are now explicitly given. New */
1544 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
1545
1546 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
1547
1548 /* The environment lines were expanded so that the supported */
1549 /* environments are now explicitly given. Previously, */
1550 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
1551 /* by the environment label SUN. */
1552
1553 /* - SPICELIB Version 1.0.0, 12-MAR-1996 (KRG) */
1554
1555 /* -& */
1556 /* $ Index_Entries */
1557
1558 /* traceback maximum depth */
1559
1560 /* -& */
1561
1562 /* It doesn't get any easier than this, simply set the maximum */
1563 /* depth and return. */
1564
1565 *depth = maxdep;
1566 return 0;
1567 /* $Procedure TRCNAM ( Get Module Name from Traceback ) */
1568
1569 L_trcnam:
1570 /* $ Abstract */
1571
1572 /* Return the name of the module having the specified position in */
1573 /* the trace representation. The first module to check in is at */
1574 /* position 1. */
1575
1576 /* $ Disclaimer */
1577
1578 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1579 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1580 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1581 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1582 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1583 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1584 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1585 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1586 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1587 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1588
1589 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1590 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1591 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1592 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1593 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1594 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1595
1596 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1597 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1598 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1599 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1600
1601 /* $ Required_Reading */
1602
1603 /* ERROR */
1604
1605 /* $ Keywords */
1606
1607 /* ERROR */
1608
1609 /* $ Declarations */
1610
1611 /* INTEGER INDEX */
1612 /* CHARACTER*(*) NAME */
1613
1614 /* $ Brief_I/O */
1615
1616 /* VARIABLE I/O DESCRIPTION */
1617 /* -------- --- -------------------------------------------------- */
1618
1619 /* INDEX I The position of the requested module name. */
1620 /* NAME O The name in the #INDEX position in the traceback. */
1621 /* FILEN P Maximum file name length. */
1622
1623 /* $ Detailed_Input */
1624
1625 /* INDEX is the position in the traceback of the requested */
1626 /* module name. The first module to check in is in */
1627 /* the first position; the last to check in the */
1628 /* position indicated by the argument, DEPTH, */
1629 /* returned by TRCDEP. Note that the first module to */
1630 /* check in is at the top of the traced call chain. */
1631
1632 /* $ Detailed_Output */
1633
1634 /* NAME is the name of the module in the position within */
1635 /* the traceback indicated by INDEX. */
1636
1637 /* The meaning of the traceback depends on the state */
1638 /* of the error handling mechanism. There are two */
1639 /* cases: */
1640
1641 /* 1. In 'RETURN' mode, when an error is */
1642 /* signaled, the traceback at that point is */
1643 /* saved. TRCDEP, TRCNAM, and QCKTRC will */
1644 /* return values pertaining to the saved */
1645 /* traceback. */
1646
1647 /* 2. In all other modes, the traceback represents */
1648 /* the CURRENT call chain. TRCDEP, TRCNAM, */
1649 /* and QCKTRC will return values pertaining to */
1650 /* the current trace representation. */
1651
1652 /* $ Parameters */
1653
1654 /* FILEN is the maximum file name length that can be */
1655 /* accommodated by this routine. */
1656
1657 /* $ Exceptions */
1658
1659 /* Because this routine is below SIGERR in the calling hierarchy, */
1660 /* this routine can not call SIGERR in the event of an error. */
1661 /* Therefore, this routine outputs error messages, rather than */
1662 /* signaling errors. */
1663
1664 /* 1) This routine detects the condition of INDEX being out of */
1665 /* range. The short error message set in that case is */
1666 /* 'SPICE(INVALIDINDEX)'. */
1667
1668 /* $ Files */
1669
1670 /* None. */
1671
1672 /* $ Particulars */
1673
1674 /* This routine is part of the SPICELIB error handling mechanism. */
1675
1676 /* $ Examples */
1677
1678 /* 1) You can use this routine, together with TRCNAM, to create a */
1679 /* traceback report. We might wish to create such a report when */
1680 /* we have detected an error condition (see FAILED). */
1681
1682 /* In this example, we assume that the error has already been */
1683 /* detected, and that we wish to create a traceback report. We */
1684 /* assume the existence of two user-supplied routines: */
1685
1686 /* USER_TRACE_FORMAT -- creates a traceback report in the */
1687 /* format preferred by the user */
1688
1689 /* USER_TRACE_INIT -- indicates that a traceback report */
1690 /* is to be created; it also */
1691 /* indicates how many module names */
1692 /* will be in the report */
1693
1694 /* C */
1695 /* C Get the trace depth, and retrieve that number of */
1696 /* C module names from the traceback representation. */
1697 /* C Call USER_TRACE_INIT to indicate that a traceback */
1698 /* C report is to be created containing `DEPTH' */
1699 /* C number of module names. Input each of these names, */
1700 /* C as they are retrieved, to USER_TRACE_FORMAT. */
1701 /* C */
1702
1703 /* CALL TRCDEP ( DEPTH ) */
1704
1705 /* CALL USER_TRACE_INIT ( DEPTH ) */
1706
1707
1708 /* DO INDEX = 1, DEPTH */
1709
1710 /* CALL TRCNAM ( INDEX, MODULE ) */
1711
1712 /* CALL USER_TRACE_FORMAT ( MODULE ) */
1713
1714 /* END DO */
1715
1716 /* $ Restrictions */
1717
1718 /* None. */
1719
1720 /* $ Literature_References */
1721
1722 /* None. */
1723
1724 /* $ Author_and_Institution */
1725
1726 /* N.J. Bachman (JPL) */
1727 /* K.R. Gehringer (JPL) */
1728
1729 /* $ Version */
1730
1731 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
1732
1733 /* Added MAC-OSX environments. */
1734
1735 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
1736
1737 /* The environment lines were expanded so that the supported */
1738 /* environments are now explicitly given. New */
1739 /* environments are WIN-NT */
1740
1741 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
1742
1743 /* CSPICE environments were added. Some typos were corrected. */
1744
1745 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
1746
1747 /* The environment lines were expanded so that the supported */
1748 /* environments are now explicitly given. New */
1749 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
1750
1751 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
1752
1753 /* The environment lines were expanded so that the supported */
1754 /* environments are now explicitly given. Previously, */
1755 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
1756 /* by the environment label SUN. */
1757
1758 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
1759
1760 /* The structure of this routine has completely changed. A stack, */
1761 /* implemented as an array of character strings, is now used to */
1762 /* store subroutine names that use the CHKIN and CHKOUT entry */
1763 /* points. This change simplified the individual entry points as */
1764 /* well as speeding up the process of checking in and checking */
1765 /* out. */
1766
1767 /* The exception: */
1768
1769 /* 2) If INDEX is in range, but no module name is found */
1770 /* at the indicated location in the trace representation, */
1771 /* the error message 'SPICE(INVALIDINDEX)' is set. */
1772
1773 /* has been removed. The only way in which a module name cannot */
1774 /* be found for a specified index is if we have overflowed the */
1775 /* stack storage for module names, and in this case we return the */
1776 /* message '<Name Not Available>'. */
1777
1778 /* The error action mechanism has been changed as well. GETACT */
1779 /* now uses an integer code rather than a short character */
1780 /* string to represent the error action. The entry points affected */
1781 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
1782
1783 /* - SPICELIB Version 1.1.1, 10-MAR-1992 (WLT) */
1784
1785 /* Comment section for permuted index source lines was added */
1786 /* following the header. */
1787
1788 /* - SPICELIB Version 1.1.0, 15-JUN-1990 (NJB) */
1789
1790 /* Error messages streamlined. Some comments updated. */
1791 /* Some cosmetic changes too. */
1792
1793 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
1794
1795 /* -& */
1796 /* $ Index_Entries */
1797
1798 /* get module name from traceback */
1799
1800 /* -& */
1801 /* $ Revisions */
1802
1803 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
1804
1805 /* The structure of this routine has completely changed. A stack, */
1806 /* implemented as an array of character strings, is now used to */
1807 /* store subroutine names that use the CHKIN and CHKOUT entry */
1808 /* points. This change simplified the individual entry points as */
1809 /* well as speeding up the process of checking in and checking */
1810 /* out. */
1811
1812 /* The exception: */
1813
1814 /* 2) If INDEX is in range, but no module name is found */
1815 /* at the indicated location in the trace representation, */
1816 /* the error message 'SPICE(INVALIDINDEX)' is set. */
1817
1818 /* has been removed. The only way in which a module name cannot */
1819 /* be found for a specified index is if we have overflowed the */
1820 /* stack storage for module names, and in this case we return the */
1821 /* message '<Name Not Available>'. */
1822
1823 /* The error action mechanism has been changed as well. GETACT */
1824 /* now uses an integer code rather than a short character */
1825 /* string to represent the error action. The entry points affected */
1826 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
1827
1828 /* - SPICELIB Version 1.1.0, 15-JUN-1990 (NJB) */
1829
1830 /* Error messages streamlined. Some comments updated. */
1831 /* Some cosmetic changes too. */
1832
1833 /* - Beta Version 1.1.1, 10-FEB-1988 (NJB) */
1834
1835 /* Parameter declarations documented. Parameters section added, */
1836 /* and parameter declarations listed in `Brief I/O'. */
1837
1838 /* - Beta Version 1.1.0, 27-OCT-1988 (NJB) */
1839
1840 /* Added test for failure to remove name from trace */
1841 /* representation. If LOC equals 0 on return from */
1842 /* NTHWD, the error SPICE(INVALIDINDEX) is reported. */
1843 /* SIGERR is not called; that would be overly recursive. */
1844
1845 /* Cosmetic changes to header and code were made. Indentation */
1846 /* of some header items was changed, and some blank lines */
1847 /* were removed from the code. */
1848 /* -& */
1849
1850 /* Get the error handling mode. */
1851
1852 getact_(&action);
1853
1854 /* If we're in 'RETURN' mode, and an error has occurred, we want to */
1855 /* use the frozen version of the traceback. Otherwise, we want to */
1856 /* get the module name from the current traceback. */
1857
1858 if (action == 3 && failed_()) {
1859
1860 /* Check the input index. It must be positive and less than the */
1861 /* current stack depth. */
1862
1863 if (*index <= 0 || *index > frzcnt + frzovr) {
1864
1865 /* Invalid index...we output the error messages directly */
1866 /* in this case: */
1867
1868 getdev_(device, (ftnlen)255);
1869 wrline_(device, "SPICE(INVALIDINDEX)", (ftnlen)255, (ftnlen)19);
1870 intstr_(index, string, (ftnlen)11);
1871 /* Writing concatenation */
1872 i__4[0] = 52, a__2[0] = "TRCNAM: An invalid index was input. Th"
1873 "e value was: ";
1874 i__4[1] = rtrim_(string, (ftnlen)11), a__2[1] = string;
1875 i__4[2] = 1, a__2[2] = ".";
1876 s_cat(ch__2, a__2, i__4, &c__3, (ftnlen)64);
1877 wrline_(device, ch__2, (ftnlen)255, rtrim_(string, (ftnlen)11) +
1878 53);
1879 return 0;
1880 }
1881
1882 /* We're OK, so get the name or not available. */
1883
1884 if (*index <= 100) {
1885 s_copy(name__, frozen + (((i__1 = *index - 1) < 100 && 0 <= i__1 ?
1886 i__1 : s_rnge("frozen", i__1, "trcpkg_", (ftnlen)1919))
1887 << 5), name_len, (ftnlen)32);
1888 } else {
1889 s_copy(name__, "<Overflow No Name Available>", name_len, (ftnlen)
1890 28);
1891 }
1892 } else {
1893
1894 /* Otherwise, use current traceback: */
1895
1896 /* Check the input index. It must be positive and less than the */
1897 /* current stack depth. */
1898
1899 if (*index <= 0 || *index > modcnt + ovrflw) {
1900
1901 /* Invalid index...we output the error messages directly */
1902 /* in this case: */
1903
1904 getdev_(device, (ftnlen)255);
1905 wrline_(device, "SPICE(INVALIDINDEX)", (ftnlen)255, (ftnlen)19);
1906 intstr_(index, string, (ftnlen)11);
1907 /* Writing concatenation */
1908 i__4[0] = 52, a__2[0] = "TRCNAM: An invalid index was input. Th"
1909 "e value was: ";
1910 i__4[1] = rtrim_(string, (ftnlen)11), a__2[1] = string;
1911 i__4[2] = 1, a__2[2] = ".";
1912 s_cat(ch__2, a__2, i__4, &c__3, (ftnlen)64);
1913 wrline_(device, ch__2, (ftnlen)255, rtrim_(string, (ftnlen)11) +
1914 53);
1915 return 0;
1916 }
1917
1918 /* We're OK, so get the name or name not available. */
1919
1920 if (*index <= 100) {
1921 s_copy(name__, stack + (((i__1 = *index - 1) < 100 && 0 <= i__1 ?
1922 i__1 : s_rnge("stack", i__1, "trcpkg_", (ftnlen)1949)) <<
1923 5), name_len, (ftnlen)32);
1924 } else {
1925 s_copy(name__, "<Overflow No Name Available>", name_len, (ftnlen)
1926 28);
1927 }
1928 }
1929 return 0;
1930 /* $Procedure QCKTRC ( Get Quick Traceback ) */
1931
1932 L_qcktrc:
1933 /* $ Abstract */
1934
1935 /* Return a string containing a traceback. */
1936
1937 /* $ Disclaimer */
1938
1939 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1940 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1941 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1942 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1943 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1944 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1945 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1946 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1947 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1948 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1949
1950 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1951 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1952 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1953 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1954 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1955 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1956
1957 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1958 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1959 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1960 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1961
1962 /* $ Required_Reading */
1963
1964 /* ERROR */
1965
1966 /* $ Keywords */
1967
1968 /* ERROR */
1969
1970 /* $ Declarations */
1971
1972 /* CHARACTER*(*) TRACE */
1973
1974 /* $ Brief_I/O */
1975
1976 /* VARIABLE I/O DESCRIPTION */
1977 /* -------- --- -------------------------------------------------- */
1978
1979 /* TRACE O A traceback report. */
1980 /* NAMLEN P Maximum module name length. */
1981 /* FILEN P Maximum file name length. */
1982
1983 /* $ Detailed_Input */
1984
1985 /* None. */
1986
1987 /* $ Detailed_Output */
1988
1989 /* TRACE is a list of module names, delimited by the */
1990 /* string, ' -->'. An example would be */
1991
1992 /* 'SPUD -->SPAM -->FOOBAR'. */
1993
1994 /* In general, the meaning of the trace is as */
1995 /* follows: */
1996
1997 /* The first name in the list is the name of the first */
1998 /* module to check in (that hasn't yet checked out). */
1999 /* The last name is the name of the module at the end */
2000 /* of the call chain; this is the last module that */
2001 /* checked in. */
2002
2003 /* The meaning of the traceback depends on the state */
2004 /* of the error handling mechanism. There are two */
2005 /* cases: */
2006
2007 /* 1. In 'RETURN' mode, when an error is */
2008 /* signaled, the traceback at that point is */
2009 /* saved. TRCDEP, TRCNAM, and QCKTRC will */
2010 /* return values pertaining to the saved */
2011 /* traceback. */
2012
2013 /* 2. In all other modes, the traceback represents */
2014 /* the CURRENT call chain. TRCDEP, TRCNAM, */
2015 /* and QCKTRC will return values pertaining to */
2016 /* the current trace representation. */
2017
2018 /* Any module names exceeding NAMLEN characters in */
2019 /* length are truncated on the right. */
2020
2021 /* $ Parameters */
2022
2023 /* FILEN is the maximum file name length that can be */
2024 /* accommodated by this routine. */
2025
2026 /* NAMLEN is the maximum module name length that can be */
2027 /* accommodated by this routine. */
2028
2029 /* $ Exceptions */
2030
2031 /* Error free. */
2032
2033 /* $ Files */
2034
2035 /* None. */
2036
2037 /* $ Particulars */
2038
2039 /* This routine is part of the SPICELIB error handling mechanism. */
2040
2041 /* $ Examples */
2042
2043 /* 1) Here's an example of how to use this routine: */
2044
2045 /* C */
2046 /* C We call RDTEXT and test for an error condition. */
2047 /* C If an error occurred, we get the traceback and */
2048 /* C long error message and output them using the */
2049 /* C user-defined routine, USER_ERROR. */
2050 /* C */
2051
2052 /* CALL RDTEXT ( FILE, LINE, EOF ) */
2053
2054 /* IF ( FAILED() ) THEN */
2055
2056 /* CALL QCKTRC ( TRACE ) */
2057 /* CALL USER_ERROR ( TRACE ) */
2058
2059 /* CALL GETMSG ( 'LONG', MSG ) */
2060 /* CALL USER_ERROR ( MSG ) */
2061
2062 /* END IF */
2063
2064 /* $ Restrictions */
2065
2066 /* It is assumed no module names exceed NAMLEN characters in length. */
2067
2068 /* $ Literature_References */
2069
2070 /* None. */
2071
2072 /* $ Author_and_Institution */
2073
2074 /* N.J. Bachman (JPL) */
2075 /* K.R. Gehringer (JPL) */
2076
2077 /* $ Version */
2078
2079 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
2080
2081 /* Added MAC-OSX environments. */
2082
2083 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
2084
2085 /* The environment lines were expanded so that the supported */
2086 /* environments are now explicitly given. New */
2087 /* environments are WIN-NT */
2088
2089 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
2090
2091 /* CSPICE environments were added. Some typos were corrected. */
2092
2093 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
2094
2095 /* The environment lines were expanded so that the supported */
2096 /* environments are now explicitly given. New */
2097 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
2098
2099 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
2100
2101 /* The environment lines were expanded so that the supported */
2102 /* environments are now explicitly given. Previously, */
2103 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
2104 /* by the environment label SUN. */
2105
2106 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
2107
2108 /* The structure of this routine has completely changed. A stack, */
2109 /* implemented as an array of character strings, is now used to */
2110 /* store subroutine names that use the CHKIN and CHKOUT entry */
2111 /* points. This change simplified the individual entry points as */
2112 /* well as speeding up the process of checking in and checking */
2113 /* out. */
2114
2115 /* The error action mechanism has been changed as well. GETACT */
2116 /* now uses an integer code rather than a short character */
2117 /* string to represent the error action. The entry points affected */
2118 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
2119
2120 /* - SPICELIB Version 1.2.0, 23-OCT-1992 (NJB) */
2121
2122 /* Bug fix made to routine QCKTRC: a section of code which */
2123 /* itself is exercised only if a bug is present inserted the */
2124 /* wrong variable into an error message. */
2125
2126 /* - SPICELIB Version 1.1.1, 10-MAR-1992 (WLT) */
2127
2128 /* Comment section for permuted index source lines was added */
2129 /* following the header. */
2130
2131 /* - SPICELIB Version 1.1.0, 15-JUN-1990 (NJB) */
2132
2133 /* Error messages streamlined. Some comments updated. */
2134 /* Some cosmetic changes too. */
2135
2136 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
2137
2138 /* -& */
2139 /* $ Index_Entries */
2140
2141 /* get quick traceback */
2142
2143 /* -& */
2144 /* $ Revisions */
2145
2146 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
2147
2148 /* The structure of this routine has completely changed. A stack, */
2149 /* implemented as an array of character strings, is now used to */
2150 /* store subroutine names that use the CHKIN and CHKOUT entry */
2151 /* points. This change simplified the individual entry points as */
2152 /* well as speeding up the process of checking in and checking */
2153 /* out. */
2154
2155 /* The error action mechanism has been changed as well. GETACT */
2156 /* now uses an integer code rather than a short character */
2157 /* string to represent the error action. The entry points affected */
2158 /* by this change are: TRCDEP, TRCNAM, QCKTRC. */
2159
2160 /* - SPICELIB Version 1.2.0, 23-OCT-1992 (NJB) */
2161
2162 /* Bug fix made to routine QCKTRC: a section of code which */
2163 /* itself is exercised only if a bug is present inserted the */
2164 /* wrong variable into an error message. The variable in */
2165 /* question was the input argument INDEX; the correct variable */
2166 /* to insert in the message is the local variable POS. */
2167
2168 /* - SPICELIB Version 1.1.0, 15-JUN-1990 (NJB) */
2169
2170 /* Error messages streamlined. Some comments updated. */
2171 /* Some cosmetic changes too. Use of SUFFIX made more */
2172 /* rational. */
2173
2174 /* - Beta Version 1.1.1, 10-FEB-1988 (NJB) */
2175
2176 /* Parameter declarations documented. Parameters section added, */
2177 /* and parameter declarations listed in `Brief I/O'. */
2178
2179 /* - Beta Version 1.1.0, 06-OCT-1988 (NJB) */
2180
2181 /* Added test for failure to remove name from trace */
2182 /* representation. If LOC equals 0 on return from */
2183 /* NTHWD, the error SPICE(INVALIDINDEX) is reported. */
2184 /* SIGERR is not called; that would be overly recursive. */
2185
2186 /* Also, some cosmetic changes to code were made. Some */
2187 /* unnecessary continuation lines were removed. */
2188 /* -& */
2189
2190 /* Be sure that the output string is empty. */
2191
2192 s_copy(trace, " ", trace_len, (ftnlen)1);
2193
2194 /* Get the error handling mode. */
2195
2196 getact_(&action);
2197
2198 /* If we're in 'RETURN' mode, and an error has occurred, we want to */
2199 /* use the frozen version of the traceback. Otherwise, we want to */
2200 /* use the current traceback. */
2201
2202 if (action == 3 && failed_()) {
2203 i__1 = frzcnt;
2204 for (i__ = 1; i__ <= i__1; ++i__) {
2205 if (i__ > 1) {
2206 suffix_("-->", &c__1, trace, (ftnlen)3, trace_len);
2207 suffix_(frozen + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2
2208 : s_rnge("frozen", i__2, "trcpkg_", (ftnlen)2241)) <<
2209 5), &c__1, trace, (ftnlen)32, trace_len);
2210 } else {
2211 suffix_(frozen + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2
2212 : s_rnge("frozen", i__2, "trcpkg_", (ftnlen)2243)) <<
2213 5), &c__0, trace, (ftnlen)32, trace_len);
2214 }
2215 }
2216 if (frzovr > 0) {
2217 suffix_("-->", &c__1, trace, (ftnlen)3, trace_len);
2218 if (frzovr > 1) {
2219 intstr_(&frzovr, string, (ftnlen)11);
2220 suffix_("<", &c__1, trace, (ftnlen)1, trace_len);
2221 suffix_(string, &c__0, trace, (ftnlen)11, trace_len);
2222 suffix_("Names Overflowed>", &c__1, trace, (ftnlen)17,
2223 trace_len);
2224 } else {
2225 suffix_("<One Name Overflowed>", &c__1, trace, (ftnlen)21,
2226 trace_len);
2227 }
2228 }
2229 } else {
2230 i__1 = modcnt;
2231 for (i__ = 1; i__ <= i__1; ++i__) {
2232 if (i__ > 1) {
2233 suffix_("-->", &c__1, trace, (ftnlen)3, trace_len);
2234 suffix_(stack + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2 :
2235 s_rnge("stack", i__2, "trcpkg_", (ftnlen)2268)) << 5)
2236 , &c__1, trace, (ftnlen)32, trace_len);
2237 } else {
2238 suffix_(stack + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2 :
2239 s_rnge("stack", i__2, "trcpkg_", (ftnlen)2270)) << 5)
2240 , &c__0, trace, (ftnlen)32, trace_len);
2241 }
2242 }
2243 if (ovrflw > 0) {
2244 suffix_("-->", &c__1, trace, (ftnlen)3, trace_len);
2245 if (ovrflw > 1) {
2246 intstr_(&ovrflw, string, (ftnlen)11);
2247 suffix_("<", &c__1, trace, (ftnlen)1, trace_len);
2248 suffix_(string, &c__0, trace, (ftnlen)11, trace_len);
2249 suffix_("Names Overflowed>", &c__1, trace, (ftnlen)17,
2250 trace_len);
2251 } else {
2252 suffix_("<One Name Overflowed>", &c__1, trace, (ftnlen)21,
2253 trace_len);
2254 }
2255 }
2256 }
2257 return 0;
2258 /* $Procedure FREEZE ( Get frozen copy of traceback ) */
2259
2260 L_freeze:
2261 /* $ Abstract */
2262
2263 /* Make a copy of the current traceback. This copy is frozen, i.e. */
2264 /* unchanged, until the next call to FREEZE. DO NOT CALL THIS */
2265 /* ROUTINE. */
2266
2267 /* $ Disclaimer */
2268
2269 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
2270 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
2271 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
2272 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
2273 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
2274 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
2275 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
2276 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
2277 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
2278 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
2279
2280 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
2281 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
2282 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
2283 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
2284 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
2285 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
2286
2287 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
2288 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
2289 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
2290 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
2291
2292 /* $ Required_Reading */
2293
2294 /* ERROR */
2295
2296 /* $ Keywords */
2297
2298 /* ERROR */
2299
2300 /* $ Declarations */
2301
2302 /* None. */
2303
2304 /* $ Brief_I/O */
2305
2306 /* VARIABLE I/O DESCRIPTION */
2307 /* -------- --- -------------------------------------------------- */
2308
2309 /* None. */
2310
2311 /* $ Detailed_Input */
2312
2313 /* None. */
2314
2315 /* $ Detailed_Output */
2316
2317 /* None. */
2318
2319 /* $ Parameters */
2320
2321 /* None. */
2322
2323 /* $ Exceptions */
2324
2325 /* None. */
2326
2327 /* $ Files */
2328
2329 /* None. */
2330
2331 /* $ Particulars */
2332
2333 /* DO NOT CALL THIS ROUTINE. */
2334
2335 /* When the error response action is 'RETURN', and an error is */
2336 /* signaled, a copy of the traceback is saved for later retrieval */
2337 /* by the application program. This is called the `frozen' version */
2338 /* of the traceback. FREEZE is used to create this frozen version. */
2339
2340 /* This routine is called by the SPICELIB routines SIGERR and RESET. */
2341
2342 /* $ Examples */
2343
2344 /* 1) */
2345 /* C */
2346 /* C Create a frozen traceback: */
2347 /* C */
2348 /* CALL FREEZE */
2349
2350 /* $ Restrictions */
2351
2352 /* For SPICELIB error handling only. */
2353
2354 /* $ Literature_References */
2355
2356 /* None. */
2357
2358 /* $ Author_and_Institution */
2359
2360 /* N.J. Bachman (JPL) */
2361 /* K.R. Gehringer (JPL) */
2362
2363 /* $ Version */
2364
2365 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
2366
2367 /* Added MAC-OSX environments. */
2368
2369 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
2370
2371 /* The environment lines were expanded so that the supported */
2372 /* environments are now explicitly given. New */
2373 /* environments are WIN-NT */
2374
2375 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
2376
2377 /* CSPICE environments were added. Some typos were corrected. */
2378
2379 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
2380
2381 /* The environment lines were expanded so that the supported */
2382 /* environments are now explicitly given. New */
2383 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
2384
2385 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
2386
2387 /* The environment lines were expanded so that the supported */
2388 /* environments are now explicitly given. Previously, */
2389 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
2390 /* by the environment label SUN. */
2391
2392 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
2393
2394 /* The structure of this routine has completely changed. A stack, */
2395 /* implemented as an array of character strings, is now used to */
2396 /* store subroutine names that use the CHKIN and CHKOUT entry */
2397 /* points. This change simplified the individual entry points as */
2398 /* well as speeding up the process of checking in and checking */
2399 /* out. */
2400
2401 /* - SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) */
2402
2403 /* Comment section for permuted index source lines was added */
2404 /* following the header. */
2405
2406 /* - SPICELIB Version 1.0.1, 15-JUN-1990 (NJB) */
2407
2408 /* Some comments changed. Cosmetic changes too. */
2409
2410 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (NJB) */
2411
2412 /* -& */
2413 /* $ Index_Entries */
2414
2415 /* None. */
2416
2417 /* -& */
2418 /* $ Revisions */
2419
2420 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
2421
2422 /* The structure of this routine has completely changed. A stack, */
2423 /* implemented as an array of character strings, is now used to */
2424 /* store subroutine names that use the CHKIN and CHKOUT entry */
2425 /* points. This change simplified the individual entry points as */
2426 /* well as speeding up the process of checking in and checking */
2427 /* out. */
2428
2429 /* - SPICELIB Version 1.0.1, 15-JUN-1990 (NJB) */
2430
2431 /* Some comments changed. Cosmetic changes too. */
2432
2433 /* - Beta Version 1.0.1, 08-FEB-1989 (NJB) */
2434
2435 /* Warnings added to discourage use of this routine in */
2436 /* non-error-handling code. */
2437
2438 /* -& */
2439
2440 /* Create a frozen version of the traceback. To do this, we move */
2441 /* the current traceback state into the freezer.. */
2442
2443 frzcnt = modcnt;
2444 frzovr = ovrflw;
2445 i__1 = modcnt;
2446 for (i__ = 1; i__ <= i__1; ++i__) {
2447 s_copy(frozen + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2 : s_rnge(
2448 "frozen", i__2, "trcpkg_", (ftnlen)2488)) << 5), stack + (((
2449 i__5 = i__ - 1) < 100 && 0 <= i__5 ? i__5 : s_rnge("stack",
2450 i__5, "trcpkg_", (ftnlen)2488)) << 5), (ftnlen)32, (ftnlen)32)
2451 ;
2452 }
2453 return 0;
2454 /* $Procedure TRCOFF ( Turn tracing off ) */
2455
2456 L_trcoff:
2457 /* $ Abstract */
2458
2459 /* Disable tracing. */
2460
2461 /* $ Disclaimer */
2462
2463 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
2464 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
2465 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
2466 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
2467 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
2468 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
2469 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
2470 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
2471 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
2472 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
2473
2474 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
2475 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
2476 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
2477 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
2478 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
2479 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
2480
2481 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
2482 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
2483 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
2484 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
2485
2486 /* $ Required_Reading */
2487
2488 /* ERROR */
2489
2490 /* $ Keywords */
2491
2492 /* ERROR */
2493
2494 /* $ Declarations */
2495
2496 /* None. */
2497
2498 /* $ Brief_I/O */
2499
2500 /* VARIABLE I/O DESCRIPTION */
2501 /* -------- --- -------------------------------------------------- */
2502
2503 /* None. */
2504
2505 /* $ Detailed_Input */
2506
2507 /* None. */
2508
2509 /* $ Detailed_Output */
2510
2511 /* None. */
2512
2513 /* $ Parameters */
2514
2515 /* None. */
2516
2517 /* $ Exceptions */
2518
2519 /* Error free. */
2520
2521 /* $ Files */
2522
2523 /* None. */
2524
2525 /* $ Particulars */
2526
2527 /* This routine disables tracing. Checking in or out does not modify */
2528 /* the current traceback any further after TRCOFF is called. The */
2529 /* routines TRCNAM, TRCDEP, and QCKTRC will return information */
2530 /* based on the traceback at the point where TRCOFF is called. */
2531
2532 /* Once tracing has been disabled, it cannot be re-enabled. */
2533
2534 /* Additionally, TRCOFF blanks out the existing trace, since the */
2535 /* trace will usually be invalid at the time an error is signaled. */
2536 /* The frozen copy of the trace, if there is one, is not modified. */
2537
2538 /* $ Examples */
2539
2540 /* 1) C */
2541 /* C Program initialization: */
2542 /* C */
2543 /* . */
2544 /* . */
2545 /* . */
2546 /* C */
2547 /* C We disable tracing to enhance speed: */
2548 /* C */
2549 /* CALL TRCOFF */
2550 /* C */
2551 /* C More initialization code: */
2552 /* C */
2553 /* . */
2554 /* . */
2555 /* . */
2556
2557 /* $ Restrictions */
2558
2559 /* None. */
2560
2561 /* $ Literature_References */
2562
2563 /* None. */
2564
2565 /* $ Author_and_Institution */
2566
2567 /* N.J. Bachman (JPL) */
2568 /* K.R. Gehringer (JPL) */
2569
2570 /* $ Version */
2571
2572 /* - SPICELIB Version 4.0.5, 17-JUL-2002 (BVS) */
2573
2574 /* Added MAC-OSX environments. */
2575
2576 /* - SPICELIB Version 4.0.4, 08-OCT-1999 (WLT) */
2577
2578 /* The environment lines were expanded so that the supported */
2579 /* environments are now explicitly given. New */
2580 /* environments are WIN-NT */
2581
2582 /* - SPICELIB Version 4.0.3, 24-SEP-1999 (NJB) */
2583
2584 /* CSPICE environments were added. Some typos were corrected. */
2585
2586 /* - SPICELIB Version 4.0.2, 28-JUL-1999 (WLT) */
2587
2588 /* The environment lines were expanded so that the supported */
2589 /* environments are now explicitly given. New */
2590 /* environments are PC-DIGITAL, SGI-O32 and SGI-N32. */
2591
2592 /* - SPICELIB Version 4.0.1, 18-MAR-1999 (WLT) */
2593
2594 /* The environment lines were expanded so that the supported */
2595 /* environments are now explicitly given. Previously, */
2596 /* environments such as SUN-SUNOS and SUN-SOLARIS were implied */
2597 /* by the environment label SUN. */
2598
2599 /* - SPICELIB Version 2.0.0, 12-MAR-1996 (KRG) */
2600
2601 /* The structure of this routine has completely changed. A stack, */
2602 /* implemented as an array of character strings, is now used to */
2603 /* store subroutine names that use the CHKIN and CHKOUT entry */
2604 /* points. This change simplified the individual entry points as */
2605 /* well as speeding up the process of checking in and checking */
2606 /* out. */
2607
2608 /* - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
2609
2610 /* Comment section for permuted index source lines was added */
2611 /* following the header. */
2612
2613 /* - SPICELIB Version 1.0.0, 11-JUL-1990 (NJB) */
2614
2615 /* -& */
2616 /* $ Index_Entries */
2617
2618 /* turn tracing off */
2619
2620 /* -& */
2621
2622 /* Indicate that tracing is disabled: */
2623
2624 notrc = TRUE_;
2625
2626 /* The stack depth becomes 0 (it will be referenced if TRCDEP is */
2627 /* called). The overflow count set to 0 as well, for consistency; */
2628 /* it will not be referenced again after this code is executed. */
2629
2630 modcnt = 0;
2631 ovrflw = 0;
2632 return 0;
2633 } /* trcpkg_ */
2634
trcpkg_(integer * depth,integer * index,char * module,char * trace,char * name__,ftnlen module_len,ftnlen trace_len,ftnlen name_len)2635 /* Subroutine */ int trcpkg_(integer *depth, integer *index, char *module,
2636 char *trace, char *name__, ftnlen module_len, ftnlen trace_len,
2637 ftnlen name_len)
2638 {
2639 return trcpkg_0_(0, depth, index, module, trace, name__, module_len,
2640 trace_len, name_len);
2641 }
2642
chkin_(char * module,ftnlen module_len)2643 /* Subroutine */ int chkin_(char *module, ftnlen module_len)
2644 {
2645 return trcpkg_0_(1, (integer *)0, (integer *)0, module, (char *)0, (char *
2646 )0, module_len, (ftnint)0, (ftnint)0);
2647 }
2648
chkout_(char * module,ftnlen module_len)2649 /* Subroutine */ int chkout_(char *module, ftnlen module_len)
2650 {
2651 return trcpkg_0_(2, (integer *)0, (integer *)0, module, (char *)0, (char *
2652 )0, module_len, (ftnint)0, (ftnint)0);
2653 }
2654
trcdep_(integer * depth)2655 /* Subroutine */ int trcdep_(integer *depth)
2656 {
2657 return trcpkg_0_(3, depth, (integer *)0, (char *)0, (char *)0, (char *)0,
2658 (ftnint)0, (ftnint)0, (ftnint)0);
2659 }
2660
trcmxd_(integer * depth)2661 /* Subroutine */ int trcmxd_(integer *depth)
2662 {
2663 return trcpkg_0_(4, depth, (integer *)0, (char *)0, (char *)0, (char *)0,
2664 (ftnint)0, (ftnint)0, (ftnint)0);
2665 }
2666
trcnam_(integer * index,char * name__,ftnlen name_len)2667 /* Subroutine */ int trcnam_(integer *index, char *name__, ftnlen name_len)
2668 {
2669 return trcpkg_0_(5, (integer *)0, index, (char *)0, (char *)0, name__, (
2670 ftnint)0, (ftnint)0, name_len);
2671 }
2672
qcktrc_(char * trace,ftnlen trace_len)2673 /* Subroutine */ int qcktrc_(char *trace, ftnlen trace_len)
2674 {
2675 return trcpkg_0_(6, (integer *)0, (integer *)0, (char *)0, trace, (char *)
2676 0, (ftnint)0, trace_len, (ftnint)0);
2677 }
2678
freeze_(void)2679 /* Subroutine */ int freeze_(void)
2680 {
2681 return trcpkg_0_(7, (integer *)0, (integer *)0, (char *)0, (char *)0, (
2682 char *)0, (ftnint)0, (ftnint)0, (ftnint)0);
2683 }
2684
trcoff_(void)2685 /* Subroutine */ int trcoff_(void)
2686 {
2687 return trcpkg_0_(8, (integer *)0, (integer *)0, (char *)0, (char *)0, (
2688 char *)0, (ftnint)0, (ftnint)0, (ftnint)0);
2689 }
2690
2691