示例#1
0
/* $Procedure VERSION ( Print library version information ) */
/* Main program */ MAIN__(void)
{
    /* System generated locals */
    address a__1[2], a__2[4];
    integer i__1[2], i__2, i__3[4], i__4;
    doublereal d__1;
    char ch__1[25], ch__2[99];

    /* Builtin functions */
    /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen),
	     s_copy(char *, char *, ftnlen, ftnlen);
    integer s_rnge(char *, integer, char *, integer);
    /* Subroutine */ int s_stop(char *, ftnlen);

    /* Local variables */
    char line[80], vrsn[6];
    extern /* Subroutine */ int zzplatfm_(char *, char *, ftnlen, ftnlen);
    integer i__;
    extern /* Subroutine */ int ucase_(char *, char *, ftnlen, ftnlen);
    extern doublereal dpmin_(void);
    extern /* Subroutine */ int repmd_(char *, char *, doublereal *, integer *
	    , char *, ftnlen, ftnlen, ftnlen);
    extern doublereal dpmax_(void);
    char fform[80];
    extern /* Subroutine */ int repmi_(char *, char *, integer *, char *, 
	    ftnlen, ftnlen, ftnlen);
    char cmplr[80];
    extern integer wdcnt_(char *, ftnlen);
    char tform[80];
    extern integer rtrim_(char *, ftnlen);
    char os[80];
    extern /* Subroutine */ int getcml_(char *, ftnlen), byebye_(char *, 
	    ftnlen);
    extern integer intmin_(void), intmax_(void);
    char linout[80*6];
    extern /* Subroutine */ int tostdo_(char *, ftnlen), tkvrsn_(char *, char 
	    *, ftnlen, ftnlen);
    extern integer pos_(char *, char *, integer *, ftnlen, ftnlen);
    char sys[80];

/* $ Abstract */

/*     This program prints to standard output the current SPICE */
/*     distribution version number, hardware system ID, operating */
/*     system ID, compiler name, the format of double precision */
/*     numbers for the hardware architecture, and the max and min */
/*     values for double precision and integer numbers. */

/* $ 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. */

/* $ Keyword */

/*     VERSION */
/*     UTILITY */

/* $ Parameters */

/*     LINELN            length of line output string, set to 80. */

/*     DATEID            update version time string, set to 20. */

/* $ Exceptions */

/*     None. */

/* $ Files */

/*     None. */

/* $ Particulars */

/*     The version utility may use 3 different command line arguments. */
/*     The default (no arguments) returns the Toolkit version string. */

/*     Usage: $ version [OPTION] */

/* $ Description */

/*     None. */

/* $ Examples */


/*     Default behavior: */

/*     $ version */
/*     N0051 */

/*     Display all (-a) information: */

/*     $version -a */

/*     Toolkit version  : N0051 */
/*     System           : PC */
/*     Operating System : LINUX */
/*     Compiler         : LINUX G77 */
/*     File Format      : LTL-IEEE */
/*     MAX DP           :  1.7976931348623E+308 */
/*     MIN DP           : -1.7976931348623E+308 */
/*     MAX INT          :  2147483647 */
/*     MIN INT          : -2147483647 */

/*     Display version (-v) information: */

/*     $version -v */

/*     Version Utility for SPICE Toolkit edition N0051, */
/*     last update: 1.1.0, 05-OCT-2001 */

/*     Display help (-h) information: */

/*     $version -h */

/*     Usage: version [OPTION] */
/*     no arguments   output only the SPICE toolkit version string. */
/*     -a(ll)         output all environment variables; SPICE toolkit */
/*                    version, system ID, operating system, compiler, */
/*                    binary file format, max and min values for */
/*                    double precision and integer numbers. */
/*     -v(ersion)     output the version of the utility. */

/* $ Restrictions */

/*     None. */

/* $ Literature_References */

/*     None. */

/* $ Author_and_Institution */

/*     W.L. Taber      (JPL) */
/*     F.S. Turner     (JPL) */
/*     E.D. Wright     (JPL) */

/* $ Version */

/*     SPICELIB Version 1.1.0 26-SEP-2001 (FST) (EDW) */

/*        Added TEXT_FORMAT output. */

/*        Included options for SYSTEM, O/S, COMPILER, FILE_FORMAT, */
/*        max/min DPs & integers, outputs, version, and help. */

/*        Added proper SPICE header. */

/*     SPICELIB Version 1.0.0 13-NOV-2001 (WLT) */

