1 /* zzctr.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* $Procedure ZZCTR ( Manipulate Counter Array ) */
zzctr_0_(int n__,integer * newctr,integer * oldctr,logical * update)9 /* Subroutine */ int zzctr_0_(int n__, integer *newctr, integer *oldctr,
10 logical *update)
11 {
12 /* Initialized data */
13
14 static logical first = TRUE_;
15
16 extern /* Subroutine */ int chkin_(char *, ftnlen);
17 static integer ctrhgh;
18 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
19 ftnlen);
20 extern integer intmin_(void), intmax_(void);
21 extern /* Subroutine */ int setmsg_(char *, ftnlen);
22 static integer ctrlow;
23 extern logical return_(void);
24
25 /* $ Abstract */
26
27 /* Manipulate counter array. */
28
29 /* $ Disclaimer */
30
31 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
32 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
33 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
34 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
35 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
36 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
37 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
38 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
39 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
40 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
41
42 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
43 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
44 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
45 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
46 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
47 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
48
49 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
50 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
51 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
52 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
53
54 /* $ Required_Reading */
55
56 /* None. */
57
58 /* $ Keywords */
59
60 /* UTILITY */
61
62 /* $ Declarations */
63 /* $ Abstract */
64
65 /* This include file defines the dimension of the counter */
66 /* array used by various SPICE subsystems to uniquely identify */
67 /* changes in their states. */
68
69 /* $ Disclaimer */
70
71 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
72 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
73 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
74 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
75 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
76 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
77 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
78 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
79 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
80 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
81
82 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
83 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
84 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
85 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
86 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
87 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
88
89 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
90 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
91 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
92 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
93
94 /* $ Parameters */
95
96 /* CTRSIZ is the dimension of the counter array used by */
97 /* various SPICE subsystems to uniquely identify */
98 /* changes in their states. */
99
100 /* $ Author_and_Institution */
101
102 /* B.V. Semenov (JPL) */
103
104 /* $ Literature_References */
105
106 /* None. */
107
108 /* $ Version */
109
110 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
111
112 /* -& */
113
114 /* End of include file. */
115
116 /* $ Brief_I/O */
117
118 /* Variable I/O Entry */
119 /* -------- --- -------------------------------------------------- */
120 /* NEWCTR I ZZCTRCHK */
121 /* OLDCTR I/O ZZCTRUIN, ZZCTRSIN, ZZCTRINC, ZZCTRCHK */
122 /* UPDATE O ZZCTRCHK */
123
124 /* CTRSIZ P (All) */
125
126 /* $ Detailed_Input */
127
128 /* See the ENTRY points for a discussion of their arguments. */
129
130 /* $ Detailed_Output */
131
132 /* See the ENTRY points for a discussion of their arguments. */
133
134 /* $ Parameters */
135
136 /* CTRSIZ is the dimension of the counter array used by */
137 /* various SPICE subsystems to identify */
138 /* changes in their states. This parameter is */
139 /* defined in the include file. */
140
141 /* $ Exceptions */
142
143 /* 1) If ZZCTR is called directly, the error SPICE(BOGUSENTRY) is */
144 /* signaled. */
145
146 /* $ Files */
147
148 /* None. */
149
150 /* $ Particulars */
151
152 /* ZZCTR should never be called directly, but should instead be */
153 /* accessed only through its entry points. */
154
155 /* The purpose of this routine is to manipulate counter arrays used */
156 /* by various SPICE subsystems to identify changes in their states. */
157
158 /* ZZCTRUIN Initialize counter array kept by a user */
159 /* routine. */
160
161 /* ZZCTRSIN Initialize counter array kept by a */
162 /* subsystem routine. */
163
164 /* ZZCTRINC Increment counter array. */
165
166 /* ZZCTRCHK Check/update counter array. */
167
168 /* A counter array consists of CTRSIZ elements representing */
169 /* cascading counters. The fastest counter is at index 1, the */
170 /* slowest counter is at index CTRSIZ. At the start of counting all */
171 /* counter array elements are set to INTMIN. In the process of */
172 /* counting the fastest element is incremented by one. As with any */
173 /* cascading counters when the fastest counter reaches INTMAX it */
174 /* rolls back to INTMIN and the next counter is incremented by 1. */
175 /* When all counters reach INTMAX, ZZCTRINC signals an error. */
176
177 /* $ Examples */
178
179 /* The counter array gives subsystems like POOL a way to provide to */
180 /* the user routines of that subsystem's services a simple indicator */
181 /* of whether the subsystem's state has changed, meaning that some */
182 /* saved values may have become stale and need to be updated or some */
183 /* other action needs to be taken in the user routines. */
184
185 /* For that the subsystem initializes a counter array ("subsystem */
186 /* counter") using ZZCTRSIN, saves it, increments it using ZZCTRINC */
187 /* each time the subsystem's state changes, and resets a user */
188 /* counter to subsystem counter and indicates the need for update */
189 /* when counters are not the same, like this: */
190
191 /* C */
192 /* C Include zzctr.inc to access CTRSIZ. */
193 /* C */
194 /* INCLUDE 'zzctr.inc' */
195 /* ... */
196 /* C */
197 /* C In input/output variable declarations declare user */
198 /* C user counter (USRCTR) as I/O and the update flag */
199 /* C (UPDATE) as O. */
200 /* C */
201 /* INTEGER USRCTR ( CTRSIZ ) */
202 /* LOGICAL UPDATE */
203 /* ... */
204 /* C */
205 /* C In local variable declarations declare and save the */
206 /* C subsystem counter (SUBCTR) that will incremented */
207 /* C with each change of state. */
208 /* C */
209 /* INTEGER SUBCTR ( CTRSIZ ) */
210 /* ... */
211 /* SAVE SUBCTR */
212 /* ... */
213 /* C */
214 /* C In all places where initialization is done set */
215 /* C subsystem counter using ZZCTRSIN. */
216 /* C */
217 /* IF ( FIRST ) THEN */
218 /* ... */
219 /* CALL ZZCTRSIN( SUBCTR ) */
220 /* FIRST = .FALSE. */
221 /* END IF */
222 /* ... */
223 /* C */
224 /* C In all places where the subsystem state changes */
225 /* C increment the subsystem counter using ZZCTRINC. */
226 /* C */
227 /* CALL ZZCTRINC( SUBCTR ) */
228 /* ... */
229 /* C */
230 /* C Make a special entry that checks and resets input */
231 /* C user counter to the current subsystem counter and */
232 /* C indicates whether it was updated using ZZCTRCHK. */
233 /* C */
234 /* ENTRY <entry_name> ( USRCTR, UPDATE ) */
235
236 /* CALL ZZCTRCHK( SUBCTR, USRCTR, UPDATE ) */
237
238 /* RETURN */
239 /* ... */
240
241 /* The users of the subsystem services initialize a counter array */
242 /* ("user counter") using ZZCTRUIN, save it, and check against the */
243 /* subsystem's counter and update, if needed, using the subsystem's */
244 /* entry point, like this: */
245
246 /* C */
247 /* C Include zzctr.inc to access CTRSIZ. */
248 /* C */
249 /* INCLUDE 'zzctr.inc' */
250 /* ... */
251 /* C */
252 /* C In local variable declarations declare and save */
253 /* C user counter. Also declare an update flag. */
254 /* C */
255 /* INTEGER USRCTR ( CTRSIZ ) */
256 /* LOGICAL UPDATE */
257 /* ... */
258 /* SAVE USRCTR */
259 /* ... */
260 /* C */
261 /* C In all places where initialization is done initialize */
262 /* C the user counter using ZZCTRUIN to ensure update on */
263 /* C the first check. */
264 /* C */
265 /* IF ( FIRST ) THEN */
266 /* ... */
267 /* CALL ZZCTRUIN( USRCTR ) */
268 /* FIRST = .FALSE. */
269 /* END IF */
270 /* ... */
271 /* C */
272 /* C In all places where there is a need to check for */
273 /* C the subsystem state change call subsystem's entry */
274 /* C that checks and updates the user counter based on */
275 /* C value of the subsystem counter. */
276 /* C */
277 /* CALL <entry_name> ( USRCTR, UPDATE ) */
278
279 /* IF ( UPDATE ) THEN */
280
281 /* C */
282 /* C Do what needs to be done when the subsystem */
283 /* C state has changed. */
284 /* C */
285 /* ... */
286
287 /* END IF */
288
289 /* $ Restrictions */
290
291 /* None. */
292
293 /* $ Literature_References */
294
295 /* None. */
296
297 /* $ Author_and_Institution */
298
299 /* B.V. Semenov (JPL) */
300
301 /* $ Version */
302
303 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
304
305 /* -& */
306 /* $ Index_Entries */
307
308 /* manipulate counter array */
309
310 /* -& */
311
312 /* SPICELIB functions */
313
314
315 /* Local variables. */
316
317
318 /* Save EVERYTHING. */
319
320
321 /* Initial values. */
322
323 /* Parameter adjustments */
324 if (newctr) {
325 }
326
327 /* Function Body */
328 switch(n__) {
329 case 1: goto L_zzctruin;
330 case 2: goto L_zzctrsin;
331 case 3: goto L_zzctrinc;
332 case 4: goto L_zzctrchk;
333 }
334
335
336 /* Standard SPICE error handling. */
337
338 if (return_()) {
339 return 0;
340 }
341
342 /* This routine should never be called. If this routine is called, */
343 /* an error is signaled. */
344
345 chkin_("ZZCTR", (ftnlen)5);
346 setmsg_("ZZCTR: You have called an entry which performs performs no run-"
347 "time function. This may indicate a bug. Please check the documen"
348 "tation for the subroutine ZZCTR.", (ftnlen)159);
349 sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17);
350 chkout_("ZZCTR", (ftnlen)5);
351 return 0;
352 /* $Procedure ZZCTRUIN ( CounTeR array, User counter INitialization ) */
353
354 L_zzctruin:
355 /* $ Abstract */
356
357 /* Set counter array to the initial values for the user routines. */
358
359 /* $ Disclaimer */
360
361 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
362 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
363 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
364 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
365 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
366 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
367 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
368 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
369 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
370 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
371
372 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
373 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
374 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
375 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
376 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
377 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
378
379 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
380 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
381 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
382 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
383
384 /* $ Required_Reading */
385
386 /* None. */
387
388 /* $ Keywords */
389
390 /* UTILITY */
391
392 /* $ Declarations */
393
394 /* INTEGER OLDCTR ( CTRSIZ ) */
395
396 /* $ Brief_I/O */
397
398 /* Variable I/O Entry */
399 /* -------- --- -------------------------------------------------- */
400 /* OLDCTR O Counter array to be set to initial user values. */
401
402 /* CTRSIZ P Counter array size. */
403
404 /* $ Detailed_Input */
405
406 /* None. */
407
408 /* $ Detailed_Output */
409
410 /* OLDCTR is the counter array set to the initial values for */
411 /* the user routines. */
412
413 /* $ Parameters */
414
415 /* CTRSIZ is the dimension of the counter array used by */
416 /* various SPICE subsystems to identify */
417 /* changes in their states. */
418
419 /* $ Exceptions */
420
421 /* None. */
422
423 /* $ Files */
424
425 /* None. */
426
427 /* $ Particulars */
428
429 /* This type of initialization must be done by all user routines */
430 /* to ensure update on the first check. */
431
432 /* $ Examples */
433
434 /* See umbrella Examples. */
435
436 /* $ Restrictions */
437
438 /* None. */
439
440 /* $ Literature_References */
441
442 /* None. */
443
444 /* $ Author_and_Institution */
445
446 /* B.V. Semenov (JPL) */
447
448 /* $ Version */
449
450 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
451
452 /* -& */
453 /* $ Index_Entries */
454
455 /* initialize counter array to user values */
456
457 /* -& */
458
459 /* Standard SPICE error handling. */
460
461 if (return_()) {
462 return 0;
463 }
464
465 /* Initialize the high and low values. */
466
467 if (first) {
468 ctrhgh = intmax_();
469 ctrlow = intmin_();
470 first = FALSE_;
471 }
472
473 /* Set counter. */
474
475 oldctr[0] = ctrhgh;
476 oldctr[1] = ctrhgh;
477 return 0;
478 /* $Procedure ZZCTRSIN ( CounTeR array, Subsystem counter INitialization ) */
479
480 L_zzctrsin:
481 /* $ Abstract */
482
483 /* Set counter array to the initial values for the subsystem */
484 /* routines. */
485
486 /* $ Disclaimer */
487
488 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
489 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
490 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
491 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
492 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
493 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
494 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
495 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
496 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
497 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
498
499 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
500 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
501 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
502 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
503 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
504 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
505
506 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
507 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
508 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
509 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
510
511 /* $ Required_Reading */
512
513 /* None. */
514
515 /* $ Keywords */
516
517 /* UTILITY */
518
519 /* $ Declarations */
520
521 /* INTEGER OLDCTR ( CTRSIZ ) */
522
523 /* $ Brief_I/O */
524
525 /* Variable I/O Entry */
526 /* -------- --- -------------------------------------------------- */
527 /* OLDCTR O Counter array to be set to initial subsystem values */
528
529 /* CTRSIZ P Counter array size. */
530
531 /* $ Detailed_Input */
532
533 /* None. */
534
535 /* $ Detailed_Output */
536
537 /* OLDCTR is the counter array set to the initial values for */
538 /* the subsystem routines. */
539
540 /* $ Parameters */
541
542 /* CTRSIZ is the dimension of the counter array used by */
543 /* various SPICE subsystems to identify */
544 /* changes in their states. */
545
546 /* $ Exceptions */
547
548 /* None. */
549
550 /* $ Files */
551
552 /* None. */
553
554 /* $ Particulars */
555
556 /* This type of initialization must be done by all subsystem */
557 /* routines to set the counters to the lowest initial values. */
558
559 /* $ Examples */
560
561 /* See umbrella Examples. */
562
563 /* $ Restrictions */
564
565 /* None. */
566
567 /* $ Literature_References */
568
569 /* None. */
570
571 /* $ Author_and_Institution */
572
573 /* B.V. Semenov (JPL) */
574
575 /* $ Version */
576
577 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
578
579 /* -& */
580 /* $ Index_Entries */
581
582 /* initialize counter array to subsystem values */
583
584 /* -& */
585
586 /* Standard SPICE error handling. */
587
588 if (return_()) {
589 return 0;
590 }
591
592 /* Initialize the high and low values. */
593
594 if (first) {
595 ctrhgh = intmax_();
596 ctrlow = intmin_();
597 first = FALSE_;
598 }
599
600 /* Set counter. */
601
602 oldctr[0] = ctrlow;
603 oldctr[1] = ctrlow;
604 return 0;
605 /* $Procedure ZZCTRINC ( CounTeR Array, INCrement counter ) */
606
607 L_zzctrinc:
608 /* $ Abstract */
609
610 /* Increment counter array. */
611
612 /* $ Disclaimer */
613
614 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
615 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
616 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
617 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
618 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
619 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
620 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
621 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
622 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
623 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
624
625 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
626 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
627 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
628 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
629 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
630 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
631
632 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
633 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
634 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
635 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
636
637 /* $ Required_Reading */
638
639 /* None. */
640
641 /* $ Keywords */
642
643 /* UTILITY */
644
645 /* $ Declarations */
646
647 /* INTEGER OLDCTR ( CTRSIZ ) */
648
649 /* $ Brief_I/O */
650
651 /* Variable I/O Entry */
652 /* -------- --- -------------------------------------------------- */
653 /* OLDCTR I/O Counter array to be incremented. */
654
655 /* CTRSIZ P Counter array size. */
656
657 /* $ Detailed_Input */
658
659 /* OLDCTR is the counter array to be incremented. */
660
661 /* $ Detailed_Output */
662
663 /* OLDCTR is the counter array that was incremented. */
664
665 /* $ Parameters */
666
667 /* CTRSIZ is the dimension of the counter array used by */
668 /* various SPICE subsystems to identify */
669 /* changes in their states. */
670
671 /* $ Exceptions */
672
673 /* 1) If all elements of the counter array on the input are equal */
674 /* to INTMAX, the error '(SPICEISTIRED)' is signaled. */
675
676 /* $ Files */
677
678 /* None. */
679
680 /* $ Particulars */
681
682 /* None. */
683
684 /* $ Examples */
685
686 /* See umbrella Examples. */
687
688 /* $ Restrictions */
689
690 /* None. */
691
692 /* $ Literature_References */
693
694 /* None. */
695
696 /* $ Author_and_Institution */
697
698 /* B.V. Semenov (JPL) */
699
700 /* $ Version */
701
702 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
703
704 /* -& */
705 /* $ Index_Entries */
706
707 /* increment counter array */
708
709 /* -& */
710
711 /* Standard SPICE error handling. */
712
713 if (return_()) {
714 return 0;
715 }
716
717 /* Initialize the high and low values. */
718
719 if (first) {
720 ctrhgh = intmax_();
721 ctrlow = intmin_();
722 first = FALSE_;
723 }
724
725 /* Signal an error if both input counter array elements have high */
726 /* values. */
727
728 if (oldctr[0] == ctrhgh && oldctr[1] == ctrhgh) {
729 chkin_("ZZCTRINC", (ftnlen)8);
730 setmsg_("A subsystem state counter overflowed. For this to happen th"
731 "ere must be a SPICE bug or you must have been running your S"
732 "PICE-based application for a very long time. Please contact "
733 "NAIF.and report the circumstances under which this happened.",
734 (ftnlen)239);
735 sigerr_("SPICE(SPICEISTIRED)", (ftnlen)19);
736 chkout_("ZZCTRINC", (ftnlen)8);
737 return 0;
738 }
739
740 /* Increment counters. */
741
742 if (oldctr[0] == ctrhgh) {
743 oldctr[0] = ctrlow;
744 ++oldctr[1];
745 } else {
746 ++oldctr[0];
747 }
748 return 0;
749 /* $Procedure ZZCTRCHK ( CounTeR array, CHecK and update ) */
750
751 L_zzctrchk:
752 /* $ Abstract */
753
754 /* Check and update, if needed, counter array. */
755
756 /* $ Disclaimer */
757
758 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
759 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
760 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
761 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
762 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
763 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
764 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
765 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
766 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
767 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
768
769 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
770 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
771 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
772 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
773 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
774 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
775
776 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
777 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
778 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
779 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
780
781 /* $ Required_Reading */
782
783 /* None. */
784
785 /* $ Keywords */
786
787 /* UTILITY */
788
789 /* $ Declarations */
790
791 /* INTEGER NEWCTR ( CTRSIZ ) */
792 /* INTEGER OLDCTR ( CTRSIZ ) */
793 /* LOGICAL UPDATE */
794
795 /* $ Brief_I/O */
796
797 /* Variable I/O Entry */
798 /* -------- --- -------------------------------------------------- */
799 /* NEWCTR I New counter value. */
800 /* OLDCTR I/O Old counter value. */
801 /* UPDATE O Update flag. */
802
803 /* CTRSIZ P Counter array size. */
804
805 /* $ Detailed_Input */
806
807 /* NEWCTR is the new counter value against which the old */
808 /* value should be checked. */
809
810 /* OLDCTR is the old counter value. */
811
812 /* $ Detailed_Output */
813
814 /* OLDCTR is the updated the old counter value, set equal to */
815 /* the new counter value if counters were different or */
816 /* kept the same if counters were the same. */
817
818 /* UPDATE is the logical flag indicating whether the old */
819 /* counter was updated. */
820
821 /* $ Parameters */
822
823 /* CTRSIZ is the dimension of the counter array used by */
824 /* various SPICE subsystems to identify */
825 /* changes in their states. */
826
827 /* $ Exceptions */
828
829 /* Error free. */
830
831 /* $ Files */
832
833 /* None. */
834
835 /* $ Particulars */
836
837 /* None. */
838
839 /* $ Examples */
840
841 /* See umbrella Examples. */
842
843 /* $ Restrictions */
844
845 /* None. */
846
847 /* $ Literature_References */
848
849 /* None. */
850
851 /* $ Author_and_Institution */
852
853 /* B.V. Semenov (JPL) */
854
855 /* $ Version */
856
857 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
858
859 /* -& */
860 /* $ Index_Entries */
861
862 /* check and update counter array */
863
864 /* -& */
865
866 /* Standard SPICE error handling. */
867
868 if (return_()) {
869 return 0;
870 }
871
872 /* Do counters differ? */
873
874 *update = newctr[0] != oldctr[0] || newctr[1] != oldctr[1];
875
876 /* If they do, set old counter to new value. */
877
878 if (*update) {
879 oldctr[0] = newctr[0];
880 oldctr[1] = newctr[1];
881 }
882 return 0;
883 } /* zzctr_ */
884
zzctr_(integer * newctr,integer * oldctr,logical * update)885 /* Subroutine */ int zzctr_(integer *newctr, integer *oldctr, logical *update)
886 {
887 return zzctr_0_(0, newctr, oldctr, update);
888 }
889
zzctruin_(integer * oldctr)890 /* Subroutine */ int zzctruin_(integer *oldctr)
891 {
892 return zzctr_0_(1, (integer *)0, oldctr, (logical *)0);
893 }
894
zzctrsin_(integer * oldctr)895 /* Subroutine */ int zzctrsin_(integer *oldctr)
896 {
897 return zzctr_0_(2, (integer *)0, oldctr, (logical *)0);
898 }
899
zzctrinc_(integer * oldctr)900 /* Subroutine */ int zzctrinc_(integer *oldctr)
901 {
902 return zzctr_0_(3, (integer *)0, oldctr, (logical *)0);
903 }
904
zzctrchk_(integer * newctr,integer * oldctr,logical * update)905 /* Subroutine */ int zzctrchk_(integer *newctr, integer *oldctr, logical *
906 update)
907 {
908 return zzctr_0_(4, newctr, oldctr, update);
909 }
910
911