1 /* ekopr.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 EKOPR ( EK, open file for reading ) */
ekopr_(char * fname,integer * handle,ftnlen fname_len)9 /* Subroutine */ int ekopr_(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 dasopr_(char *, integer *, ftnlen), chkout_(
15 char *, ftnlen);
16 extern logical return_(void);
17
18 /* $ Abstract */
19
20 /* Open an existing E-kernel file for reading. */
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 read access. */
69
70 /* $ Detailed_Output */
71
72 /* HANDLE is the EK file handle of the file designated 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 the indicated file, the */
90 /* error will be diagnosed by routines called by this routine. */
91
92 /* $ Files */
93
94 /* See the EK Required Reading for a discussion of the EK file */
95 /* format. */
96
97 /* $ Particulars */
98
99 /* This routine should be used to open an EK file for read access. */
100 /* EKs opened for read access may not be modified. */
101
102 /* Opening an EK file with this routine makes the EK accessible to */
103 /* the SPICELIB EK readers */
104
105 /* EKRCEC */
106 /* EKRCED */
107 /* EKRCEI */
108
109 /* all of which expect an EK file handle as an input argument. These */
110 /* readers allow a caller to read individual EK column entries. */
111
112 /* To make an EK available to the EK query system, the file must be */
113 /* loaded via EKLEF, rather than by this routine. See the EK */
114 /* Required Reading for further information. */
115
116 /* $ Examples */
117
118 /* 1) Open the file MY.EK for read access: */
119
120 /* CALL EKOPR ( 'MY.EK', HANDLE ) */
121
122 /* $ Restrictions */
123
124 /* 1) No more than FTSIZE DAS files may be opened simultaneously. */
125 /* See DASFM for the value of FTSIZE. */
126
127 /* $ Literature_References */
128
129 /* None. */
130
131 /* $ Author_and_Institution */
132
133 /* N.J. Bachman (JPL) */
134
135 /* $ Version */
136
137 /* - Beta Version 1.0.0, 26-AUG-1995 (NJB) */
138
139 /* -& */
140 /* $ Index_Entries */
141
142 /* open EK for reading */
143
144 /* -& */
145
146 /* SPICELIB functions */
147
148
149 /* Standard SPICE error handling. */
150
151 if (return_()) {
152 return 0;
153 } else {
154 chkin_("EKOPR", (ftnlen)5);
155 }
156
157 /* Open the file as a DAS file. */
158
159 dasopr_(fname, handle, fname_len);
160 if (failed_()) {
161 chkout_("EKOPR", (ftnlen)5);
162 return 0;
163 }
164
165 /* Nothing doing unless the architecture is correct. This file */
166 /* should be a paged DAS EK. */
167
168 zzekpgch_(handle, "READ", (ftnlen)4);
169 chkout_("EKOPR", (ftnlen)5);
170 return 0;
171 } /* ekopr_ */
172
173