/*        First version, Thu NOV 13 10:04:41 PST 1997 W.L. Taber */

/* -& */

/*     SPICELIB functions. */


/*     Local Parameters. */


/*     Local Variables. */


/*     Get command line. */

    getcml_(line, (ftnlen)80);
    ucase_(line, line, (ftnlen)80, (ftnlen)80);
    tkvrsn_("TOOLKIT", vrsn, (ftnlen)7, (ftnlen)6);

/*     Parse the command line for arguments. Appropriately respond. */

    if (wdcnt_(line, (ftnlen)80) == 0) {

/*        No arguments, default to the toolkit version string. */

	tostdo_(vrsn, rtrim_(vrsn, (ftnlen)6));
    } else if (pos_(line, "-A", &c__1, (ftnlen)80, (ftnlen)2) == 1) {

/*        All. Output everything. */

	tostdo_(" ", (ftnlen)1);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "Toolkit version  : ";
	i__1[1] = 6, a__1[1] = vrsn;
	s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)25);
	tostdo_(ch__1, (ftnlen)25);
	zzplatfm_("SYSTEM", sys, (ftnlen)6, (ftnlen)80);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "System           : ";
	i__1[1] = 80, a__1[1] = sys;
	s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99);
	tostdo_(ch__2, (ftnlen)99);
	zzplatfm_("O/S", os, (ftnlen)3, (ftnlen)80);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "Operating System : ";
	i__1[1] = 80, a__1[1] = os;
	s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99);
	tostdo_(ch__2, (ftnlen)99);
	zzplatfm_("COMPILER", cmplr, (ftnlen)8, (ftnlen)80);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "Compiler         : ";
	i__1[1] = 80, a__1[1] = cmplr;
	s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99);
	tostdo_(ch__2, (ftnlen)99);
	zzplatfm_("FILE_FORMAT", fform, (ftnlen)11, (ftnlen)80);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "File Format      : ";
	i__1[1] = 80, a__1[1] = fform;
	s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99);
	tostdo_(ch__2, (ftnlen)99);
	zzplatfm_("TEXT_FORMAT", tform, (ftnlen)11, (ftnlen)80);
/* Writing concatenation */
	i__1[0] = 19, a__1[0] = "Text File Format : ";
	i__1[1] = 80, a__1[1] = tform;
	s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99);
	tostdo_(ch__2, (ftnlen)99);
	s_copy(linout, "MAX DP           :  #", (ftnlen)80, (ftnlen)21);
	d__1 = dpmax_();
	repmd_(linout, "#", &d__1, &c__23, linout, (ftnlen)80, (ftnlen)1, (
		ftnlen)80);
	tostdo_(linout, (ftnlen)80);
	s_copy(linout + 80, "MIN DP           : #", (ftnlen)80, (ftnlen)20);
	d__1 = dpmin_();
	repmd_(linout + 80, "#", &d__1, &c__23, linout + 80, (ftnlen)80, (
		ftnlen)1, (ftnlen)80);
	tostdo_(linout + 80, (ftnlen)80);
	s_copy(linout + 160, "MAX INT          :  #", (ftnlen)80, (ftnlen)21);
	i__2 = intmax_();
	repmi_(linout + 160, "#", &i__2, linout + 160, (ftnlen)80, (ftnlen)1, 
		(ftnlen)80);
	tostdo_(linout + 160, (ftnlen)80);
	s_copy(linout + 240, "MIN INT          : #", (ftnlen)80, (ftnlen)20);
	i__2 = intmin_();
	repmi_(linout + 240, "#", &i__2, linout + 240, (ftnlen)80, (ftnlen)1, 
		(ftnlen)80);
	tostdo_(linout + 240, (ftnlen)80);
	tostdo_(" ", (ftnlen)1);
    } else if (pos_(line, "-V", &c__1, (ftnlen)80, (ftnlen)2) == 1) {

/*        Version. Output the utility version string. */

/* Writing concatenation */
	i__3[0] = 42, a__2[0] = "Version Utility for SPICE Toolkit edition ";
	i__3[1] = rtrim_(vrsn, (ftnlen)6), a__2[1] = vrsn;
	i__3[2] = 15, a__2[2] = ", last update: ";
	i__3[3] = 18, a__2[3] = "1.1.0, 07-JAN-2002  ";
	s_cat(linout, a__2, i__3, &c__4, (ftnlen)80);
	tostdo_(" ", (ftnlen)1);
	tostdo_(linout, (ftnlen)80);
	tostdo_(" ", (ftnlen)1);
    } else if (pos_(line, "-H", &c__1, (ftnlen)80, (ftnlen)2) == 1) {

/*        Help. How does does one use this perplexing routine? */

	s_copy(linout, "Usage: version [OPTION]", (ftnlen)80, (ftnlen)23);
	s_copy(linout + 80, " no arguments   output only the SPICE toolkit v"
		"ersion string.", (ftnlen)80, (ftnlen)61);
	s_copy(linout + 160, " -a(ll)         output all environment variabl"
		"es; SPICE toolkit version, system", (ftnlen)80, (ftnlen)79);
	s_copy(linout + 240, "                ID, operating system, compiler"
		", and binary file format, ", (ftnlen)80, (ftnlen)72);
	s_copy(linout + 320, "                max and min values for double "
		"precision and integer numbers.", (ftnlen)80, (ftnlen)76);
	s_copy(linout + 400, " -v(ersion)     output the version of the util"
		"ity.", (ftnlen)80, (ftnlen)50);
	tostdo_(" ", (ftnlen)1);
	for (i__ = 1; i__ <= 6; ++i__) {
	    tostdo_(linout + ((i__2 = i__ - 1) < 6 && 0 <= i__2 ? i__2 : 
		    s_rnge("linout", i__2, "version_", (ftnlen)272)) * 80, 
		    rtrim_(linout + ((i__4 = i__ - 1) < 6 && 0 <= i__4 ? i__4 
		    : s_rnge("linout", i__4, "version_", (ftnlen)272)) * 80, (
		    ftnlen)80));
	}
	tostdo_(" ", (ftnlen)1);
    } else {

/*        The user put something on the command line, but nothing */
/*        known. Return the toolkit version string. */

	tostdo_(vrsn, rtrim_(vrsn, (ftnlen)6));
    }

