1 /* ekopw.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 /* $Procedure EKOPW ( EK, open file for writing ) */
ekopw_(char * fname,integer * handle,ftnlen fname_len)9 /* Subroutine */ int ekopw_(char *fname, integer *handle, ftnlen fname_len)
10 {
11 extern /* Subroutine */ int zzekpgch_(integer *, char *, ftnlen), chkin_(
12 char *, ftnlen);
13 extern logical failed_(void);
14 extern /* Subroutine */ int dasopw_(char *, integer *, ftnlen), chkout_(
15 char *, ftnlen);
16 extern logical return_(void);
17
18 /* $ Abstract */
19
20 /* Open an existing E-kernel file for writing. */
21
22 /* $ Disclaimer */
23
24 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
25 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
26 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
27 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
28 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
29 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
30 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
31 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
32 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
33 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
34
35 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
36 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
37 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
38 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
39 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
40 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
41
42 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
43 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
44 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
45 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
46
47 /* $ Required_Reading */
48
49 /* EK */
50
51 /* $ Keywords */
52
53 /* EK */
54 /* FILES */
55 /* UTILITY */
56
57 /* $ Declarations */
58 /* $ Brief_I/O */
59
60 /* Variable I/O Description */
61 /* -------- --- -------------------------------------------------- */
62 /* FNAME I Name of EK file. */
63 /* HANDLE O Handle attached to EK file. */
64
65 /* $ Detailed_Input */
66
67 /* FNAME is the name of an existing E-kernel file to be */
68 /* opened for write access. */
69
70 /* $ Detailed_Output */
71
72 /* HANDLE is the DAS file handle of the EK designate by */
73 /* FNAME. This handle is used to identify the file */
74 /* to other EK routines. */
75
76 /* $ Parameters */
77
78 /* None. */
79
80 /* $ Exceptions */
81
82 /* 1) If the indicated file cannot be opened, the error will be */
83 /* diagnosed by routines called by this routine. The new file */
84 /* will be deleted. */
85
86 /* 2) If the indicated file has the wrong architecture version, the */
87 /* error will be diagnosed by routines called by this routine. */
88
89 /* 3) If an I/O error occurs while reading or writing the indicated */
90 /* file, the error will be diagnosed by routines called by this */
91 /* routine. */
92
93 /* $ Files */
94
95 /* See the EK Required Reading for a discussion of the EK file */
96 /* format. */
97
98 /* $ Particulars */
99
100 /* This routine should be used to open an EK file for write access. */
101
102 /* Opening an EK file with this routine makes the EK accessible to */
103 /* the following SPICELIB EK access routines, all of which modify */
104 /* the target EK file: */
105
106 /* Begin segment: */
107
108 /* EKBSEG */
109
110 /* Append, insert, delete records: */
111
112 /* EKAPPR */
113 /* EKINSR */
114 /* EKDELR */
115
116 /* Add column entries: */
117
118 /* EKACEC */
119 /* EKACED */
120 /* EKACEI */
121
122 /* Update existing column entries: */
123
124 /* EKUCEC */
125 /* EKUCED */
126 /* EKUCEI */
127
128 /* Execute fast write: */
129
130 /* EKIFLD */
131 /* EKFFLD */
132 /* EKACEC */
133 /* EKACED */
134 /* EKACEI */
135
136 /* An EK opened for write access is also accessible for reading. */
137 /* The file may be accessed by the SPICELIB EK readers */
138
139 /* EKRCEC */
140 /* EKRCED */
141 /* EKRCEI */
142
143 /* and summary routines: */
144
145 /* EKNSEG */
146 /* EKSSUM */
147
148
149 /* An EK opened for write access cannot be queried. To make an EK */
150 /* available to the EK query system, the file must be loaded via */
151 /* EKLEF, rather than by this routine. See the EK Required Reading */
152 /* for further information. */
153
154 /* $ Examples */
155
156 /* 1) Open the file MY.EK for write access: */
157
158 /* CALL EKOPW ( 'MY.EK', HANDLE ) */
159
160 /* $ Restrictions */
161
162 /* 1) No more than FTSIZE DAS files may be opened simultaneously. */
163 /* See DASFM for the value of FTSIZE. */
164
165 /* $ Literature_References */
166
167 /* None. */
168
169 /* $ Author_and_Institution */
170
171 /* N.J. Bachman (JPL) */
172
173 /* $ Version */
174
175 /* - SPICELIB Version 1.0.1, 09-JAN-2002 (NJB) */
176
177 /* Documentation change: instances of the phrase "fast load" */
178 /* were replaced with "fast write." */
179
180 /* - Beta Version 1.0.0, 26-SEP-1995 (NJB) */
181
182 /* -& */
183 /* $ Index_Entries */
184
185 /* open EK for writing */
186
187 /* -& */
188
189 /* SPICELIB functions */
190
191
192 /* Standard SPICE error handling. */
193
194 if (return_()) {
195 return 0;
196 } else {
197 chkin_("EKOPW", (ftnlen)5);
198 }
199
200 /* Open the file as a DAS file. */
201
202 dasopw_(fname, handle, fname_len);
203 if (failed_()) {
204 chkout_("EKOPW", (ftnlen)5);
205 return 0;
206 }
207
208 /* Nothing doing unless the architecture is correct. This file */
209 /* should be a paged DAS EK. */
210
211 zzekpgch_(handle, "WRITE", (ftnlen)5);
212 chkout_("EKOPW", (ftnlen)5);
213 return 0;
214 } /* ekopw_ */
215
216