1 /* errhan.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__0 = 0;
12
13 /* $Procedure ERRHAN ( Insert DAF/DAS file name into long error message ) */
errhan_(char * marker,integer * handle,ftnlen marker_len)14 /* Subroutine */ int errhan_(char *marker, integer *handle, ftnlen marker_len)
15 {
16 /* Builtin functions */
17 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
18
19 /* Local variables */
20 extern /* Subroutine */ int zzddhnfo_(integer *, char *, integer *,
21 integer *, integer *, logical *, ftnlen);
22 char fname[255];
23 extern /* Subroutine */ int errch_(char *, char *, ftnlen, ftnlen);
24 logical found;
25 integer intbff, intarc, intamh;
26 extern /* Subroutine */ int suffix_(char *, integer *, char *, ftnlen,
27 ftnlen), intstr_(integer *, char *, ftnlen);
28 char numstr[32];
29
30 /* $ Abstract */
31
32 /* Substitute the first occurrence of a marker in the current long */
33 /* error message with the file name associated with a given */
34 /* DAF/DAS handle. */
35
36 /* $ Disclaimer */
37
38 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
39 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
40 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
41 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
42 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
43 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
44 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
45 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
46 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
47 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
48
49 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
50 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
51 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
52 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
53 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
54 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
55
56 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
57 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
58 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
59 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
60
61 /* $ Required_Reading */
62
63 /* ERROR */
64
65 /* $ Keywords */
66
67 /* DAF */
68 /* DAS */
69 /* ERROR */
70 /* STRING */
71
72 /* $ Declarations */
73
74 /* $ Abstract */
75
76 /* Parameter declarations for the DAF/DAS handle manager. */
77
78 /* $ Disclaimer */
79
80 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
81 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
82 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
83 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
84 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
85 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
86 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
87 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
88 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
89 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
90
91 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
92 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
93 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
94 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
95 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
96 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
97
98 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
99 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
100 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
101 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
102
103 /* $ Required_Reading */
104
105 /* DAF, DAS */
106
107 /* $ Keywords */
108
109 /* PRIVATE */
110
111 /* $ Particulars */
112
113 /* This include file contains parameters defining limits and */
114 /* integer codes that are utilized in the DAF/DAS handle manager */
115 /* routines. */
116
117 /* $ Restrictions */
118
119 /* None. */
120
121 /* $ Author_and_Institution */
122
123 /* F.S. Turner (JPL) */
124
125 /* $ Literature_References */
126
127 /* None. */
128
129 /* $ Version */
130
131 /* - SPICELIB Version 2.5.0, 10-MAR-2014 (BVS) */
132
133 /* Updated for SUN-SOLARIS-64BIT-INTEL. */
134
135 /* - SPICELIB Version 2.4.0, 10-MAR-2014 (BVS) */
136
137 /* Updated for PC-LINUX-64BIT-IFORT. */
138
139 /* - SPICELIB Version 2.3.0, 10-MAR-2014 (BVS) */
140
141 /* Updated for PC-CYGWIN-GFORTRAN. */
142
143 /* - SPICELIB Version 2.2.0, 10-MAR-2014 (BVS) */
144
145 /* Updated for PC-CYGWIN-64BIT-GFORTRAN. */
146
147 /* - SPICELIB Version 2.1.0, 10-MAR-2014 (BVS) */
148
149 /* Updated for PC-CYGWIN-64BIT-GCC_C. */
150
151 /* - SPICELIB Version 2.0.0, 12-APR-2012 (BVS) */
152
153 /* Increased FTSIZE (from 1000 to 5000). */
154
155 /* - SPICELIB Version 1.20.0, 13-MAY-2010 (BVS) */
156
157 /* Updated for SUN-SOLARIS-INTEL. */
158
159 /* - SPICELIB Version 1.19.0, 13-MAY-2010 (BVS) */
160
161 /* Updated for SUN-SOLARIS-INTEL-CC_C. */
162
163 /* - SPICELIB Version 1.18.0, 13-MAY-2010 (BVS) */
164
165 /* Updated for SUN-SOLARIS-INTEL-64BIT-CC_C. */
166
167 /* - SPICELIB Version 1.17.0, 13-MAY-2010 (BVS) */
168
169 /* Updated for SUN-SOLARIS-64BIT-NATIVE_C. */
170
171 /* - SPICELIB Version 1.16.0, 13-MAY-2010 (BVS) */
172
173 /* Updated for PC-WINDOWS-64BIT-IFORT. */
174
175 /* - SPICELIB Version 1.15.0, 13-MAY-2010 (BVS) */
176
177 /* Updated for PC-LINUX-64BIT-GFORTRAN. */
178
179 /* - SPICELIB Version 1.14.0, 13-MAY-2010 (BVS) */
180
181 /* Updated for PC-64BIT-MS_C. */
182
183 /* - SPICELIB Version 1.13.0, 13-MAY-2010 (BVS) */
184
185 /* Updated for MAC-OSX-64BIT-INTEL_C. */
186
187 /* - SPICELIB Version 1.12.0, 13-MAY-2010 (BVS) */
188
189 /* Updated for MAC-OSX-64BIT-IFORT. */
190
191 /* - SPICELIB Version 1.11.0, 13-MAY-2010 (BVS) */
192
193 /* Updated for MAC-OSX-64BIT-GFORTRAN. */
194
195 /* - SPICELIB Version 1.10.0, 18-MAR-2009 (BVS) */
196
197 /* Updated for PC-LINUX-GFORTRAN. */
198
199 /* - SPICELIB Version 1.9.0, 18-MAR-2009 (BVS) */
200
201 /* Updated for MAC-OSX-GFORTRAN. */
202
203 /* - SPICELIB Version 1.8.0, 19-FEB-2008 (BVS) */
204
205 /* Updated for PC-LINUX-IFORT. */
206
207 /* - SPICELIB Version 1.7.0, 14-NOV-2006 (BVS) */
208
209 /* Updated for PC-LINUX-64BIT-GCC_C. */
210
211 /* - SPICELIB Version 1.6.0, 14-NOV-2006 (BVS) */
212
213 /* Updated for MAC-OSX-INTEL_C. */
214
215 /* - SPICELIB Version 1.5.0, 14-NOV-2006 (BVS) */
216
217 /* Updated for MAC-OSX-IFORT. */
218
219 /* - SPICELIB Version 1.4.0, 14-NOV-2006 (BVS) */
220
221 /* Updated for PC-WINDOWS-IFORT. */
222
223 /* - SPICELIB Version 1.3.0, 26-OCT-2005 (BVS) */
224
225 /* Updated for SUN-SOLARIS-64BIT-GCC_C. */
226
227 /* - SPICELIB Version 1.2.0, 03-JAN-2005 (BVS) */
228
229 /* Updated for PC-CYGWIN_C. */
230
231 /* - SPICELIB Version 1.1.0, 03-JAN-2005 (BVS) */
232
233 /* Updated for PC-CYGWIN. */
234
235 /* - SPICELIB Version 1.0.1, 17-JUL-2002 */
236
237 /* Added MAC-OSX environments. */
238
239 /* - SPICELIB Version 1.0.0, 07-NOV-2001 */
240
241 /* -& */
242
243 /* Unit and file table size parameters. */
244
245 /* FTSIZE is the maximum number of files (DAS and DAF) that a */
246 /* user may have open simultaneously. */
247
248
249 /* RSVUNT is the number of units protected from being locked */
250 /* to a particular handle by ZZDDHHLU. */
251
252
253 /* SCRUNT is the number of units protected for use by scratch */
254 /* files. */
255
256
257 /* UTSIZE is the maximum number of logical units this manager */
258 /* will utilize at one time. */
259
260
261 /* Access method enumeration. These parameters are used to */
262 /* identify which access method is associated with a particular */
263 /* handle. They need to be synchronized with the STRAMH array */
264 /* defined in ZZDDHGSD in the following fashion: */
265
266 /* STRAMH ( READ ) = 'READ' */
267 /* STRAMH ( WRITE ) = 'WRITE' */
268 /* STRAMH ( SCRTCH ) = 'SCRATCH' */
269 /* STRAMH ( NEW ) = 'NEW' */
270
271 /* These values are used in the file table variable FTAMH. */
272
273
274 /* Binary file format enumeration. These parameters are used to */
275 /* identify which binary file format is associated with a */
276 /* particular handle. They need to be synchronized with the STRBFF */
277 /* array defined in ZZDDHGSD in the following fashion: */
278
279 /* STRBFF ( BIGI3E ) = 'BIG-IEEE' */
280 /* STRBFF ( LTLI3E ) = 'LTL-IEEE' */
281 /* STRBFF ( VAXGFL ) = 'VAX-GFLT' */
282 /* STRBFF ( VAXDFL ) = 'VAX-DFLT' */
283
284 /* These values are used in the file table variable FTBFF. */
285
286
287 /* Some random string lengths... more documentation required. */
288 /* For now this will have to suffice. */
289
290
291 /* Architecture enumeration. These parameters are used to identify */
292 /* which file architecture is associated with a particular handle. */
293 /* They need to be synchronized with the STRARC array defined in */
294 /* ZZDDHGSD in the following fashion: */
295
296 /* STRARC ( DAF ) = 'DAF' */
297 /* STRARC ( DAS ) = 'DAS' */
298
299 /* These values will be used in the file table variable FTARC. */
300
301
302 /* For the following environments, record length is measured in */
303 /* characters (bytes) with eight characters per double precision */
304 /* number. */
305
306 /* Environment: Sun, Sun FORTRAN */
307 /* Source: Sun Fortran Programmer's Guide */
308
309 /* Environment: PC, MS FORTRAN */
310 /* Source: Microsoft Fortran Optimizing Compiler User's Guide */
311
312 /* Environment: Macintosh, Language Systems FORTRAN */
313 /* Source: Language Systems FORTRAN Reference Manual, */
314 /* Version 1.2, page 12-7 */
315
316 /* Environment: PC/Linux, g77 */
317 /* Source: Determined by experiment. */
318
319 /* Environment: PC, Lahey F77 EM/32 Version 4.0 */
320 /* Source: Lahey F77 EM/32 Language Reference Manual, */
321 /* page 144 */
322
323 /* Environment: HP-UX 9000/750, FORTRAN/9000 Series 700 computers */
324 /* Source: FORTRAN/9000 Reference-Series 700 Computers, */
325 /* page 5-110 */
326
327 /* Environment: NeXT Mach OS (Black Hardware), */
328 /* Absoft Fortran Version 3.2 */
329 /* Source: NAIF Program */
330
331
332 /* The following parameter defines the size of a string used */
333 /* to store a filenames on this target platform. */
334
335
336 /* The following parameter controls the size of the character record */
337 /* buffer used to read data from non-native files. */
338
339 /* $ Brief_I/O */
340
341 /* Variable I/O Description */
342 /* -------- --- -------------------------------------------------- */
343 /* MARKER I A substring in the long error message to be */
344 /* replaced. */
345 /* HANDLE I DAF/DAS handle associated with a file. */
346 /* FILEN P Maximum length of filename. */
347
348 /* $ Detailed_Input */
349
350 /* MARKER is a character string that marks a position in */
351 /* the long error message where a file name is to be */
352 /* substituted. Leading and trailing blanks in MARKER */
353 /* are not significant. */
354
355 /* Case IS significant; 'XX' is considered to be */
356 /* a different marker from 'xx'. */
357
358 /* HANDLE is the DAF/DAS handle associated with the file of */
359 /* interest. HANDLE must be associated with a currently */
360 /* loaded DAF or DAS file. */
361
362 /* $ Detailed_Output */
363
364 /* None. */
365
366 /* $ Parameters */
367
368 /* FILEN is the maximum file name length that can be */
369 /* accommodated by this routine. Currently this */
370 /* parameter is defined in the include file */
371 /* zzddhman.inc. */
372
373 /* $ Exceptions */
374
375 /* Error free. */
376
377
378 /* 1) If HANDLE refers to a scratch DAS file, the string inserted */
379 /* into the long error message is */
380
381 /* 'DAS SCRATCH FILE' */
382
383 /* 2) If HANDLE is not associated with a loaded DAF or DAS file, */
384 /* the string inserted into the long error message is: */
385
386 /* '<No name found for handle #>' */
387
388 /* where the handle number is substituted for the marker '#'. */
389
390 /* $ Files */
391
392 /* See "Detailed_Input" description of the variable HANDLE. */
393
394 /* $ Particulars */
395
396 /* This routine provides a convenient and error-free mechanism */
397 /* for inserting a DAF or DAS file name into an error message, */
398 /* given the file handle associated with the file of interest. */
399
400 /* $ Examples */
401
402 /* 1) Create an error message pertaining to an SPK file */
403 /* designated by HANDLE, then signal an error. */
404
405 /* CALL SETMSG ( 'SPK file # contains a type 3 segment ' // */
406 /* . 'with invalid polynomial degree #. ' // */
407 /* . 'Segment index in file is #.' ) */
408 /* CALL ERRHAN ( '#', HANDLE ) */
409 /* CALL ERRINT ( '#', DEGREE ) */
410 /* CALL ERRINT ( '#', I ) */
411 /* CALL SIGERR ( 'SPICE(INVALIDDEGREE)' ) */
412
413 /* $ Restrictions */
414
415 /* 1) The supported filename length is limited by the parameter */
416 /* FILEN. */
417
418 /* $ Literature_References */
419
420 /* None. */
421
422 /* $ Author_and_Institution */
423
424 /* N.J. Bachman (JPL) */
425
426 /* $ Version */
427
428 /* - SPICELIB Version 1.0.1, 05-FEB-2015 (NJB) */
429
430 /* Removed header comments about restrictions */
431 /* on using this routine for DAS files. */
432
433 /* - SPICELIB Version 1.0.0, 04-JAN-2002 (NJB) */
434
435 /* -& */
436 /* $ Index_Entries */
437
438 /* insert DAF or DAS filename into long error message */
439
440 /* -& */
441
442 /* Local parameters */
443
444
445 /* Local variables */
446
447
448 /* Get the name of the file designated by the input handle. */
449
450 zzddhnfo_(handle, fname, &intarc, &intbff, &intamh, &found, (ftnlen)255);
451 if (! found) {
452 intstr_(handle, numstr, (ftnlen)32);
453 s_copy(fname, "<No name found for handle ", (ftnlen)255, (ftnlen)26);
454 suffix_(numstr, &c__1, fname, (ftnlen)32, (ftnlen)255);
455 suffix_(">", &c__0, fname, (ftnlen)1, (ftnlen)255);
456 }
457
458 /* Insert the file name string into the long error message. */
459
460 errch_(marker, fname, marker_len, (ftnlen)255);
461 return 0;
462 } /* errhan_ */
463
464