bool split_name(symbol const& name, symbol & prefix, symbol & suffix) const { if (name.is_numerical()) return false; char const* str = name.bare_str(); char const* period = strchr(str,'.'); if (!period) return false; svector<char> prefix_((unsigned)(period-str), str); prefix_.push_back(0); prefix = symbol(prefix_.c_ptr()); suffix = symbol(period + 1); return true; }
/* $Procedure META_2 ( Percy's interface to META_0 ) */ /* Subroutine */ int meta_2__0_(int n__, char *command, char *temps, integer * ntemps, char *temp, integer *btemp, char *error, ftnlen command_len, ftnlen temps_len, ftnlen temp_len, ftnlen error_len) { /* Initialized data */ static logical pass1 = TRUE_; static char margns[128] = "LEFT 1 RIGHT 75 " " " " "; static char keynam[6*10] = "1 " "2 " "3 " "4 " "5 " "6 " "7 " "8 " "9 " "10 "; /* System generated locals */ address a__1[5]; integer i__1, i__2[5]; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_cmp(char *, char *, ftnlen, ftnlen), s_wsle(cilist *), e_wsle( void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); integer do_lio(integer *, integer *, char *, ftnlen); /* Local variables */ extern /* Subroutine */ int getopt_1__(char *, integer *, char *, integer *, char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen, ftnlen); static integer sbeg; static char mode[16], pick[32]; static integer b, e, i__, j; extern integer cardc_(char *, ftnlen); extern logical batch_(void); static integer score; static logical fixit; extern integer rtrim_(char *, ftnlen); static char style[128]; static integer m2code; static char tryit[600]; extern /* Subroutine */ int m2gmch_(char *, char *, char *, integer *, logical *, integer *, logical *, integer *, integer *, char *, ftnlen, ftnlen, ftnlen, ftnlen), m2rcvr_(integer *, integer *, char *, ftnlen), scardc_(integer *, char *, ftnlen); static integer bscore, cutoff; static logical reason; extern /* Subroutine */ int prefix_(char *, integer *, char *, ftnlen, ftnlen), ssizec_(integer *, char *, ftnlen), repsub_(char *, integer *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); static logical intrct; extern /* Subroutine */ int suffix_(char *, integer *, char *, ftnlen, ftnlen); static char thnwds[32*7], kwords[32*16]; extern /* Subroutine */ int cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen), prepsn_(char *, ftnlen); static logical pssthn; static char questn[80]; extern /* Subroutine */ int niceio_3__(char *, integer *, char *, ftnlen, ftnlen), cnfirm_1__(char *, logical *, ftnlen); /* Fortran I/O blocks */ static cilist io___19 = { 0, 6, 0, 0, 0 }; static cilist io___20 = { 0, 6, 0, 0, 0 }; static cilist io___21 = { 0, 6, 0, 0, 0 }; static cilist io___22 = { 0, 6, 0, 0, 0 }; static cilist io___23 = { 0, 6, 0, 0, 0 }; static cilist io___27 = { 0, 6, 0, 0, 0 }; static cilist io___29 = { 0, 6, 0, 0, 0 }; static cilist io___30 = { 0, 6, 0, 0, 0 }; static cilist io___31 = { 0, 6, 0, 0, 0 }; /* $ Abstract */ /* Given a collection of acceptable syntax's and a statement */ /* (COMMAND) this routine determines if the statement is */ /* syntactically correct. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* The META/2 Book. */ /* $ Keywords */ /* COMPARE */ /* PARSING */ /* SEARCH */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* COMMAND I A candidate PERCY command. */ /* TEMPS I A collection of language definition statements */ /* NTEMPS I The number of definition statements */ /* TEMP - Work space required for comparison of statements. */ /* BTEMP O The first of the def statements that best matches. */ /* ERROR O Non-blank if none of the def's match. */ /* $ Detailed_Input */ /* COMMAND A candidate PERCY command. */ /* TEMPS A collection of language definition statements */ /* NTEMPS The number of definition statements */ /* TEMP Work space required for comparison of statements. */ /* TEMP should be declared to have the same length */ /* as the character strings that make up TEMPS. */ /* $ Detailed_Output */ /* BTEMP The first of the def statements that best matches. */ /* ERROR Non-blank if none of the def's match. */ /* $ Files */ /* None. */ /* $ Exceptions */ /* None. */ /* $ Particulars */ /* Later. */ /* $ Examples */ /* Later. */ /* $ Restrictions */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* H.A. Neilan (JPL) */ /* W.L. Taber (JPL) */ /* I.M. Underwood (JPL) */ /* $ Version */ /* - META/2 Configured Version 3.0.0, 11-AUG-1995 (WLT) */ /* The control flow through this routine was modified */ /* so that it will now re-try all templates (starting */ /* with the best previous match) if a spelling error */ /* is encountered. This should fix the confused */ /* responses that META/2 gave occassionally before. */ /* - META/2 Configured Version 2.0.0, 9-MAY-1994 (WLT) */ /* This is the configured version of the Command Loop */ /* software as of May 9, 1994 */ /* - META/2 Configured Version 2.0.0, 9-MAY-1994 */ /* Added a pretty print formatting capability to the */ /* error diagnostics. */ /* - META/2 Configured Version 1.0.0, 3-MAY-1994 (WLT) */ /* This is the configured version of META/2 */ /* software as of May 3, 1994 */ /* - Beta Version 2.0.0, 14-JAN-1993 (HAN) */ /* Assigned the value 'INTERACTIVE' to the variable MODE, and */ /* replaced calls to VTLIB routines with calls to more */ /* portable routines. */ /* - Beta Version 1.0.0, 13-JUL-1988 (WLT) (IMU) */ /* -& */ /* Spice Functions */ /* Local variables. */ /* Saved variables */ /* Initial values */ /* Parameter adjustments */ if (temps) { } if (error) { } /* Function Body */ switch(n__) { case 1: goto L_m2marg; } /* %&END_DECLARATIONS */ /* Take care of first pass initializations. */ if (pass1) { pass1 = FALSE_; ssizec_(&c__1, thnwds, (ftnlen)32); scardc_(&c__0, thnwds, (ftnlen)32); ssizec_(&c__10, kwords, (ftnlen)32); scardc_(&c__0, kwords, (ftnlen)32); /* Determine if were in batch or interactive mode. */ if (batch_()) { s_copy(mode, "BATCH", (ftnlen)16, (ftnlen)5); } else { s_copy(mode, "INTERACTIVE", (ftnlen)16, (ftnlen)11); } } intrct = s_cmp(mode, "BATCH", (ftnlen)16, (ftnlen)5) != 0; s_copy(style, margns, (ftnlen)128, (ftnlen)128); suffix_("NEWLINE /cr VTAB /vt HARDSPACE , ", &c__1, style, (ftnlen)33, ( ftnlen)128); i__ = 0; bscore = -1; m2code = -1; cutoff = 72; reason = TRUE_; /* Look through the templates until we get a match or we */ /* run out of templates to try. */ i__1 = *ntemps; for (i__ = 1; i__ <= i__1; ++i__) { score = 0; s_copy(temp, temps + (i__ - 1) * temps_len, temp_len, temps_len); sbeg = 1; m2code = 0; m2gmch_(temp, thnwds, command, &sbeg, &reason, &cutoff, &pssthn, & m2code, &score, error, temp_len, (ftnlen)32, command_len, error_len); /* If M2CODE comes back zero, we are done with the work */ /* of this routine. */ if (m2code == 0) { *btemp = i__; return 0; } if (score > bscore) { bscore = score; *btemp = i__; } } /* If we get here, we know we didn't have a match. Examine the */ /* highest scoring template to get available diagnostics */ /* about the mismatch. */ s_copy(temp, temps + (*btemp - 1) * temps_len, temp_len, temps_len); sbeg = 1; fixit = TRUE_; m2code = 0; m2gmch_(temp, thnwds, command, &sbeg, &c_true, &cutoff, &pssthn, &m2code, &score, error, temp_len, (ftnlen)32, command_len, error_len); /* If we are in interactiive mode and we have a spelling error, we */ /* can attempt to fix it. Note this occurs only if the M2CODE */ /* is less than 100 mod 10000. */ while(m2code % 10000 < 100 && intrct && fixit) { /* Construct a friendly message; display it; and */ /* get the user's response as to whether or not the */ /* command should be modified. */ s_copy(tryit, error, (ftnlen)600, error_len); prefix_("Hmmmm.,,,", &c__1, tryit, (ftnlen)9, (ftnlen)600); suffix_("/cr/cr I can repair this if you like.", &c__0, tryit, ( ftnlen)37, (ftnlen)600); s_wsle(&io___19); e_wsle(); niceio_3__(tryit, &c__6, style, (ftnlen)600, (ftnlen)128); s_wsle(&io___20); e_wsle(); s_wsle(&io___21); e_wsle(); s_wsle(&io___22); e_wsle(); s_wsle(&io___23); e_wsle(); m2rcvr_(&b, &e, kwords, (ftnlen)32); if (cardc_(kwords, (ftnlen)32) == 1) { /* Writing concatenation */ i__2[0] = 17, a__1[0] = "Should I change \""; i__2[1] = e - (b - 1), a__1[1] = command + (b - 1); i__2[2] = 6, a__1[2] = "\" to \""; i__2[3] = rtrim_(kwords + 192, (ftnlen)32), a__1[3] = kwords + 192; i__2[4] = 3, a__1[4] = "\" ?"; s_cat(questn, a__1, i__2, &c__5, (ftnlen)80); cnfirm_1__(questn, &fixit, rtrim_(questn, (ftnlen)80)); } else { cnfirm_1__("Should I fix it?", &fixit, (ftnlen)16); } /* If the user has elected to have us fix the command */ /* we have a few things to do... */ if (fixit) { /* Look up the suggested fixes. If there is more than */ /* one possibility, see which one the user thinks is */ /* best. Otherwise, no more questions for now. */ m2rcvr_(&b, &e, kwords, (ftnlen)32); if (cardc_(kwords, (ftnlen)32) > 1) { i__1 = cardc_(kwords, (ftnlen)32) - 4; for (i__ = 1; i__ <= i__1; ++i__) { s_wsle(&io___27); e_wsle(); } i__1 = cardc_(kwords, (ftnlen)32); getopt_1__("Which word did you mean?", &i__1, keynam, &c__6, kwords + 192, &c__32, kwords + 192, pick, (ftnlen)24, (ftnlen)6, (ftnlen)32, (ftnlen)32, (ftnlen)32); } else { s_copy(pick, kwords + 192, (ftnlen)32, (ftnlen)32); } /* Make the requested repairs on the command, and */ /* redisplay the command. */ repsub_(command, &b, &e, pick, command, command_len, (ftnlen)32, command_len); cmprss_(" ", &c__1, command, command, (ftnlen)1, command_len, command_len); s_wsle(&io___29); do_lio(&c__9, &c__1, " ", (ftnlen)1); e_wsle(); s_wsle(&io___30); do_lio(&c__9, &c__1, " ", (ftnlen)1); e_wsle(); niceio_3__(command, &c__6, style, command_len, (ftnlen)128); s_wsle(&io___31); e_wsle(); /* Look through the templates again until we get a match or we */ /* run out of templates to try. Note however, that this time */ /* we will start in a different spot. We already have a best */ /* matching template. We'll start our search for a match */ /* there and simulate a circular list of templates so that */ /* we can examine all of them if necessary. */ s_copy(error, " ", error_len, (ftnlen)1); s_copy(error + error_len, " ", error_len, (ftnlen)1); bscore = -1; m2code = -1; cutoff = 72; reason = TRUE_; j = *btemp - 1; i__1 = *ntemps; for (i__ = 1; i__ <= i__1; ++i__) { /* Get the index of the next template to examine. */ ++j; while(j > *ntemps) { j -= *ntemps; } /* Set the template, score for this template, spot to */ /* begin examining it and the M2CODE so far. */ s_copy(temp, temps + (j - 1) * temps_len, temp_len, temps_len) ; sbeg = 1; score = 0; m2code = 0; m2gmch_(temp, thnwds, command, &sbeg, &reason, &cutoff, & pssthn, &m2code, &score, error, temp_len, (ftnlen)32, command_len, error_len); /* If we get back a zero M2CODE we've got a match */ /* This routine's work is done. */ if (m2code == 0) { *btemp = i__; return 0; } /* Hmmph. No match. See if we've got a better */ /* matching score so far and then go on to the next */ /* template if any are left. */ if (score > bscore) { bscore = score; *btemp = i__; } } /* If we made it to this point the command doesn't properly */ /* match any of the templates. Get the best match and */ /* determine the diagnostics for this template. */ s_copy(temp, temps + (*btemp - 1) * temps_len, temp_len, temps_len); sbeg = 1; m2code = 0; score = 0; m2gmch_(temp, thnwds, command, &sbeg, &reason, &cutoff, &pssthn, & m2code, &score, error, temp_len, (ftnlen)32, command_len, error_len); } } /* If you get to this point. We didn't have a match set up */ /* the second level of mismatch diagnostics using the best */ /* matching template. (BTEMP already points to it.) */ s_copy(temp, temps + (*btemp - 1) * temps_len, temp_len, temps_len); cmprss_(" ", &c__1, temp, temp, (ftnlen)1, temp_len, temp_len); prepsn_(temp, temp_len); prepsn_(error + error_len, error_len); prefix_("/cr/cr(-3:-3) ", &c__1, error + error_len, (ftnlen)14, error_len) ; prefix_(temp, &c__1, error + error_len, temp_len, error_len); prefix_("/cr/cr(3:3) ", &c__1, error + error_len, (ftnlen)12, error_len); prefix_("a command with the following syntax:", &c__3, error + error_len, (ftnlen)36, error_len); prefix_("I Believe you were trying to enter", &c__1, error + error_len, ( ftnlen)34, error_len); prefix_("META/2:", &c__1, error + error_len, (ftnlen)7, error_len); return 0; /* The following entry point allows user's to adjust the margins */ /* of the META/2 error messages. */ L_m2marg: s_copy(margns, temp, (ftnlen)128, temp_len); return 0; } /* meta_2__ */
/* $Procedure SPKGPS ( S/P Kernel, geometric position ) */ /* Subroutine */ int spkgps_(integer *targ, doublereal *et, char *ref, integer *obs, doublereal *pos, doublereal *lt, ftnlen ref_len) { /* Initialized data */ static logical first = TRUE_; /* System generated locals */ integer i__1, i__2, i__3; /* Builtin functions */ integer s_cmp(char *, char *, ftnlen, ftnlen), s_rnge(char *, integer, char *, integer); /* Local variables */ extern /* Subroutine */ int vadd_(doublereal *, doublereal *, doublereal * ); integer cobs, legs; doublereal sobs[6]; extern /* Subroutine */ int vsub_(doublereal *, doublereal *, doublereal * ), vequ_(doublereal *, doublereal *), zznamfrm_(integer *, char *, integer *, char *, integer *, ftnlen, ftnlen), zzctruin_(integer *); integer i__; extern /* Subroutine */ int etcal_(doublereal *, char *, ftnlen); integer refid; extern /* Subroutine */ int chkin_(char *, ftnlen); char oname[40]; doublereal descr[5]; integer ctarg[20]; char ident[40], tname[40]; extern /* Subroutine */ int errch_(char *, char *, ftnlen, ftnlen), moved_(doublereal *, integer *, doublereal *); logical found; extern /* Subroutine */ int repmi_(char *, char *, integer *, char *, ftnlen, ftnlen, ftnlen); doublereal starg[120] /* was [6][20] */; logical nofrm; static char svref[32]; doublereal stemp[6]; integer ctpos; doublereal vtemp[6]; extern doublereal vnorm_(doublereal *); extern /* Subroutine */ int bodc2n_(integer *, char *, logical *, ftnlen); static integer svctr1[2]; extern logical failed_(void); extern /* Subroutine */ int cleard_(integer *, doublereal *); integer handle, cframe; extern /* Subroutine */ int refchg_(integer *, integer *, doublereal *, doublereal *); extern doublereal clight_(void); integer tframe[20]; extern integer isrchi_(integer *, integer *, integer *); extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen); static integer svrefi; extern /* Subroutine */ int irfnum_(char *, integer *, ftnlen), prefix_( char *, integer *, char *, ftnlen, ftnlen), setmsg_(char *, ftnlen), suffix_(char *, integer *, char *, ftnlen, ftnlen); integer tmpfrm; extern /* Subroutine */ int irfrot_(integer *, integer *, doublereal *), spksfs_(integer *, doublereal *, integer *, doublereal *, char *, logical *, ftnlen); extern integer frstnp_(char *, ftnlen); extern logical return_(void); doublereal psxfrm[9] /* was [3][3] */; extern /* Subroutine */ int spkpvn_(integer *, doublereal *, doublereal *, integer *, doublereal *, integer *), intstr_(integer *, char *, ftnlen); integer nct; doublereal rot[9] /* was [3][3] */; extern /* Subroutine */ int mxv_(doublereal *, doublereal *, doublereal *) ; char tstring[80]; /* $ Abstract */ /* Compute the geometric position of a target body relative to an */ /* observing body. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* SPK */ /* $ Keywords */ /* EPHEMERIS */ /* $ Declarations */ /* $ Abstract */ /* This file contains the number of inertial reference */ /* frames that are currently known by the SPICE toolkit */ /* software. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* FRAMES */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* NINERT P Number of known inertial reference frames. */ /* $ Parameters */ /* NINERT is the number of recognized inertial reference */ /* frames. This value is needed by both CHGIRF */ /* ZZFDAT, and FRAMEX. */ /* $ Author_and_Institution */ /* W.L. Taber (JPL) */ /* $ Literature_References */ /* None. */ /* $ Version */ /* - SPICELIB Version 1.0.0, 10-OCT-1996 (WLT) */ /* -& */ /* $ Abstract */ /* This include file defines the dimension of the counter */ /* array used by various SPICE subsystems to uniquely identify */ /* changes in their states. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Parameters */ /* CTRSIZ is the dimension of the counter array used by */ /* various SPICE subsystems to uniquely identify */ /* changes in their states. */ /* $ Author_and_Institution */ /* B.V. Semenov (JPL) */ /* $ Literature_References */ /* None. */ /* $ Version */ /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */ /* -& */ /* End of include file. */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* TARG I Target body. */ /* ET I Target epoch. */ /* REF I Target reference frame. */ /* OBS I Observing body. */ /* POS O Position of target. */ /* LT O Light time. */ /* $ Detailed_Input */ /* TARG is the standard NAIF ID code for a target body. */ /* ET is the epoch (ephemeris time) at which the position */ /* of the target body is to be computed. */ /* REF is the name of the reference frame to */ /* which the vectors returned by the routine should */ /* be rotated. This may be any frame supported by */ /* the SPICELIB subroutine REFCHG. */ /* OBS is the standard NAIF ID code for an observing body. */ /* $ Detailed_Output */ /* POS contains the position of the target */ /* body, relative to the observing body. This vector is */ /* rotated into the specified reference frame. Units */ /* are always km. */ /* LT is the one-way light time from the observing body */ /* to the geometric position of the target body at the */ /* specified epoch. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If insufficient ephemeris data has been loaded to compute */ /* the necessary positions, the error SPICE(SPKINSUFFDATA) is */ /* signalled. */ /* $ Files */ /* See: $Restrictions. */ /* $ Particulars */ /* SPKGPS computes the geometric position, T(t), of the target */ /* body and the geometric position, O(t), of the observing body */ /* relative to the first common center of motion. Subtracting */ /* O(t) from T(t) gives the geometric position of the target */ /* body relative to the observer. */ /* CENTER ----- O(t) */ /* | / */ /* | / */ /* | / */ /* | / T(t) - O(t) */ /* | / */ /* T(t) */ /* The one-way light time, tau, is given by */ /* | T(t) - O(t) | */ /* tau = ----------------- */ /* c */ /* For example, if the observing body is -94, the Mars Observer */ /* spacecraft, and the target body is 401, Phobos, then the */ /* first common center is probably 4, the Mars Barycenter. */ /* O(t) is the position of -94 relative to 4 and T(t) is the */ /* position of 401 relative to 4. */ /* The center could also be the Solar System Barycenter, body 0. */ /* For example, if the observer is 399, Earth, and the target */ /* is 299, Venus, then O(t) would be the position of 399 relative */ /* to 0 and T(t) would be the position of 299 relative to 0. */ /* Ephemeris data from more than one segment may be required */ /* to determine the positions of the target body and observer */ /* relative to a common center. SPKGPS reads as many segments */ /* as necessary, from as many files as necessary, using files */ /* that have been loaded by previous calls to SPKLEF (load */ /* ephemeris file). */ /* SPKGPS is similar to SPKGEO but returns geometric positions */ /* only. */ /* $ Examples */ /* The following code example computes the geometric */ /* position of the moon with respect to the earth and */ /* then prints the distance of the moon from the */ /* the earth at a number of epochs. */ /* Assume the SPK file SAMPLE.BSP contains ephemeris data */ /* for the moon relative to earth over the time interval */ /* from BEGIN to END. */ /* INTEGER EARTH */ /* PARAMETER ( EARTH = 399 ) */ /* INTEGER MOON */ /* PARAMETER ( MOON = 301 ) */ /* INTEGER N */ /* PARAMETER ( N = 100 ) */ /* INTEGER I */ /* CHARACTER*(20) UTC */ /* DOUBLE PRECISION BEGIN */ /* DOUBLE PRECISION DELTA */ /* DOUBLE PRECISION END */ /* DOUBLE PRECISION ET */ /* DOUBLE PRECISION POS ( 3 ) */ /* DOUBLE PRECISION LT */ /* DOUBLE PRECISION VNORM */ /* C */ /* C Load the binary SPK ephemeris file. */ /* C */ /* CALL FURNSH ( 'SAMPLE.BSP' ) */ /* . */ /* . */ /* . */ /* C */ /* C Divide the interval of coverage [BEGIN,END] into */ /* C N steps. At each step, compute the position, and */ /* C print out the epoch in UTC time and position norm. */ /* C */ /* DELTA = ( END - BEGIN ) / N */ /* DO I = 0, N */ /* ET = BEGIN + I*DELTA */ /* CALL SPKGPS ( MOON, ET, 'J2000', EARTH, POS, LT ) */ /* CALL ET2UTC ( ET, 'C', 0, UTC ) */ /* WRITE (*,*) UTC, VNORM ( POS ) */ /* END DO */ /* $ Restrictions */ /* 1) The ephemeris files to be used by SPKGPS must be loaded */ /* by SPKLEF before SPKGPS is called. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* B.V. Semenov (JPL) */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 2.0.0, 08-JAN-2014 (BVS) */ /* Updated to save the input frame name and POOL state counter */ /* and to do frame name-ID conversion only if the counter has */ /* changed. */ /* Updated to map the input frame name to its ID by first calling */ /* ZZNAMFRM, and then calling IRFNUM. The side effect of this */ /* change is that now the frame with the fixed name 'DEFAULT' */ /* that can be associated with any code via CHGIRF's entry point */ /* IRFDEF will be fully masked by a frame with indentical name */ /* defined via a text kernel. Previously the CHGIRF's 'DEFAULT' */ /* frame masked the text kernel frame with the same name. */ /* Replaced SPKLEF with FURNSH and fixed errors in Examples. */ /* - SPICELIB Version 1.2.0, 05-NOV-2005 (NJB) */ /* Updated to remove non-standard use of duplicate arguments */ /* in VADD calls. */ /* - SPICELIB Version 1.1.0, 05-JAN-2005 (NJB) */ /* Tests of routine FAILED() were added. */ /* - SPICELIB Version 1.0.0, 9-JUL-1998 (WLT) */ /* -& */ /* $ Index_Entries */ /* geometric position of one body relative to another */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 1.2.0, 05-NOV-2005 (NJB) */ /* Updated to remove non-standard use of duplicate arguments */ /* in VADD calls. */ /* -& */ /* This is the idea: */ /* Every body moves with respect to some center. The center */ /* is itself a body, which in turn moves about some other */ /* center. If we begin at the target body (T), follow */ /* the chain, */ /* T */ /* \ */ /* SSB \ */ /* \ C[1] */ /* \ / */ /* \ / */ /* \ / */ /* \ / */ /* C[3]-----------C[2] */ /* and avoid circular definitions (A moves about B, and B moves */ /* about A), eventually we get the position relative to the solar */ /* system barycenter (which, for our purposes, doesn't move). */ /* Thus, */ /* T = T + C[1] + C[2] + ... + C[n] */ /* SSB C[1] C[2] [C3] SSB */ /* where */ /* X */ /* Y */ /* is the position of body X relative to body Y. */ /* However, we don't want to follow each chain back to the SSB */ /* if it isn't necessary. Instead we will just follow the chain */ /* of the target body and follow the chain of the observing body */ /* until we find a common node in the tree. */ /* In the example below, C is the first common node. We compute */ /* the position of TARG relative to C and the position of OBS */ /* relative to C, then subtract the two positions. */ /* TARG */ /* \ */ /* SSB \ */ /* \ A */ /* \ / OBS */ /* \ / | */ /* \ / | */ /* \ / | */ /* B-------------C-----------------D */ /* SPICELIB functions */ /* Local parameters */ /* CHLEN is the maximum length of a chain. That is, */ /* it is the maximum number of bodies in the chain from */ /* the target or observer to the SSB. */ /* Saved frame name length. */ /* Local variables */ /* Saved frame name/ID item declarations. */ /* Saved frame name/ID items. */ /* Initial values. */ /* In-line Function Definitions */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("SPKGPS", (ftnlen)6); } /* Initialization. */ if (first) { /* Initialize counter. */ zzctruin_(svctr1); first = FALSE_; } /* We take care of the obvious case first. It TARG and OBS are the */ /* same we can just fill in zero. */ if (*targ == *obs) { *lt = 0.; cleard_(&c__3, pos); chkout_("SPKGPS", (ftnlen)6); return 0; } /* CTARG contains the integer codes of the bodies in the */ /* target body chain, beginning with TARG itself and then */ /* the successive centers of motion. */ /* STARG(1,I) is the position of the target body relative */ /* to CTARG(I). The id-code of the frame of this position is */ /* stored in TFRAME(I). */ /* COBS and SOBS will contain the centers and positions of the */ /* observing body. (They are single elements instead of arrays */ /* because we only need the current center and position of the */ /* observer relative to it.) */ /* First, we construct CTARG and STARG. CTARG(1) is */ /* just the target itself, and STARG(1,1) is just a zero */ /* vector, that is, the position of the target relative */ /* to itself. */ /* Then we follow the chain, filling up CTARG and STARG */ /* as we go. We use SPKSFS to search through loaded */ /* files to find the first segment applicable to CTARG(1) */ /* and time ET. Then we use SPKPVN to compute the position */ /* of the body CTARG(1) at ET in the segment that was found */ /* and get its center and frame of motion (CTARG(2) and TFRAME(2). */ /* We repeat the process for CTARG(2) and so on, until */ /* there is no data found for some CTARG(I) or until we */ /* reach the SSB. */ /* Next, we find centers and positions in a similar manner */ /* for the observer. It's a similar construction as */ /* described above, but I is always 1. COBS and SOBS */ /* are overwritten with each new center and position, */ /* beginning at OBS. However, we stop when we encounter */ /* a common center of motion, that is when COBS is equal */ /* to CTARG(I) for some I. */ /* Finally, we compute the desired position of the target */ /* relative to the observer by subtracting the position of */ /* the observing body relative to the common node from */ /* the position of the target body relative to the common */ /* node. */ /* CTPOS is the position in CTARG of the common node. */ /* Since the upgrade to use hashes and counter bypass ZZNAMFRM */ /* became more efficient in looking up frame IDs than IRFNUM. So the */ /* original order of calls "IRFNUM first, NAMFRM second" was */ /* switched to "ZZNAMFRM first, IRFNUM second". */ /* The call to IRFNUM, now redundant for built-in inertial frames, */ /* was preserved to for a sole reason -- to still support the */ /* ancient and barely documented ability for the users to associate */ /* a frame with the fixed name 'DEFAULT' with any CHGIRF inertial */ /* frame code via CHGIRF's entry point IRFDEF. */ /* Note that in the case of ZZNAMFRM's failure to resolve name and */ /* IRFNUM's success to do so, the code returned by IRFNUM for */ /* 'DEFAULT' frame is *not* copied to the saved code SVREFI (which */ /* would be set to 0 by ZZNAMFRM) to make sure that on subsequent */ /* calls ZZNAMFRM does not do a bypass (as SVREFI always forced look */ /* up) and calls IRFNUM again to reset the 'DEFAULT's frame ID */ /* should it change between the calls. */ zznamfrm_(svctr1, svref, &svrefi, ref, &refid, (ftnlen)32, ref_len); if (refid == 0) { irfnum_(ref, &refid, ref_len); } if (refid == 0) { if (frstnp_(ref, ref_len) > 0) { setmsg_("The string supplied to specify the reference frame, ('#" "') contains non-printing characters. The two most commo" "n causes for this kind of error are: 1. an error in the " "call to SPKGPS; 2. an uninitialized variable. ", (ftnlen) 213); errch_("#", ref, (ftnlen)1, ref_len); } else if (s_cmp(ref, " ", ref_len, (ftnlen)1) == 0) { setmsg_("The string supplied to specify the reference frame is b" "lank. The most common cause for this kind of error is a" "n uninitialized variable. ", (ftnlen)137); } else { setmsg_("The string supplied to specify the reference frame was " "'#'. This frame is not recognized. Possible causes for " "this error are: 1. failure to load the frame definition " "into the kernel pool; 2. An out-of-date edition of the t" "oolkit. ", (ftnlen)231); errch_("#", ref, (ftnlen)1, ref_len); } sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } } /* Fill in CTARG and STARG until no more data is found */ /* or until we reach the SSB. If the chain gets too */ /* long to fit in CTARG, that is if I equals CHLEN, */ /* then overwrite the last elements of CTARG and STARG. */ /* Note the check for FAILED in the loop. If SPKSFS */ /* or SPKPVN happens to fail during execution, and the */ /* current error handling action is to NOT abort, then */ /* FOUND may be stuck at TRUE, CTARG(I) will never */ /* become zero, and the loop will execute indefinitely. */ /* Construct CTARG and STARG. Begin by assigning the */ /* first elements: TARG and the position of TARG relative */ /* to itself. */ i__ = 1; ctarg[(i__1 = i__ - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("ctarg", i__1, "spkgps_", (ftnlen)603)] = *targ; found = TRUE_; cleard_(&c__6, &starg[(i__1 = i__ * 6 - 6) < 120 && 0 <= i__1 ? i__1 : s_rnge("starg", i__1, "spkgps_", (ftnlen)606)]); while(found && i__ < 20 && ctarg[(i__1 = i__ - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("ctarg", i__1, "spkgps_", (ftnlen)608)] != *obs && ctarg[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ctarg", i__2, "spkgps_", (ftnlen)608)] != 0) { /* Find a file and segment that has position */ /* data for CTARG(I). */ spksfs_(&ctarg[(i__1 = i__ - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge( "ctarg", i__1, "spkgps_", (ftnlen)617)], et, &handle, descr, ident, &found, (ftnlen)40); if (found) { /* Get the position of CTARG(I) relative to some */ /* center of motion. This new center goes in */ /* CTARG(I+1) and the position is called STEMP. */ ++i__; spkpvn_(&handle, descr, et, &tframe[(i__1 = i__ - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("tframe", i__1, "spkgps_", (ftnlen) 627)], &starg[(i__2 = i__ * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)627)], & ctarg[(i__3 = i__ - 1) < 20 && 0 <= i__3 ? i__3 : s_rnge( "ctarg", i__3, "spkgps_", (ftnlen)627)]); /* Here's what we have. STARG is the position of CTARG(I-1) */ /* relative to CTARG(I) in reference frame TFRAME(I) */ /* If one of the routines above failed during */ /* execution, we just give up and check out. */ if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } } } tframe[0] = tframe[1]; /* If the loop above ended because we ran out of */ /* room in the arrays CTARG and STARG, then we */ /* continue finding positions but we overwrite the */ /* last elements of CTARG and STARG. */ /* If, as a result, the first common node is */ /* overwritten, we'll just have to settle for */ /* the last common node. This will cause a small */ /* loss of precision, but it's better than other */ /* alternatives. */ if (i__ == 20) { while(found && ctarg[19] != 0 && ctarg[19] != *obs) { /* Find a file and segment that has position */ /* data for CTARG(CHLEN). */ spksfs_(&ctarg[19], et, &handle, descr, ident, &found, (ftnlen)40) ; if (found) { /* Get the position of CTARG(CHLEN) relative to */ /* some center of motion. The new center */ /* overwrites the old. The position is called */ /* STEMP. */ spkpvn_(&handle, descr, et, &tmpfrm, stemp, &ctarg[19]); /* Add STEMP to the position of TARG relative to */ /* the old center to get the position of TARG */ /* relative to the new center. Overwrite */ /* the last element of STARG. */ if (tframe[19] == tmpfrm) { moved_(&starg[114], &c__3, vtemp); } else if (tmpfrm > 0 && tmpfrm <= 21 && tframe[19] > 0 && tframe[19] <= 21) { irfrot_(&tframe[19], &tmpfrm, rot); mxv_(rot, &starg[114], vtemp); } else { refchg_(&tframe[19], &tmpfrm, et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, &starg[114], vtemp); } vadd_(vtemp, stemp, &starg[114]); tframe[19] = tmpfrm; /* If one of the routines above failed during */ /* execution, we just give up and check out. */ if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } } } } nct = i__; /* NCT is the number of elements in CTARG, */ /* the chain length. We have in hand the following information */ /* STARG(1...3,K) position of body */ /* CTARG(K-1) relative to body CTARG(K) in the frame */ /* TFRAME(K) */ /* For K = 2,..., NCT. */ /* CTARG(1) = TARG */ /* STARG(1...3,1) = ( 0, 0, 0 ) */ /* TFRAME(1) = TFRAME(2) */ /* Now follow the observer's chain. Assign */ /* the first values for COBS and SOBS. */ cobs = *obs; cleard_(&c__6, sobs); /* Perhaps we have a common node already. */ /* If so it will be the last node on the */ /* list CTARG. */ /* We let CTPOS will be the position of the common */ /* node in CTARG if one is found. It will */ /* be zero if COBS is not found in CTARG. */ if (ctarg[(i__1 = nct - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("ctarg", i__1, "spkgps_", (ftnlen)762)] == cobs) { ctpos = nct; cframe = tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge( "tframe", i__1, "spkgps_", (ftnlen)764)]; } else { ctpos = 0; } /* Repeat the same loop as above, but each time */ /* we encounter a new center of motion, check to */ /* see if it is a common node. (When CTPOS is */ /* not zero, CTARG(CTPOS) is the first common node.) */ /* Note that we don't need a centers array nor a */ /* positions array, just a single center and position */ /* is sufficient --- we just keep overwriting them. */ /* When the common node is found, we have everything */ /* we need in that one center (COBS) and position */ /* (SOBS-position of the target relative to COBS). */ found = TRUE_; nofrm = TRUE_; legs = 0; while(found && cobs != 0 && ctpos == 0) { /* Find a file and segment that has position */ /* data for COBS. */ spksfs_(&cobs, et, &handle, descr, ident, &found, (ftnlen)40); if (found) { /* Get the position of COBS; call it STEMP. */ /* The center of motion of COBS becomes the */ /* new COBS. */ if (legs == 0) { spkpvn_(&handle, descr, et, &tmpfrm, sobs, &cobs); } else { spkpvn_(&handle, descr, et, &tmpfrm, stemp, &cobs); } if (nofrm) { nofrm = FALSE_; cframe = tmpfrm; } /* Add STEMP to the position of OBS relative to */ /* the old COBS to get the position of OBS */ /* relative to the new COBS. */ if (cframe == tmpfrm) { /* On the first leg of the position of the observer, we */ /* don't have to add anything, the position of the */ /* observer is already in SOBS. We only have to add when */ /* the number of legs in the observer position is one or */ /* greater. */ if (legs > 0) { vadd_(sobs, stemp, vtemp); vequ_(vtemp, sobs); } } else if (tmpfrm > 0 && tmpfrm <= 21 && cframe > 0 && cframe <= 21) { irfrot_(&cframe, &tmpfrm, rot); mxv_(rot, sobs, vtemp); vadd_(vtemp, stemp, sobs); cframe = tmpfrm; } else { refchg_(&cframe, &tmpfrm, et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, sobs, vtemp); vadd_(vtemp, stemp, sobs); cframe = tmpfrm; } /* Check failed. We don't want to loop */ /* indefinitely. */ if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } /* We now have one more leg of the path for OBS. Set */ /* LEGS to reflect this. Then see if the new center */ /* is a common node. If not, repeat the loop. */ ++legs; ctpos = isrchi_(&cobs, &nct, ctarg); } } /* If CTPOS is zero at this point, it means we */ /* have not found a common node though we have */ /* searched through all the available data. */ if (ctpos == 0) { bodc2n_(targ, tname, &found, (ftnlen)40); if (found) { prefix_("# (", &c__0, tname, (ftnlen)3, (ftnlen)40); suffix_(")", &c__0, tname, (ftnlen)1, (ftnlen)40); repmi_(tname, "#", targ, tname, (ftnlen)40, (ftnlen)1, (ftnlen)40) ; } else { intstr_(targ, tname, (ftnlen)40); } bodc2n_(obs, oname, &found, (ftnlen)40); if (found) { prefix_("# (", &c__0, oname, (ftnlen)3, (ftnlen)40); suffix_(")", &c__0, oname, (ftnlen)1, (ftnlen)40); repmi_(oname, "#", obs, oname, (ftnlen)40, (ftnlen)1, (ftnlen)40); } else { intstr_(obs, oname, (ftnlen)40); } setmsg_("Insufficient ephemeris data has been loaded to compute the " "position of TARG relative to OBS at the ephemeris epoch #. ", (ftnlen)118); etcal_(et, tstring, (ftnlen)80); errch_("TARG", tname, (ftnlen)4, (ftnlen)40); errch_("OBS", oname, (ftnlen)3, (ftnlen)40); errch_("#", tstring, (ftnlen)1, (ftnlen)80); sigerr_("SPICE(SPKINSUFFDATA)", (ftnlen)20); chkout_("SPKGPS", (ftnlen)6); return 0; } /* If CTPOS is not zero, then we have reached a */ /* common node, specifically, */ /* CTARG(CTPOS) = COBS = CENTER */ /* (in diagram below). The POSITION of the target */ /* (TARG) relative to the observer (OBS) is just */ /* STARG(1,CTPOS) - SOBS. */ /* SOBS */ /* CENTER ---------------->OBS */ /* | . */ /* | . N */ /* S | . O */ /* T | . I */ /* A | . T */ /* R | . I */ /* G | . S */ /* | . O */ /* | . P */ /* V L */ /* TARG */ /* And the light-time between them is just */ /* | POSITION | */ /* LT = --------- */ /* c */ /* Compute the position of the target relative to CTARG(CTPOS) */ if (ctpos == 1) { tframe[0] = cframe; } i__1 = ctpos - 1; for (i__ = 2; i__ <= i__1; ++i__) { if (tframe[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("tframe" , i__2, "spkgps_", (ftnlen)960)] == tframe[(i__3 = i__) < 20 && 0 <= i__3 ? i__3 : s_rnge("tframe", i__3, "spkgps_", ( ftnlen)960)]) { vadd_(&starg[(i__2 = i__ * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)962)], &starg[( i__3 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__3 ? i__3 : s_rnge("starg", i__3, "spkgps_", (ftnlen)962)], stemp); moved_(stemp, &c__3, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen) 963)]); } else if (tframe[(i__3 = i__) < 20 && 0 <= i__3 ? i__3 : s_rnge( "tframe", i__3, "spkgps_", (ftnlen)965)] > 0 && tframe[(i__3 = i__) < 20 && 0 <= i__3 ? i__3 : s_rnge("tframe", i__3, "spk" "gps_", (ftnlen)965)] <= 21 && tframe[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("tframe", i__2, "spkgps_", (ftnlen) 965)] > 0 && tframe[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("tframe", i__2, "spkgps_", (ftnlen)965)] <= 21) { irfrot_(&tframe[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("tframe", i__2, "spkgps_", (ftnlen)967)], &tframe[( i__3 = i__) < 20 && 0 <= i__3 ? i__3 : s_rnge("tframe", i__3, "spkgps_", (ftnlen)967)], rot); mxv_(rot, &starg[(i__2 = i__ * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)968)], stemp); vadd_(stemp, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)969)], vtemp); moved_(vtemp, &c__3, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen) 970)]); } else { refchg_(&tframe[(i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("tframe", i__2, "spkgps_", (ftnlen)974)], &tframe[( i__3 = i__) < 20 && 0 <= i__3 ? i__3 : s_rnge("tframe", i__3, "spkgps_", (ftnlen)974)], et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, &starg[(i__2 = i__ * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)981)], stemp); vadd_(stemp, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen)982)], vtemp); moved_(vtemp, &c__3, &starg[(i__2 = (i__ + 1) * 6 - 6) < 120 && 0 <= i__2 ? i__2 : s_rnge("starg", i__2, "spkgps_", (ftnlen) 983)]); } } /* To avoid unnecessary frame transformations we'll do */ /* a bit of extra decision making here. It's a lot */ /* faster to make logical checks than it is to compute */ /* frame transformations. */ if (tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("tframe", i__1, "spkgps_", (ftnlen)996)] == cframe) { vsub_(&starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 : s_rnge("starg", i__1, "spkgps_", (ftnlen)998)], sobs, pos); } else if (tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge( "tframe", i__1, "spkgps_", (ftnlen)1000)] == refid) { /* If the last frame associated with the target is already */ /* in the requested output frame, we convert the position of */ /* the observer to that frame and then subtract the position */ /* of the observer from the position of the target. */ if (refid > 0 && refid <= 21 && cframe > 0 && cframe <= 21) { irfrot_(&cframe, &refid, rot); mxv_(rot, sobs, stemp); } else { refchg_(&cframe, &refid, et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, sobs, stemp); } /* We've now transformed SOBS into the requested reference frame. */ /* Set CFRAME to reflect this. */ cframe = refid; vsub_(&starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 : s_rnge("starg", i__1, "spkgps_", (ftnlen)1031)], stemp, pos); } else if (cframe > 0 && cframe <= 21 && tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("tframe", i__1, "spkgps_", (ftnlen) 1034)] > 0 && tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("tframe", i__1, "spkgps_", (ftnlen)1034)] <= 21) { /* If both frames are inertial we use IRFROT instead of */ /* REFCHG to get things into a common frame. */ irfrot_(&tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge( "tframe", i__1, "spkgps_", (ftnlen)1040)], &cframe, rot); mxv_(rot, &starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 : s_rnge("starg", i__1, "spkgps_", (ftnlen)1041)], stemp); vsub_(stemp, sobs, pos); } else { /* Use the more general routine REFCHG to make the transformation. */ refchg_(&tframe[(i__1 = ctpos - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge( "tframe", i__1, "spkgps_", (ftnlen)1048)], &cframe, et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, &starg[(i__1 = ctpos * 6 - 6) < 120 && 0 <= i__1 ? i__1 : s_rnge("starg", i__1, "spkgps_", (ftnlen)1055)], stemp); vsub_(stemp, sobs, pos); } /* Finally, rotate as needed into the requested frame. */ if (cframe == refid) { /* We don't have to do anything in this case. */ } else if (refid > 0 && refid <= 21 && cframe > 0 && cframe <= 21) { /* Since both frames are inertial, we use the more direct */ /* routine IRFROT to get the transformation to REFID. */ irfrot_(&cframe, &refid, rot); mxv_(rot, pos, stemp); moved_(stemp, &c__3, pos); } else { refchg_(&cframe, &refid, et, psxfrm); if (failed_()) { chkout_("SPKGPS", (ftnlen)6); return 0; } mxv_(psxfrm, pos, stemp); moved_(stemp, &c__3, pos); } *lt = vnorm_(pos) / clight_(); chkout_("SPKGPS", (ftnlen)6); return 0; } /* spkgps_ */
/* Subroutine */ int kerman_0_(int n__, char *commnd, char *infile__, char * error, ftnlen commnd_len, ftnlen infile_len, ftnlen error_len) { /* Initialized data */ static integer nfiles = 0; static logical first = TRUE_; static char synval[80*9] = " " " " " " " " " " " " " " " " " " " " " " " " " " " " "EK #word[ekfile] " " " "LEAPSECONDS #word[leapfile] " " " "SCLK KERNEL #word[sc" "lkfile] "; /* System generated locals */ integer i__1, i__2, i__3; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_rnge(char *, integer, char *, integer), s_cmp(char *, char *, ftnlen, ftnlen); /* Local variables */ static integer need; static char file[127], name__[32]; static integer clen; extern logical have_(char *, ftnlen); static integer left, reqd, nseg; static char indx[4], pval[32*4]; static integer hits; static char size[32], type__[32]; static logical quit; extern /* Subroutine */ int zzeksinf_(integer *, integer *, char *, integer *, char *, integer *, ftnlen, ftnlen); static integer i__, j, k; extern integer cardc_(char *, ftnlen); static integer l, n; extern /* Subroutine */ int clgai_(integer *, char *, integer *, integer * , ftnlen), clgac_(integer *, char *, char *, ftnlen, ftnlen); static integer r__; static char cname[80], break__[80]; static integer headr[5]; extern /* Subroutine */ int eklef_(char *, integer *, ftnlen), clnid_( integer *, integer *, logical *); static integer space; extern logical match_(char *, char *, ftnlen, ftnlen); extern /* Subroutine */ int chkin_(char *, ftnlen); static integer tcode, ncomc; extern /* Subroutine */ int ekuef_(integer *); static char rname[6], tname[32]; extern /* Subroutine */ int repmc_(char *, char *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen), clnew_(char *, integer *, integer *, integer *, integer *, integer *, logical *, logical *, integer *, ftnlen); static logical found; static integer csize, ncols, ncomr; static logical cnull; static integer right, width[5], ctype; extern integer ltrim_(char *, ftnlen); static integer count; extern integer rtrim_(char *, ftnlen); static integer sizes[5]; static char style[80]; extern /* Subroutine */ int clnum_(integer *); static logical justr[5]; extern /* Subroutine */ int m2chck_(char *, char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen), m2getc_(char *, char *, logical *, char *, ftnlen, ftnlen, ftnlen), m2ints_(integer *, char *, integer *, char *, ftnlen, ftnlen); static integer id, nb; static char bs[1]; extern logical m2xist_(char *, ftnlen); static integer nh, sb, handle; static char ifname[60], tabnam[64], tabcol[80*506], rnamec[7], cnames[64* 100]; static integer handls[20], segdsc[24]; extern integer isrchc_(char *, integer *, char *, ftnlen, ftnlen), eknseg_(integer *); extern /* Subroutine */ int gcolmn_(); extern integer isrchi_(integer *, integer *, integer *); extern /* Subroutine */ int pagput_(char *, ftnlen); extern logical return_(void); extern /* Subroutine */ int nspwln_(char *, ftnlen); static char synkey[32*9]; static integer synptr[9]; static char ekfils[127*20], thisfl[127], messge[300], idword[8]; static integer cdscrs[1100] /* was [11][100] */, widest, totalc, nresvr, nresvc; static logical cindxd; static char spcial[4*5], lsttab[32]; static integer colids[506], lmarge, ordvec[500]; static logical presrv[5]; extern /* Subroutine */ int replch_(char *, char *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen), prefix_(char *, integer *, char * , ftnlen, ftnlen), chkout_(char *, ftnlen), expool_(char *, logical *, ftnlen), repmct_(char *, char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen), clunld_(integer *), ldpool_(char *, ftnlen); static integer nid; extern /* Subroutine */ int dasfnh_(char *, integer *, ftnlen); static integer col, seg, ids[5]; extern /* Subroutine */ int remlac_(integer *, integer *, char *, integer *, ftnlen), nspglr_(integer *, integer *), nspmrg_(char *, ftnlen) , suffix_(char *, integer *, char *, ftnlen, ftnlen), pagrst_( void), pagset_(char *, integer *, ftnlen), ssizec_(integer *, char *, ftnlen), ssizei_(integer *, integer *), appndc_(char *, char *, ftnlen, ftnlen), appndi_(integer *, integer *), pagscn_( char *, ftnlen), scolmn_(integer *, integer *, char *, ftnlen), tabrpt_(integer *, integer *, integer *, integer *, logical *, logical *, char *, integer *, integer *, U_fp, ftnlen), orderc_( char *, integer *, integer *, ftnlen); extern integer pos_(char *, char *, integer *, ftnlen, ftnlen); extern /* Subroutine */ int pagsft_(void), dasrfr_(integer *, char *, char *, integer *, integer *, integer *, integer *, ftnlen, ftnlen), nspshc_(integer *, logical *), bbputc_1__(char *, char *, integer *, char *, ftnlen, ftnlen, ftnlen), nicepr_1__(char *, char *, S_fp, ftnlen, ftnlen); /* Version 2.4.0, 26-SEP-2005 */ /* Minor bug fix: replaced FILE with INFILE in the RTRIM call */ /* constructing "The file # is not listed ..." error message. */ /* Version 2.3.0, 21-JUN-1999 */ /* Added RETURN before first entry points. */ /* Version 2.2.0, 22-APR-1997 */ /* Declared PAGPUT external */ /* Version 2.1.0 14-SEP-1995 */ /* Variable INDEX removed. */ /* Version 2.0.0 23-AUG-1995 */ /* The widest string in a string column is no longer supplied */ /* by the EK summary stuff. We just set the value WIDEST */ /* to 24. */ /* This routine handles the loading of E-kernels, leapsecond and */ /* SCLK kernels. */ /* Passable routines */ /* Parameters that contain the routine name for use in check-in, */ /* check-out, and error messages. */ /* SPICELIB functions */ /* E-kernel functions */ /* Meta/2 Functions */ /* Interface to the SPICELIB error handling. */ /* Ek include files. */ /* +============================================================== */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* Include Section: EK Column Descriptor Parameters */ /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */ /* Note: The column descriptor size parameter CDSCSZ is */ /* declared separately in the include section CDSIZE$INC.FOR. */ /* Offset of column descriptors, relative to start of segment */ /* integer address range. This number, when added to the last */ /* integer address preceding the segment, yields the DAS integer */ /* base address of the first column descriptor. Currently, this */ /* offset is exactly the size of a segment descriptor. The */ /* parameter SDSCSZ, which defines the size of a segment descriptor, */ /* is declared in the include file eksegdsc.inc. */ /* Size of column descriptor */ /* Indices of various pieces of column descriptors: */ /* CLSIDX is the index of the column's class code. (We use the */ /* word `class' to distinguish this item from the column's data */ /* type.) */ /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */ /* or TIME). The type is actually implied by the class, but it */ /* will frequently be convenient to look up the type directly. */ /* LENIDX is the index of the column's string length value, if the */ /* column has character type. A value of IFALSE in this element of */ /* the descriptor indicates that the strings have variable length. */ /* SIZIDX is the index of the column's element size value. This */ /* descriptor element is meaningful for columns with fixed-size */ /* entries. For variable-sized columns, this value is IFALSE. */ /* NAMIDX is the index of the base address of the column's name. */ /* IXTIDX is the data type of the column's index. IXTIDX */ /* contains a type value only if the column is indexed. For columns */ /* that are not indexed, the location IXTIDX contains the boolean */ /* value IFALSE. */ /* IXPIDX is a pointer to the column's index. IXTPDX contains a */ /* meaningful value only if the column is indexed. The */ /* interpretation of the pointer depends on the data type of the */ /* index. */ /* NFLIDX is the index of a flag indicating whether nulls are */ /* permitted in the column. The value at location NFLIDX is */ /* ITRUE if nulls are permitted and IFALSE otherwise. */ /* ORDIDX is the index of the column's ordinal position in the */ /* list of columns belonging to the column's parent segment. */ /* METIDX is the index of the column's integer metadata pointer. */ /* This pointer is a DAS integer address. */ /* The last position in the column descriptor is reserved. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Column Descriptor Parameters */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* Include Section: EK Segment Descriptor Parameters */ /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */ /* All `base addresses' referred to below are the addresses */ /* *preceding* the item the base applies to. This convention */ /* enables simplied address calculations in many cases. */ /* Size of segment descriptor. Note: the include file ekcoldsc.inc */ /* must be updated if this parameter is changed. The parameter */ /* CDOFF in that file should be kept equal to SDSCSZ. */ /* Index of the segment type code: */ /* Index of the segment's number. This number is the segment's */ /* index in the list of segments contained in the EK to which */ /* the segment belongs. */ /* Index of the DAS integer base address of the segment's integer */ /* meta-data: */ /* Index of the DAS character base address of the table name: */ /* Index of the segment's column count: */ /* Index of the segment's record count: */ /* Index of the root page number of the record tree: */ /* Index of the root page number of the character data page tree: */ /* Index of the root page number of the double precision data page */ /* tree: */ /* Index of the root page number of the integer data page tree: */ /* Index of the `modified' flag: */ /* Index of the `initialized' flag: */ /* Index of the shadowing flag: */ /* Index of the companion file handle: */ /* Index of the companion segment number: */ /* The next three items are, respectively, the page numbers of the */ /* last character, d.p., and integer data pages allocated by the */ /* segment: */ /* The next three items are, respectively, the page-relative */ /* indices of the last DAS word in use in the segment's */ /* last character, d.p., and integer data pages: */ /* Index of the DAS character base address of the column name list: */ /* The last descriptor element is reserved for future use. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Segment Descriptor Parameters */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* Include Section: EK Boolean Enumerated Type */ /* ekbool.inc Version 1 21-DEC-1994 (NJB) */ /* Within the EK system, boolean values sometimes must be */ /* represented by integer or character codes. The codes and their */ /* meanings are listed below. */ /* Integer code indicating `true': */ /* Integer code indicating `false': */ /* Character code indicating `true': */ /* Character code indicating `false': */ /* End Include Section: EK Boolean Enumerated Type */ /* +============================================================== */ /* Meta/2 syntax definition variables. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* Include Section: EK Data Types */ /* ektype.inc Version 1 27-DEC-1994 (NJB) */ /* Within the EK system, data types of EK column contents are */ /* represented by integer codes. The codes and their meanings */ /* are listed below. */ /* Integer codes are also used within the DAS system to indicate */ /* data types; the EK system makes no assumptions about compatibility */ /* between the codes used here and those used in the DAS system. */ /* Character type: */ /* Double precision type: */ /* Integer type: */ /* `Time' type: */ /* Within the EK system, time values are represented as ephemeris */ /* seconds past J2000 (TDB), and double precision numbers are used */ /* to store these values. However, since time values require special */ /* treatment both on input and output, and since the `TIME' column */ /* has a special role in the EK specification and code, time values */ /* are identified as a type distinct from double precision numbers. */ /* End Include Section: EK Data Types */ /* E-kernel column type definitions */ /* INTEGER CH */ /* PARAMETER ( CH = 1 ) */ /* INTEGER DP */ /* PARAMETER ( DP = 2 ) */ /* INTEGER INT */ /* PARAMETER ( INT = 3 ) */ /* INTEGER TIME */ /* PARAMETER ( TIME = 4 ) */ /* Local Parameters */ /* FILSIZ is the maximum number of characters allowed for a */ /* filename */ /* LNGSIZ is the maximum number of characters allowed for */ /* use in reporting the columns associated with a given */ /* file. */ /* MAXFIL is the maximum number of E-kernels that can be loaded */ /* at any one time. */ /* NNAMES is the maximum number of names/headings that can appear */ /* in a report of loaded files and columns. */ /* MAXCOL is the maximum number of columns that may be present */ /* in any segment of an E-kernel */ /* LNSIZE is the standard text line length. */ /* Initialization logical */ /* Loaded file database (shared between entry points) */ /* Local Variables */ /* INTEGER IFALSE */ /* PARAMETER ( IFALSE = -1 ) */ /* Variables needed by NSPEKS */ /* Save everything. */ /* Initial Values */ /* Parameter adjustments */ if (error) { } /* Function Body */ switch(n__) { case 1: goto L_nspld; case 2: goto L_nspuld; case 3: goto L_nspeks; case 4: goto L_nspekc; } return 0; /* Load an E-, leapsecond, or sclk kernel. */ L_nspld: /* Standard Spicelib error handling. */ s_copy(rname, "NSPLD", (ftnlen)6, (ftnlen)5); s_copy(rnamec, "NSPLD:", (ftnlen)7, (ftnlen)6); if (return_()) { return 0; } chkin_(rname, (ftnlen)6); /* On the first pass establish the syntax that this routine */ /* is responsible for recognizing. */ if (first) { first = FALSE_; *(unsigned char *)bs = '@'; for (i__ = 1; i__ <= 100; ++i__) { s_copy(cnames + (((i__1 = i__ - 1) < 100 && 0 <= i__1 ? i__1 : s_rnge("cnames", i__1, "kerman_", (ftnlen)361)) << 6), " ", (ftnlen)64, (ftnlen)1); } for (i__ = 1; i__ <= 3; ++i__) { replch_(synval + ((i__1 = i__ + 5) < 9 && 0 <= i__1 ? i__1 : s_rnge("synval", i__1, "kerman_", (ftnlen)366)) * 80, "#", bs, synval + ((i__2 = i__ + 5) < 9 && 0 <= i__2 ? i__2 : s_rnge("synval", i__2, "kerman_", (ftnlen)366)) * 80, (ftnlen)80, (ftnlen)1, (ftnlen)1, (ftnlen)80); } m2ints_(&c__3, synkey, synptr, synval, (ftnlen)32, (ftnlen)80); } /* See if this command matches a known syntax. If it doesn't */ /* there is no point in hanging around. */ m2chck_(commnd, synkey, synptr, synval, error, commnd_len, (ftnlen)32, ( ftnlen)80, error_len); if (have_(error, error_len)) { prefix_(rnamec, &c__1, error, (ftnlen)7, error_len); chkout_(rname, (ftnlen)6); return 0; } if (m2xist_("ekfile", (ftnlen)6)) { /* We need to have a leapseconds kernel loaded before */ /* we can load an E-kernel. */ expool_("DELTET/DELTA_AT", &found, (ftnlen)15); if (! found) { s_copy(error, "Before an E-kernel can be loaded, you must load a" " leapseconds kernel. ", error_len, (ftnlen)71); chkout_(rname, (ftnlen)6); return 0; } m2getc_("ekfile", commnd, &found, file, (ftnlen)6, commnd_len, ( ftnlen)127); /* See if we already have this file. */ if (isrchc_(file, &nfiles, ekfils, (ftnlen)127, (ftnlen)127) > 0) { chkout_(rname, (ftnlen)6); return 0; } /* Make sure there is room for this file. */ if (nfiles == 20) { s_copy(error, "The maximum number of E-kernels that can loaded a" "t open by INSPEKT at one time is #. That number has alr" "eady been reached. You will need to unload one of the fi" "les that have already been loaded before you will be abl" "e to load any other files. ", error_len, (ftnlen)244); repmct_(error, "#", &c__20, "L", error, error_len, (ftnlen)1, ( ftnlen)1, error_len); prefix_(rnamec, &c__1, error, (ftnlen)7, error_len); chkout_(rname, (ftnlen)6); return 0; } /* Load the file as an e-kernel. */ eklef_(file, &handle, rtrim_(file, (ftnlen)127)); if (have_(error, error_len)) { prefix_(rnamec, &c__1, error, (ftnlen)7, error_len); chkout_(rname, (ftnlen)6); return 0; } /* Store the name of this file. */ ++nfiles; s_copy(ekfils + ((i__1 = nfiles - 1) < 20 && 0 <= i__1 ? i__1 : s_rnge("ekfils", i__1, "kerman_", (ftnlen)442)) * 127, file, ( ftnlen)127, (ftnlen)127); /* Determine how many segments are in the file we just loaded. */ nseg = eknseg_(&handle); /* For each segment in the newly loaded file ... */ i__1 = nseg; for (seg = 1; seg <= i__1; ++seg) { s_copy(tabnam, " ", (ftnlen)64, (ftnlen)1); for (i__ = 1; i__ <= 100; ++i__) { s_copy(cnames + (((i__2 = i__ - 1) < 100 && 0 <= i__2 ? i__2 : s_rnge("cnames", i__2, "kerman_", (ftnlen)457)) << 6) , " ", (ftnlen)64, (ftnlen)1); } zzeksinf_(&handle, &seg, tabnam, segdsc, cnames, cdscrs, (ftnlen) 64, (ftnlen)64); /* Add each column name to the list of columns held by the */ /* column manager. */ ncols = segdsc[4]; i__2 = ncols; for (col = 1; col <= i__2; ++col) { /* We need to make the column name include table it */ /* belongs to (a fully qualified column name). */ prefix_(".", &c__0, cnames + (((i__3 = col - 1) < 100 && 0 <= i__3 ? i__3 : s_rnge("cnames", i__3, "kerman_", ( ftnlen)475)) << 6), (ftnlen)1, (ftnlen)64); prefix_(tabnam, &c__0, cnames + (((i__3 = col - 1) < 100 && 0 <= i__3 ? i__3 : s_rnge("cnames", i__3, "kerman_", ( ftnlen)476)) << 6), (ftnlen)64, (ftnlen)64); cindxd = cdscrs[(i__3 = col * 11 - 6) < 1100 && 0 <= i__3 ? i__3 : s_rnge("cdscrs", i__3, "kerman_", (ftnlen)478)] != -1; cnull = cdscrs[(i__3 = col * 11 - 4) < 1100 && 0 <= i__3 ? i__3 : s_rnge("cdscrs", i__3, "kerman_", (ftnlen)479)] != -1; ctype = cdscrs[(i__3 = col * 11 - 10) < 1100 && 0 <= i__3 ? i__3 : s_rnge("cdscrs", i__3, "kerman_", (ftnlen)481)] ; clen = cdscrs[(i__3 = col * 11 - 9) < 1100 && 0 <= i__3 ? i__3 : s_rnge("cdscrs", i__3, "kerman_", (ftnlen)482)] ; csize = cdscrs[(i__3 = col * 11 - 8) < 1100 && 0 <= i__3 ? i__3 : s_rnge("cdscrs", i__3, "kerman_", (ftnlen)483)] ; /* This is what used to be here, but the item NBLIDX */ /* vanished by design. We now just set this so something */ /* reasonable. 24 seemed like the reasonable thing at */ /* the time. (See the column manager and do a bit of */ /* code diving to see what this is used for.) */ /* WIDEST = CDSCRS ( NBLIDX, COL ) */ widest = 24; clnew_(cnames + (((i__3 = col - 1) < 100 && 0 <= i__3 ? i__3 : s_rnge("cnames", i__3, "kerman_", (ftnlen)496)) << 6) , &handle, &ctype, &clen, &widest, &csize, &cindxd, & cnull, &id, (ftnlen)64); } } /* If anything went wrong, unload the file. */ if (have_(error, error_len)) { prefix_(rnamec, &c__1, error, (ftnlen)7, error_len); ekuef_(&handle); clunld_(&handle); --nfiles; chkout_(rname, (ftnlen)6); return 0; } } else if (m2xist_("leapfile", (ftnlen)8)) { m2getc_("leapfile", commnd, &found, file, (ftnlen)8, commnd_len, ( ftnlen)127); ldpool_(file, (ftnlen)127); bbputc_1__("POST", "LEAPSECONDS", &c__1, file, (ftnlen)4, (ftnlen)11, (ftnlen)127); } else if (m2xist_("sclkfile", (ftnlen)8)) { m2getc_("sclkfile", commnd, &found, file, (ftnlen)8, commnd_len, ( ftnlen)127); ldpool_(file, (ftnlen)127); bbputc_1__("APPEND", "SCLK", &c__1, file, (ftnlen)6, (ftnlen)4, ( ftnlen)127); } else { s_copy(error, "The input command was unrecognized and somehow got to" " an \"impossible\" place in KERMAN.FOR", error_len, (ftnlen) 89); } if (have_(error, error_len)) { prefix_(rnamec, &c__1, error, (ftnlen)7, error_len); chkout_(rname, (ftnlen)6); return 0; } chkout_(rname, (ftnlen)6); return 0; /* Unload an E-kernel from the list of known files. */ L_nspuld: s_copy(rname, "NSPULD", (ftnlen)6, (ftnlen)6); s_copy(rnamec, "NSPULD:", (ftnlen)7, (ftnlen)7); if (return_()) { return 0; } chkin_(rname, (ftnlen)6); j = isrchc_(infile__, &nfiles, ekfils, infile_len, (ftnlen)127); if (j == 0) { s_copy(error, "The file # is not listed among those files that have " "been loaded. ", error_len, (ftnlen)66); repmc_(error, "#", infile__, error, error_len, (ftnlen)1, rtrim_( infile__, infile_len), error_len); chkout_(rname, (ftnlen)6); return 0; } /* Get the handle associated with this file. */ dasfnh_(infile__, &handle, rtrim_(infile__, infile_len)); if (have_(error, error_len)) { chkout_(rname, (ftnlen)6); return 0; } /* Now unload the file, and detach its handle from any columns to */ /* which it might be attached. */ ekuef_(&handle); clunld_(&handle); /* Finally remove this file from our internal list of files. */ remlac_(&c__1, &j, ekfils, &nfiles, (ftnlen)127); chkout_(rname, (ftnlen)6); return 0; /* Create a report regarding currently loaded kernels/columns. */ L_nspeks: /* Version 2.0 Aug 3, 1995 */ /* This routine was rewritten to provide a more friendly */ /* kernel summary. */ /* ---B. Taber */ /* This routine displays the currently loaded E-kernels. */ s_copy(rname, "NSPEKS", (ftnlen)6, (ftnlen)6); s_copy(rnamec, "NSPEKS:", (ftnlen)7, (ftnlen)7); if (return_()) { return 0; } /* write (*,*) 'Checking in:' */ chkin_(rname, (ftnlen)6); if (nfiles <= 0) { nspwln_(" ", (ftnlen)1); nspwln_("There are no E-kernels loaded now.", (ftnlen)34); nspwln_(" ", (ftnlen)1); chkout_(rname, (ftnlen)6); return 0; } /* First thing we do is set up the NICEPR_1 style string */ /* to be used in creation of summary headers. */ /* write (*,*) 'Fetching margins: ' */ nspglr_(&left, &right); nspmrg_(style, (ftnlen)80); suffix_("FLAG", &c__1, style, (ftnlen)4, (ftnlen)80); suffix_("E-kernel:", &c__1, style, (ftnlen)9, (ftnlen)80); /* Reset the output page, title frequency and header frequency */ /* values. */ /* write (*,*) 'Resetting page and setting up page attributes:' */ pagrst_(); pagset_("TITLEFREQUENCY", &c__0, (ftnlen)14); pagset_("HEADERFREQUENCY", &c__0, (ftnlen)15); pagset_("NOSPACEFOOTER", &c__1, (ftnlen)13); pagset_("FOOTERFREQUENCY", &c_n1, (ftnlen)15); s_copy(pval, "CH", (ftnlen)32, (ftnlen)2); s_copy(pval + 32, "D.P.", (ftnlen)32, (ftnlen)4); s_copy(pval + 64, "INTEGER", (ftnlen)32, (ftnlen)7); s_copy(pval + 96, "TIME", (ftnlen)32, (ftnlen)4); lmarge = 1; space = 1; /* Next we set up the the column id codes, sizes, */ /* default widths, justifications, component preservation, */ /* and special marker attributes for each column. */ headr[0] = 1; headr[1] = 2; headr[2] = 3; headr[3] = 4; headr[4] = 5; sizes[0] = 1; sizes[1] = 1; sizes[2] = 1; sizes[3] = 1; sizes[4] = 1; width[0] = 16; width[1] = 16; width[2] = 8; width[3] = 8; width[4] = 6; need = width[0] + width[1] + width[2] + width[3] + width[4] + 4; right = min(right,need); pagset_("PAGEWIDTH", &right, (ftnlen)9); reqd = width[2] + width[3] + width[4] + 4; /* If the page width is less than default needed, we reset the */ /* widths of the first two columns so they will fit in available */ /* space. */ if (right < need) { width[0] = (right - reqd) / 2; width[1] = width[0]; } justr[0] = FALSE_; justr[1] = FALSE_; justr[2] = FALSE_; justr[3] = TRUE_; justr[4] = TRUE_; presrv[0] = TRUE_; presrv[1] = TRUE_; presrv[2] = TRUE_; presrv[3] = TRUE_; presrv[4] = TRUE_; s_copy(spcial, " ", (ftnlen)4, (ftnlen)1); s_copy(spcial + 4, " ", (ftnlen)4, (ftnlen)1); s_copy(spcial + 8, " ", (ftnlen)4, (ftnlen)1); s_copy(spcial + 12, " ", (ftnlen)4, (ftnlen)1); s_copy(spcial + 16, " ", (ftnlen)4, (ftnlen)1); /* write (*,*) 'Starting file loop:' */ i__1 = nfiles; for (i__ = 1; i__ <= i__1; ++i__) { /* Get the handle associated with this file, and get the */ /* number of ID's currently known. */ dasfnh_(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge( "ekfils", i__2, "kerman_", (ftnlen)738)) * 127, &handle, ( ftnlen)127); clnum_(&nid); /* write (*,*) 'File: ', I, 'Handle: ', HANDLE */ /* Now empty out the table/column data for this file. */ /* write (*,*) 'Empty out the column collector.' */ ssizec_(&c__500, tabcol, (ftnlen)80); ssizei_(&c__500, colids); /* Cycle over all column id's to determine if they */ /* are attached to this particular file. */ /* write (*,*) 'Beginning Column search: ', NID, ' Columns' */ i__2 = nid; for (j = 1; j <= i__2; ++j) { clnid_(&j, &id, &found); clgai_(&id, "HANDLES", &nh, handls, (ftnlen)7); if (isrchi_(&handle, &nh, handls) > 0) { /* This column is associated with this file. Store */ /* its name and id-code for the next section of code. */ /* write (*,*) 'Column id and associated handle match.' */ clgac_(&id, "NAME", cname, (ftnlen)4, (ftnlen)80); appndc_(cname, tabcol, (ftnlen)80, (ftnlen)80); appndi_(&id, colids); } } /* Layout the pages. We perform a soft page reset */ /* so that the various sections will be empty. */ /* Note this doesn't affect frequency parameter */ /* or other geometry attributes of pages. */ /* write (*,*) 'Creating page: Title:' */ pagscn_("TITLE", (ftnlen)5); pagput_(" ", (ftnlen)1); pagput_("Summary of Loaded E-kernels", (ftnlen)27); pagput_(" ", (ftnlen)1); /* write (*,*) 'Creating page: Header' */ /* Set up the various items needed for the report header. */ pagscn_("HEADER", (ftnlen)6); pagput_(" ", (ftnlen)1); nicepr_1__(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)791)) * 127, style, (S_fp)pagput_, (ftnlen)127, (ftnlen)80); pagput_(" ", (ftnlen)1); scolmn_(&c__1, &c__1, "Table Name", (ftnlen)10); scolmn_(&c__2, &c__1, "Column Name", (ftnlen)11); scolmn_(&c__3, &c__1, "Type", (ftnlen)4); scolmn_(&c__4, &c__1, "Size", (ftnlen)4); scolmn_(&c__5, &c__1, "Index", (ftnlen)5); /* write (*,*) 'Creating page: Column headings' */ tabrpt_(&c__5, headr, sizes, width, justr, presrv, spcial, &lmarge, & space, (U_fp)gcolmn_, (ftnlen)4); s_copy(break__, "===================================================" "=============================", (ftnlen)80, (ftnlen)80); pagput_(break__, right); /* Now set the page section to the body portion for */ /* preparing to fill in the e-kernel summary. */ /* write (*,*) 'Creating page: Body of report:' */ pagscn_("BODY", (ftnlen)4); n = cardc_(tabcol, (ftnlen)80); orderc_(tabcol + 480, &n, ordvec, (ftnlen)80); s_copy(lsttab, " ", (ftnlen)32, (ftnlen)1); i__2 = n; for (j = 1; j <= i__2; ++j) { k = ordvec[(i__3 = j - 1) < 500 && 0 <= i__3 ? i__3 : s_rnge( "ordvec", i__3, "kerman_", (ftnlen)826)]; clgac_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge( "colids", i__3, "kerman_", (ftnlen)828)], "TABLE", tname, (ftnlen)5, (ftnlen)32); clgac_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge( "colids", i__3, "kerman_", (ftnlen)829)], "NAME", cname, ( ftnlen)4, (ftnlen)80); clgac_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge( "colids", i__3, "kerman_", (ftnlen)830)], "SIZE", size, ( ftnlen)4, (ftnlen)32); clgac_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge( "colids", i__3, "kerman_", (ftnlen)831)], "INDEXED", indx, (ftnlen)7, (ftnlen)4); /* Note: There is only one type associated with each */ /* handle. Thus TCODE does not need to be an array. */ clgai_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge( "colids", i__3, "kerman_", (ftnlen)836)], "TYPE", &count, &tcode, (ftnlen)4); if (s_cmp(tname, lsttab, (ftnlen)32, (ftnlen)32) == 0) { s_copy(tname, " ", (ftnlen)32, (ftnlen)1); } else if (s_cmp(lsttab, " ", (ftnlen)32, (ftnlen)1) != 0) { pagput_(" ", (ftnlen)1); s_copy(lsttab, tname, (ftnlen)32, (ftnlen)32); } else { s_copy(lsttab, tname, (ftnlen)32, (ftnlen)32); } nb = pos_(cname, ".", &c__1, (ftnlen)80, (ftnlen)1) + 1; s_copy(name__, cname + (nb - 1), (ftnlen)32, 80 - (nb - 1)); if (tcode == 1) { clgac_(&colids[(i__3 = k + 5) < 506 && 0 <= i__3 ? i__3 : s_rnge("colids", i__3, "kerman_", (ftnlen)852)], "TYPE", type__, (ftnlen)4, (ftnlen)32); sb = pos_(type__, "*", &c__1, (ftnlen)32, (ftnlen)1); s_copy(pval, "CH", (ftnlen)32, (ftnlen)2); suffix_(type__ + (sb - 1), &c__0, pval, 32 - (sb - 1), ( ftnlen)32); } scolmn_(&c__6, &c__1, tname, (ftnlen)32); scolmn_(&c__7, &c__1, name__, (ftnlen)32); scolmn_(&c__8, &c__1, pval + (((i__3 = tcode - 1) < 4 && 0 <= i__3 ? i__3 : s_rnge("pval", i__3, "kerman_", (ftnlen)860) ) << 5), (ftnlen)32); scolmn_(&c__9, &c__1, size, (ftnlen)32); scolmn_(&c__10, &c__1, indx, (ftnlen)4); ids[0] = 6; ids[1] = 7; ids[2] = 8; ids[3] = 9; ids[4] = 10; /* write (*,*) 'Creating next row:' */ /* write (*,*) TNAME */ /* write (*,*) NAME */ /* write (*,*) PVAL(TCODE) */ /* write (*,*) SIZE */ /* write (*,*) INDX */ tabrpt_(&c__5, ids, sizes, width, justr, presrv, spcial, &lmarge, &space, (U_fp)gcolmn_, (ftnlen)4); /* write (*,*) 'Row created.' */ } /* Do a soft page reset so for the next file to be displayed */ /* write (*,*) 'Performing soft page reset.' */ pagsft_(); pagrst_(); pagset_("TITLEFREQUENCY", &c_n1, (ftnlen)14); pagset_("HEADERFREQUENCY", &c__0, (ftnlen)15); pagset_("NOSPACEFOOTER", &c__1, (ftnlen)13); pagset_("FOOTERFREQUENCY", &c_n1, (ftnlen)15); } chkout_(rname, (ftnlen)6); return 0; /* $Procedure NSPEKC ( Inspekt the comments from EK files ) */ L_nspekc: /* This entry point examines each file that matches the */ /* template given by INFILE and if comments exist for the */ /* file, they are displayed. */ /* Version 1.0.0 25-AUG-1995 (WLT) */ chkin_("NSPEKC", (ftnlen)6); totalc = 0; s_copy(thisfl, " ", (ftnlen)127, (ftnlen)1); /* We might not need the style string, but it doesn't hurt to */ /* get it. */ nspmrg_(style, (ftnlen)80); /* If there are no loaded E-kernels say so and return. */ if (nfiles == 0) { s_copy(messge, "There are no E-kernels loaded now. ", (ftnlen)300, ( ftnlen)35); nicepr_1__(messge, style, (S_fp)nspwln_, (ftnlen)300, (ftnlen)80); chkout_("NSPEKC", (ftnlen)6); return 0; } /* Count the number of characters present in the files */ /* that match the template. */ r__ = rtrim_(infile__, infile_len); l = ltrim_(infile__, infile_len); i__1 = nfiles; for (i__ = 1; i__ <= i__1; ++i__) { if (match_(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)945)) * 127, infile__ + (l - 1), (ftnlen)127, r__ - (l - 1))) { dasfnh_(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)947)) * 127, & handle, (ftnlen)127); dasrfr_(&handle, idword, ifname, &nresvr, &nresvc, &ncomr, &ncomc, (ftnlen)8, (ftnlen)60); totalc += ncomc; ++hits; s_copy(thisfl, ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)955)) * 127, (ftnlen)127, (ftnlen)127); } } /* If we didn't get any characters there several possible */ /* reasons. We can look at HITS to see why and form a */ /* grammatically reasonable message. */ if (totalc == 0) { if (hits == 0) { s_copy(messge, "There are no E-kernels loaded whose file name ma" "tches the supplied template '#'.", (ftnlen)300, (ftnlen) 80); repmc_(messge, "#", infile__ + (l - 1), messge, (ftnlen)300, ( ftnlen)1, r__ - (l - 1), (ftnlen)300); } else if (hits == 1) { s_copy(messge, "There are no comments present in the file '#'. ", (ftnlen)300, (ftnlen)47); repmc_(messge, "#", thisfl, messge, (ftnlen)300, (ftnlen)1, ( ftnlen)127, (ftnlen)300); } else if (hits == 2) { s_copy(messge, "There are no comments present in either of the #" " files that match the supplied template. ", (ftnlen)300, ( ftnlen)89); repmct_(messge, "#", &hits, "L", messge, (ftnlen)300, (ftnlen)1, ( ftnlen)1, (ftnlen)300); } else { s_copy(messge, "There are no comments present in any of the # fi" "les that match the supplied template. ", (ftnlen)300, ( ftnlen)86); repmct_(messge, "#", &hits, "L", messge, (ftnlen)300, (ftnlen)1, ( ftnlen)1, (ftnlen)300); } nicepr_1__(messge, style, (S_fp)nspwln_, (ftnlen)300, (ftnlen)80); chkout_("NSPEKC", (ftnlen)6); return 0; } /* Ok. We've got something. Set up the output page to receive */ /* the comments a file at a time. */ suffix_("FLAG E-kernel:", &c__1, style, (ftnlen)14, (ftnlen)80); i__1 = nfiles; for (i__ = 1; i__ <= i__1; ++i__) { if (match_(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)1012)) * 127, infile__ + (l - 1), (ftnlen)127, r__ - (l - 1))) { dasfnh_(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)1014)) * 127, & handle, (ftnlen)127); dasrfr_(&handle, idword, ifname, &nresvr, &nresvc, &ncomr, &ncomc, (ftnlen)8, (ftnlen)60); if (ncomc == 0) { s_copy(messge, "# contains no comments.", (ftnlen)300, ( ftnlen)23); repmc_(messge, "#", ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", ( ftnlen)1023)) * 127, messge, (ftnlen)300, (ftnlen)1, ( ftnlen)127, (ftnlen)300); nspwln_(" ", (ftnlen)1); nicepr_1__(messge, style, (S_fp)nspwln_, (ftnlen)300, (ftnlen) 80); } else { pagrst_(); pagscn_("HEADER", (ftnlen)6); pagset_("TITLEFREQUENCY", &c__0, (ftnlen)14); pagset_("HEADERFREQUENCY", &c__0, (ftnlen)15); pagset_("NOSPACEFOOTER", &c__1, (ftnlen)13); pagset_("FOOTERFREQUENCY", &c_n1, (ftnlen)15); pagput_(" ", (ftnlen)1); nicepr_1__(ekfils + ((i__2 = i__ - 1) < 20 && 0 <= i__2 ? i__2 : s_rnge("ekfils", i__2, "kerman_", (ftnlen)1038) ) * 127, style, (S_fp)pagput_, (ftnlen)127, (ftnlen) 80); pagput_(" ", (ftnlen)1); nspshc_(&handle, &quit); if (quit) { nspwln_(" ", (ftnlen)1); chkout_("NSPEKC", (ftnlen)6); return 0; } } } } nspwln_(" ", (ftnlen)1); chkout_("NSPEKC", (ftnlen)6); return 0; } /* kerman_ */
/* $Procedure SCDECD ( Decode spacecraft clock ) */ /* Subroutine */ int scdecd_(integer *sc, doublereal *sclkdp, char *sclkch, ftnlen sclkch_len) { /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; doublereal d__1; /* Builtin functions */ double d_nint(doublereal *); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_rnge(char *, integer, char *, integer), i_len(char *, ftnlen); /* Local variables */ integer part, i__; extern /* Subroutine */ int chkin_(char *, ftnlen), errdp_(char *, doublereal *, ftnlen); doublereal ticks; extern /* Subroutine */ int scfmt_(integer *, doublereal *, char *, ftnlen); doublereal pstop[9999]; extern logical failed_(void); extern integer lastnb_(char *, ftnlen); integer prelen; extern integer lstled_(doublereal *, integer *, doublereal *); extern /* Subroutine */ int sigerr_(char *, ftnlen); integer suflen; extern /* Subroutine */ int scpart_(integer *, integer *, doublereal *, doublereal *), chkout_(char *, ftnlen), prefix_(char *, integer *, char *, ftnlen, ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), suffix_(char *, integer *, char *, ftnlen, ftnlen); integer nparts; doublereal pstart[9999]; extern logical return_(void); extern /* Subroutine */ int intstr_(integer *, char *, ftnlen); doublereal ptotls[9999]; char prtstr[5]; /* $ Abstract */ /* Convert double precision encoding of spacecraft clock time into */ /* a character representation. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* SCLK */ /* $ Keywords */ /* CONVERSION */ /* TIME */ /* $ Declarations */ /* $ Abstract */ /* Include file sclk.inc */ /* SPICE private file intended solely for the support of SPICE */ /* routines. Users should not include this file directly due */ /* to the volatile nature of this file */ /* The parameters below define sizes and limits used by */ /* the SCLK system. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Parameters */ /* See the declaration section below. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Literature_References */ /* None. */ /* $ Version */ /* - SPICELIB Version 2.0.0, 24-MAY-2010 (NJB) */ /* Increased value of maximum coefficient record count */ /* parameter MXCOEF from 10K to 50K. */ /* - SPICELIB Version 1.0.0, 11-FEB-2008 (NJB) */ /* -& */ /* Number of supported SCLK field delimiters: */ /* Supported SCLK string field delimiters: */ /* Maximum number of partitions: */ /* Partition string length. */ /* Since the maximum number of partitions is given by MXPART is */ /* 9999, PRTSTR needs at most 4 characters for the partition number */ /* and one character for the slash. */ /* Maximum number of coefficient records: */ /* Maximum number of fields in an SCLK string: */ /* Length of strings used to represent D.P. */ /* numbers: */ /* Maximum number of supported parallel time systems: */ /* End of include file sclk.inc */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* SC I NAIF spacecraft identification code. */ /* SCLKDP I Encoded representation of a spacecraft clock count. */ /* SCLKCH O Character representation of a clock count. */ /* MXPART P Maximum number of spacecraft clock partitions. */ /* $ Detailed_Input */ /* SC is the NAIF integer code of the spacecraft whose */ /* clock's time is being decoded. */ /* SCLKDP is the double precision encoding of a clock time in */ /* units of ticks since the spacecraft clock start time. */ /* This value does reflect partition information. */ /* An analogy may be drawn between a spacecraft clock */ /* and a standard wall clock. The number of ticks */ /* corresponding to the wall clock string */ /* hh:mm:ss */ /* would be the number of seconds represented by that */ /* time. */ /* For example: */ /* Clock string Number of ticks */ /* ------------ --------------- */ /* 00:00:10 10 */ /* 00:01:00 60 */ /* 00:10:00 600 */ /* 01:00:00 3600 */ /* If SCLKDP contains a fractional part the result */ /* is the same as if SCLKDP had been rounded to the */ /* nearest whole number. */ /* $ Detailed_Output */ /* SCLKCH is the character representation of the clock count. */ /* The exact form that SCLKCH takes depends on the */ /* spacecraft. */ /* Nevertheless, SCLKCH will have the following general */ /* format: */ /* 'pp/sclk_string' */ /* 'pp' is an integer greater than or equal to one and */ /* represents a "partition number". */ /* Each mission is divided into some number of partitions. */ /* A new partition starts when the spacecraft clock */ /* resets, either to zero, or to some other */ /* value. Thus, the first partition for any mission */ /* starts with launch, and ends with the first clock */ /* reset. The second partition starts immediately when */ /* the first stopped, and so on. */ /* In order to be completely unambiguous about a */ /* particular time, you need to specify a partition number */ /* along with the standard clock string. */ /* Information about when partitions occur for different */ /* missions is contained in a spacecraft clock kernel */ /* file which needs to be loaded into the kernel pool */ /* before calling SCDECD. */ /* The routine SCPART may be used to read the partition */ /* start and stop times, in encoded units of ticks, from */ /* the kernel file. */ /* Since the end time of one partition is coincident with */ /* the begin time of the next, two different time strings */ /* with different partition numbers can encode into the */ /* same value. */ /* For example, if partition 1 ends at time t1, and */ /* partition 2 starts at time t2, then */ /* '1/t1' and '2/t2' */ /* will be encoded into the same value, say X. SCDECD */ /* always decodes such values into the latter of the */ /* two partitions. In this example, */ /* CALL SCDECD ( X, SC, CLKSTR ) */ /* will result in */ /* CLKSTR = '2/t2'. */ /* 'sclk_string' is a spacecraft specific clock string, */ /* typically consisting of a number of components */ /* separated by delimiters. */ /* Using Galileo as an example, the full format is */ /* wwwwwwww:xx:y:z */ /* where z is a mod-8 counter (values 0-7) which */ /* increments approximately once every 8 1/3 ms., y is a */ /* mod-10 counter (values 0-9) which increments once */ /* every time z turns over, i.e., approximately once every */ /* 66 2/3 ms., xx is a mod-91 (values 0-90) counter */ /* which increments once every time y turns over, i.e., */ /* once every 2/3 seconds. wwwwwwww is the Real-Time Image */ /* Count (RIM), which increments once every time xx turns */ /* over, i.e., once every 60 2/3 seconds. The roll-over */ /* expression for the RIM is 16777215, which corresponds */ /* to approximately 32 years. */ /* wwwwwwww, xx, y, and z are referred to interchangeably */ /* as the fields or components of the spacecraft clock. */ /* SCLK components may be separated by any of these five */ /* characters: ' ' ':' ',' '-' '.' */ /* The delimiter used is determined by a kernel pool */ /* variable and can be adjusted by the user. */ /* Some spacecraft clock components have offset, or */ /* starting, values different from zero. For example, */ /* with an offset value of 1, a mod 20 counter would */ /* cycle from 1 to 20 instead of from 0 to 19. */ /* See the SCLK required reading for a detailed */ /* description of the Voyager and Mars Observer clock */ /* formats. */ /* $ Parameters */ /* MXPART is the maximum number of spacecraft clock partitions */ /* expected in the kernel file for any one spacecraft. */ /* See the INCLUDE file sclk.inc for this parameter's */ /* value. */ /* $ Exceptions */ /* 1) If kernel variables required by this routine are unavailable, */ /* the error will be diagnosed by routines called by this routine. */ /* SCLKCH will be returned as a blank string in this case. */ /* 2) If the number of partitions in the kernel file for spacecraft */ /* SC exceeds the parameter MXPART, the error */ /* 'SPICE(TOOMANYPARTS)' is signaled. SCLKCH will be returned */ /* as a blank string in this case. */ /* 3) If the encoded value does not fall in the boundaries of the */ /* mission, the error 'SPICE(VALUEOUTOFRANGE)' is signaled. */ /* SCLKCH will be returned as a blank string in this case. */ /* 4) If the declared length of SCLKCH is not large enough to */ /* contain the output clock string the error */ /* 'SPICE(SCLKTRUNCATED)' is signaled either by this routine */ /* or by a routine called by this routine. On output SCLKCH */ /* will contain a portion of the truncated clock string. */ /* $ Files */ /* A kernel file containing spacecraft clock partition information */ /* for the desired spacecraft must be loaded, using the routine */ /* FURNSH, before calling this routine. */ /* $ Particulars */ /* In general, it is difficult to compare spacecraft clock counts */ /* numerically since there are too many clock components for a */ /* single comparison. The routine SCENCD provides a method of */ /* assigning a single double precision number to a spacecraft's */ /* clock count, given one of its character representations. */ /* This routine performs the inverse operation to SCENCD, converting */ /* an encoded double precision number to character format. */ /* To convert the number of ticks since the start of the mission to */ /* a clock format character string, SCDECD: */ /* 1) Determines the spacecraft clock partition that TICKS falls */ /* in. */ /* 2) Subtracts off the number of ticks occurring in previous */ /* partitions, to get the number of ticks since the beginning */ /* of the current partition. */ /* 3) Converts the resulting ticks to clock format and forms the */ /* string */ /* 'partition_number/clock_string' */ /* $ Examples */ /* Double precision encodings of spacecraft clock counts are used to */ /* tag pointing data in the C-kernel. */ /* In the following example, pointing for a sequence of images from */ /* the Voyager 2 narrow angle camera is requested from the C-kernel */ /* using an array of character spacecraft clock counts as input. */ /* The clock counts attached to the output are then decoded to */ /* character and compared with the input strings. */ /* CHARACTER*(25) CLKIN ( 4 ) */ /* CHARACTER*(25) CLKOUT */ /* CHARACTER*(25) CLKTOL */ /* DOUBLE PRECISION TIMEIN */ /* DOUBLE PRECISION TIMOUT */ /* DOUBLE PRECISION CMAT ( 3, 3 ) */ /* INTEGER NPICS */ /* INTEGER SC */ /* DATA NPICS / 4 / */ /* DATA CLKIN / '2/20538:39:768', */ /* . '2/20543:21:768', */ /* . '2/20550:37', */ /* . '2/20561:59' / */ /* DATA CLKTOL / ' 0:01:000' / */ /* C */ /* C The instrument we want pointing for is the Voyager 2 */ /* C narrow angle camera. The reference frame we want is */ /* C J2000. The spacecraft is Voyager 2. */ /* C */ /* INST = -32001 */ /* REF = 'J2000' */ /* SC = -32 */ /* C */ /* C Load the appropriate files. We need */ /* C */ /* C 1) CK file containing pointing data. */ /* C 2) Spacecraft clock kernel file, for SCENCD and SCDECD. */ /* C */ /* CALL CKLPF ( 'VGR2NA.CK' ) */ /* CALL FURNSH ( 'SCLK.KER' ) */ /* C */ /* C Convert the tolerance string to ticks. */ /* C */ /* CALL SCTIKS ( SC, CLKTOL, TOL ) */ /* DO I = 1, NPICS */ /* CALL SCENCD ( SC, CLKIN( I ), TIMEIN ) */ /* CALL CKGP ( INST, TIMEIN, TOL, REF, CMAT, TIMOUT, */ /* . FOUND ) */ /* CALL SCDECD ( SC, TIMOUT, CLKOUT ) */ /* WRITE (*,*) */ /* WRITE (*,*) 'Input s/c clock count: ', CLKIN( I ) */ /* WRITE (*,*) 'Output s/c clock count: ', CLKOUT */ /* WRITE (*,*) 'Output C-Matrix: ', CMAT */ /* END DO */ /* The output from such a program might look like: */ /* Input s/c clock count: 2/20538:39:768 */ /* Output s/c clock count: 2/20538:39:768 */ /* Output C-Matrix: 'first C-matrix' */ /* Input s/c clock count: 2/20543:21:768 */ /* Output s/c clock count: 2/20543:22:768 */ /* Output C-Matrix: 'second C-matrix' */ /* Input s/c clock count: 2/20550:37 */ /* Output s/c clock count: 2/20550:36:768 */ /* Output C-Matrix: 'third C-matrix' */ /* Input s/c clock count: 2/20561:59 */ /* Output s/c clock count: 2/20561:58:768 */ /* Output C-Matrix: 'fourth C-matrix' */ /* $ Restrictions */ /* 1) Assumes that an SCLK kernel file appropriate for the clock */ /* designated by SC is loaded in the kernel pool at the time */ /* this routine is called. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* J.M. Lynch (JPL) */ /* R.E. Thurman (JPL) */ /* $ Version */ /* - SPICELIB Version 2.1.0, 05-FEB-2008 (NJB) */ /* Values of parameter MXPART and PARTLN are now */ /* provided by the INCLUDE file sclk.inc. */ /* - SPICELIB Version 2.0.1, 22-AUG-2006 (EDW) */ /* Replaced references to LDPOOL with references */ /* to FURNSH. */ /* - SPICELIB Version 2.0.0, 17-APR-1992 (JML) (WLT) */ /* The routine was changed to signal an error when SCLKCH is */ /* not long enough to contain the output spacecraft clock */ /* string. */ /* FAILED is now checked after calling SCPART. */ /* References to CLPOOL were deleted. */ /* Miscellaneous minor updates to the header were performed. */ /* Comment section for permuted index source lines was added */ /* following the header. */ /* - SPICELIB Version 1.0.0, 06-SEP-1990 (JML) (RET) */ /* -& */ /* $ Index_Entries */ /* decode spacecraft_clock */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 2.0.0, 10-APR-1992 (JML) (WLT) */ /* The routine was changed to signal an error when SCLKCH is */ /* not long enough to contain the output spacecraft clock */ /* string. Previously, the SCLK routines simply truncated */ /* the clock string on the right. It was determined that */ /* since this truncation could easily go undetected by the */ /* user ( only the leftmost field of a clock string is */ /* required when clock string is used as an input to a */ /* SCLK routine ), it would be better to signal an error */ /* when this happens. */ /* FAILED is checked after calling SCPART in case an */ /* error has occurred reading the kernel file and the */ /* error action is not set to 'abort'. */ /* References to CLPOOL were deleted. */ /* Miscellaneous minor updates to the header were performed. */ /* Comment section for permuted index source lines was added */ /* following the header. */ /* -& */ /* SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("SCDECD", (ftnlen)6); } /* Use a working copy of the input. */ ticks = d_nint(sclkdp); s_copy(sclkch, " ", sclkch_len, (ftnlen)1); /* Read the partition start and stop times (in ticks) for this */ /* mission. Error if there are too many of them. Also need to */ /* check FAILED in case error handling is not in ABORT or */ /* DEFAULT mode. */ scpart_(sc, &nparts, pstart, pstop); if (failed_()) { chkout_("SCDECD", (ftnlen)6); return 0; } if (nparts > 9999) { setmsg_("The number of partitions, #, for spacecraft # exceeds the v" "alue for parameter MXPART, #.", (ftnlen)88); errint_("#", &nparts, (ftnlen)1); errint_("#", sc, (ftnlen)1); errint_("#", &c__9999, (ftnlen)1); sigerr_("SPICE(TOOMANYPARTS)", (ftnlen)19); chkout_("SCDECD", (ftnlen)6); return 0; } /* For each partition, compute the total number of ticks in that */ /* partition plus all preceding partitions. */ d__1 = pstop[0] - pstart[0]; ptotls[0] = d_nint(&d__1); i__1 = nparts; for (i__ = 2; i__ <= i__1; ++i__) { d__1 = ptotls[(i__3 = i__ - 2) < 9999 && 0 <= i__3 ? i__3 : s_rnge( "ptotls", i__3, "scdecd_", (ftnlen)495)] + pstop[(i__4 = i__ - 1) < 9999 && 0 <= i__4 ? i__4 : s_rnge("pstop", i__4, "scd" "ecd_", (ftnlen)495)] - pstart[(i__5 = i__ - 1) < 9999 && 0 <= i__5 ? i__5 : s_rnge("pstart", i__5, "scdecd_", (ftnlen)495)]; ptotls[(i__2 = i__ - 1) < 9999 && 0 <= i__2 ? i__2 : s_rnge("ptotls", i__2, "scdecd_", (ftnlen)495)] = d_nint(&d__1); } /* The partition corresponding to the input ticks is the first one */ /* whose tick total is greater than the input value. The one */ /* exception is when the input ticks is equal to the total number */ /* of ticks represented by all the partitions. In this case the */ /* partition number is the last one, i.e. NPARTS. */ /* Error if TICKS comes before the first partition (that is, if it's */ /* negative), or after the last one. */ if (ticks == ptotls[(i__1 = nparts - 1) < 9999 && 0 <= i__1 ? i__1 : s_rnge("ptotls", i__1, "scdecd_", (ftnlen)510)]) { part = nparts; } else { part = lstled_(&ticks, &nparts, ptotls) + 1; } if (ticks < 0. || part > nparts) { setmsg_("Value for ticks, #, does not fall in any partition for spac" "ecraft #.", (ftnlen)68); errdp_("#", &ticks, (ftnlen)1); errint_("#", sc, (ftnlen)1); sigerr_("SPICE(VALUEOUTOFRANGE)", (ftnlen)22); chkout_("SCDECD", (ftnlen)6); return 0; } /* To get the count in this partition, subtract off the total of */ /* the preceding partition counts and add the beginning count for */ /* this partition. */ if (part == 1) { ticks += pstart[(i__1 = part - 1) < 9999 && 0 <= i__1 ? i__1 : s_rnge( "pstart", i__1, "scdecd_", (ftnlen)535)]; } else { ticks = ticks + pstart[(i__1 = part - 1) < 9999 && 0 <= i__1 ? i__1 : s_rnge("pstart", i__1, "scdecd_", (ftnlen)537)] - ptotls[( i__2 = part - 2) < 9999 && 0 <= i__2 ? i__2 : s_rnge("ptotls", i__2, "scdecd_", (ftnlen)537)]; } /* Now create the output SCLK clock string. */ /* First convert from ticks to clock string format. */ scfmt_(sc, &ticks, sclkch, sclkch_len); /* Now convert the partition number to a character string and prefix */ /* it to the output string. */ intstr_(&part, prtstr, (ftnlen)5); suffix_("/", &c__0, prtstr, (ftnlen)1, (ftnlen)5); prelen = lastnb_(prtstr, (ftnlen)5); suflen = lastnb_(sclkch, sclkch_len); if (i_len(sclkch, sclkch_len) - suflen < prelen) { setmsg_("Output string too short to contain clock string. Input tick" " value: #, requires string of length #, but declared length " "is #.", (ftnlen)124); errdp_("#", sclkdp, (ftnlen)1); i__1 = prelen + suflen; errint_("#", &i__1, (ftnlen)1); i__1 = i_len(sclkch, sclkch_len); errint_("#", &i__1, (ftnlen)1); sigerr_("SPICE(SCLKTRUNCATED)", (ftnlen)20); chkout_("SCDECD", (ftnlen)6); return 0; } prefix_(prtstr, &c__0, sclkch, (ftnlen)5, sclkch_len); chkout_("SCDECD", (ftnlen)6); return 0; } /* scdecd_ */
/* $Procedure RDCMD (Read command file) */ /* Subroutine */ int rdcmd_(char *cmdfil, char *cmdsym, integer *cmdptr, char *cmdval, ftnlen cmdfil_len, ftnlen cmdsym_len, ftnlen cmdval_len) { /* Initialized data */ static char kwds1[32*2] = "LEAPSECONDS_KERNEL 1 1 " "SPK_KERNEL" " 1 1000 "; static char kwds2[32*5] = "SOURCE_SPK_KERNEL 1 1000 " "LOG_FILE " " 0 1 " "BODIES 0 1 " "BEGI" "N_TIME 0 1000 " "INCLUDE_TEXT_FILE 0 1000 "; static char kwds3[32*3] = "BODIES 0 1 " "BEGIN_TIME" " 0 1000 " "INCLUDE_COMMENTS 0 1 "; static char kwds4[32*1] = "END_TIME 1 1 "; /* System generated locals */ cilist ci__1; /* Builtin functions */ integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void); /* Local variables */ static char line[350]; static integer unit; extern /* Subroutine */ int chkin_(char *, ftnlen), cperr_(char *, integer *, ftnlen), repmi_(char *, char *, integer *, char *, ftnlen, ftnlen, ftnlen); static char tabval[32*26]; extern /* Subroutine */ int evalcp_(char *, logical *, char *, integer *, char *, logical *, ftnlen, ftnlen, ftnlen), initcp_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); static char reason[160]; extern /* Subroutine */ int sigerr_(char *, ftnlen); static integer tabptr[26]; extern /* Subroutine */ int prefix_(char *, integer *, char *, ftnlen, ftnlen); static char tabsym[32*26]; extern /* Subroutine */ int ssizec_(integer *, char *, ftnlen), chkout_( char *, ftnlen); static integer linnum, iostat; extern /* Subroutine */ int setmsg_(char *, ftnlen), ssizei_(integer *, integer *); extern logical return_(void); extern /* Subroutine */ int syputc_(char *, char *, integer *, char *, integer *, char *, ftnlen, ftnlen, ftnlen, ftnlen), txtopr_(char * , integer *, ftnlen); static logical eof, err; /* $ Abstract */ /* Parse the command file. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* None. */ /* $ Declarations */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* CMDFIL I Name of command file. */ /* CMDSYM, */ /* CMDPTR, */ /* CMDVAL O Command symbol table. */ /* $ Detailed_Input */ /* CMDFIL is the name of the command file. */ /* $ Detailed_Output */ /* CMDSYM, */ /* CMDPTR, */ /* CMDVAL is the command symbol table. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) An error is signaled if the file cannot be parsed */ /* successfully. */ /* $ Files */ /* None. */ /* $ Particulars */ /* None. */ /* $ Examples */ /* None. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* M.J. Spencer (JPL) */ /* $ Version */ /* - Beta Version 1.1.0, 17-JAN-2014 (BVS) */ /* Increased LINLEN from 120 to 350 (350 = 300 characters for */ /* value consistent with VALLEN in CPARSE_2 and the main program */ /* + 50 more characters for the keyword name, =, and blanks.) */ /* Increased maximum counts of child values in KWDS* from 300 to */ /* 1000 for all values. */ /* Saved all variables. */ /* - Beta Version 1.0.0, 26-JAN-1994 (MJS) */ /* -& */ /* SPICELIB functions */ /* Other functions */ /* Local parameters */ /* Local variables */ /* Save all. */ /* Initial values */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("RDCMD", (ftnlen)5); } /* Initialize the parser. */ ssizec_(&c__20, tabsym, (ftnlen)32); ssizei_(&c__20, tabptr); ssizec_(&c__20, tabval, (ftnlen)32); syputc_("HEAD", kwds1, &c__2, tabsym, tabptr, tabval, (ftnlen)4, (ftnlen) 32, (ftnlen)32, (ftnlen)32); syputc_("SPK_KERNEL", kwds2, &c__5, tabsym, tabptr, tabval, (ftnlen)10, ( ftnlen)32, (ftnlen)32, (ftnlen)32); syputc_("SOURCE_SPK_KERNEL", kwds3, &c__3, tabsym, tabptr, tabval, ( ftnlen)17, (ftnlen)32, (ftnlen)32, (ftnlen)32); syputc_("BEGIN_TIME", kwds4, &c__1, tabsym, tabptr, tabval, (ftnlen)10, ( ftnlen)32, (ftnlen)32, (ftnlen)32); initcp_(tabsym, tabptr, tabval, "HEAD", (ftnlen)32, (ftnlen)32, (ftnlen)4) ; /* Open the command file, and parse its contents */ txtopr_(cmdfil, &unit, cmdfil_len); eof = FALSE_; err = FALSE_; while(! eof && ! err) { ci__1.cierr = 1; ci__1.ciend = 1; ci__1.ciunit = unit; ci__1.cifmt = "(A)"; iostat = s_rsfe(&ci__1); if (iostat != 0) { goto L100001; } iostat = do_fio(&c__1, line, (ftnlen)350); if (iostat != 0) { goto L100001; } iostat = e_rsfe(); L100001: eof = iostat != 0; evalcp_(line, &eof, cmdsym, cmdptr, cmdval, &err, (ftnlen)350, cmdsym_len, cmdval_len); } if (err) { cperr_(reason, &linnum, (ftnlen)160); repmi_(reason, "#", &linnum, reason, (ftnlen)160, (ftnlen)1, (ftnlen) 160); prefix_(":", &c__1, reason, (ftnlen)1, (ftnlen)160); prefix_(cmdfil, &c__0, reason, cmdfil_len, (ftnlen)160); setmsg_(reason, (ftnlen)160); sigerr_("SPICE(CMDPARSEERROR)", (ftnlen)20); chkout_("RDCMD", (ftnlen)5); return 0; } chkout_("RDCMD", (ftnlen)5); return 0; } /* rdcmd_ */