/*     Done. Indicate as much. Say bye. */

    byebye_("SUCCESS", (ftnlen)7);
    s_stop("", (ftnlen)0);
    return 0;
} /* MAIN__ */
示例#2
0
/* $Procedure   STCF01 (STAR catalog type 1, find stars in RA-DEC box) */
/* Subroutine */ int stcf01_(char *catnam, doublereal *westra, doublereal *
	eastra, doublereal *sthdec, doublereal *nthdec, integer *nstars, 
	ftnlen catnam_len)
{
    /* Builtin functions */
    /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);

    /* Local variables */
    extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *,
	     ftnlen, ftnlen);
    doublereal ramin;
    extern /* Subroutine */ int repmc_(char *, char *, char *, char *, ftnlen,
	     ftnlen, ftnlen, ftnlen);
    doublereal ramax;
    extern /* Subroutine */ int repmd_(char *, char *, doublereal *, integer *
	    , char *, ftnlen, ftnlen, ftnlen);
    logical error;
    char query[512], qrytm1[512], qrytm2[512];
    doublereal decmin;
    extern /* Subroutine */ int ekfind_(char *, integer *, logical *, char *, 
	    ftnlen, ftnlen);
    doublereal decmax;
    extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, 
	    ftnlen);
    char errmsg[512];
    extern /* Subroutine */ int setmsg_(char *, ftnlen);
    extern logical return_(void);
    extern doublereal dpr_(void);

/* $ Abstract */

/*     Search through a type 1 star catalog and return the number of */
/*     stars within a specified RA - DEC rectangle. */

/* $ 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 */

/*     EK */

/* $ Keywords */

/*     None. */

/* $ Declarations */
/* $ Brief_I/O */

/*     Variable  I/O  Description */
/*     --------  ---  -------------------------------------------------- */
/*     CATNAM      I   Catalog table name. */
/*     WESTRA      I   Western most right ascension in radians. */
/*     EASTRA      I   Eastern most right ascension in radians. */
/*     STHDEC      I   Southern most declination in radians. */
/*     NTHDEC      I   Northern most declination in radians. */
/*     NSTARS      O   Number of stars found. */

/* $ Detailed_Input */

/*     CATNAM      is name of the catalog data table. This name is */
/*                 returned by the catalog loader routine STCL01. */

/*     WESTRA      are right ascension and declination constraints */
/*     EASTRA      giving the western, eastern, southern and northern */
/*     STHDEC      boundaries of a search rectangle as follows: */
/*     NTHDEC */
/*                       RA  BETWEEN WESTRA  AND EASTRA  and */
/*                       DEC BETWEEN STHDEC AND NTHDEC */

