1 /* ekops.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__3 = 3;
11
12 /* $Procedure EKOPS ( EK, open scratch file ) */
ekops_(integer * handle)13 /* Subroutine */ int ekops_(integer *handle)
14 {
15 /* System generated locals */
16 integer i__1, i__2;
17
18 /* Local variables */
19 integer base;
20 extern /* Subroutine */ int zzekpgan_(integer *, integer *, integer *,
21 integer *), zzekpgin_(integer *), zzektrit_(integer *, integer *);
22 integer p;
23 extern /* Subroutine */ int chkin_(char *, ftnlen);
24 extern logical failed_(void);
25 extern /* Subroutine */ int dasudi_(integer *, integer *, integer *,
26 integer *), dasops_(integer *), chkout_(char *, ftnlen);
27 extern logical return_(void);
28
29 /* $ Abstract */
30
31 /* Open a scratch E-kernel file and prepare the file for writing. */
32
33 /* $ Disclaimer */
34
35 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
36 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
37 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
38 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
39 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
40 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
41 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
42 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
43 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
44 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
45
46 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
47 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
48 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
49 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
50 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
51 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
52
53 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
54 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
55 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
56 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
57
58 /* $ Required_Reading */
59
60 /* EK */
61
62 /* $ Keywords */
63
64 /* EK */
65 /* FILES */
66 /* UTILITY */
67
68 /* $ Declarations */
69 /* $ Disclaimer */
70
71 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
72 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
73 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
74 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
75 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
76 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
77 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
78 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
79 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
80 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
81
82 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
83 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
84 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
85 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
86 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
87 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
88
89 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
90 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
91 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
92 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
93
94
95 /* Include Section: EK Data Types */
96
97 /* ektype.inc Version 1 27-DEC-1994 (NJB) */
98
99
100 /* Within the EK system, data types of EK column contents are */
101 /* represented by integer codes. The codes and their meanings */
102 /* are listed below. */
103
104 /* Integer codes are also used within the DAS system to indicate */
105 /* data types; the EK system makes no assumptions about compatibility */
106 /* between the codes used here and those used in the DAS system. */
107
108
109 /* Character type: */
110
111
112 /* Double precision type: */
113
114
115 /* Integer type: */
116
117
118 /* `Time' type: */
119
120 /* Within the EK system, time values are represented as ephemeris */
121 /* seconds past J2000 (TDB), and double precision numbers are used */
122 /* to store these values. However, since time values require special */
123 /* treatment both on input and output, and since the `TIME' column */
124 /* has a special role in the EK specification and code, time values */
125 /* are identified as a type distinct from double precision numbers. */
126
127
128 /* End Include Section: EK Data Types */
129
130 /* $ Disclaimer */
131
132 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
133 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
134 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
135 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
136 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
137 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
138 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
139 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
140 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
141 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
142
143 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
144 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
145 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
146 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
147 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
148 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
149
150 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
151 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
152 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
153 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
154
155
156 /* Include Section: EK File Metadata Parameters */
157
158 /* ekfilpar.inc Version 1 28-MAR-1995 (NJB) */
159
160 /* These parameters apply to EK files using architecture 4. */
161 /* These files use a paged DAS file as their underlying file */
162 /* structure. */
163
164 /* The metadata for an architecture 4 EK file is very simple: it */
165 /* consists of a single integer, which is a pointer to a tree */
166 /* that in turn points to the segments in the EK. However, in the */
167 /* interest of upward compatibility, one integer page is reserved */
168 /* for the file's metadata. */
169
170
171 /* Size of file parameter block: */
172
173
174 /* All offsets shown below are relative to the beginning of the */
175 /* first integer page in the EK. */
176
177
178 /* Index of the segment pointer tree---this location contains the */
179 /* root page number of the tree: */
180
181
182 /* End Include Section: EK File Metadata Parameters */
183
184 /* $ Brief_I/O */
185
186 /* Variable I/O Description */
187 /* -------- --- -------------------------------------------------- */
188 /* HANDLE O File handle attached to new EK file. */
189
190 /* $ Detailed_Input */
191
192 /* None. */
193
194 /* $ Detailed_Output */
195
196 /* HANDLE is the EK file handle of the file designated by */
197 /* FNAME. This handle is used to identify the file */
198 /* to other EK routines. */
199
200 /* $ Parameters */
201
202 /* None. */
203
204 /* $ Exceptions */
205
206 /* 1) If the indicated file cannot be opened, the error will be */
207 /* diagnosed by routines called by this routine. The new file */
208 /* will be deleted. */
209
210 /* 2) If an I/O error occurs while reading or writing the indicated */
211 /* file, the error will be diagnosed by routines called by this */
212 /* routine. */
213
214 /* $ Files */
215
216 /* See the EK Required Reading for a discussion of the EK file */
217 /* format. */
218
219 /* $ Particulars */
220
221 /* This routine operates by side effects: it opens and prepares */
222 /* an EK for addition of data. */
223
224 /* $ Examples */
225
226 /* 1) Open a scratch EK. The EK should be closed via EKCLS. */
227 /* The EK file will be deleted when closed. */
228
229
230 /* CALL EKOPS ( HANDLE ) */
231
232 /* [Write/Read EK] */
233
234 /* CALL EKCLS ( HANDLE ) */
235
236
237 /* $ Restrictions */
238
239 /* 1) No more than FTSIZE DAS files may be opened simultaneously. */
240 /* See DASFM for the value of FTSIZE. */
241
242 /* $ Literature_References */
243
244 /* None. */
245
246 /* $ Author_and_Institution */
247
248 /* N.J. Bachman (JPL) */
249
250 /* $ Version */
251
252 /* - Beta Version 1.0.0, 26-SEP-1995 (NJB) */
253
254 /* -& */
255 /* $ Index_Entries */
256
257 /* open scratch E-kernel */
258 /* open scratch EK */
259
260 /* -& */
261
262 /* SPICELIB functions */
263
264
265 /* Local variables */
266
267
268 /* Standard SPICE error handling. */
269
270 if (return_()) {
271 return 0;
272 } else {
273 chkin_("EKOPS", (ftnlen)5);
274 }
275 dasops_(handle);
276 if (failed_()) {
277 chkout_("EKOPS", (ftnlen)5);
278 return 0;
279 }
280
281 /* Initialize the file for paged access. The EK architecture */
282 /* code is automatically set by the paging initialization routine. */
283
284 zzekpgin_(handle);
285 if (failed_()) {
286 chkout_("EKOPS", (ftnlen)5);
287 return 0;
288 }
289
290 /* Allocate the first integer page for the file's metadata. We */
291 /* don't need to examine the page number; it's 1. */
292
293 zzekpgan_(handle, &c__3, &p, &base);
294
295 /* Initialize a new tree. This tree will point to the file's */
296 /* segments. */
297
298 zzektrit_(handle, &p);
299
300 /* Save the segment pointer's root page number. */
301
302 i__1 = base + 1;
303 i__2 = base + 1;
304 dasudi_(handle, &i__1, &i__2, &p);
305
306 /* That's it. We're ready to add data to the file. */
307
308 chkout_("EKOPS", (ftnlen)5);
309 return 0;
310 } /* ekops_ */
311
312