1 /* spks15.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* Table of constant values */
9 
10 static integer c__16 = 16;
11 
12 /* $Procedure SPKS15 ( S/P Kernel, subset, type 15 ) */
spks15_(integer * handle,integer * baddr,integer * eaddr,doublereal * begin,doublereal * end)13 /* Subroutine */ int spks15_(integer *handle, integer *baddr, integer *eaddr,
14 	doublereal *begin, doublereal *end)
15 {
16     doublereal data[16];
17     extern /* Subroutine */ int chkin_(char *, ftnlen), dafada_(doublereal *,
18 	    integer *), dafgda_(integer *, integer *, integer *, doublereal *)
19 	    , chkout_(char *, ftnlen);
20     extern logical return_(void);
21 
22 /* $ Abstract */
23 
24 /*     Extract a subset of the data in an SPK segment of type 15 */
25 /*     into a new segment. */
26 
27 /* $ Disclaimer */
28 
29 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
30 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
31 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
32 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
33 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
34 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
35 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
36 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
37 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
38 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
39 
40 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
41 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
42 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
43 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
44 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
45 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
46 
47 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
48 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
49 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
50 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
51 
52 /* $ Required_Reading */
53 
54 /*     SPK */
55 /*     DAF */
56 
57 /* $ Keywords */
58 
59 /*     EPHEMERIS */
60 
61 /* $ Declarations */
62 /* $ Brief_I/O */
63 
64 /*     Variable  I/O  Description */
65 /*     --------  ---  -------------------------------------------------- */
66 /*     HANDLE     I   Handle of file containing source segment. */
67 /*     BADDR      I   Beginning address in file of source segment. */
68 /*     EADDR      I   Ending address in file of source segment. */
69 /*     BEGIN      I   Beginning (initial epoch) of subset. */
70 /*     END        I   End (final epoch) of subset. */
71 
72 /* $ Detailed_Input */
73 
74 /*     HANDLE, */
75 /*     BADDR, */
76 /*     EADDR       are the file handle assigned to an SPK file, and the */
77 /*                 beginning and ending addresses of a segment within */
78 /*                 that file.  Together they determine a complete set of */
79 /*                 ephemeris data, from which a subset is to be */
80 /*                 extracted. */
81 
82 /*     BEGIN, */
83 /*     END         are the initial and final epochs (ephemeris time) */
84 /*                 of the subset. */
85 
86 /* $ Detailed_Output */
87 
88 /*     See $Files section. */
89 
90 /* $ Parameters */
91 
92 /*     None. */
93 
94 /* $ Exceptions */
95 
96 /*     1)  This routine relies on the caller to ensure that the */
97 /*         interval [BEGIN, END] is contained in the coverage */
98 /*         interval of the segment. */
99 
100 /*     2)  If BEGIN > END, no data is written to the target file. */
101 
102 /* $ Files */
103 
104 /*     Data is extracted from the file connected to the input */
105 /*     handle, and written to the current DAF open for writing. */
106 
107 /*     The segment descriptor and summary must already have been written */
108 /*     prior to calling this routine.  The segment must be ended */
109 /*     external to this routine. */
110 
111 /* $ Particulars */
112 
113 /*     This routine is intended solely for use as a utility by the */
114 /*     routine SPKSUB. It transfers a subset of a type 15 SPK data */
115 /*     segment to a properly initialized segment of a second SPK file. */
116 
117 /*     The exact structure of a segment of data type 15 is described */
118 /*     in the section on type 15 in the SPK Required Reading. */
119 
120 /* $ Examples */
121 
122 /*     This routine is intended only for use as a utility by SPKSUB. */
123 /*     To use this routine successfully, you must: */
124 
125 /*        Open the SPK file from which to extract data. */
126 /*        Locate the segment from which data should be extracted. */
127 
128 /*        Open the SPK file to which this data should be written. */
129 /*        Begin a new segment (array). */
130 /*        Write the summary information for the array. */
131 
132 /*        Call this routine to extract the appropriate data from the */
133 /*        SPK open for read. */
134 
135 /*        End the array to which this routine writes data. */
136 
137 /*     Much of this procedure is carried out by the routine SPKSUB.  The */
138 /*     examples of that routine illustrate more fully the process */
139 /*     described above. */
140 
141 /* $ Restrictions */
142 
143 /*     None. */
144 
145 /* $ Literature_References */
146 
147 /*     None. */
148 
149 /* $ Author_and_Institution */
150 
151 /*     W.L. Taber      (JPL) */
152 
153 /* $ Version */
154 
155 /* -    SPICELIB Version 1.1.0, 07-SEP-2001 (EDW) */
156 
157 /*        Replaced DAFRDA call with DAFGDA. */
158 /*        Added IMPLICIT NONE. */
159 
160 /* -    SPICELIB Version 1.0.0, 7-NOV-1994 (WLT) */
161 
162 /* -& */
163 /* $ Index_Entries */
164 
165 /*     subset type_15 spk segment */
166 
167 /* -& */
168 /* $ Revisions */
169 
170 
171 /* -& */
172 
173 /*     SPICELIB functions */
174 
175 
176 /*     Local variables */
177 
178 
179 /*     Standard SPICE error handling. */
180 
181     if (return_()) {
182 	return 0;
183     } else {
184 	chkin_("SPKS15", (ftnlen)6);
185     }
186 
187 /*     See whether there's any work to do; return immediately if not. */
188 
189     if (*begin > *end) {
190 	chkout_("SPKS15", (ftnlen)6);
191 	return 0;
192     }
193 
194 /*     This couldn't be much easier.  First copy the entire */
195 /*     type 15 segment out of the file. */
196 
197     dafgda_(handle, baddr, eaddr, data);
198 
199 /*     Now write the data into the output file. */
200 
201     dafada_(data, &c__16);
202     chkout_("SPKS15", (ftnlen)6);
203     return 0;
204 } /* spks15_ */
205 
206