/*                 where RA and DEC are the right ascension and */
/*                 declination of a star. WESTRA always represents */
/*                 "west" side of this rectangle and EASTRA -- the */
/*                 "east" side.  STHDEC represents the "south" side */
/*                 of the rectangle, NTHDEC represents the "north" */
/*                 side of the rectangle. */

/*                 For an observer standing on the surface */
/*                 of the earth at the equator, the west side of the */
/*                 rectangle ( the side associated with WESTRA) rises */
/*                 first. The east side (the side associated with */
/*                 EASTRA) rises last.  All meridians that rise between */
/*                 the rising of the west and east edges of the */
/*                 rectangle  cross through the RA-DEC rectangle. */

/*                 To specify the 6 degrees wide RA-DEC */
/*                 square centered on the celestical equator that */
/*                 has western most right ascension of 357 degrees, */
/*                 use the following values for WESTRA, EASTRA, STHDEC, */
/*                 and NTHDEC (we multiply the angles by the SPICELIB */
/*                 function RPD to convert degrees to radians). */

/*                      WESTRA  = 357.0D0 * RPD() */
/*                      EASTRA  =   3.0D0 * RPD() */
/*                      STHDEC  =  -3.0D0 * RPD() */
/*                      DEXMAX  =   3.0D0 * RPD() */

/*                 To specify a 5 degree wide RA-DEC square that has */
/*                 western most right ascension 10 degrees and */
/*                 eastern most right ascension 15 degrees and southern */
/*                 most declination of 45 degrees, assign the following */
/*                 values to WESTRA, EASTRA, STHDEC and NTHDEC. */

/*                      WESTRA  =  10.0D0 * RPD() */
/*                      EASTRA  =  15.0D0 * RPD() */
/*                      STHDEC  =  45.0D0 * RPD() */
/*                      DEXMAX  =  50.0D0 * RPD() */

/*                 All RA and DECS should be in radians and relative */
/*                 to the J2000 inertial frame. */

/*                 All Right Ascension values should be in the */
/*                 interval [0, 2*pi ).  This routine does */
/*                 not "fold" Right Ascension values into the this */
/*                 interval.  For example if you request stars in */
/*                 whose right ascensions lie between 3*pi and 4*pi */
/*                 no stars will be found. */

/*                 All Declination values should be in the interval */
/*                 [-pi,pi]. */

/* $ Detailed_Output */

/*     NSTARS      is number of catalog stars found within the */
/*                 specified RA - DEC rectangle. */

/* $ Parameters */

/*     None. */

/* $ Exceptions */

/*     1) If no star catalog has been loaded, an error will be */
/*        signalled by a routine in the call tree of this routine. */

/*     2) If the catalog query fails for any reason then */
/*        the error 'SPICE(QUERYFAILURE)'is signalled. */

/* $ Files */

/*     This routine searches for stars within SPICE type 1 star catalog */
/*     files that have been loaded by calls to the STCL01 routine and */
/*     that contain that catalog data table named CATNAM. */

/*     SPICE type 1 star catalog files MUST contain a single data table. */
/*     It can occupy a single segment or it can spread across multiple */
/*     segments. This table MUST include the following columns: */

/*        column name                data type          units */
/*     ------------------------------------------------------- */
/*        RA                   DOUBLE PRECISION        DEGREES */
/*        DEC                  DOUBLE PRECISION        DEGREES */
/*        RA_SIGMA             DOUBLE PRECISION        DEGREES */
/*        DEC_SIGMA            DOUBLE PRECISION        DEGREES */
/*        CATALOG_NUMBER       INTEGER */
/*        SPECTRAL_TYPE        CHARACTER*(4) */
/*        VISUAL_MAGNITUDE     DOUBLE PRECISION */

/*     Nulls are not allowed in any of the columns. */
/*     Other columns can also be present in the table but their data */
/*     will NOT be accessible through STCF01 and STCG01 -- */
/*     the interface used to access data in the catalog. Note */
/*     that the names and attributes of these additional columns */
/*     must be identical for all segments containing this table. */

/* $ Particulars */

/*     This routine is intended to be a part of the user interface to */
/*     the SPICE type 1 star catalog. It allows the caller to find all */
/*     stars within a specified RA - DEC rectangle in the SPICE */
/*     EK type 1 star catalog files loaded by STCL01. This */
/*     subroutine MUST NOT be called before a catalog file has */
/*     been loaded. */

/*     Other routines in the SPICE type 1 star catalog access */
/*     family are: */

/*        STCL01  load the catalog file and make its data */
/*                available for search and retrieval. */

