/* $Procedure ZZBODKER ( Private --- Process Body-Name Kernel Pool Maps ) */ /* Subroutine */ int zzbodker_(char *names, char *nornam, integer *codes, integer *nvals, integer *ordnom, integer *ordcod, integer *nocds, logical *extker, ftnlen names_len, ftnlen nornam_len) { /* Initialized data */ static char nbc[32] = "NAIF_BODY_CODE "; static char nbn[32] = "NAIF_BODY_NAME "; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; /* Builtin functions */ integer s_rnge(char *, integer, char *, integer), s_cmp(char *, char *, ftnlen, ftnlen); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); /* Local variables */ logical drop[2000]; char type__[1*2]; integer nsiz[2]; extern /* Subroutine */ int zzbodini_(char *, char *, integer *, integer * , integer *, integer *, integer *, ftnlen, ftnlen); integer i__, j; extern /* Subroutine */ int chkin_(char *, ftnlen), ucase_(char *, char *, ftnlen, ftnlen), errch_(char *, char *, ftnlen, ftnlen); logical found; extern /* Subroutine */ int ljust_(char *, char *, ftnlen, ftnlen); logical plfind[2]; extern /* Subroutine */ int orderc_(char *, integer *, integer *, ftnlen), gcpool_(char *, integer *, integer *, integer *, char *, logical *, ftnlen, ftnlen), gipool_(char *, integer *, integer *, integer *, integer *, logical *, ftnlen), sigerr_(char *, ftnlen); logical remdup; extern /* Subroutine */ int chkout_(char *, ftnlen), dtpool_(char *, logical *, integer *, char *, ftnlen, ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); extern logical return_(void); integer num[2]; /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* This routine processes the kernel pool vectors NAIF_BODY_NAME */ /* and NAIF_BODY_CODE into the formatted lists required by ZZBODTRN */ /* to successfully compute code-name mappings. */ /* $ 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 */ /* NAIF_IDS */ /* $ Keywords */ /* BODY */ /* $ Declarations */ /* $ Abstract */ /* This include file lists the parameter collection */ /* defining the number of SPICE ID -> NAME mappings. */ /* $ 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 */ /* naif_ids.req */ /* $ Keywords */ /* Body mappings. */ /* $ Author_and_Institution */ /* E.D. Wright (JPL) */ /* $ Version */ /* SPICELIB 1.0.0 Thu May 20 07:57:58 2010 (EDW) */ /* A script generates this file. Do not edit by hand. */ /* Edit the creation script to modify the contents of */ /* ZZBODTRN.INC. */ /* Maximum size of a NAME string */ /* Count of default SPICE mapping assignments. */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* NAMES O Array of kernel pool assigned names. */ /* NORNAM O Array of normalized kernel pool assigned names. */ /* CODES O Array of ID codes for NAMES/NORNAM. */ /* NVALS O Length of NAMES, NORNAM, CODES, and ORDNOM arrays. */ /* ORDNOM O Order vector for NORNAM. */ /* ORDCOD O Modified order vector for CODES. */ /* NOCDS O Length of ORDCOD array. */ /* EXTKER O Logical indicating presence of kernel pool names. */ /* MAXL P Maximum length of body name strings. */ /* NROOM P Maximum length of kernel pool data vectors. */ /* $ Detailed_Input */ /* None. */ /* $ Detailed_Output */ /* NAMES the array of highest precedent names extracted */ /* from the kernel pool vector NAIF_BODY_NAME. This */ /* array is parallel to NORNAM and CODES. */ /* NORNAM the array of highest precedent names extracted */ /* from the kernel pool vector NAIF_BODY_NAME. After */ /* extraction, each entry is converted to uppercase, */ /* and groups of spaces are compressed to a single */ /* space. This represents the canonical member of the */ /* equivalence class each parallel entry in NAMES */ /* belongs. */ /* CODES the array of highest precedent codes extracted */ /* from the kernel pool vector NAIF_BODY_CODE. This */ /* array is parallel to NAMES and NORNAM. */ /* NVALS the number of items contained in NAMES, NORNAM, */ /* CODES and ORDNOM. */ /* ORDNOM the order vector of indexes for NORNAM. The set */ /* of values NORNAM( ORDNOM(1) ), NORNAM( ORDNOM(2) ), */ /* ... forms an increasing list of name values. */ /* ORDCOD the modified ordering vector of indexes into */ /* CODES. The list CODES( ORDCOD(1) ), */ /* CODES( ORDCOD(2) ), ... , CODES( ORDCOD(NOCDS) ) */ /* forms an increasing non-repeating list of integers. */ /* Moreover, every value in CODES is listed exactly */ /* once in this sequence. */ /* NOCDS the number of indexes listed in ORDCOD. This */ /* value will never exceed NVALS. */ /* EXTKER is a logical that indicates to the caller whether */ /* any kernel pool name-code maps have been defined. */ /* If EXTKER is .FALSE., then the kernel pool variables */ /* NAIF_BODY_CODE and NAIF_BODY_NAME are empty and */ /* only the built-in and ZZBODDEF code-name mappings */ /* need consideration. If .TRUE., then the values */ /* returned by this module need consideration. */ /* $ Parameters */ /* MAXL is the maximum length of a body name. Defined in */ /* the include file 'zzbodtrn.inc'. */ /* NROOM is the maximum number of kernel pool data items */ /* that can be processed from the NAIF_BODY_CODE */ /* and NAIF_BODY_NAME lists. */ /* $ Files */ /* None. */ /* $ Exceptions */ /* 1) The error SPICE(MISSINGKPV) is signaled when one of the */ /* NAIF_BODY_CODE and NAIF_BODY_NAME keywords is present in the */ /* kernel pool and the other is not. */ /* 2) The error SPICE(KERVARTOOBIG) is signaled if one or both of */ /* the NAIF_BODY_CODE and NAIF_BODY_NAME kernel pool vectors */ /* have a cardinality that exceeds NROOM. */ /* 3) The error SPICE(BADDIMENSIONS) is signaled if the cardinality */ /* of the NAIF_BODY_CODE and NAIF_BODY_NAME kernel pool vectors do */ /* not match. */ /* 4) The error SPICE(BLANKNAMEASSIGNED) is signaled if an entry */ /* in the NAIF_BODY_NAME kernel pool vector is a blank string. */ /* ID codes may not be assigned to a blank string. */ /* $ Particulars */ /* This routine examines the contents of the kernel pool, ingests */ /* the contents of the NAIF_BODY_CODE and NAIF_BODY_NAME keywords, */ /* and produces the order vectors and name/code lists that ZZBODTRN */ /* requires to resolve code to name and name to code mappings. */ /* $ Examples */ /* None. */ /* $ Restrictions */ /* None. */ /* $ Author_and_Institution */ /* F.S. Turner (JPL) */ /* E.D. Wright (JPL) */ /* $ Literature_References */ /* None. */ /* $ Version */ /* - SPICELIB Version 1.0.0, 23-AUG-2002 (EDW) (FST) */ /* -& */ /* SPICELIB Functions */ /* Local Parameters */ /* Local Variables */ /* Saved Variables */ /* Data Statements */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZBODKER", (ftnlen)8); } /* Until the code below proves otherwise, we shall assume */ /* we lack kernel pool name/code mappings. */ *extker = FALSE_; /* Check for the external body ID variables in the kernel pool. */ gcpool_(nbn, &c__1, &c__2000, num, names, plfind, (ftnlen)32, (ftnlen)36); gipool_(nbc, &c__1, &c__2000, &num[1], codes, &plfind[1], (ftnlen)32); /* Examine PLFIND(1) and PLFIND(2) for problems. */ if (plfind[0] != plfind[1]) { /* If they are not both present or absent, signal an error. */ setmsg_("The kernel pool vector, #, used in mapping between names an" "d ID-codes is absent, while # is not. This is often due to " "an improperly constructed text kernel. Check loaded kernels" " for these keywords.", (ftnlen)199); if (plfind[0]) { errch_("#", nbc, (ftnlen)1, (ftnlen)32); errch_("#", nbn, (ftnlen)1, (ftnlen)32); } else { errch_("#", nbn, (ftnlen)1, (ftnlen)32); errch_("#", nbc, (ftnlen)1, (ftnlen)32); } sigerr_("SPICE(MISSINGKPV)", (ftnlen)17); chkout_("ZZBODKER", (ftnlen)8); return 0; } else if (! plfind[0]) { /* Return if both keywords are absent. */ chkout_("ZZBODKER", (ftnlen)8); return 0; } /* If we reach here, then both kernel pool variables are present. */ /* Perform some simple sanity checks on their lengths. */ dtpool_(nbn, &found, nsiz, type__, (ftnlen)32, (ftnlen)1); dtpool_(nbc, &found, &nsiz[1], type__ + 1, (ftnlen)32, (ftnlen)1); if (nsiz[0] > 2000 || nsiz[1] > 2000) { setmsg_("The kernel pool vectors used to define the names/ID-codes m" "appingexceeds the max size. The size of the NAME vector is #" "1. The size of the CODE vector is #2. The max number allowed" " of elements is #3.", (ftnlen)198); errint_("#1", nsiz, (ftnlen)2); errint_("#2", &nsiz[1], (ftnlen)2); errint_("#3", &c__2000, (ftnlen)2); sigerr_("SPICE(KERVARTOOBIG)", (ftnlen)19); chkout_("ZZBODKER", (ftnlen)8); return 0; } else if (nsiz[0] != nsiz[1]) { setmsg_("The kernel pool vectors used for mapping between names and " "ID-codes are not the same size. The size of the name vector" ", NAIF_BODY_NAME is #. The size of the ID-code vector, NAIF_" "BODY_CODE is #. You need to examine the ID-code kernel you l" "oaded and correct the mismatch.", (ftnlen)270); errint_("#", nsiz, (ftnlen)1); errint_("#", &nsiz[1], (ftnlen)1); sigerr_("SPICE(BADDIMENSIONS)", (ftnlen)20); chkout_("ZZBODKER", (ftnlen)8); return 0; } /* Compute the canonical member of the equivalence class of NAMES, */ /* NORNAM. This normalization compresses groups of spaces into a */ /* single space, left justifies the string, and uppercases the */ /* contents. While passing through the NAMES array, look for any */ /* blank strings and signal an appropriate error. */ *nvals = num[0]; i__1 = *nvals; for (i__ = 1; i__ <= i__1; ++i__) { /* Check for blank strings. */ if (s_cmp(names + ((i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("names", i__2, "zzbodker_", (ftnlen)345)) * 36, " ", ( ftnlen)36, (ftnlen)1) == 0) { setmsg_("An attempt to assign the code, #, to a blank string was" " made. Check loaded text kernels for a blank string in " "the NAIF_BODY_NAME array.", (ftnlen)136); errint_("#", &i__, (ftnlen)1); sigerr_("SPICE(BLANKNAMEASSIGNED)", (ftnlen)24); chkout_("ZZBODKER", (ftnlen)8); return 0; } /* Compute the canonical member of the equivalence class. */ ljust_(names + ((i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge( "names", i__2, "zzbodker_", (ftnlen)361)) * 36, nornam + (( i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("nornam", i__3, "zzbodker_", (ftnlen)361)) * 36, (ftnlen)36, (ftnlen)36) ; ucase_(nornam + ((i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge( "nornam", i__2, "zzbodker_", (ftnlen)362)) * 36, nornam + (( i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("nornam", i__3, "zzbodker_", (ftnlen)362)) * 36, (ftnlen)36, (ftnlen)36) ; cmprss_(" ", &c__1, nornam + ((i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("nornam", i__2, "zzbodker_", (ftnlen)363)) * 36, nornam + ((i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("nornam", i__3, "zzbodker_", (ftnlen)363)) * 36, ( ftnlen)1, (ftnlen)36, (ftnlen)36); } /* Determine a preliminary order vector for NORNAM. */ orderc_(nornam, nvals, ordnom, (ftnlen)36); /* We are about to remove duplicates. Make some initial */ /* assumptions, no duplicates exist in NORNAM. */ i__1 = *nvals; for (i__ = 1; i__ <= i__1; ++i__) { drop[(i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("drop", i__2, "zzbodker_", (ftnlen)377)] = FALSE_; } remdup = FALSE_; /* ORDERC clusters duplicate entries in NORNAM together. */ /* Use this fact to locate duplicates on one pass through */ /* NORNAM. */ i__1 = *nvals - 1; for (i__ = 1; i__ <= i__1; ++i__) { if (s_cmp(nornam + ((i__3 = ordnom[(i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("ordnom", i__2, "zzbodker_", (ftnlen)389) ] - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("nornam", i__3, "zzbodker_", (ftnlen)389)) * 36, nornam + ((i__5 = ordnom[( i__4 = i__) < 2000 && 0 <= i__4 ? i__4 : s_rnge("ordnom", i__4, "zzbodker_", (ftnlen)389)] - 1) < 2000 && 0 <= i__5 ? i__5 : s_rnge("nornam", i__5, "zzbodker_", (ftnlen)389)) * 36, (ftnlen)36, (ftnlen)36) == 0) { /* We have at least one duplicate to remove. */ remdup = TRUE_; /* If the normalized entries are equal, drop the one with */ /* the lower index in the NAMES array. Entries defined */ /* later in the kernel pool have higher precedence. */ if (ordnom[(i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge( "ordnom", i__2, "zzbodker_", (ftnlen)401)] < ordnom[(i__3 = i__) < 2000 && 0 <= i__3 ? i__3 : s_rnge("ordnom", i__3, "zzbodker_", (ftnlen)401)]) { drop[(i__3 = ordnom[(i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("ordnom", i__2, "zzbodker_", (ftnlen) 402)] - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("drop", i__3, "zzbodker_", (ftnlen)402)] = TRUE_; } else { drop[(i__3 = ordnom[(i__2 = i__) < 2000 && 0 <= i__2 ? i__2 : s_rnge("ordnom", i__2, "zzbodker_", (ftnlen)404)] - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("drop", i__3, "zzbodker_", (ftnlen)404)] = TRUE_; } } } /* If necessary, remove duplicates. */ if (remdup) { /* Sweep through the DROP array, compressing off any elements */ /* that are to be dropped. */ j = 0; i__1 = *nvals; for (i__ = 1; i__ <= i__1; ++i__) { if (! drop[(i__2 = i__ - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge( "drop", i__2, "zzbodker_", (ftnlen)423)]) { ++j; s_copy(names + ((i__2 = j - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("names", i__2, "zzbodker_", (ftnlen)425)) * 36, names + ((i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("names", i__3, "zzbodker_", (ftnlen)425)) * 36, (ftnlen)36, (ftnlen)36); s_copy(nornam + ((i__2 = j - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge("nornam", i__2, "zzbodker_", (ftnlen)426)) * 36, nornam + ((i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge("nornam", i__3, "zzbodker_", (ftnlen) 426)) * 36, (ftnlen)36, (ftnlen)36); codes[(i__2 = j - 1) < 2000 && 0 <= i__2 ? i__2 : s_rnge( "codes", i__2, "zzbodker_", (ftnlen)427)] = codes[( i__3 = i__ - 1) < 2000 && 0 <= i__3 ? i__3 : s_rnge( "codes", i__3, "zzbodker_", (ftnlen)427)]; } } /* Adjust NVALS to compensate for the number of elements that */ /* were compressed off the list. */ *nvals = j; } /* Compute the order vectors that ZZBODTRN requires. */ zzbodini_(names, nornam, codes, nvals, ordnom, ordcod, nocds, (ftnlen)36, (ftnlen)36); /* We're on the home stretch if we make it to this point. */ /* Set EXTKER to .TRUE., check out and return. */ *extker = TRUE_; chkout_("ZZBODKER", (ftnlen)8); return 0; } /* zzbodker_ */
/* $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 ETCAL ( Convert ET to Calendar format ) */ /* Subroutine */ int etcal_(doublereal *et, char *string, ftnlen string_len) { /* Initialized data */ static logical first = TRUE_; static integer extra[12] = { 0,0,1,1,1,1,1,1,1,1,1,1 }; static integer dpjan0[12] = { 0,31,59,90,120,151,181,212,243,273,304,334 } ; static integer dpbegl[12] = { 0,31,60,91,121,152,182,213,244,274,305,335 } ; static char months[3*12] = "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"; /* System generated locals */ address a__1[12]; integer i__1, i__2, i__3[12]; doublereal d__1; /* Builtin functions */ integer s_rnge(char *, integer, char *, integer); double d_int(doublereal *); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ static integer dn2000; static doublereal dp2000, frac; static char date[180]; static doublereal remd, secs; static integer year, mins; static char dstr[16], hstr[16], mstr[16], sstr[16], ystr[16]; static doublereal halfd, q; static integer tsecs, dofyr, month, hours; extern /* Subroutine */ int ljust_(char *, char *, ftnlen, ftnlen); static doublereal mynum; static integer bh, bm, iq; static doublereal secspd; static char messge[16]; static integer offset; static doublereal dmnint; static logical adjust; static integer daynum; extern integer intmin_(void), intmax_(void); extern /* Subroutine */ int dpstrf_(doublereal *, integer *, char *, char *, ftnlen, ftnlen); static doublereal dmxint, mydnom; extern /* Subroutine */ int cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); extern integer lstlti_(integer *, integer *, integer *); extern /* Subroutine */ int intstr_(integer *, char *, ftnlen); static integer yr1, yr4; static char era[16]; static integer day, rem; extern doublereal spd_(void); static integer yr100, yr400; /* $ Abstract */ /* Convert from an ephemeris epoch measured in seconds past */ /* the epoch of J2000 to a calendar string format using a */ /* formal calendar free of leapseconds. */ /* $ 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 */ /* TIME */ /* $ Declarations */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* ET I Ephemeris time measured in seconds past J2000. */ /* STRING O A standard calendar representation of ET. */ /* $ Detailed_Input */ /* ET is an epoch measured in ephemeris seconds */ /* past the epoch of J2000. */ /* $ Detailed_Output */ /* STRING is a calendar string representing the input ephemeris */ /* epoch. This string is based upon extending the */ /* Gregorian Calendar backward and forward indefinitely */ /* keeping the same rules for determining leap years. */ /* Moreover, there is no accounting for leapseconds. */ /* To be sure that all of the date can be stored in */ /* STRING, it should be declared to have length at */ /* least 48 characters. */ /* The string will have the following format */ /* year (era) mon day hr:mn:sc.sss */ /* Where: */ /* year --- is the year */ /* era --- is the chronological era associated with */ /* the date. For years after 999 A.D. */ /* the era is omitted. For years */ /* between 1 A.D. and 999 A.D. (inclusive) */ /* era is the string 'A.D.' For epochs */ /* before 1 A.D. Jan 1 00:00:00, era is */ /* given as 'B.C.' and the year is converted */ /* to years before the "Christian Era". */ /* The last B.C. epoch is */ /* 1 B.C. DEC 31 23:59:59.999 */ /* The first A.D. epoch (which occurs .001 */ /* seconds after the last B.C. epoch) is: */ /* 1 A.D. JAN 1 00:00:00.000 */ /* Note: there is no year 0 A.D. or 0 B.C. */ /* mon --- is a 3-letter abbreviation for the month */ /* in all capital letters. */ /* day --- is the day of the month */ /* hr --- is the hour of the day (between 0 and 23) */ /* leading zeros are added to hr if the */ /* numeric value is less than 10. */ /* mn --- is the minute of the hour (0 to 59) */ /* leading zeros are added to mn if the */ /* numeric value is less than 10. */ /* sc.sss is the second of the minute to 3 decimal */ /* places ( 0 to 59.999). Leading zeros */ /* are added if the numeric value is less */ /* than 10. Seconds are truncated, not */ /* rounded. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* Error free. */ /* 1) If the input ET is so large that the corresponding */ /* number of days since 1 A.D. Jan 1, 00:00:00 is */ /* within 1 of overflowing or underflowing an integer, */ /* ET will not be converted to the correct string */ /* representation rather, the string returned will */ /* state that the epoch was before or after the day */ /* that is INTMIN +1 or INTMAX - 1 days after */ /* 1 A.D. Jan 1, 00:00:00. */ /* 2) If the output string is not sufficiently long to hold */ /* the full date, it will be truncated on the right. */ /* $ Files */ /* None. */ /* $ Particulars */ /* This is an error free routine for converting ephemeris epochs */ /* represented as seconds past the J2000 epoch to formal */ /* calendar strings based upon the Gregorian Calendar. This formal */ /* time is often useful when one needs a human recognizable */ /* form of an ephemeris epoch. There is no accounting for leap */ /* seconds in the output times produced. */ /* Note: The calendar epochs produced are not the same as the */ /* UTC calendar epochs that correspond to ET. The strings */ /* produced by this routine may vary from the corresponding */ /* UTC epochs by more than 1 minute. */ /* This routine can be used in creating error messages or */ /* in routines and programs in which one prefers to report */ /* times without employing leapseconds to produce exact UTC */ /* epochs. */ /* $ Examples */ /* Suppose you wish to report that no data is */ /* available at a particular ephemeris epoch ET. The following */ /* code shows how you might accomplish this task. */ /* CALL DPSTRF ( ET, 6, 'F', ETSTR ) */ /* CALL ETCAL ( ET, STRING ) */ /* E1 = RTRIM ( STRING ) */ /* E2 = RTRIM ( ETSTR ) */ /* WRITE (*,*) 'There is no data available for the body ' */ /* WRITE (*,*) 'at requested time: ' */ /* WRITE (*,*) ' ', STRING(1:E1), ' (', ETSTR(1:E2), ')' */ /* $ Restrictions */ /* One must keep in mind when using this routine that */ /* ancient times are not based upon the Gregorian */ /* calendar. For example the 0 point of the Julian */ /* Date system is 4713 B.C. Jan 1, 12:00:00 on the Julian */ /* Calendar. If one formalized the Gregorian calendar */ /* and extended it indefinitely, the zero point of the Julian */ /* date system corresponds to 4714 B.C. NOV 24 12:00:00 on */ /* the Gregorian calendar. There are several reasons for this. */ /* Leap years in the Julian calendar occur every */ /* 4 years (including *all* centuries). Moreover, the */ /* Gregorian calendar "effectively" begins on 15 Oct, 1582 A.D. */ /* which is 5 Oct, 1582 A.D. in the Julian Calendar. */ /* Therefore you must be careful in your interpretation */ /* of ancient dates produced by this routine. */ /* $ Literature_References */ /* 1. "From Sundial to Atomic Clocks---Understanding Time and */ /* Frequency" by James Jespersen and Jane Fitz-Randolph */ /* Dover Publications, Inc. New York (1982). */ /* $ Author_and_Institution */ /* W.L. Taber (JPL) */ /* K.R. Gehringer (JPL) */ /* $ Version */ /* - SPICELIB Version 2.2.0, 05-MAR-1998 (WLT) */ /* The documentation concerning the appearance of the output */ /* time string was corrected so that it does not suggest */ /* a comma is inserted after the day of the month. The */ /* comma was removed from the output string in Version 2.0.0 */ /* (see the note below) but the documentation was not upgraded */ /* accordingly. */ /* - SPICELIB Version 2.1.0, 20-MAY-1996 (WLT) */ /* Two arrays that were initialized but never used were */ /* removed. */ /* - SPICELIB Version 2.0.0, 16-AUG-1995 (KRG) */ /* If the day number was less than 10, the spacing was off for */ /* the rest of the time by one space, that for the "tens" digit. */ /* This has been fixed by using a leading zero when the number of */ /* days is < 10. */ /* Also, the comma that appeared between the month/day/year */ /* and the hour:minute:seconds tokens has been removed. This was */ /* done in order to make the calendar date format of ETCAL */ /* consistent with the calendar date format of ET2UTC. */ /* - SPICELIB Version 1.0.0, 14-DEC-1993 (WLT) */ /* -& */ /* $ Index_Entries */ /* Convert ephemeris time to a formal calendar date */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 2.1.0, 20-MAY-1996 (WLT) */ /* Two arrays that were initialized but never used were */ /* removed. */ /* - SPICELIB Version 2.0.0, 16-AUG-1995 (KRG) */ /* If the day number was less than 10, the spacing was off for */ /* the rest of the time by one space, that for the "tens" digit. */ /* This has been fixed byusing a leading zero when the number of */ /* days is < 10. */ /* Also, the comma that appeared between the month/day/year */ /* and the hour:minute:seconds tokens has been removed. This was */ /* done in order to make the calendar date format of ETCAL */ /* consistent with the calendar date format of ET2UTC. */ /* - SPICELIB Version 1.0.0, 14-DEC-1993 (WLT) */ /* -& */ /* Spicelib Functions. */ /* We declare the variables that contain the number of days in */ /* 400 years, 100 years, 4 years and 1 year. */ /* The following integers give the number of days during the */ /* associated month of a non-leap year. */ /* The integers that follow give the number of days in a normal */ /* year that precede the first of the month. */ /* The integers that follow give the number of days in a leap */ /* year that precede the first of the month. */ /* The variables below hold the components of the output string */ /* before they are put together. */ /* We will construct our string using the local variable DATE */ /* and transfer the results to the output STRING when we are */ /* done. */ /* MONTHS contains 3-letter abbreviations for the months of the year */ /* The array EXTRA contains the number of additional days that */ /* appear before the first of a month during a leap year (as opposed */ /* to a non-leap year). */ /* DPJAN0(I) gives the number of days that occur before the I'th */ /* month of a normal year. */ /* Definitions of statement functions. */ /* The number of days elapsed since Jan 1, of year 1 A.D. to */ /* Jan 1 of YEAR is given by: */ /* The number of leap days in a year is given by: */ /* To compute the day of the year we */ /* look up the number of days to the beginning of the month, */ /* add on the number leap days that occurred prior to that */ /* time */ /* add on the number of days into the month */ /* The number of days since 1 Jan 1 A.D. is given by: */ if (first) { first = FALSE_; halfd = spd_() / 2.; secspd = spd_(); dn2000 = (c__2000 - 1) * 365 + (c__2000 - 1) / 4 - (c__2000 - 1) / 100 + (c__2000 - 1) / 400 + (dpjan0[(i__1 = c__1 - 1) < 12 && 0 <= i__1 ? i__1 : s_rnge("dpjan0", i__1, "etcal_", (ftnlen) 571)] + extra[(i__2 = c__1 - 1) < 12 && 0 <= i__2 ? i__2 : s_rnge("extra", i__2, "etcal_", (ftnlen)571)] * ((c__2000 / 4 << 2) / c__2000 - c__2000 / 100 * 100 / c__2000 + c__2000 / 400 * 400 / c__2000) + c__1) - 1; dmxint = (doublereal) intmax_(); dmnint = (doublereal) intmin_(); } /* Now we "in-line" compute the following call. */ /* call rmaind ( et + halfd, secspd, dp2000, secs ) */ /* because we can't make a call to rmaind. */ /* The reader may wonder why we use et + halfd. The value */ /* et is seconds past the ephemeris epoch of J2000 which */ /* is at 2000 Jan 1, 12:00:00. We want to compute days past */ /* 2000 Jan 1, 00:00:00. The seconds past THAT epoch is et + halfd. */ /* We add on 0.0005 seconds so that the string produced will be */ /* rounded to the nearest millisecond. */ mydnom = secspd; mynum = *et + halfd; d__1 = mynum / mydnom; q = d_int(&d__1); remd = mynum - q * mydnom; if (remd < 0.) { q += -1.; remd += mydnom; } secs = remd; dp2000 = q; /* Do something about the problem when ET is vastly */ /* out of range. (Day number outside MAX and MIN integer). */ if (dp2000 + dn2000 < dmnint + 1) { dp2000 = dmnint - dn2000 + 1; s_copy(messge, "Epoch before ", (ftnlen)16, (ftnlen)13); secs = 0.; } else if (dp2000 + dn2000 > dmxint - 1) { dp2000 = dmxint - dn2000 - 1; s_copy(messge, "Epoch after ", (ftnlen)16, (ftnlen)12); secs = 0.; } else { s_copy(messge, " ", (ftnlen)16, (ftnlen)1); } /* Compute the number of days since 1 .A.D. Jan 1, 00:00:00. */ /* From the tests in the previous IF-ELSE IF-ELSE block this */ /* addition is guaranteed not to overflow. */ daynum = (integer) (dp2000 + (doublereal) dn2000); /* If the number of days is negative, we need to do a little */ /* work so that we can represent the date in the B.C. era. */ /* We add enough multiples of 400 years so that the year will */ /* be positive and then we subtract off the appropriate multiple */ /* of 400 years later. */ if (daynum < 0) { /* Since we can't make the call below and remain */ /* error free, we compute it ourselves. */ /* call rmaini ( daynum, dp400y, offset, daynum ) */ iq = daynum / 146097; rem = daynum - iq * 146097; if (rem < 0) { --iq; rem += 146097; } offset = iq; daynum = rem; adjust = TRUE_; } else { adjust = FALSE_; } /* Next we compute the year. Divide out multiples of 400, 100 */ /* 4 and 1 year. Finally combine these to get the correct */ /* value for year. (Note this is all integer arithmetic.) */ /* Recall that DP1Y = 365 */ /* DP4Y = 4*DPY + 1 */ /* DP100Y = 25*DP4Y - 1 */ /* DP400Y = 4*DP100Y + 1 */ yr400 = daynum / 146097; rem = daynum - yr400 * 146097; /* Computing MIN */ i__1 = 3, i__2 = rem / 36524; yr100 = min(i__1,i__2); rem -= yr100 * 36524; /* Computing MIN */ i__1 = 24, i__2 = rem / 1461; yr4 = min(i__1,i__2); rem -= yr4 * 1461; /* Computing MIN */ i__1 = 3, i__2 = rem / 365; yr1 = min(i__1,i__2); rem -= yr1 * 365; dofyr = rem + 1; year = yr400 * 400 + yr100 * 100 + (yr4 << 2) + yr1 + 1; /* Get the month, and day of month (depending upon whether */ /* we have a leap year or not). */ if ((year / 4 << 2) / year - year / 100 * 100 / year + year / 400 * 400 / year == 0) { month = lstlti_(&dofyr, &c__12, dpjan0); day = dofyr - dpjan0[(i__1 = month - 1) < 12 && 0 <= i__1 ? i__1 : s_rnge("dpjan0", i__1, "etcal_", (ftnlen)698)]; } else { month = lstlti_(&dofyr, &c__12, dpbegl); day = dofyr - dpbegl[(i__1 = month - 1) < 12 && 0 <= i__1 ? i__1 : s_rnge("dpbegl", i__1, "etcal_", (ftnlen)701)]; } /* If we had to adjust the year to make it positive, we now */ /* need to correct it and then convert it to a B.C. year. */ if (adjust) { year += offset * 400; year = -year + 1; s_copy(era, " B.C. ", (ftnlen)16, (ftnlen)6); } else { /* If the year is less than 1000, we can't just write it */ /* out. We need to add the era. If we don't do this */ /* the dates look very confusing. */ if (year < 1000) { s_copy(era, " A.D. ", (ftnlen)16, (ftnlen)6); } else { s_copy(era, " ", (ftnlen)16, (ftnlen)1); } } /* Convert Seconds to Hours, Minute and Seconds. */ /* We work with thousandths of a second in integer arithmetic */ /* so that all of the truncation work with seconds will already */ /* be done. (Note that we already know that SECS is greater than */ /* or equal to zero so we'll have no problems with HOURS, MINS */ /* or SECS becoming negative.) */ tsecs = (integer) (secs * 1e3); frac = secs - (doublereal) tsecs; hours = tsecs / 3600000; tsecs -= hours * 3600000; mins = tsecs / 60000; tsecs -= mins * 60000; secs = (doublereal) tsecs / 1e3; /* We round seconds if we can do so without getting seconds to be */ /* bigger than 60. */ if (secs + 5e-4 < 60.) { secs += 5e-4; } /* Finally, get the components of our date string. */ intstr_(&year, ystr, (ftnlen)16); if (day >= 10) { intstr_(&day, dstr, (ftnlen)16); } else { s_copy(dstr, "0", (ftnlen)16, (ftnlen)1); intstr_(&day, dstr + 1, (ftnlen)15); } /* We want to zero pad the hours minutes and seconds. */ if (hours < 10) { bh = 2; } else { bh = 1; } if (mins < 10) { bm = 2; } else { bm = 1; } s_copy(mstr, "00", (ftnlen)16, (ftnlen)2); s_copy(hstr, "00", (ftnlen)16, (ftnlen)2); s_copy(sstr, " ", (ftnlen)16, (ftnlen)1); /* Now construct the string components for hours, minutes and */ /* seconds. */ secs = (integer) (secs * 1e3) / 1e3; intstr_(&hours, hstr + (bh - 1), 16 - (bh - 1)); intstr_(&mins, mstr + (bm - 1), 16 - (bm - 1)); dpstrf_(&secs, &c__6, "F", sstr, (ftnlen)1, (ftnlen)16); /* The form of the output for SSTR has a leading blank followed by */ /* the first significant digit. If a decimal point is in the */ /* third slot, then SSTR is of the form ' x.xxxxx' and we need */ /* to insert a leading zero. */ if (*(unsigned char *)&sstr[2] == '.') { *(unsigned char *)sstr = '0'; } /* We don't want any leading spaces in SSTR, (HSTR and MSTR don't */ /* have leading spaces by construction. */ ljust_(sstr, sstr, (ftnlen)16, (ftnlen)16); /* Now form the date string, squeeze out extra spaces and */ /* left justify the whole thing. */ /* Writing concatenation */ i__3[0] = 16, a__1[0] = messge; i__3[1] = 16, a__1[1] = ystr; i__3[2] = 16, a__1[2] = era; i__3[3] = 3, a__1[3] = months + ((i__1 = month - 1) < 12 && 0 <= i__1 ? i__1 : s_rnge("months", i__1, "etcal_", (ftnlen)810)) * 3; i__3[4] = 1, a__1[4] = " "; i__3[5] = 3, a__1[5] = dstr; i__3[6] = 1, a__1[6] = " "; i__3[7] = 2, a__1[7] = hstr; i__3[8] = 1, a__1[8] = ":"; i__3[9] = 2, a__1[9] = mstr; i__3[10] = 1, a__1[10] = ":"; i__3[11] = 6, a__1[11] = sstr; s_cat(date, a__1, i__3, &c__12, (ftnlen)180); cmprss_(" ", &c__1, date, date, (ftnlen)1, (ftnlen)180, (ftnlen)180); ljust_(date, date, (ftnlen)180, (ftnlen)180); s_copy(string, date, string_len, (ftnlen)180); return 0; } /* etcal_ */
/* $Procedure ZZSPKAP1 ( S/P Kernel, apparent state ) */ /* Subroutine */ int zzspkap1_(integer *targ, doublereal *et, char *ref, doublereal *sobs, char *abcorr, doublereal *starg, doublereal *lt, ftnlen ref_len, ftnlen abcorr_len) { /* Initialized data */ static logical first = TRUE_; static char flags[5*9] = "NONE " "LT " "LT+S " "CN " "CN+S " "XLT " "XLT+S" "XCN " "XCN+S"; static char prvcor[5] = " "; /* System generated locals */ integer i__1; doublereal d__1; /* Builtin functions */ integer s_cmp(char *, char *, ftnlen, ftnlen); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); /* Local variables */ char corr[5]; extern /* Subroutine */ int zzspksb1_(integer *, doublereal *, char *, doublereal *, ftnlen); static logical xmit; extern /* Subroutine */ int vequ_(doublereal *, doublereal *); char corr2[5]; integer i__, refid; extern /* Subroutine */ int chkin_(char *, ftnlen), ucase_(char *, char *, ftnlen, ftnlen), errch_(char *, char *, ftnlen, ftnlen), moved_( doublereal *, integer *, doublereal *); static logical usecn; doublereal sapos[3]; extern /* Subroutine */ int vsubg_(doublereal *, doublereal *, integer *, doublereal *); static logical uselt; extern doublereal vnorm_(doublereal *), clight_(void); extern integer isrchc_(char *, integer *, char *, ftnlen, ftnlen); extern /* Subroutine */ int stelab_(doublereal *, doublereal *, doublereal *), sigerr_(char *, ftnlen), chkout_(char *, ftnlen), stlabx_(doublereal *, doublereal *, doublereal *); integer ltsign; extern /* Subroutine */ int setmsg_(char *, ftnlen), irfnum_(char *, integer *, ftnlen); doublereal tstate[6]; integer maxitr; extern /* Subroutine */ int cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); extern logical return_(void); static logical usestl; extern logical odd_(integer *); /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* Return the state (position and velocity) of a target body */ /* relative to an observer, optionally corrected for light time and */ /* stellar aberration. */ /* $ 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 */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* TARG I Target body. */ /* ET I Observer epoch. */ /* REF I Inertial reference frame of observer's state. */ /* SOBS I State of observer wrt. solar system barycenter. */ /* ABCORR I Aberration correction flag. */ /* STARG O State of target. */ /* LT O One way light time between observer and target. */ /* $ Detailed_Input */ /* TARG is the NAIF ID code for a target body. The target */ /* and observer define a state vector whose position */ /* component points from the observer to the target. */ /* ET is the ephemeris time, expressed as seconds past J2000 */ /* TDB, at which the state of the target body relative to */ /* the observer is to be computed. ET refers to time at */ /* the observer's location. */ /* REF is the inertial reference frame with respect to which */ /* the observer's state SOBS is expressed. REF must be */ /* recognized by the SPICE Toolkit. The acceptable */ /* frames are listed in the Frames Required Reading, as */ /* well as in the SPICELIB routine CHGIRF. */ /* Case and blanks are not significant in the string REF. */ /* SOBS is the geometric (uncorrected) state of the observer */ /* relative to the solar system barycenter at epoch ET. */ /* SOBS is a 6-vector: the first three components of */ /* SOBS represent a Cartesian position vector; the last */ /* three components represent the corresponding velocity */ /* vector. SOBS is expressed relative to the inertial */ /* reference frame designated by REF. */ /* Units are always km and km/sec. */ /* ABCORR indicates the aberration corrections to be applied */ /* to the state of the target body to account for one-way */ /* light time and stellar aberration. See the discussion */ /* in the Particulars section for recommendations on */ /* how to choose aberration corrections. */ /* ABCORR may be any of the following: */ /* 'NONE' Apply no correction. Return the */ /* geometric state of the target body */ /* relative to the observer. */ /* The following values of ABCORR apply to the */ /* "reception" case in which photons depart from the */ /* target's location at the light-time corrected epoch */ /* ET-LT and *arrive* at the observer's location at ET: */ /* 'LT' Correct for one-way light time (also */ /* called "planetary aberration") using a */ /* Newtonian formulation. This correction */ /* yields the state of the target at the */ /* moment it emitted photons arriving at */ /* the observer at ET. */ /* The light time correction involves */ /* iterative solution of the light time */ /* equation (see Particulars for details). */ /* The solution invoked by the 'LT' option */ /* uses one iteration. */ /* 'LT+S' Correct for one-way light time and */ /* stellar aberration using a Newtonian */ /* formulation. This option modifies the */ /* state obtained with the 'LT' option to */ /* account for the observer's velocity */ /* relative to the solar system */ /* barycenter. The result is the apparent */ /* state of the target---the position and */ /* velocity of the target as seen by the */ /* observer. */ /* 'CN' Converged Newtonian light time */ /* correction. In solving the light time */ /* equation, the 'CN' correction iterates */ /* until the solution converges (three */ /* iterations on all supported platforms). */ /* The 'CN' correction typically does not */ /* substantially improve accuracy because */ /* the errors made by ignoring */ /* relativistic effects may be larger than */ /* the improvement afforded by obtaining */ /* convergence of the light time solution. */ /* The 'CN' correction computation also */ /* requires a significantly greater number */ /* of CPU cycles than does the */ /* one-iteration light time correction. */ /* 'CN+S' Converged Newtonian light time */ /* and stellar aberration corrections. */ /* The following values of ABCORR apply to the */ /* "transmission" case in which photons *depart* from */ /* the observer's location at ET and arrive at the */ /* target's location at the light-time corrected epoch */ /* ET+LT: */ /* 'XLT' "Transmission" case: correct for */ /* one-way light time using a Newtonian */ /* formulation. This correction yields the */ /* state of the target at the moment it */ /* receives photons emitted from the */ /* observer's location at ET. */ /* 'XLT+S' "Transmission" case: correct for */ /* one-way light time and stellar */ /* aberration using a Newtonian */ /* formulation This option modifies the */ /* state obtained with the 'XLT' option to */ /* account for the observer's velocity */ /* relative to the solar system */ /* barycenter. The position component of */ /* the computed target state indicates the */ /* direction that photons emitted from the */ /* observer's location must be "aimed" to */ /* hit the target. */ /* 'XCN' "Transmission" case: converged */ /* Newtonian light time correction. */ /* 'XCN+S' "Transmission" case: converged */ /* Newtonian light time and stellar */ /* aberration corrections. */ /* Neither special nor general relativistic effects are */ /* accounted for in the aberration corrections applied */ /* by this routine. */ /* Case and blanks are not significant in the string */ /* ABCORR. */ /* $ Detailed_Output */ /* STARG is a Cartesian state vector representing the position */ /* and velocity of the target body relative to the */ /* specified observer. STARG is corrected for the */ /* specified aberrations, and is expressed with respect */ /* to the specified inertial reference frame. The first */ /* three components of STARG represent the x-, y- and */ /* z-components of the target's position; last three */ /* components form the corresponding velocity vector. */ /* The position component of STARG points from the */ /* observer's location at ET to the aberration-corrected */ /* location of the target. Note that the sense of the */ /* position vector is independent of the direction of */ /* radiation travel implied by the aberration */ /* correction. */ /* The velocity component of STARG is obtained by */ /* evaluating the target's geometric state at the light */ /* time corrected epoch, so for aberration-corrected */ /* states, the velocity is not precisely equal to the */ /* time derivative of the position. */ /* Units are always km and km/sec. */ /* LT is the one-way light time between the observer and */ /* target in seconds. If the target state is corrected */ /* for aberrations, then LT is the one-way light time */ /* between the observer and the light time corrected */ /* target location. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If the value of ABCORR is not recognized, the error */ /* 'SPICE(SPKINVALIDOPTION)' is signaled. */ /* 2) If the reference frame requested is not a recognized */ /* inertial reference frame, the error 'SPICE(BADFRAME)' */ /* is signaled. */ /* 3) If the state of the target relative to the solar system */ /* barycenter cannot be computed, the error will be diagnosed */ /* by routines in the call tree of this routine. */ /* $ Files */ /* This routine computes states using SPK files that have been */ /* loaded into the SPICE system, normally via the kernel loading */ /* interface routine FURNSH. Application programs typically load */ /* kernels once before this routine is called, for example during */ /* program initialization; kernels need not be loaded repeatedly. */ /* See the routine FURNSH and the SPK and KERNEL Required Reading */ /* for further information on loading (and unloading) kernels. */ /* If any of the ephemeris data used to compute STARG are expressed */ /* relative to a non-inertial frame in the SPK files providing those */ /* data, additional kernels may be needed to enable the reference */ /* frame transformations required to compute the state. Normally */ /* these additional kernels are PCK files or frame kernels. Any */ /* such kernels must already be loaded at the time this routine is */ /* called. */ /* $ Particulars */ /* In space science or engineering applications one frequently */ /* wishes to know where to point a remote sensing instrument, such */ /* as an optical camera or radio antenna, in order to observe or */ /* otherwise receive radiation from a target. This pointing problem */ /* is complicated by the finite speed of light: one needs to point */ /* to where the target appears to be as opposed to where it actually */ /* is at the epoch of observation. We use the adjectives */ /* "geometric," "uncorrected," or "true" to refer to an actual */ /* position or state of a target at a specified epoch. When a */ /* geometric position or state vector is modified to reflect how it */ /* appears to an observer, we describe that vector by any of the */ /* terms "apparent," "corrected," "aberration corrected," or "light */ /* time and stellar aberration corrected." */ /* The SPICE Toolkit can correct for two phenomena affecting the */ /* apparent location of an object: one-way light time (also called */ /* "planetary aberration") and stellar aberration. Correcting for */ /* one-way light time is done by computing, given an observer and */ /* observation epoch, where a target was when the observed photons */ /* departed the target's location. The vector from the observer to */ /* this computed target location is called a "light time corrected" */ /* vector. The light time correction depends on the motion of the */ /* target, but it is independent of the velocity of the observer */ /* relative to the solar system barycenter. Relativistic effects */ /* such as light bending and gravitational delay are not accounted */ /* for in the light time correction performed by this routine. */ /* The velocity of the observer also affects the apparent location */ /* of a target: photons arriving at the observer are subject to a */ /* "raindrop effect" whereby their velocity relative to the observer */ /* is, using a Newtonian approximation, the photons' velocity */ /* relative to the solar system barycenter minus the velocity of the */ /* observer relative to the solar system barycenter. This effect is */ /* called "stellar aberration." Stellar aberration is independent */ /* of the velocity of the target. The stellar aberration formula */ /* used by this routine is non-relativistic. */ /* Stellar aberration corrections are applied after light time */ /* corrections: the light time corrected target position vector is */ /* used as an input to the stellar aberration correction. */ /* When light time and stellar aberration corrections are both */ /* applied to a geometric position vector, the resulting position */ /* vector indicates where the target "appears to be" from the */ /* observer's location. */ /* As opposed to computing the apparent position of a target, one */ /* may wish to compute the pointing direction required for */ /* transmission of photons to the target. This requires correction */ /* of the geometric target position for the effects of light time and */ /* stellar aberration, but in this case the corrections are computed */ /* for radiation traveling from the observer to the target. */ /* The "transmission" light time correction yields the target's */ /* location as it will be when photons emitted from the observer's */ /* location at ET arrive at the target. The transmission stellar */ /* aberration correction is the inverse of the traditional stellar */ /* aberration correction: it indicates the direction in which */ /* radiation should be emitted so that, using a Newtonian */ /* approximation, the sum of the velocity of the radiation relative */ /* to the observer and of the observer's velocity, relative to the */ /* solar system barycenter, yields a velocity vector that points in */ /* the direction of the light time corrected position of the target. */ /* The traditional aberration corrections applicable to observation */ /* and those applicable to transmission are related in a simple way: */ /* one may picture the geometry of the "transmission" case by */ /* imagining the "observation" case running in reverse time order, */ /* and vice versa. */ /* One may reasonably object to using the term "observer" in the */ /* transmission case, in which radiation is emitted from the */ /* observer's location. The terminology was retained for */ /* consistency with earlier documentation. */ /* Below, we indicate the aberration corrections to use for some */ /* common applications: */ /* 1) Find the apparent direction of a target for a remote-sensing */ /* observation: */ /* Use 'LT+S': apply both light time and stellar */ /* aberration corrections. */ /* Note that using light time corrections alone ('LT') is */ /* generally not a good way to obtain an approximation to an */ /* apparent target vector: since light time and stellar */ /* aberration corrections often partially cancel each other, */ /* it may be more accurate to use no correction at all than to */ /* use light time alone. */ /* 2) Find the corrected pointing direction to radiate a signal */ /* to a target: */ /* Use 'XLT+S': apply both light time and stellar */ /* aberration corrections for transmission. */ /* 3) Obtain an uncorrected state vector derived directly from */ /* data in an SPK file: */ /* Use 'NONE'. */ /* 4) Compute the apparent position of a target body relative */ /* to a star or other distant object: */ /* Use 'LT' or 'LT+S' as needed to match the correction */ /* applied to the position of the distant object. For */ /* example, if a star position is obtained from a catalog, */ /* the position vector may not be corrected for stellar */ /* aberration. In this case, to find the angular */ /* separation of the star and the limb of a planet, the */ /* vector from the observer to the planet should be */ /* corrected for light time but not stellar aberration. */ /* 5) Use a geometric state vector as a low-accuracy estimate */ /* of the apparent state for an application where execution */ /* speed is critical: */ /* Use 'NONE'. */ /* 6) While this routine cannot perform the relativistic */ /* aberration corrections required to compute states */ /* with the highest possible accuracy, it can supply the */ /* geometric states required as inputs to these computations: */ /* Use 'NONE', then apply high-accuracy aberration */ /* corrections (not available in the SPICE Toolkit). */ /* Below, we discuss in more detail how the aberration corrections */ /* applied by this routine are computed. */ /* Geometric case */ /* ============== */ /* ZZSPKAP1 begins by computing the geometric position T(ET) of */ /* the target body relative to the solar system barycenter (SSB). */ /* Subtracting the geometric position of the observer O(ET) gives */ /* the geometric position of the target body relative to the */ /* observer. The one-way light time, LT, is given by */ /* | T(ET) - O(ET) | */ /* LT = ------------------- */ /* c */ /* The geometric relationship between the observer, target, and */ /* solar system barycenter is as shown: */ /* SSB ---> O(ET) */ /* | / */ /* | / */ /* | / */ /* | / T(ET) - O(ET) */ /* V V */ /* T(ET) */ /* The returned state consists of the position vector */ /* T(ET) - O(ET) */ /* and a velocity obtained by taking the difference of the */ /* corresponding velocities. In the geometric case, the */ /* returned velocity is actually the time derivative of the */ /* position. */ /* Reception case */ /* ============== */ /* When any of the options 'LT', 'CN', 'LT+S', 'CN+S' is */ /* selected, ZZSPKAP1 computes the position of the target body at */ /* epoch ET-LT, where LT is the one-way light time. Let T(t) and */ /* O(t) represent the positions of the target and observer */ /* relative to the solar system barycenter at time t; then LT is */ /* the solution of the light-time equation */ /* | T(ET-LT) - O(ET) | */ /* LT = ------------------------ (1) */ /* c */ /* The ratio */ /* | T(ET) - O(ET) | */ /* --------------------- (2) */ /* c */ /* is used as a first approximation to LT; inserting (2) into the */ /* RHS of the light-time equation (1) yields the "one-iteration" */ /* estimate of the one-way light time. Repeating the process */ /* until the estimates of LT converge yields the "converged */ /* Newtonian" light time estimate. */ /* Subtracting the geometric position of the observer O(ET) gives */ /* the position of the target body relative to the observer: */ /* T(ET-LT) - O(ET). */ /* SSB ---> O(ET) */ /* | \ | */ /* | \ | */ /* | \ | T(ET-LT) - O(ET) */ /* | \ | */ /* V V V */ /* T(ET) T(ET-LT) */ /* The position component of the light-time corrected state */ /* is the vector */ /* T(ET-LT) - O(ET) */ /* The velocity component of the light-time corrected state */ /* is the difference */ /* T_vel(ET-LT) - O_vel(ET) */ /* where T_vel and O_vel are, respectively, the velocities of */ /* the target and observer relative to the solar system */ /* barycenter at the epochs ET-LT and ET. */ /* If correction for stellar aberration is requested, the target */ /* position is rotated toward the solar system barycenter- */ /* relative velocity vector of the observer. The rotation is */ /* computed as follows: */ /* Let r be the light time corrected vector from the observer */ /* to the object, and v be the velocity of the observer with */ /* respect to the solar system barycenter. Let w be the angle */ /* between them. The aberration angle phi is given by */ /* sin(phi) = v sin(w) / c */ /* Let h be the vector given by the cross product */ /* h = r X v */ /* Rotate r by phi radians about h to obtain the apparent */ /* position of the object. */ /* The velocity component of the output state STARG is */ /* not corrected for stellar aberration. */ /* Transmission case */ /* ================== */ /* When any of the options 'XLT', 'XCN', 'XLT+S', 'XCN+S' are */ /* selected, ZZSPKAP1 computes the position of the target body T */ /* at epoch ET+LT, where LT is the one-way light time. LT is the */ /* solution of the light-time equation */ /* | T(ET+LT) - O(ET) | */ /* LT = ------------------------ (3) */ /* c */ /* Subtracting the geometric position of the observer, O(ET), */ /* gives the position of the target body relative to the */ /* observer: T(ET-LT) - O(ET). */ /* SSB --> O(ET) */ /* / | * */ /* / | * T(ET+LT) - O(ET) */ /* / |* */ /* / *| */ /* V V V */ /* T(ET+LT) T(ET) */ /* The position component of the light-time corrected state */ /* is the vector */ /* T(ET+LT) - O(ET) */ /* The velocity component of the light-time corrected state */ /* is the difference */ /* T_vel(ET+LT) - O_vel(ET) */ /* where T_vel and O_vel are, respectively, the velocities of */ /* the target and observer relative to the solar system */ /* barycenter at the epochs ET+LT and ET. */ /* If correction for stellar aberration is requested, the target */ /* position is rotated away from the solar system barycenter- */ /* relative velocity vector of the observer. The rotation is */ /* computed as in the reception case, but the sign of the */ /* rotation angle is negated. */ /* The velocity component of the output state STARG is */ /* not corrected for stellar aberration. */ /* Neither special nor general relativistic effects are accounted */ /* for in the aberration corrections performed by this routine. */ /* $ Examples */ /* In the following code fragment, ZZSPKSB1 and ZZSPKAP1 are used */ /* to display the position of Io (body 501) as seen from the */ /* Voyager 2 spacecraft (Body -32) at a series of epochs. */ /* Normally, one would call the high-level reader SPKEZR to obtain */ /* state vectors. The example below illustrates the interface */ /* of this routine but is not intended as a recommendation on */ /* how to use the SPICE SPK subsystem. */ /* The use of integer ID codes is necessitated by the low-level */ /* interface of this routine. */ /* IO = 501 */ /* VGR2 = -32 */ /* DO WHILE ( EPOCH .LE. END ) */ /* CALL ZZSPKSB1 ( VGR2, EPOCH, 'J2000', STVGR2 ) */ /* CALL ZZSPKAP1 ( IO, EPOCH, 'J2000', STVGR2, */ /* . 'LT+S', STIO, LT ) */ /* CALL RECRAD ( STIO, RANGE, RA, DEC ) */ /* WRITE (*,*) RA * DPR(), DEC * DPR() */ /* EPOCH = EPOCH + DELTA */ /* END DO */ /* $ Restrictions */ /* 1) SPICE Private routine. */ /* 2) The kernel files to be used by ZZSPKAP1 must be loaded */ /* (normally by the SPICELIB kernel loader FURNSH) before */ /* this routine is called. */ /* 3) Unlike most other SPK state computation routines, this */ /* routine requires that the input state be relative to an */ /* inertial reference frame. Non-inertial frames are not */ /* supported by this routine. */ /* 4) In a future version of this routine, the implementation */ /* of the aberration corrections may be enhanced to improve */ /* accuracy. */ /* $ Literature_References */ /* SPK Required Reading. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* H.A. Neilan (JPL) */ /* I.M. Underwood (JPL) */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.0, 12-DEC-2004 (NJB) */ /* Based on SPICELIB Version 3.0.1, 20-OCT-2003 (EDW) */ /* -& */ /* $ Index_Entries */ /* low-level aberration correction */ /* apparent state from spk file */ /* get apparent state */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 2.0.0, 22-MAY-1995 (WLT) */ /* The routine was modified to support the options 'CN' and */ /* 'CN+S' aberration corrections. Moreover, diagnostics were */ /* added to check for reference frames that are not recognized */ /* inertial frames. */ /* - SPICELIB Version 1.1.1, 06-MAR-1991 (JML) */ /* In the example program, the calling sequence of ZZSPKAP1 */ /* was corrected. */ /* - SPICELIB Version 1.1.0, 25-MAY-1990 (HAN) */ /* The local variable CORR was added to eliminate a run-time */ /* error that occurred when ZZSPKAP1 was determining what */ /* corrections to apply to the state. If the literal string */ /* 'LT' was assigned to ABCORR, ZZSPKAP1 attempted to look at */ /* ABCORR(3:4). Because ABCORR is a passed length argument, its */ /* length is not guaranteed, and those positions may not exist. */ /* Searching beyond the bounds of a string resulted in a */ /* run-time error at NAIF because NAIF compiles SPICELIB using the */ /* CHECK=BOUNDS option for the DEC VAX/VMX DCL FORTRAN command. */ /* Also, without the local variable CORR, ZZSPKAP1 would have to */ /* modify the value of a passed argument, ABCORR. That's a no no. */ /* -& */ /* SPICELIB functions */ /* Local parameters */ /* Indices of flags in the FLAGS array: */ /* Local variables */ /* Saved variables */ /* Initial values */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZSPKAP1", (ftnlen)8); } if (first || s_cmp(abcorr, prvcor, abcorr_len, (ftnlen)5) != 0) { /* The aberration correction flag differs from the value it */ /* had on the previous call, if any. Analyze the new flag. */ /* Remove leading and embedded white space from the aberration */ /* correction flag, then convert to upper case. */ cmprss_(" ", &c__0, abcorr, corr2, (ftnlen)1, abcorr_len, (ftnlen)5); ucase_(corr2, corr, (ftnlen)5, (ftnlen)5); /* Locate the flag in our list of flags. */ i__ = isrchc_(corr, &c__9, flags, (ftnlen)5, (ftnlen)5); if (i__ == 0) { setmsg_("Requested aberration correction # is not supported.", ( ftnlen)51); errch_("#", abcorr, (ftnlen)1, abcorr_len); sigerr_("SPICE(SPKINVALIDOPTION)", (ftnlen)23); chkout_("ZZSPKAP1", (ftnlen)8); return 0; } /* The aberration correction flag is recognized; save it. */ s_copy(prvcor, abcorr, (ftnlen)5, abcorr_len); /* Set logical flags indicating the attributes of the requested */ /* correction. */ xmit = i__ > 5; uselt = i__ == 2 || i__ == 3 || i__ == 6 || i__ == 7; usestl = i__ > 1 && odd_(&i__); usecn = i__ == 4 || i__ == 5 || i__ == 8 || i__ == 9; first = FALSE_; } /* See if the reference frame is a recognized inertial frame. */ irfnum_(ref, &refid, ref_len); if (refid == 0) { setmsg_("The requested frame '#' is not a recognized inertial frame. " , (ftnlen)60); errch_("#", ref, (ftnlen)1, ref_len); sigerr_("SPICE(BADFRAME)", (ftnlen)15); chkout_("ZZSPKAP1", (ftnlen)8); return 0; } /* Determine the sign of the light time offset. */ if (xmit) { ltsign = 1; } else { ltsign = -1; } /* Find the geometric state of the target body with respect to the */ /* solar system barycenter. Subtract the state of the observer */ /* to get the relative state. Use this to compute the one-way */ /* light time. */ zzspksb1_(targ, et, ref, starg, ref_len); vsubg_(starg, sobs, &c__6, tstate); moved_(tstate, &c__6, starg); *lt = vnorm_(starg) / clight_(); /* To correct for light time, find the state of the target body */ /* at the current epoch minus the one-way light time. Note that */ /* the observer remains where he is. */ if (uselt) { maxitr = 1; } else if (usecn) { maxitr = 3; } else { maxitr = 0; } i__1 = maxitr; for (i__ = 1; i__ <= i__1; ++i__) { d__1 = *et + ltsign * *lt; zzspksb1_(targ, &d__1, ref, starg, ref_len); vsubg_(starg, sobs, &c__6, tstate); moved_(tstate, &c__6, starg); *lt = vnorm_(starg) / clight_(); } /* At this point, STARG contains the light time corrected */ /* state of the target relative to the observer. */ /* If stellar aberration correction is requested, perform it now. */ /* Stellar aberration corrections are not applied to the target's */ /* velocity. */ if (usestl) { if (xmit) { /* This is the transmission case. */ /* Compute the position vector obtained by applying */ /* "reception" stellar aberration to STARG. */ stlabx_(starg, &sobs[3], sapos); vequ_(sapos, starg); } else { /* This is the reception case. */ /* Compute the position vector obtained by applying */ /* "reception" stellar aberration to STARG. */ stelab_(starg, &sobs[3], sapos); vequ_(sapos, starg); } } chkout_("ZZSPKAP1", (ftnlen)8); return 0; } /* zzspkap1_ */
/* $Procedure ZZGFWSTS ( Private --- GF, sift first window thru second ) */ /* Subroutine */ int zzgfwsts_(doublereal *wndw1, doublereal *wndw2, char * inclsn, doublereal *wndw3, ftnlen inclsn_len) { /* Builtin functions */ integer s_cmp(char *, char *, ftnlen, ftnlen); /* Local variables */ logical keep, left, open; integer begp1, begp2, begp3, endp1, endp2, endp3, size1, size2; extern integer cardd_(doublereal *); extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *, ftnlen, ftnlen); logical right; extern integer sized_(doublereal *); extern /* Subroutine */ int scardd_(integer *, doublereal *); char locinc[2]; logical closed; extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen), ssized_(integer *, doublereal *), setmsg_(char *, ftnlen) , errint_(char *, integer *, ftnlen), cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); integer maxpts, ovflow; extern logical return_(void); /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* Determine those intervals of the first window that are */ /* properly contained in an interval of the second. */ /* $ 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 */ /* INTERVALS, WINDOWS */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- --------------------------------------------------- */ /* WNDW1 I Input window 1. */ /* WNDW2 I Input window 2. */ /* INCLSN I Flag indicating inclusion desired. */ /* WNDW3 I/O Result of sifting WNDW1 through WNDW2. */ /* $ Detailed_Input */ /* WNDW1 is an initialized SPICELIB window */ /* WNDW2 is an initialized SPICELIB window */ /* INCLSN is a string indicating how intervals of WNDW1 must */ /* be contained in WNDW2. Allowed values are: '[]', '(]', */ /* '[)', and '()', where a square bracket represents a */ /* closed interval and a curved bracket an open interval. */ /* Suppose that [a,b] is an interval of WNDW1 and that */ /* [c,d] is an interval of WNDW2. Then the table below */ /* shows the tests used to determine the inclusion of */ /* [a,b] in the interval from c to d. */ /* [] --- [a,b] is contained in [c,d] */ /* (] --- [a,b] is contained in (c,d] */ /* [) --- [a,b] is contained in [c,d) */ /* () --- [a,b] is contained in (c,d) */ /* if INCLSN is not one of these four values, the */ /* error SPICE(UNKNOWNINCLUSION) is signaled. */ /* WNDW3 is an initialized SPICELIB window, used on input */ /* only for the purpose of determining the amount */ /* of space declared for use in WNDW3. */ /* $ Detailed_Output */ /* WNDW3 is a window consisting those of intervals in WNDW1 */ /* that are wholly contained in some interval of WNDW2. */ /* $ Parameters */ /* LBCELL is the SPICELIB cell lower bound. */ /* $ Exceptions */ /* 1) If the window WNDW3 does not have sufficient space to */ /* contain the sifting of WNDW1 through WNDW2 the error */ /* 'SPICE(OUTOFROOM)' is signaled. */ /* $ Files */ /* None. */ /* $ Particulars */ /* This routine allows the user to specify two closed subsets of the */ /* real line and to find the intervals of one that are contained */ /* within the intervals of another. The subsets of the real line */ /* are assumed to be made up of disjoint unions of closed intervals. */ /* $ Examples */ /* Suppose that WNDW1 and WNDW2 are described by the tables below. */ /* WNDW1 WNDW2 */ /* 12.3 12.8 11.7 13.5 */ /* 17.8 20.4 17.2 18.3 */ /* 21.4 21.7 18.5 22.6 */ /* 38.2 39.8 40.1 45.6 */ /* 44.0 59.9 */ /* Then WNDW3 will be given by: */ /* WNDW3 */ /* 12.3 12.8 */ /* 21.4 21.7 */ /* $ Restrictions */ /* The set WNDW3 must not overwrite WNDW1 or WNDW2. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* W.L. Taber (JPL) */ /* L.S. Elson (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.1, 08-DEC-2010 (EDW) */ /* Edit to replaced term "schedule" with "window." */ /* - SPICELIB Version 1.0.0, 05-MAR-2009 (NJB) (LSE) (WLT) */ /* -& */ /* $ Index_Entries */ /* find window intervals contained in an interval of another */ /* -& */ /* SPICELIB functions */ /* Local parameters */ /* Local Variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } chkin_("ZZGFWSTS", (ftnlen)8); /* Store the maximum number of endpoints that can be loaded into */ /* WNDW3 */ maxpts = sized_(wndw3); ssized_(&maxpts, wndw3); /* Find the number of endpoints in each of the input windows. */ size1 = cardd_(wndw1); size2 = cardd_(wndw2); /* Initialize the place holders for each of the input windows. */ begp1 = 1; begp2 = 1; endp1 = 2; endp2 = 2; begp3 = -1; endp3 = 0; cmprss_(" ", &c__0, inclsn, locinc, (ftnlen)1, inclsn_len, (ftnlen)2); open = s_cmp(locinc, "()", (ftnlen)2, (ftnlen)2) == 0; left = s_cmp(locinc, "[)", (ftnlen)2, (ftnlen)2) == 0; right = s_cmp(locinc, "(]", (ftnlen)2, (ftnlen)2) == 0; closed = s_cmp(locinc, "[]", (ftnlen)2, (ftnlen)2) == 0; if (! (open || left || right || closed)) { setmsg_("The value of the inclusion flag must be one of the followin" "g: '[]', '[)', '(]', or '()'. However the value supplied wa" "s '#'. ", (ftnlen)126); errch_("#", inclsn, (ftnlen)1, inclsn_len); sigerr_("SPICE(UNKNOWNINCLUSION)", (ftnlen)23); chkout_("ZZGFWSTS", (ftnlen)8); return 0; } /* We haven't had a chance to overflow yet. */ ovflow = 0; while(begp1 < size1 && begp2 < size2) { /* Using the current interval endpoints determine the overlap of */ /* the two intervals. */ if (wndw1[endp1 + 5] < wndw2[begp2 + 5]) { /* the end of the first interval precedes the beginning of the */ /* second */ begp1 += 2; endp1 += 2; } else if (wndw2[endp2 + 5] < wndw1[begp1 + 5]) { /* the end of the second interval precedes the beginning of the */ /* first */ begp2 += 2; endp2 += 2; } else { /* the intervals intersect. Is the first contained in the */ /* second? */ if (closed) { keep = wndw1[begp1 + 5] >= wndw2[begp2 + 5] && wndw1[endp1 + 5] <= wndw2[endp2 + 5]; } else if (open) { keep = wndw1[begp1 + 5] > wndw2[begp2 + 5] && wndw1[endp1 + 5] < wndw2[endp2 + 5]; } else if (left) { keep = wndw1[begp1 + 5] >= wndw2[begp2 + 5] && wndw1[endp1 + 5] < wndw2[endp2 + 5]; } else if (right) { keep = wndw1[begp1 + 5] > wndw2[begp2 + 5] && wndw1[endp1 + 5] <= wndw2[endp2 + 5]; } if (keep) { begp3 += 2; endp3 += 2; if (begp3 < maxpts) { /* Adequate room is left in WNDW3 to include this */ /* interval */ wndw3[begp3 + 5] = wndw1[begp1 + 5]; wndw3[endp3 + 5] = wndw1[endp1 + 5]; } else { ovflow += 2; } } /* Determine which window pointers to increment */ if (wndw1[endp1 + 5] < wndw2[endp2 + 5]) { /* The first interval lies before the end of the second */ begp1 += 2; endp1 += 2; } else if (wndw2[endp2 + 5] < wndw1[endp1 + 5]) { /* The second interval lies before the end of the first */ begp2 += 2; endp2 += 2; } else { /* The first and second intervals end at the same place */ begp1 += 2; endp1 += 2; begp2 += 2; endp2 += 2; } } } if (ovflow > 0) { setmsg_("The output window does not have sufficient memory to contai" "n the result of sifting the two given windows. The output wi" "ndow requires space for # more values than what has been pro" "vided. ", (ftnlen)186); errint_("#", &ovflow, (ftnlen)1); sigerr_("SPICE(OUTOFROOM)", (ftnlen)16); } else { scardd_(&endp3, wndw3); } chkout_("ZZGFWSTS", (ftnlen)8); return 0; } /* zzgfwsts_ */
/* $Procedure DRDPGR ( Derivative of rectangular w.r.t. planetographic ) */ /* Subroutine */ int drdpgr_(char *body, doublereal *lon, doublereal *lat, doublereal *alt, doublereal *re, doublereal *f, doublereal *jacobi, ftnlen body_len) { /* System generated locals */ integer i__1, i__2; /* Builtin functions */ integer s_cmp(char *, char *, ftnlen, ftnlen), s_rnge(char *, integer, char *, integer); /* Local variables */ integer i__, n; extern /* Subroutine */ int chkin_(char *, ftnlen), ucase_(char *, char *, ftnlen, ftnlen), errch_(char *, char *, ftnlen, ftnlen); logical found; extern /* Subroutine */ int errdp_(char *, doublereal *, ftnlen); integer sense; extern /* Subroutine */ int repmi_(char *, char *, integer *, char *, ftnlen, ftnlen, ftnlen), bods2c_(char *, integer *, logical *, ftnlen), drdgeo_(doublereal *, doublereal *, doublereal *, doublereal *, doublereal *, doublereal *); integer bodyid; doublereal geolon; extern /* Subroutine */ int gcpool_(char *, integer *, integer *, integer *, char *, logical *, ftnlen, ftnlen); char kvalue[80]; extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen); char pmkvar[32], pgrlon[4]; extern /* Subroutine */ int setmsg_(char *, ftnlen), cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen); extern integer plnsns_(integer *); extern logical return_(void); char tmpstr[32]; /* $ Abstract */ /* This routine computes the Jacobian matrix of the transformation */ /* from planetographic to rectangular coordinates. */ /* $ 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 */ /* COORDINATES */ /* DERIVATIVES */ /* MATRIX */ /* $ Declarations */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* BODY I Name of body with which coordinates are associated. */ /* LON I Planetographic longitude of a point (radians). */ /* LAT I Planetographic latitude of a point (radians). */ /* ALT I Altitude of a point above reference spheroid. */ /* RE I Equatorial radius of the reference spheroid. */ /* F I Flattening coefficient. */ /* JACOBI O Matrix of partial derivatives. */ /* $ Detailed_Input */ /* BODY Name of the body with which the planetographic */ /* coordinate system is associated. */ /* BODY is used by this routine to look up from the */ /* kernel pool the prime meridian rate coefficient giving */ /* the body's spin sense. See the Files and Particulars */ /* header sections below for details. */ /* LON Planetographic longitude of the input point. This is */ /* the angle between the prime meridian and the meridian */ /* containing the input point. For bodies having */ /* prograde (aka direct) rotation, the direction of */ /* increasing longitude is positive west: from the +X */ /* axis of the rectangular coordinate system toward the */ /* -Y axis. For bodies having retrograde rotation, the */ /* direction of increasing longitude is positive east: */ /* from the +X axis toward the +Y axis. */ /* The earth, moon, and sun are exceptions: */ /* planetographic longitude is measured positive east for */ /* these bodies. */ /* The default interpretation of longitude by this */ /* and the other planetographic coordinate conversion */ /* routines can be overridden; see the discussion in */ /* Particulars below for details. */ /* Longitude is measured in radians. On input, the range */ /* of longitude is unrestricted. */ /* LAT Planetographic latitude of the input point. For a */ /* point P on the reference spheroid, this is the angle */ /* between the XY plane and the outward normal vector at */ /* P. For a point P not on the reference spheroid, the */ /* planetographic latitude is that of the closest point */ /* to P on the spheroid. */ /* Latitude is measured in radians. On input, the */ /* range of latitude is unrestricted. */ /* ALT Altitude of point above the reference spheroid. */ /* Units of ALT must match those of RE. */ /* RE Equatorial radius of a reference spheroid. This */ /* spheroid is a volume of revolution: its horizontal */ /* cross sections are circular. The shape of the */ /* spheroid is defined by an equatorial radius RE and */ /* a polar radius RP. Units of RE must match those of */ /* ALT. */ /* F Flattening coefficient = */ /* (RE-RP) / RE */ /* where RP is the polar radius of the spheroid, and the */ /* units of RP match those of RE. */ /* $ Detailed_Output */ /* JACOBI is the matrix of partial derivatives of the conversion */ /* from planetographic to rectangular coordinates. It */ /* has the form */ /* .- -. */ /* | DX/DLON DX/DLAT DX/DALT | */ /* | DY/DLON DY/DLAT DY/DALT | */ /* | DZ/DLON DZ/DLAT DZ/DALT | */ /* `- -' */ /* evaluated at the input values of LON, LAT and ALT. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If the body name BODY cannot be mapped to a NAIF ID code, */ /* and if BODY is not a string representation of an integer, */ /* the error SPICE(IDCODENOTFOUND) will be signaled. */ /* 2) If the kernel variable */ /* BODY<ID code>_PGR_POSITIVE_LON */ /* is present in the kernel pool but has a value other */ /* than one of */ /* 'EAST' */ /* 'WEST' */ /* the error SPICE(INVALIDOPTION) will be signaled. Case */ /* and blanks are ignored when these values are interpreted. */ /* 3) If polynomial coefficients for the prime meridian of BODY */ /* are not available in the kernel pool, and if the kernel */ /* variable BODY<ID code>_PGR_POSITIVE_LON is not present in */ /* the kernel pool, the error SPICE(MISSINGDATA) will be signaled. */ /* 4) If the equatorial radius is non-positive, the error */ /* SPICE(VALUEOUTOFRANGE) is signaled. */ /* 5) If the flattening coefficient is greater than or equal to one, */ /* the error SPICE(VALUEOUTOFRANGE) is signaled. */ /* $ Files */ /* This routine expects a kernel variable giving BODY's prime */ /* meridian angle as a function of time to be available in the */ /* kernel pool. Normally this item is provided by loading a PCK */ /* file. The required kernel variable is named */ /* BODY<body ID>_PM */ /* where <body ID> represents a string containing the NAIF integer */ /* ID code for BODY. For example, if BODY is 'JUPITER', then */ /* the name of the kernel variable containing the prime meridian */ /* angle coefficients is */ /* BODY599_PM */ /* See the PCK Required Reading for details concerning the prime */ /* meridian kernel variable. */ /* The optional kernel variable */ /* BODY<body ID>_PGR_POSITIVE_LON */ /* also is normally defined via loading a text kernel. When this */ /* variable is present in the kernel pool, the prime meridian */ /* coefficients for BODY are not required by this routine. See the */ /* Particulars section below for details. */ /* $ Particulars */ /* It is often convenient to describe the motion of an object in the */ /* planetographic coordinate system. However, when performing */ /* vector computations it's hard to beat rectangular coordinates. */ /* To transform states given with respect to planetographic */ /* coordinates to states with respect to rectangular coordinates, */ /* one makes use of the Jacobian of the transformation between the */ /* two systems. */ /* Given a state in planetographic coordinates */ /* ( lon, lat, alt, dlon, dlat, dalt ) */ /* the velocity in rectangular coordinates is given by the matrix */ /* equation: */ /* t | t */ /* (dx, dy, dz) = JACOBI| * (dlon, dlat, dalt) */ /* |(lon,lat,alt) */ /* This routine computes the matrix */ /* | */ /* JACOBI| */ /* |(lon,lat,alt) */ /* In the planetographic coordinate system, longitude is defined */ /* using the spin sense of the body. Longitude is positive to the */ /* west if the spin is prograde and positive to the east if the spin */ /* is retrograde. The spin sense is given by the sign of the first */ /* degree term of the time-dependent polynomial for the body's prime */ /* meridian Euler angle "W": the spin is retrograde if this term is */ /* negative and prograde otherwise. For the sun, planets, most */ /* natural satellites, and selected asteroids, the polynomial */ /* expression for W may be found in a SPICE PCK kernel. */ /* The earth, moon, and sun are exceptions: planetographic longitude */ /* is measured positive east for these bodies. */ /* If you wish to override the default sense of positive longitude */ /* for a particular body, you can do so by defining the kernel */ /* variable */ /* BODY<body ID>_PGR_POSITIVE_LON */ /* where <body ID> represents the NAIF ID code of the body. This */ /* variable may be assigned either of the values */ /* 'WEST' */ /* 'EAST' */ /* For example, you can have this routine treat the longitude */ /* of the earth as increasing to the west using the kernel */ /* variable assignment */ /* BODY399_PGR_POSITIVE_LON = 'WEST' */ /* Normally such assignments are made by placing them in a text */ /* kernel and loading that kernel via FURNSH. */ /* The definition of this kernel variable controls the behavior of */ /* the SPICELIB planetographic routines */ /* PGRREC */ /* RECPGR */ /* DPGRDR */ /* DRDPGR */ /* It does not affect the other SPICELIB coordinate conversion */ /* routines. */ /* $ Examples */ /* Numerical results shown for this example may differ between */ /* platforms as the results depend on the SPICE kernels used as */ /* input and the machine specific arithmetic implementation. */ /* Find the planetographic state of the earth as seen from */ /* Mars in the J2000 reference frame at January 1, 2005 TDB. */ /* Map this state back to rectangular coordinates as a check. */ /* PROGRAM EX1 */ /* IMPLICIT NONE */ /* C */ /* C SPICELIB functions */ /* C */ /* DOUBLE PRECISION RPD */ /* C */ /* C Local variables */ /* C */ /* DOUBLE PRECISION ALT */ /* DOUBLE PRECISION DRECTN ( 3 ) */ /* DOUBLE PRECISION ET */ /* DOUBLE PRECISION F */ /* DOUBLE PRECISION JACOBI ( 3, 3 ) */ /* DOUBLE PRECISION LAT */ /* DOUBLE PRECISION LON */ /* DOUBLE PRECISION LT */ /* DOUBLE PRECISION PGRVEL ( 3 ) */ /* DOUBLE PRECISION RADII ( 3 ) */ /* DOUBLE PRECISION RE */ /* DOUBLE PRECISION RECTAN ( 3 ) */ /* DOUBLE PRECISION RP */ /* DOUBLE PRECISION STATE ( 6 ) */ /* INTEGER N */ /* C */ /* C Load a PCK file containing a triaxial */ /* C ellipsoidal shape model and orientation */ /* C data for Mars. */ /* C */ /* CALL FURNSH ( 'pck00008.tpc' ) */ /* C */ /* C Load an SPK file giving ephemerides of earth and Mars. */ /* C */ /* CALL FURNSH ( 'de405.bsp' ) */ /* C */ /* C Load a leapseconds kernel to support time conversion. */ /* C */ /* CALL FURNSH ( 'naif0007.tls' ) */ /* C */ /* C Look up the radii for Mars. Although we */ /* C omit it here, we could first call BADKPV */ /* C to make sure the variable BODY499_RADII */ /* C has three elements and numeric data type. */ /* C If the variable is not present in the kernel */ /* C pool, BODVRD will signal an error. */ /* C */ /* CALL BODVRD ( 'MARS', 'RADII', 3, N, RADII ) */ /* C */ /* C Compute flattening coefficient. */ /* C */ /* RE = RADII(1) */ /* RP = RADII(3) */ /* F = ( RE - RP ) / RE */ /* C */ /* C Look up the geometric state of earth as seen from Mars at */ /* C January 1, 2005 TDB, relative to the J2000 reference */ /* C frame. */ /* C */ /* CALL STR2ET ( 'January 1, 2005 TDB', ET ) */ /* CALL SPKEZR ( 'Earth', ET, 'J2000', 'LT+S', */ /* . 'Mars', STATE, LT ) */ /* C */ /* C Convert position to planetographic coordinates. */ /* C */ /* CALL RECPGR ( 'MARS', STATE, RE, F, LON, LAT, ALT ) */ /* C */ /* C Convert velocity to planetographic coordinates. */ /* C */ /* CALL DPGRDR ( 'MARS', STATE(1), STATE(2), STATE(3), */ /* . RE, F, JACOBI ) */ /* CALL MXV ( JACOBI, STATE(4), PGRVEL ) */ /* C */ /* C As a check, convert the planetographic state back to */ /* C rectangular coordinates. */ /* C */ /* CALL PGRREC ( 'MARS', LON, LAT, ALT, RE, F, RECTAN ) */ /* CALL DRDPGR ( 'MARS', LON, LAT, ALT, RE, F, JACOBI ) */ /* CALL MXV ( JACOBI, PGRVEL, DRECTN ) */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Rectangular coordinates:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' X (km) = ', STATE(1) */ /* WRITE(*,*) ' Y (km) = ', STATE(2) */ /* WRITE(*,*) ' Z (km) = ', STATE(3) */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Rectangular velocity:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' dX/dt (km/s) = ', STATE(4) */ /* WRITE(*,*) ' dY/dt (km/s) = ', STATE(5) */ /* WRITE(*,*) ' dZ/dt (km/s) = ', STATE(6) */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Ellipsoid shape parameters: ' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' Equatorial radius (km) = ', RE */ /* WRITE(*,*) ' Polar radius (km) = ', RP */ /* WRITE(*,*) ' Flattening coefficient = ', F */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Planetographic coordinates:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' Longitude (deg) = ', LON / RPD() */ /* WRITE(*,*) ' Latitude (deg) = ', LAT / RPD() */ /* WRITE(*,*) ' Altitude (km) = ', ALT */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Planetographic velocity:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' d Longitude/dt (deg/s) = ', PGRVEL(1)/RPD() */ /* WRITE(*,*) ' d Latitude/dt (deg/s) = ', PGRVEL(2)/RPD() */ /* WRITE(*,*) ' d Altitude/dt (km/s) = ', PGRVEL(3) */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Rectangular coordinates from inverse ' // */ /* . 'mapping:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' X (km) = ', RECTAN(1) */ /* WRITE(*,*) ' Y (km) = ', RECTAN(2) */ /* WRITE(*,*) ' Z (km) = ', RECTAN(3) */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) 'Rectangular velocity from inverse mapping:' */ /* WRITE(*,*) ' ' */ /* WRITE(*,*) ' dX/dt (km/s) = ', DRECTN(1) */ /* WRITE(*,*) ' dY/dt (km/s) = ', DRECTN(2) */ /* WRITE(*,*) ' dZ/dt (km/s) = ', DRECTN(3) */ /* WRITE(*,*) ' ' */ /* END */ /* Output from this program should be similar to the following */ /* (rounding and formatting differ across platforms): */ /* Rectangular coordinates: */ /* X (km) = 146039732. */ /* Y (km) = 278546607. */ /* Z (km) = 119750315. */ /* Rectangular velocity: */ /* dX/dt (km/s) = -47.0428824 */ /* dY/dt (km/s) = 9.07021778 */ /* dZ/dt (km/s) = 4.75656274 */ /* Ellipsoid shape parameters: */ /* Equatorial radius (km) = 3396.19 */ /* Polar radius (km) = 3376.2 */ /* Flattening coefficient = 0.00588600756 */ /* Planetographic coordinates: */ /* Longitude (deg) = 297.667659 */ /* Latitude (deg) = 20.844504 */ /* Altitude (km) = 336531825. */ /* Planetographic velocity: */ /* d Longitude/dt (deg/s) = -8.35738632E-06 */ /* d Latitude/dt (deg/s) = 1.59349355E-06 */ /* d Altitude/dt (km/s) = -11.2144327 */ /* Rectangular coordinates from inverse mapping: */ /* X (km) = 146039732. */ /* Y (km) = 278546607. */ /* Z (km) = 119750315. */ /* Rectangular velocity from inverse mapping: */ /* dX/dt (km/s) = -47.0428824 */ /* dY/dt (km/s) = 9.07021778 */ /* dZ/dt (km/s) = 4.75656274 */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.0, 26-DEC-2004 (NJB) (WLT) */ /* -& */ /* $ Index_Entries */ /* Jacobian of rectangular w.r.t. planetographic coordinates */ /* -& */ /* $ Revisions */ /* None. */ /* -& */ /* SPICELIB functions */ /* Local parameters */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } chkin_("DRDPGR", (ftnlen)6); /* Convert the body name to an ID code. */ bods2c_(body, &bodyid, &found, body_len); if (! found) { setmsg_("The value of the input argument BODY is #, this is not a re" "cognized name of an ephemeris object. The cause of this prob" "lem may be that you need an updated version of the SPICE Too" "lkit. ", (ftnlen)185); errch_("#", body, (ftnlen)1, body_len); sigerr_("SPICE(IDCODENOTFOUND)", (ftnlen)21); chkout_("DRDPGR", (ftnlen)6); return 0; } /* The equatorial radius must be positive. If not, signal an error */ /* and check out. */ if (*re <= 0.) { setmsg_("Equatorial radius was #.", (ftnlen)24); errdp_("#", re, (ftnlen)1); sigerr_("SPICE(VALUEOUTOFRANGE)", (ftnlen)22); chkout_("DRDPGR", (ftnlen)6); return 0; } /* If the flattening coefficient is greater than 1, the polar radius */ /* is negative. If F is equal to 1, the polar radius is zero. Either */ /* case is a problem, so signal an error and check out. */ if (*f >= 1.) { setmsg_("Flattening coefficient was #.", (ftnlen)29); errdp_("#", f, (ftnlen)1); sigerr_("SPICE(VALUEOUTOFRANGE)", (ftnlen)22); chkout_("DRDPGR", (ftnlen)6); return 0; } /* Look up the longitude sense override variable from the */ /* kernel pool. */ repmi_("BODY#_PGR_POSITIVE_LON", "#", &bodyid, pmkvar, (ftnlen)22, ( ftnlen)1, (ftnlen)32); gcpool_(pmkvar, &c__1, &c__1, &n, kvalue, &found, (ftnlen)32, (ftnlen)80); if (found) { /* Make sure we recognize the value of PGRLON. */ cmprss_(" ", &c__0, kvalue, tmpstr, (ftnlen)1, (ftnlen)80, (ftnlen)32) ; ucase_(tmpstr, pgrlon, (ftnlen)32, (ftnlen)4); if (s_cmp(pgrlon, "EAST", (ftnlen)4, (ftnlen)4) == 0) { sense = 1; } else if (s_cmp(pgrlon, "WEST", (ftnlen)4, (ftnlen)4) == 0) { sense = -1; } else { setmsg_("Kernel variable # may have the values EAST or WEST. Ac" "tual value was #.", (ftnlen)72); errch_("#", pmkvar, (ftnlen)1, (ftnlen)32); errch_("#", kvalue, (ftnlen)1, (ftnlen)80); sigerr_("SPICE(INVALIDOPTION)", (ftnlen)20); chkout_("DRDPGR", (ftnlen)6); return 0; } } else { /* Look up the spin sense of the body's prime meridian. */ sense = plnsns_(&bodyid); /* If the required prime meridian rate was not available, */ /* PLNSNS returns the code 0. Here we consider this situation */ /* to be an error. */ if (sense == 0) { repmi_("BODY#_PM", "#", &bodyid, pmkvar, (ftnlen)8, (ftnlen)1, ( ftnlen)32); setmsg_("Prime meridian rate coefficient defined by kernel varia" "ble # is required but not available for body #. ", ( ftnlen)103); errch_("#", pmkvar, (ftnlen)1, (ftnlen)32); errch_("#", body, (ftnlen)1, body_len); sigerr_("SPICE(MISSINGDATA)", (ftnlen)18); chkout_("DRDPGR", (ftnlen)6); return 0; } /* Handle the special cases: earth, moon, and sun. */ if (bodyid == 399 || bodyid == 301 || bodyid == 10) { sense = 1; } } /* At this point, SENSE is set to +/- 1. */ /* Adjust the longitude according to the sense of the body's */ /* spin, or according to the override value if one is provided. */ /* We want positive east longitude. */ geolon = sense * *lon; /* Now that we have geodetic longitude in hand, use the */ /* geodetic equivalent of the input coordinates to find the */ /* Jacobian matrix of rectangular coordinates with respect */ /* to geodetic coordinates. */ drdgeo_(&geolon, lat, alt, re, f, jacobi); /* The matrix JACOBI is */ /* .- -. */ /* | DX/DGEOLON DX/DLAT DX/DALT | */ /* | DY/DGEOLON DY/DLAT DY/DALT | */ /* | DZ/DGEOLON DZ/DLAT DZ/DALT | */ /* `- -' */ /* which, applying the chain rule to D(*)/DGEOLON, is equivalent to */ /* .- -. */ /* | (1/SENSE) * DX/DLON DX/DLAT DX/DALT | */ /* | (1/SENSE) * DY/DLON DY/DLAT DY/DALT | */ /* | (1/SENSE) * DZ/DLON DZ/DLAT DZ/DALT | */ /* `- -' */ /* So, multiplying the first column of JACOBI by SENSE gives us the */ /* matrix we actually want to compute: the Jacobian matrix of */ /* rectangular coordinates with respect to planetographic */ /* coordinates. */ for (i__ = 1; i__ <= 3; ++i__) { jacobi[(i__1 = i__ - 1) < 9 && 0 <= i__1 ? i__1 : s_rnge("jacobi", i__1, "drdpgr_", (ftnlen)736)] = sense * jacobi[(i__2 = i__ - 1) < 9 && 0 <= i__2 ? i__2 : s_rnge("jacobi", i__2, "drdpgr_", (ftnlen)736)]; } chkout_("DRDPGR", (ftnlen)6); return 0; } /* drdpgr_ */
/* $Procedure ZZBODBLT ( Private --- Retrieve Built-In Body-Code Maps ) */ /* Subroutine */ int zzbodblt_0_(int n__, integer *room, char *names, char * nornam, integer *codes, integer *nvals, char *device, char *reqst, ftnlen names_len, ftnlen nornam_len, ftnlen device_len, ftnlen reqst_len) { /* Initialized data */ static logical first = TRUE_; /* System generated locals */ address a__1[2], a__2[3]; integer i__1, i__2, i__3[2], i__4[3]; /* Builtin functions */ integer s_rnge(char *, integer, char *, integer); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ integer i__; extern /* Subroutine */ int chkin_(char *, ftnlen), ucase_(char *, char *, ftnlen, ftnlen), movec_(char *, integer *, char *, ftnlen, ftnlen), movei_(integer *, integer *, integer *); extern logical eqstr_(char *, char *, ftnlen, ftnlen); extern /* Subroutine */ int ljust_(char *, char *, ftnlen, ftnlen); char zzint[36]; static integer bltcod[563]; static char bltnam[36*563]; extern /* Subroutine */ int orderc_(char *, integer *, integer *, ftnlen); extern integer lastnb_(char *, ftnlen); extern /* Subroutine */ int orderi_(integer *, integer *, integer *), sigerr_(char *, ftnlen), chkout_(char *, ftnlen); static char bltnor[36*563]; extern /* Subroutine */ int wrline_(char *, char *, ftnlen, ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), cmprss_(char *, integer *, char *, char *, ftnlen, ftnlen, ftnlen) ; integer zzocod[563]; char zzline[75]; integer zzonam[563]; extern logical return_(void); extern /* Subroutine */ int intstr_(integer *, char *, ftnlen); char zzrqst[4]; extern /* Subroutine */ int zzidmap_(integer *, char *, ftnlen); /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* This is the umbrella routine that contains entry points to */ /* access the built-in body name-code mappings. */ /* $ 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 */ /* BODY */ /* $ Declarations */ /* $ Abstract */ /* This include file lists the parameter collection */ /* defining the number of SPICE ID -> NAME mappings. */ /* $ 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 */ /* naif_ids.req */ /* $ Keywords */ /* Body mappings. */ /* $ Author_and_Institution */ /* E.D. Wright (JPL) */ /* $ Version */ /* SPICELIB 1.0.0 Thu May 20 07:57:58 2010 (EDW) */ /* A script generates this file. Do not edit by hand. */ /* Edit the creation script to modify the contents of */ /* ZZBODTRN.INC. */ /* Maximum size of a NAME string */ /* Count of default SPICE mapping assignments. */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* ROOM I ZZBODGET */ /* NAMES O ZZBODGET */ /* NORNAM O ZZBODGET */ /* CODES O ZZBODGET */ /* NVALS O ZZBODGET */ /* DEVICE I ZZBODLST */ /* REQST I ZZBODLST */ /* $ Detailed_Input */ /* See the entry points for a discussion of their arguments. */ /* $ Detailed_Output */ /* See the entry points for a discussion of their arguments. */ /* $ Parameters */ /* See the include file 'zzbodtrn.inc' for the list of parameters */ /* this routine utilizes. */ /* $ Exceptions */ /* 1) The error SPICE(BOGUSENTRY) is signaled if ZZBODBLT is */ /* called directly. */ /* $ Files */ /* None. */ /* $ Particulars */ /* ZZBODBLT should never be called directly, instead access */ /* the entry points: */ /* ZZBODGET Fetch the built-in body name/code list. */ /* ZZBODLST Output the name-ID mapping list. */ /* $ Examples */ /* See ZZBODTRN and its entry points for details. */ /* $ Restrictions */ /* 1) No duplicate entries should appear in the built-in */ /* BLTNAM list. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* F.S. Turner (JPL) */ /* B.V. Semenov (JPL) */ /* $ Version */ /* - SPICELIB Version 2.3.1, 27-FEB-2007 (EDW) */ /* Completed the ZZBODLST decalrations section. */ /* - SPICELIB Version 2.3.0, 17-MAR-2003 (EDW) */ /* Added a call to ZZIDMAP to retrieve the default */ /* mapping list. "zzbodtrn.inc" no longer */ /* contains the default mapping list. */ /* - SPICELIB Version 2.2.0 21-FEB-2003 (BVS) */ /* Changed MER-A and MER-B to MER-1 and MER-2. */ /* - SPICELIB Version 2.1.0 04-DEC-2002 (EDW) */ /* Added new assignments to the default collection: */ /* -226 ROSETTA */ /* 517 CALLIRRHOE */ /* 518 THEMISTO */ /* 519 MAGACLITE */ /* 520 TAYGETE */ /* 521 CHALDENE */ /* 522 HARPALYKE */ /* 523 KALYKE */ /* 524 IOCASTE */ /* 525 ERINOME */ /* 526 ISONOE */ /* 527 PRAXIDIKE */ /* - SPICELIB Version 2.0.0, 23-AUG-2002 (FST) */ /* Initial release. This begins at Version 2.0.0 because */ /* the entry point ZZBODLST was cut out of ZZBODTRN and */ /* placed here at Version 1.0.0. */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 2.0.0, 23-AUG-2002 (FST) */ /* The entries following this one were copied from */ /* the version section of ZZBODTRN. SPICELIB has */ /* been changed to ZZBODTRN for convenience in noting */ /* version information relevant for that module. */ /* This was done to carry the history of body name-code */ /* additions with this new umbrella. */ /* Added to the collection: */ /* -236 MESSENGER */ /* - ZZBODTRN Version 3.2.0, 14-AUG-2002 (EDW) */ /* Added the ZZBODKIK entry point. */ /* Moved the NAIF_BODY_NAME/CODE to subroutine */ /* ZZBODKER. No change in logic. */ /* Added logic to enforce the precedence masking; */ /* logic removes duplicate assignments of ZZBODDEF. */ /* Removed the NAMENOTUNIQUE error block. */ /* - ZZBODTRN Version 3.1.5, 27-NOV-2001 (EDW) */ /* Added to the collection: */ /* -200 CONTOUR */ /* -146 LUNAR-A */ /* -135 DRTS-W */ /* Added the subroutine ZZBODLST as an entry point. */ /* The routine outputs the current name-ID mapping */ /* list to some output device. */ /* - ZZBODTRN Version 3.1.0, 17-OCT-2001 (EDW) */ /* To improve clarity, the BEGXX block initialization now */ /* exists in the include file zzbodtrn.inc. */ /* Removed the comments concerning the 851, 852, ... temporary */ /* codes. */ /* Set the WNAMES assignment to NAIF_BODY_CODE, NAIF_BODY_NAME */ /* as a DATA statement. */ /* Edited headers to match information in naif_ids required */ /* reading. */ /* Edited headers, removed typos and bad grammar, clarified */ /* descriptions. */ /* Added to the collection */ /* -41 MARS EXPRESS, MEX */ /* -44 BEAGLE 2, BEAGLE2 */ /* -70 DEEP IMPACT IMPACTOR SPACECRAFT */ /* -94 MO, MARS OBSERVER */ /* -140 DEEP IMPACT FLYBY SPACECRAFT */ /* -172 SLCOMB, STARLIGHT COMBINER */ /* -205 SLCOLL, STARLIGHT COLLECTOR */ /* -253 MER-A */ /* -254 MER-B */ /* Corrected typo, vehicle -188 should properly be MUSES-C, */ /* previous versions listed the name as MUSES-B. */ /* Removed from collection */ /* -84 MARS SURVEYOR 01 LANDER */ /* -154 EOS-PM1 */ /* -200 PLUTO EXPRESS 1, PEX1 */ /* -202 PLUTO EXPRESS 2, PEX2 */ /* - ZZBODTRN Version 3.0.0, 29-MAR-2000 (WLT) */ /* The ID codes for Cluster 1, 2, 3 and 4 were added. The */ /* ID coded for Pluto Express were removed. The ID codes */ /* for Pluto-Kuiper Express, Pluto-Kuiper Express Simulation */ /* and Contour were added. */ /* - ZZBODTRN Version 2.0.0, 26-JAN-1998 (EDW) */ /* The Galileo probe ID -228 replaces the incorrect ID -344. */ /* DSS stations 5 through 65 added to the collection. */ /* Added to the collection */ /* -107 TROPICAL RAINFALL MEASURING MISSION, TRMM */ /* -154, EOS-PM1 */ /* -142 EOS-AM1 */ /* -151 AXAF */ /* -1 GEOTAIL */ /* -13 POLAR */ /* -21 SOHO */ /* -8 WIND */ /* -25 LUNAR PROSPECTOR, LPM */ /* -116 MARS POLAR LANDER, MPL */ /* -127 MARS CLIMATE ORBITER, MCO */ /* -188 MUSES-C */ /* -97 TOPEX/POSEIDON */ /* -6 PIONEER-6, P6 */ /* -7 PIONEER-7, P7 */ /* -20 PIONEER-8, P8 */ /* -23 PIONEER-10, P10 */ /* -24 PIONEER-11, P11 */ /* -178 NOZOMI, PLANET-B */ /* -79 SPACE INFRARED TELESCOPE FACILITY, SIRTF */ /* -29 STARDUST, SDU */ /* -47 GENESIS */ /* -48 HUBBLE SPACE TELESCOPE, HST */ /* -200 PLUTO EXPRESS 1, PEX1 */ /* -202 PLUTO EXPRESS 2, PEX2 */ /* -164 YOHKOH, SOLAR-A */ /* -165 MAP */ /* -166 IMAGE */ /* -53 MARS SURVEYOR 01 ORBITER */ /* 618 PAN */ /* 716 CALIBAN */ /* 717 SYCORAX */ /* -30 DS-1 (low priority) */ /* -58 HALCA */ /* -150 HUYGEN PROBE, CASP */ /* -55 ULS */ /* Modified ZZBODC2N and ZZBODN2C so the user may load an */ /* external IDs kernel to override or supplement the standard */ /* collection. The kernel must be loaded prior a call to */ /* ZZBODC2N or ZZBODN2C. */ /* - ZZBODTRN Version 1.1.0, 22-MAY-1996 (WLT) */ /* Added the id-code for Comet Hyakutake, Comet Hale-Bopp, */ /* Mars 96, Cassini Simulation, MGS Simulation. */ /* - ZZBODTRN Version 1.0.0, 25-SEP-1995 (BVS) */ /* Renamed umbrella subroutine and entry points to */ /* correspond private routine convention (ZZ...). Added IDs for */ /* tracking stations Goldstone (399001), Canberra (399002), */ /* Madrid (399003), Usuda (399004). */ /* - ZZBODTRN Version 2.2.0, 01-AUG-1995 (HAN) */ /* Added the IDs for Near Earth Asteroid Rendezvous (-93), */ /* Mars Pathfinder (-53), Ulysses (-55), VSOP (-58), */ /* Radioastron (-59), Cassini spacecraft (-82), and Cassini */ /* Huygens probe (-150). */ /* Mars Observer (-94) was replaced with Mars Global */ /* Surveyor (-94). */ /* - ZZBODTRN Version 2.1.0, 15-MAR-1995 (KSZ) (HAN) */ /* Two Shoemaker Levy 9 fragments were added, Q1 and P2 */ /* (IDs 50000022 and 50000023). Two asteroids were added, */ /* Eros and Mathilde (IDs 2000433 and 2000253). The */ /* Saturnian satellite Pan (ID 618) was added. */ /* - ZZBODTRN Version 2.0.0, 03-FEB-1995 (NJB) */ /* The Galileo probe (ID -344) has been added to the permanent */ /* collection. */ /* - ZZBODTRN Version 1.0.0, 29-APR-1994 (MJS) */ /* SPICELIB symbol tables are no longer used. Instead, two order */ /* vectors are used to index the NAMES and CODES arrays. Also, */ /* this version does not support reading body name ID pairs from a */ /* file. */ /* - ZZBODTRN Version 2.0.1, 10-MAR-1992 (WLT) */ /* Comment section for permuted index source lines was added */ /* following the header. */ /* - ZZBODTRN Version 2.0.0, 15-JUL-1991 (WLT) */ /* The body id's for the Uranian satellites discovered by Voyager */ /* were modified to conform to those established by the IAU */ /* nomenclature committee. In addition the id's for Gaspra and */ /* Ida were added. */ /* - ZZBODTRN Version 1.0.0, 7-MAR-1991 (WLT) */ /* Some items previously considered errors were removed */ /* and some minor modifications were made to improve the */ /* robustness of the routines. */ /* - ZZBODTRN Version 1.0.0, 28-JUN-1990 (JEM) */ /* -& */ /* SPICELIB Functions */ /* Local Parameters */ /* Local Variables */ /* Saved Variables */ /* Data Statements */ /* Parameter adjustments */ if (names) { } if (nornam) { } if (codes) { } /* Function Body */ switch(n__) { case 1: goto L_zzbodget; case 2: goto L_zzbodlst; } /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZBODBLT", (ftnlen)8); sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17); chkout_("ZZBODBLT", (ftnlen)8); } return 0; /* $Procedure ZZBODGET ( Private --- Body-Code Get Built-In List ) */ L_zzbodget: /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* Retrieve a copy of the built-in body name-code mapping lists. */ /* $ 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 */ /* PRIVATE */ /* BODY */ /* $ Declarations */ /* INTEGER ROOM */ /* CHARACTER*(*) NAMES ( * ) */ /* CHARACTER*(*) NORNAM ( * ) */ /* INTEGER CODES ( * ) */ /* INTEGER NVALS */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* ROOM I Space available in NAMES, NORNAM, and CODES. */ /* NAMES O Array of built-in body names. */ /* NORNAM O Array of normalized built-in body names. */ /* CODES O Array of built-in ID codes for NAMES/NORNAM. */ /* NVALS O Length of NAMES, NORNAM, CODES, and ORDNOM arrays. */ /* $ Detailed_Input */ /* ROOM is the maximum number of entries that NAMES, NORNAM, */ /* and CODES may receive. */ /* $ Detailed_Output */ /* NAMES the array of built-in names. This array is parallel */ /* to NORNAM and CODES. */ /* NORNAM the array of normalized built-in body names. This */ /* array is computed from the NAMES array by compressing */ /* groups of spaces into a single space, left-justifying */ /* the name, and uppercasing the letters. */ /* CODES the array of built-in codes associated with NAMES */ /* and NORNAM entries. */ /* NVALS the number of items returned in NAMES, NORNAM, */ /* and CODES. */ /* $ Parameters */ /* NPERM the number of permanent, or built-in, body name-code */ /* mappings. */ /* $ Exceptions */ /* 1) SPICE(BUG) is signaled if ROOM is less than NPERM, the */ /* amount of space required to store the entire list of */ /* body names and codes. */ /* $ Files */ /* None. */ /* $ Particulars */ /* This routine simply copies it's local buffered version of the */ /* built-in name-code mappings to the output arguments. */ /* $ Examples */ /* See ZZBODTRN for sample usage. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* F.S. Turner (JPL) */ /* $ Version */ /* - SPICELIB Version 2.1.0, 17-MAR-2003 (EDW) */ /* Added a call to ZZIDMAP to retrieve the default */ /* mapping list. "zzbodtrn.inc" no longer */ /* contains the default mapping list. */ /* - SPICELIB Version 2.0.0, 23-AUG-2002 (FST) */ /* -& */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZBODGET", (ftnlen)8); } /* On the first invocation compute the normalized forms of BLTNAM */ /* and store them in BLTNOR. */ if (first) { /* Retrieve the default mapping list. */ zzidmap_(bltcod, bltnam, (ftnlen)36); for (i__ = 1; i__ <= 563; ++i__) { ljust_(bltnam + ((i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("bltnam", i__1, "zzbodblt_", (ftnlen)565)) * 36, bltnor + ((i__2 = i__ - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltnor", i__2, "zzbodblt_", (ftnlen)565)) * 36, ( ftnlen)36, (ftnlen)36); ucase_(bltnor + ((i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("bltnor", i__1, "zzbodblt_", (ftnlen)566)) * 36, bltnor + ((i__2 = i__ - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltnor", i__2, "zzbodblt_", (ftnlen)566)) * 36, ( ftnlen)36, (ftnlen)36); cmprss_(" ", &c__1, bltnor + ((i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("bltnor", i__1, "zzbodblt_", (ftnlen)567)) * 36, bltnor + ((i__2 = i__ - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltnor", i__2, "zzbodblt_", (ftnlen)567)) * 36, (ftnlen)1, (ftnlen)36, (ftnlen)36); } /* Do not do this again. */ first = FALSE_; } /* Copy the contents of BLTNAM, BLTNOR, and BLTCOD to the output */ /* arguments, but only if there is sufficient room. */ if (*room < 563) { setmsg_("Insufficient room to copy the stored body name-code mapping" "s to the output arguments. Space required is #, but the cal" "ler supplied #.", (ftnlen)134); errint_("#", &c__563, (ftnlen)1); errint_("#", room, (ftnlen)1); sigerr_("SPICE(BUG)", (ftnlen)10); chkout_("ZZBODGET", (ftnlen)8); return 0; } movec_(bltnam, &c__563, names, (ftnlen)36, names_len); movec_(bltnor, &c__563, nornam, (ftnlen)36, nornam_len); movei_(bltcod, &c__563, codes); *nvals = 563; chkout_("ZZBODGET", (ftnlen)8); return 0; /* $Procedure ZZBODLST ( Output permanent collection to some device. ) */ L_zzbodlst: /* $ Abstract */ /* Output the complete list of built-in body/ID mappings to */ /* some output devide. Thw routine generates 2 lists: one */ /* sorted by ID number, one sorted by name. */ /* $ 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 */ /* BODY */ /* $ Declarations */ /* CHARACTER*(*) DEVICE */ /* CHARACTER*(*) REQST */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* DEVICE I Device name to receive the output. */ /* REQST I Data list name to output. */ /* $ Detailed_Input */ /* DEVICE identifies the device to receive the */ /* body/ID mapping list. WRLINE performs the */ /* output function and so DEVICE may have */ /* the values 'SCREEN' (to generate a screen dump), */ /* 'NULL' (do nothing), or a device name (a */ /* file, or any other name valid in a FORTRAN OPEN */ /* statement). */ /* REQST A case insensitive string indicating the data */ /* set to output. REQST may have the value 'ID', */ /* 'NAME', or 'BOTH'. 'ID' outputs the name/ID mapping */ /* ordered by ID number from least to highest value. */ /* 'NAME' outputs the name/ID mapping ordered by ASCII */ /* sort on the name string. 'BOTH' outputs both */ /* ordered lists. */ /* $ Detailed_Output */ /* None. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* None. */ /* $ Files */ /* None. */ /* $ Particulars */ /* The entry point outputs ordered lists of the name/ID mappings */ /* defined in ZZBODTRN. */ /* $ Examples */ /* 1. Write both sorted lists to screen. */ /* PROGRAM X */ /* CALL ZZBODLST( 'SCREEN', 'BOTH' ) */ /* END */ /* 2. Write an ID number sorted list to a file, "body.txt". */ /* PROGRAM X */ /* CALL ZZBODLST( 'body.txt', 'ID' ) */ /* END */ /* With SCREEN output of the form: */ /* Total number of name/ID mappings: 414 */ /* ID to name mappings. */ /* -550 | M96 */ /* -550 | MARS 96 */ /* -550 | MARS-96 */ /* -550 | MARS96 */ /* -254 | MER-2 */ /* -253 | MER-1 */ /* .. .. */ /* 50000020 | SHOEMAKER-LEVY 9-B */ /* 50000021 | SHOEMAKER-LEVY 9-A */ /* 50000022 | SHOEMAKER-LEVY 9-Q1 */ /* 50000023 | SHOEMAKER-LEVY 9-P2 */ /* Name to ID mappings. */ /* 1978P1 | 901 */ /* 1979J1 | 515 */ /* .. .. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* F.S. Turner (JPL) */ /* E.D. Wright (JPL) */ /* $ Version */ /* - SPICELIB Version 2.1.1, 27-FEB-2007 (EDW) */ /* Completed the ZZBODLST declarations section. */ /* - SPICELIB Version 2.1.0, 17-MAR-2003 (EDW) */ /* Added a call to ZZIDMAP to retrieve the default */ /* mapping list. "zzbodtrn.inc" no longer */ /* contains the default mapping list. */ /* - SPICELIB Version 2.0.0, 23-AUG-2002 (FST) */ /* This entry point was moved into ZZBODBLT and some */ /* variable names were changed to refer to variables */ /* in the umbrella. */ /* - SPICELIB Version 1.0.0, 26-NOV-2001 (EDW) */ /* -& */ if (return_()) { return 0; } else { chkin_("ZZBODLST", (ftnlen)8); } /* Upper case the ZZRQST value. */ ucase_(reqst, zzrqst, reqst_len, (ftnlen)4); intstr_(&c__563, zzint, (ftnlen)36); /* Writing concatenation */ i__3[0] = 34, a__1[0] = "Total number of name/ID mappings: "; i__3[1] = 36, a__1[1] = zzint; s_cat(zzline, a__1, i__3, &c__2, (ftnlen)75); wrline_(device, zzline, device_len, lastnb_(zzline, (ftnlen)75)); /* Retrieve the current set of name/ID mappings */ zzidmap_(bltcod, bltnam, (ftnlen)36); /* Branch as defined by the value of ZZRQST. 'ID' or 'BOTH'. */ if (eqstr_(zzrqst, "ID", (ftnlen)4, (ftnlen)2) || eqstr_(zzrqst, "BOTH", ( ftnlen)4, (ftnlen)4)) { orderi_(bltcod, &c__563, zzocod); wrline_(device, " ", device_len, (ftnlen)1); wrline_(device, "ID to name mappings.", device_len, (ftnlen)20); for (i__ = 1; i__ <= 563; ++i__) { intstr_(&bltcod[(i__2 = zzocod[(i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("zzocod", i__1, "zzbodblt_", (ftnlen) 812)] - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltcod", i__2, "zzbodblt_", (ftnlen)812)], zzint, (ftnlen)36); /* Writing concatenation */ i__4[0] = 36, a__2[0] = zzint; i__4[1] = 3, a__2[1] = " | "; i__4[2] = 36, a__2[2] = bltnam + ((i__2 = zzocod[(i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("zzocod", i__1, "zzbo" "dblt_", (ftnlen)814)] - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltnam", i__2, "zzbodblt_", (ftnlen)814)) * 36; s_cat(zzline, a__2, i__4, &c__3, (ftnlen)75); wrline_(device, zzline, device_len, lastnb_(zzline, (ftnlen)75)); } } /* ... 'NAME' or 'BOTH'. */ if (eqstr_(zzrqst, "NAME", (ftnlen)4, (ftnlen)4) || eqstr_(zzrqst, "BOTH", (ftnlen)4, (ftnlen)4)) { orderc_(bltnam, &c__563, zzonam, (ftnlen)36); wrline_(device, " ", device_len, (ftnlen)1); wrline_(device, "Name to ID mappings.", device_len, (ftnlen)20); for (i__ = 1; i__ <= 563; ++i__) { intstr_(&bltcod[(i__2 = zzonam[(i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("zzonam", i__1, "zzbodblt_", (ftnlen) 834)] - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltcod", i__2, "zzbodblt_", (ftnlen)834)], zzint, (ftnlen)36); /* Writing concatenation */ i__4[0] = 36, a__2[0] = bltnam + ((i__2 = zzonam[(i__1 = i__ - 1) < 563 && 0 <= i__1 ? i__1 : s_rnge("zzonam", i__1, "zzbo" "dblt_", (ftnlen)836)] - 1) < 563 && 0 <= i__2 ? i__2 : s_rnge("bltnam", i__2, "zzbodblt_", (ftnlen)836)) * 36; i__4[1] = 3, a__2[1] = " | "; i__4[2] = 36, a__2[2] = zzint; s_cat(zzline, a__2, i__4, &c__3, (ftnlen)75); wrline_(device, zzline, device_len, lastnb_(zzline, (ftnlen)75)); } } chkout_("ZZBODLST", (ftnlen)8); return 0; } /* zzbodblt_ */