1 /* zzekgei.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__1 = 1;
11 static integer c__5 = 5;
12 
13 /* $Procedure  ZZEKGEI ( Private: EK, get encoded integer ) */
zzekgei_(integer * handle,integer * addrss,integer * ival)14 /* Subroutine */ int zzekgei_(integer *handle, integer *addrss, integer *ival)
15 {
16     /* System generated locals */
17     integer i__1;
18 
19     /* Local variables */
20     char cval[5];
21     extern /* Subroutine */ int dasrdc_(integer *, integer *, integer *,
22 	    integer *, integer *, char *, ftnlen), prtdec_(char *, integer *,
23 	    ftnlen);
24 
25 /* $ Abstract */
26 
27 /*     SPICE Private routine intended solely for the support of SPICE */
28 /*     routines.  Users should not call this routine directly due */
29 /*     to the volatile nature of this routine. */
30 
31 /*     Get an encoded integer at a specifed address from a character */
32 /*     data page. */
33 
34 /* $ Disclaimer */
35 
36 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
37 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
38 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
39 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
40 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
41 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
42 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
43 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
44 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
45 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
46 
47 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
48 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
49 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
50 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
51 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
52 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
53 
54 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
55 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
56 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
57 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
58 
59 /* $ Required_Reading */
60 
61 /*     EK */
62 
63 /* $ Keywords */
64 
65 /*     EK */
66 /*     PRIVATE */
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 Page Parameters */
96 
97 /*        ekfilpar.inc  Version 1  03-APR-1995 (NJB) */
98 
99 /*     These parameters apply to EK files using architecture 4. */
100 /*     These files use a paged DAS file as their underlying file */
101 /*     structure. */
102 
103 /*     In paged DAS EK files, data pages are structured:  they contain */
104 /*     metadata as well as data.  The metadata is located in the last */
105 /*     few addresses of each page, so as to interfere as little as */
106 /*     possible with calculation of data addresses. */
107 
108 /*     Each data page belongs to exactly one segment.  Some bookkeeping */
109 /*     information, such as record pointers, is also stored in data */
110 /*     pages. */
111 
112 /*     Each page contains a forward pointer that allows rapid lookup */
113 /*     of data items that span multiple pages.  Each page also keeps */
114 /*     track of the current number of links from its parent segment */
115 /*     to the page.  Link counts enable pages to `know' when they */
116 /*     are no longer in use by a segment; unused pages are deallocated */
117 /*     and returned to the free list. */
118 
119 /*     The parameters in this include file depend on the parameters */
120 /*     declared in the include file ekpage.inc.  If those parameters */
121 /*     change, this file must be updated.  The specified parameter */
122 /*     declarations we need from that file are: */
123 
124 /*        INTEGER               PGSIZC */
125 /*        PARAMETER           ( PGSIZC = 1024 ) */
126 
127 /*        INTEGER               PGSIZD */
128 /*        PARAMETER           ( PGSIZD = 128 ) */
129 
130 /*        INTEGER               PGSIZI */
131 /*        PARAMETER           ( PGSIZI = 256 ) */
132 
133 
134 
135 /*     Character pages use an encoding mechanism to represent integer */
136 /*     metadata.  Each integer is encoded in five consecutive */
137 /*     characters. */
138 
139 
140 /*     Character data page parameters: */
141 
142 
143 /*     Size of encoded integer: */
144 
145 
146 /*     Usable page size: */
147 
148 
149 /*     Location of character forward pointer: */
150 
151 
152 /*     Location of character link count: */
153 
154 
155 /*     Double precision data page parameters: */
156 
157 /*     Usable page size: */
158 
159 
160 /*     Location of d.p. forward pointer: */
161 
162 
163 /*     Location of d.p. link count: */
164 
165 
166 /*     Integer data page parameters: */
167 
168 /*     Usable page size: */
169 
170 
171 /*     Location of integer forward pointer: */
172 
173 
174 /*     Location of integer link count: */
175 
176 
177 /*     End Include Section:  EK Data Page Parameters */
178 
179 /* $ Brief_I/O */
180 
181 /*     Variable  I/O  Description */
182 /*     --------  ---  -------------------------------------------------- */
183 /*     HANDLE     I   EK file handle. */
184 /*     ADDRSS     I   DAS character address to read encoded value from. */
185 /*     IVAL       O   Decoded integer value. */
186 
187 /* $ Detailed_Input */
188 
189 /*     HANDLE         is the handle of an EK file open for read or */
190 /*                    write access. */
191 
192 /*     ADDRSS         is the DAS character start address from which an */
193 /*                    integer, encoded as a string, is to be read. */
194 /*                    An encoded integer occupies ENCSIZ characters, */
195 /*                    where the parameter ENCSIZ is defined in the */
196 /*                    include file ekdatpag.inc. */
197 
198 /* $ Detailed_Output */
199 
200 /*     IVAL           is an integer value obtained by decoding an */
201 /*                    encoded integer read from the specified */
202 /*                    location. */
203 
204 /* $ Parameters */
205 
206 /*     None. */
207 
208 /* $ Exceptions */
209 
210 /*     1)  If HANDLE is invalid, the error will be diagnosed by routines */
211 /*         called by this routine. */
212 
213 /*     2)  If the DAS character address range */
214 
215 /*            ADDRSS .. ADDRSS+ENCSIZ-1 */
216 
217 /*         is not a range of DAS character addresses that have been */
218 /*         initialized, the error wll be diagnosed by routines */
219 /*         called by this routine. */
220 
221 /*     3)  If the character data starting at the specified address */
222 /*         does not represent an encoded integer, the error wll be */
223 /*         diagnosed by routines called by this routine. */
224 
225 /* $ Files */
226 
227 /*     None. */
228 
229 /* $ Particulars */
230 
231 /*     This routine should be used for all EK applications reading */
232 /*     integer values that have been encoded as characters.  This */
233 /*     routine expects the encoding to have been done by ZZEKSEI. */
234 
235 /* $ Examples */
236 
237 /*     See ZZEKRD03. */
238 
239 /* $ Restrictions */
240 
241 /*     None. */
242 
243 /* $ Literature_References */
244 
245 /*     None. */
246 
247 /* $ Author_and_Institution */
248 
249 /*     N.J. Bachman       (JPL) */
250 
251 /* $ Version */
252 
253 /* -    Beta Version 1.0.0, 10-OCT-1995 (NJB) */
254 
255 /* -& */
256 
257 /*     Local variables */
258 
259 
260 /*     Discovery error handling should be used in this utility. */
261 
262 
263 /*     Read the encoded value.  The value is represented by a string of */
264 /*     characters. */
265 
266     i__1 = *addrss + 4;
267     dasrdc_(handle, addrss, &i__1, &c__1, &c__5, cval, (ftnlen)5);
268 
269 /*     Decode the number. */
270 
271     prtdec_(cval, ival, (ftnlen)5);
272     return 0;
273 } /* zzekgei_ */
274 
275