/*        STCG01  retrieve position and characteristics for */
/*                a specified star in the set found by this */
/*                routine. */

/* $ Examples */

/*     In the following code fragment, STCF01 is used to find */
/*     all stars within a specified RA - DEC rectangle in a SPICE */
/*     EK type 1 star catalog. */

/*     C */
/*     C     Load catalog file. */
/*     C */
/*           CALL STCL01 ( CATFN, TABNAM, HANDLE ) */
/*     C */
/*     C     Search through the loaded catalog. */
/*     C */
/*           CALL STCF01 ( TABNAM, WESTRA,  EASTRA, */
/*          .              STHDEC, NTHDEC, NSTARS ) */
/*     C */
/*     C     Retrieve data for every star found. */
/*     C */
/*           DO I = 1, NSTARS */

/*              CALL STCG01 ( I, RA, DEC, RASIG, DECSIG, */
/*          .                 CATNUM, SPTYPE, VMAG ) */

/*           END DO */

/* $ Restrictions */

/*     1) The catalog file STCF01 searches through MUST be loaded */
/*        by STCL01 before STCF01 is called. */

/* $ Literature_References */

/*     None. */

/* $ Author_and_Institution */

/*     B.V. Semenov    (JPL) */

/* $ Version */

/* -    SPICELIB Version 1.0.0, 15-MAY-1996 (BVS) */

/* -& */
/* $ Index_Entries */

/*      find stars in RA-DEC rectangle in type 1 star catalog */

/* -& */


/*     SPICELIB functions */


/*     Local parameters. */


/*     Local variables */


/*     Standard SPICE error handling. */

    if (return_()) {
	return 0;
    } else {
	chkin_("STCF01", (ftnlen)6);
    }

/*     Query templates. */

    s_copy(qrytm1, "SELECT RA, DEC, RA_SIGMA, DEC_SIGMA,CATALOG_NUMBER, SPEC"
	    "TRAL_TYPE, VISUAL_MAGNITUDE FROM # WHERE ( RA  BETWEEN # AND # )"
	    " AND ( DEC BETWEEN # AND # ) ", (ftnlen)512, (ftnlen)149);
    s_copy(qrytm2, "SELECT RA, DEC, RA_SIGMA, DEC_SIGMA,CATALOG_NUMBER, SPEC"
	    "TRAL_TYPE, VISUAL_MAGNITUDE FROM # WHERE ( ( RA BETWEEN # AND 36"
	    "0 ) OR   ( RA BETWEEN 0 AND #   )      ) AND   ( DEC BETWEEN # A"
	    "ND # ) ", (ftnlen)512, (ftnlen)191);

/*     Choose query template to be used. */

    if (*westra <= *eastra) {
	s_copy(query, qrytm1, (ftnlen)512, (ftnlen)512);
    } else {
	s_copy(query, qrytm2, (ftnlen)512, (ftnlen)512);
    }

/*     Convert angles in radians to angles in degrees. */

    ramin = *westra * dpr_();
    ramax = *eastra * dpr_();
    decmin = *sthdec * dpr_();
    decmax = *nthdec * dpr_();

/*     Construct query using inputs and chosen template. */

    repmc_(query, "#", catnam, query, (ftnlen)512, (ftnlen)1, catnam_len, (
	    ftnlen)512);
    repmd_(query, "#", &ramin, &c__15, query, (ftnlen)512, (ftnlen)1, (ftnlen)
	    512);
    repmd_(query, "#", &ramax, &c__15, query, (ftnlen)512, (ftnlen)1, (ftnlen)
	    512);
    repmd_(query, "#", &decmin, &c__15, query, (ftnlen)512, (ftnlen)1, (
	    ftnlen)512);
    repmd_(query, "#", &decmax, &c__15, query, (ftnlen)512, (ftnlen)1, (
	    ftnlen)512);

/*     Submit query and get number of stars. Check for */
/*     errors in QUERY. */

    ekfind_(query, nstars, &error, errmsg, (ftnlen)512, (ftnlen)512);
    if (error) {
	setmsg_("Error querying type 1 star catalog. Error message: # ", (
		ftnlen)53);
	errch_("#", errmsg, (ftnlen)1, (ftnlen)512);
	sigerr_("SPICE(QUERYFAILURE)", (ftnlen)19);
	chkout_("STCF01", (ftnlen)6);
	return 0;
    }
    chkout_("STCF01", (ftnlen)6);
    return 0;
} /* stcf01_ */