1 /* zzeksca.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* Table of constant values */
9
10 static integer c__1 = 1;
11 static integer c_b65 = 2500000;
12
13 /* $Procedure ZZEKSCA ( EK, scratch area ) */
zzeksca_0_(int n__,integer * n,integer * beg,integer * end,integer * idata,integer * top)14 /* Subroutine */ int zzeksca_0_(int n__, integer *n, integer *beg, integer *
15 end, integer *idata, integer *top)
16 {
17 /* Initialized data */
18
19 static logical first = TRUE_;
20 static integer t = 0;
21
22 /* System generated locals */
23 integer i__1, i__2;
24
25 /* Builtin functions */
26 integer s_rnge(char *, integer, char *, integer);
27
28 /* Local variables */
29 static integer base, b, e, i__;
30 extern /* Subroutine */ int chkin_(char *, ftnlen);
31 static integer lastc, lastd, lasti, numrd, start;
32 extern logical failed_(void);
33 static integer rb;
34 extern /* Subroutine */ int dasadi_(integer *, integer *, integer *),
35 cleari_(integer *, integer *), daslla_(integer *, integer *,
36 integer *, integer *), dasllc_(integer *);
37 static integer rt;
38 extern /* Subroutine */ int dasrdi_(integer *, integer *, integer *,
39 integer *);
40 static integer numadd;
41 extern /* Subroutine */ int dasudi_(integer *, integer *, integer *,
42 integer *);
43 static integer remain, scrhan;
44 extern /* Subroutine */ int daswbr_(integer *);
45 static integer scrtch[2500000];
46 extern /* Subroutine */ int dasops_(integer *), sigerr_(char *, ftnlen),
47 chkout_(char *, ftnlen), setmsg_(char *, ftnlen), errint_(char *,
48 integer *, ftnlen);
49 extern logical return_(void);
50
51 /* $ Abstract */
52
53 /* Manage the EK scratch area. */
54
55 /* $ Disclaimer */
56
57 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
58 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
59 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
60 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
61 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
62 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
63 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
64 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
65 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
66 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
67
68 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
69 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
70 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
71 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
72 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
73 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
74
75 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
76 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
77 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
78 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
79
80 /* $ Required_Reading */
81
82 /* EK */
83
84 /* $ Keywords */
85
86 /* EK */
87 /* UTILITY */
88
89 /* $ Declarations */
90 /* $ Brief_I/O */
91
92 /* Variable I/O Entry points */
93 /* -------- --- -------------------------------------------------- */
94 /* N I ZZEKSPSH, ZZEKSPOP, ZZEKSDEC */
95 /* BEG I ZZEKSUPD, ZZEKSRD */
96 /* END I ZZEKSUPD, ZZEKSRD */
97 /* IDATA I-O ZZEKSPSH, ZZEKSPOP, ZZEKSUPD, ZZEKSRD */
98 /* TOP O ZZEKSTOP */
99
100 /* $ Detailed_Input */
101
102 /* See the entry points for descriptions of their inputs. */
103
104 /* $ Detailed_Output */
105
106 /* See the entry points for descriptions of their outputs. */
107
108 /* $ Parameters */
109
110 /* None. */
111
112 /* $ Exceptions */
113
114 /* 1) If this routine is called directly, the error SPICE(BOGUSENTRY) */
115 /* is signalled. */
116
117 /* See the entry points for discussions of exceptions specific to */
118 /* those routines. */
119
120 /* $ Files */
121
122 /* None. */
123
124 /* $ Particulars */
125
126 /* The specific implementation of the EK scratch area is NOT */
127 /* considered part of the specification of this suite of routines: */
128 /* the implementation may be changed without notice. However, */
129 /* some aspects of the current implementation, such as scratch */
130 /* file usage, are visible to users and therefore are discussed */
131 /* in this subroutine header. */
132
133 /* The EK system, in searching for events that satisfy a query, */
134 /* produces intermediate results that require a potentially very */
135 /* large amount of storage, more than can be expected to be */
136 /* available in the form of memory. On the other hand, in order */
137 /* to achieve reasonable query response time, these intermediate */
138 /* results must be capable of being accessed quickly. The EK */
139 /* scratch area provides a storage location that uses a combination */
140 /* of memory and disk storage to give the EK system a large storage */
141 /* area, part of which can be rapidly accessed. */
142
143 /* The logical structure of the EK scratch area is that of a large */
144 /* one-dimensional integer stack. The indices of the elements of */
145 /* this stack are referred to as scratch area `addresses'. Scratch */
146 /* area addresses start at 1 and increase. The maximum address is */
147 /* the maximum integer representable on the host computer, but the */
148 /* maximum usable address depends on the disk storage available */
149 /* to the calling program at the time the program is run. */
150
151 /* The EK scratch area has access routines that allow a calling */
152 /* program to write to and read from it. Calling routines must */
153 /* coordinate their use of the scratch area: the scratch area is */
154 /* effectively a global data structure. Routines outside of the EK */
155 /* system should not use the scratch area. */
156
157 /* The EK scratch area routines are: */
158
159 /* ZZEKSCA ( EK scratch area umbrella routine ) */
160 /* ZZEKSTOP ( EK scratch area, return stack pointer ) */
161 /* ZZEKSPSH ( EK scratch area, push data onto stack ) */
162 /* ZZEKSDEC ( EK scratch area, decrement stack pointer ) */
163 /* ZZEKSPOP ( EK scratch area, pop data from stack ) */
164 /* ZZEKSUPD ( EK scratch area, update data ) */
165 /* ZZEKSRD ( EK scratch area, read data ) */
166 /* ZZEKSCLN ( EK scratch area, clean up ) */
167
168 /* $ Examples */
169
170 /* 1) Push data on the scratch area stack. */
171
172 /* C */
173 /* C Push N items onto the stack. */
174 /* C */
175 /* CALL ZZEKSPSH ( N, DATA ) */
176
177
178 /* 2) Update a range of addresses that may span the stack top. */
179
180 /* C */
181 /* C Since we can't leave a gap between the stack top */
182 /* C and the start of the range of addresses we write to, */
183 /* C we'll need to know where the top is. The address */
184 /* C range to update is BEG:END. */
185 /* C */
186 /* CALL ZZEKSTOP ( TOP ) */
187
188 /* IF ( BEG .GT. TOP ) THEN */
189
190 /* [ Handle error case ] */
191
192 /* ELSE */
193
194 /* CALL ZZEKSUPD ( BEG, END, DATA ) */
195
196 /* END IF */
197
198
199
200 /* 3) Read from the scratch area. */
201
202 /* C */
203 /* C Read the contents of the scratch area address */
204 /* C range BEG:END into the integer array DATA: */
205 /* C */
206 /* CALL ZZEKSTOP ( TOP ) */
207
208 /* IF ( BEG .GT. TOP ) THEN */
209
210 /* [ Handle error case ] */
211
212 /* ELSE */
213
214 /* CALL ZZEKSRD ( BEG, END, DATA ) */
215
216 /* END IF */
217
218 /* $ Restrictions */
219
220 /* 1) The current implementation of this suite of routines opens */
221 /* a scratch file. The logical unit connected to the scratch */
222 /* file counts against the total that may be used by the calling */
223 /* program. Also, the scratch file, if written to, will occupy */
224 /* additional disk storage. */
225
226 /* 2) This suite of routines should not be used by routines outside */
227 /* of the EK system. */
228
229 /* $ Literature_References */
230
231 /* None. */
232
233 /* $ Author_and_Institution */
234
235 /* N.J. Bachman (JPL) */
236
237 /* $ Version */
238
239 /* - SPICELIB Version 3.2.0, 28-JUN-2005 (NJB) */
240
241 /* Increased buffer size from 500K to 2M integers. */
242
243 /* - SPICELIB Version 3.1.0, 29-JUL-2003 (NJB) */
244
245 /* Added DASWBR call to entry point ZZEKCLN. This call frees */
246 /* the buffer records used by the scratch file. */
247
248 /* - SPICELIB Version 3.0.0, 13-DEC-2001 (NJB) */
249
250 /* Added entry point ZZEKCLN. */
251
252 /* - Beta Version 2.0.0, 02-NOV-1995 (NJB) */
253
254 /* Updated for EK architecture 3. */
255
256 /* - Beta Version 1.1.0, 01-AUG-1994 (NJB) */
257
258 /* Scratch area buffer size increased to 500K integers. */
259 /* On 32-bit systems, this amounts to 2Mb of storage. */
260
261 /* - Beta Version 1.0.1, 25-FEB-1993 (NJB) */
262
263 /* Documented. */
264
265 /* - Beta Version 1.0.0, 16-DEC-1992 (NJB) */
266
267 /* -& */
268 /* $ Index_Entries */
269
270 /* manage the EK scratch area */
271
272 /* -& */
273 /* $ Revisions */
274
275 /* - SPICELIB Version 3.2.0, 28-JUN-2005 (NJB) */
276
277 /* Increased buffer size from 500K to 2M integers. */
278
279 /* - Beta Version 2.0.0, 08-SEP-1994 (NJB) */
280
281 /* Updated for EK architecture 3. */
282
283 /* - Beta Version 1.1.0, 01-AUG-1994 (NJB) */
284
285 /* Scratch area buffer size increased to 500K integers. */
286 /* On 32-bit systems, this amounts to 2Mb of storage. */
287
288 /* -& */
289
290 /* SPICELIB functions */
291
292
293 /* Local parameters */
294
295
296 /* The parameter MEMSIZ is the size of an integer array used as */
297 /* part of the scratch area. The first MEMSIZ scratch area addresses */
298 /* refer to elements of this array. Additional storage is supplied */
299 /* by the integer logical array of a scratch DAS file; the first */
300 /* word of the scratch DAS file corresponds to scratch area address */
301 /* MEMSIZ + 1. */
302
303
304 /* Local variables */
305
306
307 /* Saved variables */
308
309
310 /* Initial values */
311
312 /* Parameter adjustments */
313 if (idata) {
314 }
315
316 /* Function Body */
317 switch(n__) {
318 case 1: goto L_zzekstop;
319 case 2: goto L_zzekspsh;
320 case 3: goto L_zzekspop;
321 case 4: goto L_zzeksdec;
322 case 5: goto L_zzeksupd;
323 case 6: goto L_zzeksrd;
324 case 7: goto L_zzekscln;
325 }
326
327
328 /* Standard SPICE error handling. */
329
330 if (return_()) {
331 return 0;
332 } else {
333 chkin_("ZZEKSCA", (ftnlen)7);
334 }
335
336 /* This routine should never be called directly. */
337
338 sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17);
339 chkout_("ZZEKSCA", (ftnlen)7);
340 return 0;
341 /* $Procedure ZZEKSTOP ( EK scratch area, stack top ) */
342
343 L_zzekstop:
344 /* $ Abstract */
345
346 /* Obtain last address in use in EK scratch area. */
347
348 /* $ Disclaimer */
349
350 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
351 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
352 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
353 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
354 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
355 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
356 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
357 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
358 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
359 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
360
361 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
362 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
363 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
364 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
365 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
366 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
367
368 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
369 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
370 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
371 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
372
373 /* $ Required_Reading */
374
375 /* EK */
376
377 /* $ Keywords */
378
379 /* EK */
380 /* UTILITY */
381
382 /* $ Declarations */
383
384 /* INTEGER TOP */
385
386 /* $ Brief_I/O */
387
388 /* Variable I/O Description */
389 /* -------- --- -------------------------------------------------- */
390 /* TOP O EK scratch area stack top. */
391
392 /* $ Detailed_Input */
393
394 /* None. */
395
396 /* $ Detailed_Output */
397
398 /* TOP is the last address of the EK scratch area stack */
399 /* top. This is the highest EK scratch area address */
400 /* currently in use. */
401
402 /* $ Parameters */
403
404 /* None. */
405
406 /* $ Exceptions */
407
408 /* Error free. */
409
410 /* $ Files */
411
412 /* None. */
413
414 /* $ Particulars */
415
416 /* The EK scratch area stack top ranges from zero to, theoretically, */
417 /* the largest integer representable on the host system. */
418 /* and never decreases during a program run. Data pushed on the */
419 /* EK stack is inserted at address TOP+1 and occupies a contiguous */
420 /* range of addresses that extends upwards from this address. */
421
422 /* $ Examples */
423
424 /* See the header of the umbrella routine ZZEKSCA for an example */
425 /* of use of this routine. */
426
427 /* $ Restrictions */
428
429 /* None. */
430
431 /* $ Literature_References */
432
433 /* None. */
434
435 /* $ Author_and_Institution */
436
437 /* N.J. Bachman (JPL) */
438
439 /* $ Version */
440
441 /* - Beta Version 2.0.0, 08-SEP-1994 (NJB) */
442
443 /* Updated for EK architecture 3. */
444
445 /* - Beta Version 1.0.0, 25-FEB-1993 (NJB) */
446
447 /* -& */
448 /* $ Index_Entries */
449
450 /* read from EK scratch area */
451
452 /* -& */
453 *top = t;
454 return 0;
455 /* $Procedure ZZEKSPSH ( EK scratch area, push data ) */
456
457 L_zzekspsh:
458 /* $ Abstract */
459
460 /* Push the contents of an integer array onto the EK scratch area */
461 /* stack. */
462
463 /* $ Disclaimer */
464
465 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
466 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
467 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
468 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
469 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
470 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
471 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
472 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
473 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
474 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
475
476 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
477 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
478 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
479 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
480 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
481 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
482
483 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
484 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
485 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
486 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
487
488 /* $ Required_Reading */
489
490 /* EK */
491
492 /* $ Keywords */
493
494 /* EK */
495 /* UTILITY */
496
497 /* $ Declarations */
498
499 /* INTEGER N */
500 /* INTEGER IDATA ( * ) */
501
502 /* $ Brief_I/O */
503
504 /* Variable I/O Description */
505 /* -------- --- -------------------------------------------------- */
506 /* N I Number of integers to push. */
507 /* IDATA I Integer data. */
508
509 /* $ Detailed_Input */
510
511 /* N is the number of integers in the array IDATA to */
512 /* append to the EK scratch area. The data is */
513 /* stored in scratch area addresses T+1:T+N, */
514 /* where T is the EK scratch area stack top prior to */
515 /* the call to ZZEKSPSH. */
516
517 /* IDATA is an integer array containing data to append to */
518 /* the EK scratch area. The first N elements of */
519 /* IDATA are appended to the EK scratch area, in */
520 /* order. */
521
522 /* $ Detailed_Output */
523
524 /* None. */
525
526 /* $ Parameters */
527
528 /* None. */
529
530 /* $ Exceptions */
531
532 /* 1) If N is non-positive, this routine simply returns. No error */
533 /* is signalled. */
534
535 /* 2) If an I/O error occurs during the data addition, the error */
536 /* will be diagnosed by routines called by this routine. */
537
538 /* $ Files */
539
540 /* None. */
541
542 /* $ Particulars */
543
544 /* Let TOP be the EK scratch area stack top prior to a call to this */
545 /* routine. Data that is appended to the EK scratch area by this */
546 /* routine is inserted at address TOP+1 and occupies a contiguous */
547 /* range of addresses that extends upwards from this address. */
548
549 /* As a side effect of calling this routine, TOP is set to TOP + N. */
550
551 /* $ Examples */
552
553 /* See the header of the umbrella routine ZZEKSCA for an example */
554 /* of use of this routine. */
555
556 /* $ Restrictions */
557
558 /* 1) This routine must execute quickly. Therefore, it checks in */
559 /* only if it detects an error. If an error is signalled by a */
560 /* routine called by this routine, this routine will not appear */
561 /* in the SPICELIB traceback display. Also, in the interest */
562 /* of speed, this routine does not test the value of the SPICELIB */
563 /* function RETURN upon entry. */
564
565 /* $ Literature_References */
566
567 /* None. */
568
569 /* $ Author_and_Institution */
570
571 /* N.J. Bachman (JPL) */
572
573 /* $ Version */
574
575 /* - Beta Version 1.0.0, 15-JAN-1995 (NJB) */
576
577 /* -& */
578 /* $ Index_Entries */
579
580 /* push integer data onto EK scratch area stack */
581
582 /* -& */
583
584 /* No checking in here. */
585
586
587 /* First time through, open a scratch DAS file. */
588
589 if (first) {
590 first = FALSE_;
591 dasops_(&scrhan);
592 if (failed_()) {
593 return 0;
594 }
595 }
596
597 /* Go back if there's no data to write. */
598
599 if (*n < 1) {
600 return 0;
601 }
602
603 /* Add as much data as possible to our big array. */
604
605 if (t < 2500000) {
606 /* Computing MIN */
607 i__1 = *n, i__2 = 2500000 - t;
608 numadd = min(i__1,i__2);
609 i__1 = numadd;
610 for (i__ = 1; i__ <= i__1; ++i__) {
611 scrtch[(i__2 = t + i__ - 1) < 2500000 && 0 <= i__2 ? i__2 :
612 s_rnge("scrtch", i__2, "zzeksca_", (ftnlen)624)] = idata[
613 i__ - 1];
614 }
615 t += numadd;
616 if (numadd == *n) {
617 return 0;
618 }
619 remain = *n - numadd;
620 start = numadd + 1;
621 if (remain == 0) {
622 return 0;
623 }
624 } else {
625 remain = *n;
626 start = 1;
627 }
628
629 /* At this point, REMAIN and START are set, and T reflects the */
630 /* amount of data we've pushed so far. If we got this far, */
631 /* we'll need to put the rest of the data in the scratch DAS. */
632
633 /* The DAS system requires separate operations for updating */
634 /* an existing range of addresses and for appending data. */
635 /* We need to know the last integer address in use in the DAS */
636 /* file in order to determine which part of the data will */
637 /* be written to addresses previously written to, and which */
638 /* part will be appended. */
639
640 daslla_(&scrhan, &lastc, &lastd, &lasti);
641
642 /* To simplify our arithmetic, we'll work with a variable RT */
643 /* that represents the stack top measured relative to the base */
644 /* of the DAS integer array. At this point, RT is greater than */
645 /* or equal to zero. */
646
647 rt = t - 2500000;
648 if (rt < lasti) {
649
650 /* Some data can be added by updating DAS addresses. The */
651 /* available range for updating is B:E, where B and E are */
652 /* calculated below. This case can occur only when LASTI > 0. */
653
654 b = rt + 1;
655 /* Computing MIN */
656 i__1 = lasti, i__2 = rt + remain;
657 e = min(i__1,i__2);
658 dasudi_(&scrhan, &b, &e, &idata[start - 1]);
659 numadd = e - b + 1;
660 start += numadd;
661 remain -= numadd;
662 t += numadd;
663 if (remain == 0) {
664 return 0;
665 }
666 }
667
668 /* At this point, START and REMAIN are set, and T reflects the */
669 /* amount of data we've pushed so far.. The remaining data */
670 /* must be appended to the scratch DAS file. */
671
672 dasadi_(&scrhan, &remain, &idata[start - 1]);
673 t += remain;
674 return 0;
675 /* $Procedure ZZEKSPOP ( EK scratch area, pop data ) */
676
677 L_zzekspop:
678 /* $ Abstract */
679
680 /* Pop a specified number of elements from the top of the EK scratch */
681 /* area stack, transferring this data to an integer array. */
682
683 /* $ Disclaimer */
684
685 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
686 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
687 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
688 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
689 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
690 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
691 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
692 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
693 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
694 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
695
696 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
697 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
698 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
699 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
700 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
701 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
702
703 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
704 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
705 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
706 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
707
708 /* $ Required_Reading */
709
710 /* EK */
711
712 /* $ Keywords */
713
714 /* EK */
715 /* UTILITY */
716
717 /* $ Declarations */
718
719 /* INTEGER N */
720 /* INTEGER IDATA ( * ) */
721
722 /* $ Brief_I/O */
723
724 /* Variable I/O Description */
725 /* -------- --- -------------------------------------------------- */
726 /* N I Number of integers to pop. */
727 /* IDATA O Integer data. */
728
729 /* $ Detailed_Input */
730
731 /* N is the number of integers to pop from the */
732 /* EK scratch area stack. The data is */
733 /* read from the scratch area addresses T-N+1:T, */
734 /* where T is the stack top prior to the call to */
735 /* ZZEKSPOP. */
736
737 /* $ Detailed_Output */
738
739 /* IDATA is an integer array containing data read from */
740 /* the EK scratch area. The first N elements of */
741 /* IDATA assigned the values occupying the top N */
742 /* elements of the EK stack. */
743 /* $ Parameters */
744
745 /* None. */
746
747 /* $ Exceptions */
748
749 /* 1) If N is non-positive or if N is greater than the number of */
750 /* items on the stack, the error SPICE(INVALIDCOUNT) is */
751 /* signalled. */
752
753 /* 2) If an I/O error occurs during the data read, the error */
754 /* will be diagnosed by routines called by this routine. */
755
756 /* $ Files */
757
758 /* None. */
759
760 /* $ Particulars */
761
762 /* Let TOP be the EK scratch area stack top prior to a call to this */
763 /* routine. Data that is read from the EK scratch area by this */
764 /* routine is transferred from addresses TOP-N+1 to TOP and occupies */
765 /* to the range of addresses 1 to N in the array IDATA. */
766
767 /* As a side effect of calling this routine, TOP is set to TOP - N. */
768
769 /* $ Examples */
770
771 /* See the header of the umbrella routine ZZEKSCA for an example */
772 /* of use of this routine. */
773
774 /* $ Restrictions */
775
776 /* 1) This routine must execute quickly. Therefore, it checks in */
777 /* only if it detects an error. If an error is signalled by a */
778 /* routine called by this routine, this routine will not appear */
779 /* in the SPICELIB traceback display. Also, in the interest */
780 /* of speed, this routine does not test the value of the SPICELIB */
781 /* function RETURN upon entry. */
782
783 /* $ Literature_References */
784
785 /* None. */
786
787 /* $ Author_and_Institution */
788
789 /* N.J. Bachman (JPL) */
790
791 /* $ Version */
792
793 /* - Beta Version 1.0.0, 10-SEP-1994 (NJB) */
794
795 /* -& */
796 /* $ Index_Entries */
797
798 /* pop integer data from EK scratch area stack */
799
800 /* -& */
801
802 /* No checking in here. */
803
804
805 /* First time through, open a scratch DAS file. */
806
807 if (first) {
808 first = FALSE_;
809 dasops_(&scrhan);
810 if (failed_()) {
811 return 0;
812 }
813 }
814
815 /* You can't pop a negative number of elements. */
816
817 if (*n < 0) {
818 chkin_("ZZEKSPOP", (ftnlen)8);
819 setmsg_("Pop count must be non-negative; call requests popping # ele"
820 "ments.", (ftnlen)65);
821 errint_("#", n, (ftnlen)1);
822 sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19);
823 chkout_("ZZEKSPOP", (ftnlen)8);
824 return 0;
825
826 /* It's an error to try to pop more data than we have on the */
827 /* stack. */
828
829 } else if (*n > t) {
830 chkin_("ZZEKSPOP", (ftnlen)8);
831 setmsg_("EK stack pointer = #; call requests popping # items.", (
832 ftnlen)52);
833 errint_("#", &t, (ftnlen)1);
834 errint_("#", n, (ftnlen)1);
835 sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19);
836 chkout_("ZZEKSPOP", (ftnlen)8);
837 return 0;
838 }
839
840 /* Read as much data as possible from our big array. */
841
842 base = t - *n;
843 if (base < 2500000) {
844 /* Computing MIN */
845 i__1 = *n, i__2 = 2500000 - base;
846 numrd = min(i__1,i__2);
847 i__1 = numrd;
848 for (i__ = 1; i__ <= i__1; ++i__) {
849 idata[i__ - 1] = scrtch[(i__2 = base + i__ - 1) < 2500000 && 0 <=
850 i__2 ? i__2 : s_rnge("scrtch", i__2, "zzeksca_", (ftnlen)
851 895)];
852 }
853 if (numrd == *n) {
854 t -= numrd;
855 return 0;
856 }
857 remain = *n - numrd;
858 base = 2500000;
859 start = numrd + 1;
860 } else {
861 remain = *n;
862 start = 1;
863 }
864
865 /* At this point, REMAIN, START and BASE are set. If we got this */
866 /* far, we'll need to read the rest of the data from the scratch DAS. */
867 /* Compute the base address to read from relative to the start of */
868 /* the DAS array. */
869
870 rb = base - 2500000;
871 b = rb + 1;
872 e = rb + remain;
873 dasrdi_(&scrhan, &b, &e, &idata[start - 1]);
874 t -= *n;
875 return 0;
876 /* $Procedure ZZEKSDEC ( EK scratch area, decrement stack pointer ) */
877
878 L_zzeksdec:
879 /* $ Abstract */
880
881 /* Decrement the EK scratch area stack pointer by a specified count. */
882
883 /* $ Disclaimer */
884
885 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
886 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
887 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
888 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
889 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
890 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
891 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
892 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
893 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
894 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
895
896 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
897 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
898 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
899 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
900 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
901 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
902
903 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
904 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
905 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
906 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
907
908 /* $ Required_Reading */
909
910 /* EK */
911
912 /* $ Keywords */
913
914 /* EK */
915 /* UTILITY */
916
917 /* $ Declarations */
918
919 /* INTEGER N */
920
921 /* $ Brief_I/O */
922
923 /* Variable I/O Description */
924 /* -------- --- -------------------------------------------------- */
925 /* N I Decrement count. */
926
927 /* $ Detailed_Input */
928
929 /* N is the number to subtract from the EK scratch */
930 /* area stack pointer. */
931
932 /* $ Detailed_Output */
933
934 /* None. */
935
936 /* $ Parameters */
937
938 /* None. */
939
940 /* $ Exceptions */
941
942 /* 1) If N is non-positive or if N is greater than the number of */
943 /* items on the stack, the error SPICE(INVALIDCOUNT) is */
944 /* signalled. */
945
946 /* $ Files */
947
948 /* None. */
949
950 /* $ Particulars */
951
952 /* Let TOP be the EK scratch area stack top prior to a call to this */
953 /* routine. The effect of calling this routine is that TOP is set */
954 /* to TOP - N. */
955
956 /* $ Examples */
957
958 /* See the header of the umbrella routine ZZEKSCA for an example */
959 /* of use of this routine. */
960
961 /* $ Restrictions */
962
963 /* 1) This routine must execute quickly. Therefore, it checks in */
964 /* only if it detects an error. If an error is signalled by a */
965 /* routine called by this routine, this routine will not appear */
966 /* in the SPICELIB traceback display. Also, in the interest */
967 /* of speed, this routine does not test the value of the SPICELIB */
968 /* function RETURN upon entry. */
969
970 /* $ Literature_References */
971
972 /* None. */
973
974 /* $ Author_and_Institution */
975
976 /* N.J. Bachman (JPL) */
977
978 /* $ Version */
979
980 /* - Beta Version 1.0.0, 10-SEP-1994 (NJB) */
981
982 /* -& */
983 /* $ Index_Entries */
984
985 /* decrement EK scratch area stack pointer */
986
987 /* -& */
988
989 /* No checking in here. */
990
991
992 /* First time through, open a scratch DAS file. */
993
994 if (first) {
995 first = FALSE_;
996 dasops_(&scrhan);
997 if (failed_()) {
998 return 0;
999 }
1000 }
1001
1002 /* Catch non-positive decrement requests. */
1003
1004 if (*n < 0) {
1005 chkin_("ZZEKSDEC", (ftnlen)8);
1006 setmsg_("Decrement value must be non-negative; call requests decreme"
1007 "nt by #.", (ftnlen)67);
1008 errint_("#", n, (ftnlen)1);
1009 sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19);
1010 chkout_("ZZEKSDEC", (ftnlen)8);
1011 return 0;
1012
1013 /* It's an error to try to decrement the pointer by more than */
1014 /* the current stack depth. */
1015
1016 } else if (*n > t) {
1017 chkin_("ZZEKSDEC", (ftnlen)8);
1018 setmsg_("EK stack pointer = #; call requests decrement by #.", (
1019 ftnlen)52);
1020 errint_("#", &t, (ftnlen)1);
1021 errint_("#", n, (ftnlen)1);
1022 sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19);
1023 chkout_("ZZEKSDEC", (ftnlen)8);
1024 return 0;
1025 }
1026 t -= *n;
1027 return 0;
1028 /* $Procedure ZZEKSUPD ( EK scratch area, update ) */
1029
1030 L_zzeksupd:
1031 /* $ Abstract */
1032
1033 /* Update the contents of a range of addresses already in use in the */
1034 /* EK scratch area. */
1035
1036 /* $ Disclaimer */
1037
1038 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1039 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1040 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1041 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1042 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1043 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1044 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1045 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1046 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1047 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1048
1049 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1050 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1051 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1052 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1053 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1054 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1055
1056 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1057 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1058 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1059 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1060
1061 /* $ Required_Reading */
1062
1063 /* EK */
1064
1065 /* $ Keywords */
1066
1067 /* EK */
1068 /* UTILITY */
1069
1070 /* $ Declarations */
1071
1072 /* INTEGER BEG */
1073 /* INTEGER END */
1074 /* INTEGER IDATA ( * ) */
1075
1076 /* $ Brief_I/O */
1077
1078 /* Variable I/O Description */
1079 /* -------- --- -------------------------------------------------- */
1080 /* BEG, */
1081 /* END I Begin and end addresses of range to update. */
1082 /* IDATA I Integer data. */
1083
1084 /* $ Detailed_Input */
1085
1086 /* BEG, */
1087 /* END are the first and last of a range of EK scratch */
1088 /* area addresses to write to. BEG and END must */
1089 /* satisfy the relations */
1090
1091 /* 1 < BEG < END < TOP */
1092 /* - - - */
1093
1094 /* where TOP is the last EK scratch area stack top */
1095 /* at the time this routine is called. */
1096
1097 /* IDATA is an integer array containing data to write to */
1098 /* the specified range of addresses in the EK scratch */
1099 /* area. The first END-BEG+1 elements of IDATA are */
1100 /* written to the specified range in the EK scratch */
1101 /* area, in order. */
1102
1103 /* $ Detailed_Output */
1104
1105 /* None. */
1106
1107 /* $ Parameters */
1108
1109 /* None. */
1110
1111 /* $ Exceptions */
1112
1113 /* 1) If either of BEG or END are outside of the range 1:TOP, */
1114 /* where TOP is the EK scratch area stack top, the error */
1115 /* SPICE(INVALIDADDRESS) is signalled. */
1116
1117 /* 2) If END < BEG, this routine simply returns. No error */
1118 /* is signalled. */
1119
1120 /* 3) If an I/O error occurs during the data addition, the error */
1121 /* will be diagnosed by routines called by this routine. */
1122
1123 /* $ Files */
1124
1125 /* None. */
1126
1127 /* $ Particulars */
1128
1129 /* Let TOP be the EK scratch area stack top prior to a call to this */
1130 /* routine. This routine is used to modify values in the scratch */
1131 /* area that lie in the address range 1:TOP. */
1132
1133 /* $ Examples */
1134
1135 /* See the header of the umbrella routine ZZEKSCA for an example */
1136 /* of use of this routine. */
1137
1138 /* $ Restrictions */
1139
1140 /* 1) This routine must execute quickly. Therefore, it checks in */
1141 /* only if it detects an error. If an error is signalled by a */
1142 /* routine called by this routine, this routine will not appear */
1143 /* in the SPICELIB traceback display. Also, in the interest */
1144 /* of speed, this routine does not test the value of the SPICELIB */
1145 /* function RETURN upon entry. */
1146
1147 /* $ Literature_References */
1148
1149 /* None. */
1150
1151 /* $ Author_and_Institution */
1152
1153 /* N.J. Bachman (JPL) */
1154
1155 /* $ Version */
1156
1157 /* - Beta Version 2.0.0, 23-FEB-1995 (NJB) */
1158
1159 /* Updated for EK architecture 3. */
1160
1161 /* - Beta Version 1.0.0, 25-FEB-1993 (NJB) */
1162
1163 /* -& */
1164 /* $ Index_Entries */
1165
1166 /* update data in EK scratch area */
1167
1168 /* -& */
1169
1170 /* No checking in here. */
1171
1172
1173 /* Validate the addresses. */
1174
1175 if (*beg < 1 || *beg > t) {
1176 chkin_("ZZEKSUPD", (ftnlen)8);
1177 setmsg_("Start address BEG was #; valid range is 1:#", (ftnlen)43);
1178 errint_("#", beg, (ftnlen)1);
1179 errint_("#", &t, (ftnlen)1);
1180 sigerr_("SPICE(INVALIDADDRESS)", (ftnlen)21);
1181 chkout_("ZZEKSUPD", (ftnlen)8);
1182 return 0;
1183 } else if (*end < 1 || *end > t) {
1184 chkin_("ZZEKSUPD", (ftnlen)8);
1185 setmsg_("End address END was #; valid range is 1:#", (ftnlen)41);
1186 errint_("#", end, (ftnlen)1);
1187 errint_("#", &t, (ftnlen)1);
1188 sigerr_("SPICE(INVALIDADDRESS)", (ftnlen)21);
1189 chkout_("ZZEKSUPD", (ftnlen)8);
1190 return 0;
1191 } else if (*beg > *end) {
1192 return 0;
1193 }
1194 if (*end <= 2500000) {
1195
1196 /* If the entire range is in memory, fine. Update the range */
1197 /* now. */
1198
1199 i__1 = *end;
1200 for (i__ = *beg; i__ <= i__1; ++i__) {
1201 scrtch[(i__2 = i__ - 1) < 2500000 && 0 <= i__2 ? i__2 : s_rnge(
1202 "scrtch", i__2, "zzeksca_", (ftnlen)1296)] = idata[i__ - *
1203 beg];
1204 }
1205 } else if (*beg <= 2500000) {
1206
1207 /* Update the portion of the address range that's in memory. */
1208
1209 for (i__ = *beg; i__ <= 2500000; ++i__) {
1210 scrtch[(i__1 = i__ - 1) < 2500000 && 0 <= i__1 ? i__1 : s_rnge(
1211 "scrtch", i__1, "zzeksca_", (ftnlen)1305)] = idata[i__ - *
1212 beg];
1213 }
1214
1215 /* Now update the rest of the range, which is in the scratch */
1216 /* DAS file. */
1217
1218 i__1 = *end - 2500000;
1219 dasudi_(&scrhan, &c__1, &i__1, &idata[2500000 - *beg + 1]);
1220 } else {
1221
1222 /* The whole range is in the DAS file. */
1223
1224 i__1 = *beg - 2500000;
1225 i__2 = *end - 2500000;
1226 dasudi_(&scrhan, &i__1, &i__2, idata);
1227 }
1228 return 0;
1229 /* $Procedure ZZEKSRD ( EK scratch area, read ) */
1230
1231 L_zzeksrd:
1232 /* $ Abstract */
1233
1234 /* Read from a range of addresses in the EK scratch area. */
1235
1236 /* $ Disclaimer */
1237
1238 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1239 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1240 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1241 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1242 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1243 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1244 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1245 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1246 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1247 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1248
1249 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1250 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1251 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1252 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1253 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1254 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1255
1256 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1257 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1258 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1259 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1260
1261 /* $ Required_Reading */
1262
1263 /* EK */
1264
1265 /* $ Keywords */
1266
1267 /* EK */
1268 /* UTILITY */
1269
1270 /* $ Declarations */
1271
1272 /* INTEGER BEG */
1273 /* INTEGER END */
1274 /* INTEGER IDATA ( * ) */
1275
1276 /* $ Brief_I/O */
1277
1278 /* Variable I/O Description */
1279 /* -------- --- -------------------------------------------------- */
1280 /* BEG, */
1281 /* END I Begin and end addresses of range to read from. */
1282 /* IDATA O Integer data. */
1283
1284 /* $ Detailed_Input */
1285
1286 /* BEG, */
1287 /* END are the first and last of a range of EK scratch */
1288 /* area addresses to read from. BEG and END must */
1289 /* satisfy the relations */
1290
1291 /* 1 < BEG < END < LAST */
1292 /* - - - */
1293
1294 /* where LAST is the last EK scratch area address */
1295 /* in use at the time this routine is called. */
1296
1297 /* $ Detailed_Output */
1298
1299 /* IDATA is an integer array containing data read from the */
1300 /* range of addresses BEG:END in the EK scratch area. */
1301 /* The first END-BEG+1 elements of IDATA are assigned */
1302 /* in order using the contents of this address range. */
1303 /* IDATA must have dimension at least END-BEG+1. */
1304
1305 /* $ Parameters */
1306
1307 /* None. */
1308
1309 /* $ Exceptions */
1310
1311 /* 1) If either of BEG or END are outside of the range 1:LAST, */
1312 /* where LAST is the last address already in use in the EK */
1313 /* scratch area, the error SPICE(INVALIDADDRESS) is signalled. */
1314
1315 /* 2) If END < BEG, this routine simply returns. No error */
1316 /* is signalled. */
1317
1318 /* 3) If an I/O error occurs during the read, the error will be */
1319 /* diagnosed by routines called by this routine. */
1320
1321 /* 4) If IDATA has dimension less than END-BEG+1, the results of */
1322 /* a call to this routine will be unpredictable, except that */
1323 /* you can safely predict they'll be wrong. */
1324
1325 /* $ Files */
1326
1327 /* None. */
1328
1329 /* $ Particulars */
1330
1331 /* Let LAST be the last address in use in the EK scratch area prior */
1332 /* to a call to this routine. This routine is used to read values */
1333 /* in the scratch area that lie in the address range 1:LAST. */
1334
1335 /* $ Examples */
1336
1337 /* See the header of the umbrella routine ZZEKSCA for an example */
1338 /* of use of this routine. */
1339
1340 /* $ Restrictions */
1341
1342 /* 1) This routine must execute quickly. Therefore, it checks in */
1343 /* only if it detects an error. If an error is signalled by a */
1344 /* routine called by this routine, this routine will not appear */
1345 /* in the SPICELIB traceback display. Also, in the interest */
1346 /* of speed, this routine does not test the value of the SPICELIB */
1347 /* function RETURN upon entry. */
1348
1349 /* $ Literature_References */
1350
1351 /* None. */
1352
1353 /* $ Author_and_Institution */
1354
1355 /* N.J. Bachman (JPL) */
1356
1357 /* $ Version */
1358
1359 /* - Beta Version 1.0.0, 23-FEB-1995 (NJB) */
1360
1361 /* -& */
1362 /* $ Index_Entries */
1363
1364 /* read from EK scratch area */
1365
1366 /* -& */
1367
1368 /* No checking in here. */
1369
1370
1371 /* Validate the addresses. */
1372
1373 if (*beg < 1 || *beg > t) {
1374 chkin_("ZZEKSRD", (ftnlen)7);
1375 setmsg_("Start address BEG was #; valid range is 1:#", (ftnlen)43);
1376 errint_("#", beg, (ftnlen)1);
1377 errint_("#", &t, (ftnlen)1);
1378 sigerr_("SPICE(INVALIDADDRESS)", (ftnlen)21);
1379 chkout_("ZZEKSRD", (ftnlen)7);
1380 return 0;
1381 } else if (*end < 1 || *end > t) {
1382 chkin_("ZZEKSRD", (ftnlen)7);
1383 setmsg_("End address END was #; valid range is 1:#", (ftnlen)41);
1384 errint_("#", end, (ftnlen)1);
1385 errint_("#", &t, (ftnlen)1);
1386 sigerr_("SPICE(INVALIDADDRESS)", (ftnlen)21);
1387 chkout_("ZZEKSRD", (ftnlen)7);
1388 return 0;
1389 } else if (*beg > *end) {
1390 return 0;
1391 }
1392 if (*end <= 2500000) {
1393
1394 /* If the entire range is in memory, fine. Read from the range */
1395 /* now. */
1396
1397 i__1 = *end;
1398 for (i__ = *beg; i__ <= i__1; ++i__) {
1399 idata[i__ - *beg] = scrtch[(i__2 = i__ - 1) < 2500000 && 0 <=
1400 i__2 ? i__2 : s_rnge("scrtch", i__2, "zzeksca_", (ftnlen)
1401 1512)];
1402 }
1403 } else if (*beg <= 2500000) {
1404
1405 /* Read from the portion of the address range that's in memory. */
1406
1407 for (i__ = *beg; i__ <= 2500000; ++i__) {
1408 idata[i__ - *beg] = scrtch[(i__1 = i__ - 1) < 2500000 && 0 <=
1409 i__1 ? i__1 : s_rnge("scrtch", i__1, "zzeksca_", (ftnlen)
1410 1521)];
1411 }
1412
1413 /* Now read the rest of the range, which is in the scratch */
1414 /* DAS file. */
1415
1416 i__1 = *end - 2500000;
1417 dasrdi_(&scrhan, &c__1, &i__1, &idata[2500000 - *beg + 1]);
1418 } else {
1419
1420 /* The whole range is in the DAS file. */
1421
1422 i__1 = *beg - 2500000;
1423 i__2 = *end - 2500000;
1424 dasrdi_(&scrhan, &i__1, &i__2, idata);
1425 }
1426 return 0;
1427 /* $Procedure ZZEKSCLN ( EK scratch area, clean up ) */
1428
1429 L_zzekscln:
1430 /* $ Abstract */
1431
1432 /* Clean up: re-initialize the EK scratch area; unload the */
1433 /* scratch file. */
1434
1435 /* $ Disclaimer */
1436
1437 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
1438 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
1439 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
1440 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
1441 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
1442 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
1443 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
1444 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
1445 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
1446 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
1447
1448 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
1449 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
1450 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
1451 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
1452 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
1453 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
1454
1455 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
1456 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
1457 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
1458 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
1459
1460 /* $ Required_Reading */
1461
1462 /* EK */
1463
1464 /* $ Keywords */
1465
1466 /* EK */
1467 /* UTILITY */
1468
1469 /* $ Declarations */
1470
1471 /* None. */
1472
1473 /* $ Brief_I/O */
1474
1475 /* None. */
1476
1477 /* $ Detailed_Input */
1478
1479 /* None. */
1480
1481 /* $ Detailed_Output */
1482
1483 /* None. */
1484
1485 /* $ Parameters */
1486
1487 /* None. */
1488
1489 /* $ Exceptions */
1490
1491 /* None. */
1492
1493 /* $ Files */
1494
1495 /* This routine unloads the scratch DAS used by this system. */
1496
1497 /* $ Particulars */
1498
1499 /* This routine is intended to enable test software to unload */
1500 /* the scratch DAS file used by the EK scratch area routines. */
1501
1502 /* $ Examples */
1503
1504 /* None. */
1505
1506 /* $ Restrictions */
1507
1508 /* 1) Many EK routines operate by side effects on the EK scratch */
1509 /* area, so this routine must be used with caution. */
1510
1511 /* $ Literature_References */
1512
1513 /* None. */
1514
1515 /* $ Author_and_Institution */
1516
1517 /* N.J. Bachman (JPL) */
1518
1519 /* $ Version */
1520
1521 /* - SPICELIB Version 3.1.0, 29-JUL-2003 (NJB) */
1522
1523 /* Added DASWBR call. This call frees the buffer records used by */
1524 /* the scratch file. */
1525
1526 /* - SPICELIB Version 3.0.0, 27-DEC-2001 (NJB) */
1527
1528 /* -& */
1529 /* $ Index_Entries */
1530
1531 /* clean up EK scratch area */
1532
1533 /* -& */
1534
1535 /* No checking in here. */
1536
1537
1538 /* Clean out the stack buffer. */
1539
1540 cleari_(&c_b65, scrtch);
1541 t = 0;
1542
1543 /* If FIRST has been set to .FALSE., we've an open scratch DAS */
1544 /* to dispose of. */
1545
1546 if (! first) {
1547
1548 /* Write out the buffered records belonging to the scratch file; */
1549 /* this will cause them to be returned to the free list. */
1550
1551 daswbr_(&scrhan);
1552
1553 /* Dump the scratch DAS. */
1554
1555 dasllc_(&scrhan);
1556 }
1557
1558 /* Tell the system to re-initialize on the next pass. */
1559
1560 first = TRUE_;
1561 return 0;
1562 } /* zzeksca_ */
1563
zzeksca_(integer * n,integer * beg,integer * end,integer * idata,integer * top)1564 /* Subroutine */ int zzeksca_(integer *n, integer *beg, integer *end, integer
1565 *idata, integer *top)
1566 {
1567 return zzeksca_0_(0, n, beg, end, idata, top);
1568 }
1569
zzekstop_(integer * top)1570 /* Subroutine */ int zzekstop_(integer *top)
1571 {
1572 return zzeksca_0_(1, (integer *)0, (integer *)0, (integer *)0, (integer *)
1573 0, top);
1574 }
1575
zzekspsh_(integer * n,integer * idata)1576 /* Subroutine */ int zzekspsh_(integer *n, integer *idata)
1577 {
1578 return zzeksca_0_(2, n, (integer *)0, (integer *)0, idata, (integer *)0);
1579 }
1580
zzekspop_(integer * n,integer * idata)1581 /* Subroutine */ int zzekspop_(integer *n, integer *idata)
1582 {
1583 return zzeksca_0_(3, n, (integer *)0, (integer *)0, idata, (integer *)0);
1584 }
1585
zzeksdec_(integer * n)1586 /* Subroutine */ int zzeksdec_(integer *n)
1587 {
1588 return zzeksca_0_(4, n, (integer *)0, (integer *)0, (integer *)0, (
1589 integer *)0);
1590 }
1591
zzeksupd_(integer * beg,integer * end,integer * idata)1592 /* Subroutine */ int zzeksupd_(integer *beg, integer *end, integer *idata)
1593 {
1594 return zzeksca_0_(5, (integer *)0, beg, end, idata, (integer *)0);
1595 }
1596
zzeksrd_(integer * beg,integer * end,integer * idata)1597 /* Subroutine */ int zzeksrd_(integer *beg, integer *end, integer *idata)
1598 {
1599 return zzeksca_0_(6, (integer *)0, beg, end, idata, (integer *)0);
1600 }
1601
zzekscln_(void)1602 /* Subroutine */ int zzekscln_(void)
1603 {
1604 return zzeksca_0_(7, (integer *)0, (integer *)0, (integer *)0, (integer *)
1605 0, (integer *)0);
1606 }
1607
1608