1 /* dafrwa.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 DAFRWA ( DAF, record/word to address ) */
dafrwa_0_(int n__,integer * recno,integer * wordno,integer * addr__)9 /* Subroutine */ int dafrwa_0_(int n__, integer *recno, integer *wordno,
10 integer *addr__)
11 {
12 extern /* Subroutine */ int chkin_(char *, ftnlen), sigerr_(char *,
13 ftnlen), chkout_(char *, ftnlen), setmsg_(char *, ftnlen),
14 errint_(char *, integer *, ftnlen);
15 extern logical return_(void);
16
17 /* $ Abstract */
18
19 /* Convert a record/word pair to its equivalent address within */
20 /* a DAF. */
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 /* DAF */
50
51 /* $ Keywords */
52
53 /* CONVERSION */
54 /* FILES */
55
56 /* $ Declarations */
57 /* $ Brief_I/O */
58
59 /* Variable I/O Description */
60 /* -------- --- -------------------------------------------------- */
61 /* RECNO, */
62 /* WORDNO I Record, word numbers of a location within DAF. */
63 /* ADDR O Corresponding address. */
64
65 /* $ Detailed_Input */
66
67 /* RECNO, */
68 /* WORDNO are the record and word numbers of an arbitrary */
69 /* location within a DAF. */
70
71 /* $ Detailed_Output */
72
73 /* ADDR is the corresponding address within the DAF. */
74
75 /* $ Parameters */
76
77 /* None. */
78
79 /* $ Files */
80
81 /* None. */
82
83 /* $ Exceptions */
84
85 /* 1) If either RECNO or WORDNO is zero or negative, the error */
86 /* SPICE(DAFNOSUCHADDR) is signalled. */
87
88 /* $ Particulars */
89
90 /* To the user, the data in a DAF appear to be a contiguous */
91 /* collection of double precision numbers, each of which has an */
92 /* address. To the DAF software, however, the data appear to be */
93 /* a collection of records, each containing 128 double precision */
94 /* words. The routines DAFARW and DAFRWA translate between these */
95 /* two representations. */
96
97 /* $ Examples */
98
99 /* Routines DAFRDA and DAFWDA illustrate the use of DAFARW and */
100 /* DAFRWA. */
101
102 /* $ Restrictions */
103
104 /* None. */
105
106 /* $ Literature_References */
107
108 /* NAIF Document 167.0, "Double Precision Array Files (DAF) */
109 /* Specification and User's Guide" */
110
111 /* $ Author_and_Institution */
112
113 /* I.M. Underwood (JPL) */
114
115 /* $ Version */
116
117 /* - SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) */
118
119 /* Comment section for permuted index source lines was added */
120 /* following the header. */
121
122 /* - SPICELIB Version 1.0.1, 22-MAR-1990 (HAN) */
123
124 /* Literature references added to the header. */
125
126 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) */
127
128 /* -& */
129 /* $ Index_Entries */
130
131 /* record/word to daf address */
132
133 /* -& */
134
135 /* SPICELIB functions */
136
137
138 /* Standard SPICE error handling. */
139
140 switch(n__) {
141 case 1: goto L_dafarw;
142 }
143
144 if (return_()) {
145 return 0;
146 } else if (*recno <= 0 || *wordno <= 0) {
147 chkin_("DAFRWA", (ftnlen)6);
148 setmsg_("No address for record #, word #.", (ftnlen)32);
149 errint_("#", recno, (ftnlen)1);
150 errint_("#", wordno, (ftnlen)1);
151 sigerr_("SPICE(DAFNOSUCHADDR)", (ftnlen)20);
152 chkout_("DAFRWA", (ftnlen)6);
153 return 0;
154 }
155
156 /* If the record and word numbers are legal, the computation is */
157 /* straightforward. */
158
159 *addr__ = *wordno + (*recno - 1 << 7);
160 return 0;
161 /* $Procedure DAFARW ( DAF, address to record/word ) */
162
163 L_dafarw:
164 /* $ Abstract */
165
166 /* Convert an address within a DAF to its equivalent */
167 /* record/word representation. */
168
169 /* $ Disclaimer */
170
171 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
172 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
173 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
174 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
175 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
176 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
177 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
178 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
179 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
180 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
181
182 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
183 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
184 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
185 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
186 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
187 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
188
189 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
190 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
191 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
192 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
193
194 /* $ Required_Reading */
195
196 /* DAF */
197
198 /* $ Keywords */
199
200 /* CONVERSION */
201 /* FILES */
202
203 /* $ Declarations */
204
205 /* INTEGER ADDR */
206 /* INTEGER RECNO */
207 /* INTEGER WORDNO */
208
209 /* $ Brief_I/O */
210
211 /* Variable I/O Description */
212 /* -------- --- -------------------------------------------------- */
213 /* ADDR I Address within DAF. */
214 /* RECNO, */
215 /* WORDNO O Corresponding record, word numbers. */
216
217 /* $ Detailed_Input */
218
219 /* ADDR is an arbitrary address within a DAF. */
220
221 /* $ Detailed_Output */
222
223 /* RECNO, */
224 /* WORDNO are the corresponding record and word numbers */
225 /* within the DAF. */
226
227 /* $ Parameters */
228
229 /* None. */
230
231 /* $ Files */
232
233 /* None. */
234
235 /* $ Exceptions */
236
237 /* 1) If ADDR is zero or negative, the error SPICE(DAFNOSUCHADDR) */
238 /* is signalled. */
239
240 /* $ Particulars */
241
242 /* To the user, the data in a DAF appear to be a contiguous */
243 /* collection of double precision numbers, each of which has an */
244 /* address. To the DAF software, however, the data appear to be */
245 /* a collection of records, each containing 128 double precision */
246 /* words. The routines DAFARW and DAFRWA translate between these */
247 /* two representations. */
248
249 /* $ Examples */
250
251 /* Routines DAFRDA and DAFWDA illustrate the use of DAFARW and */
252 /* DAFRWA. */
253
254 /* $ Restrictions */
255
256 /* None. */
257
258 /* $ Literature_References */
259
260 /* NAIF Document 167.0, "Double Precision Array Files (DAF) */
261 /* Specification and User's Guide" */
262
263 /* $ Author_and_Institution */
264
265 /* I.M. Underwood (JPL) */
266
267 /* $ Version */
268
269 /* - SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) */
270
271 /* Comment section for permuted index source lines was added */
272 /* following the header. */
273
274 /* - SPICELIB Version 1.0.1, 22-MAR-1990 (HAN) */
275
276 /* Literature references added to the header. */
277
278 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) */
279
280 /* -& */
281 /* $ Index_Entries */
282
283 /* daf address to record/word */
284
285 /* -& */
286
287 /* Standard SPICE error handling. */
288
289 if (return_()) {
290 return 0;
291 } else if (*addr__ <= 0) {
292 chkin_("DAFARW", (ftnlen)6);
293 setmsg_("No record, word for address #.", (ftnlen)30);
294 errint_("#", addr__, (ftnlen)1);
295 sigerr_("SPICE(DAFNOSUCHADDR)", (ftnlen)20);
296 chkout_("DAFARW", (ftnlen)6);
297 return 0;
298 }
299
300 /* If the address is legal, the computation is straightforward. */
301
302 *recno = (*addr__ - 1) / 128 + 1;
303 *wordno = *addr__ - (*recno - 1 << 7);
304 return 0;
305 } /* dafrwa_ */
306
dafrwa_(integer * recno,integer * wordno,integer * addr__)307 /* Subroutine */ int dafrwa_(integer *recno, integer *wordno, integer *addr__)
308 {
309 return dafrwa_0_(0, recno, wordno, addr__);
310 }
311
dafarw_(integer * addr__,integer * recno,integer * wordno)312 /* Subroutine */ int dafarw_(integer *addr__, integer *recno, integer *wordno)
313 {
314 return dafrwa_0_(1, recno, wordno, addr__);
315 }
316
317