1 /******************************************************************************
2 *
3 *  NSSDC/CDF				 CDF Standard Interface (I) /FORTRAN.
4 *
5 *  Version 2.7, 14-Feb-96, Hughes STX.
6 *
7 *  Modification history:
8 *
9 *   V1.0  22-Jan-91, J Love	Original version (for CDF V2.0).
10 *   V1.1  11-Feb-91, J Love	Fixed max_rec in CDF_inquire.
11 *   V2.0   1-Jun-91, J Love	Renamed (was CDF_V2_FORTRAN_IF.C).  Changed
12 *				for new CDF V2.1 internal structures.  Also
13 *				calls INTERNAL i/f directly rather than using
14 *				C i/f.
15 *   V2.1  30-Jul-91, J Love	Use 'CDFlib'.  If variable data type is CHAR
16 *				or UCHAR, check for %DESCR (if VMS).
17 *   V2.2  20-May-92, J Love	Modified for IBM-PC port (Microsoft C/FORTRAN
18 *				necessary).  CDF V2.2.
19 *   V2.3   2-Sep-92, J Love	CDF V2.3 (shareable/NeXT).
20 *   V2.4  18-Oct-93, J Love	CDF V2.4 (DEC Alpha ports [`int' != `long']).
21 *   V2.4a  2-Mar-94, J Love	Fixed `CDF_create' (dimensionality checking).
22 *   V2.5   9-Nov-94, J Love	CDF V2.5.
23 *   V2.6  19-Jan-95, J Love	IRIX 6.0 (64-bit).
24 *   V2.6a 13-Jun-95, J Love	Linux.
25 *   V2.7  14-Feb-96, J Love	CDF V2.6 (renamed - previously `cdf_f_if.c').
26 *   V3.0  28-Aug-01, M Liu      Add CDF_getrVarsRecordData,
27 *                               CDF_getzVarsRecordData, CDF_putrVarsRecordData,
28 *                               CDF_putzVarsRecordData.
29 *   V3.1  26-May-05, M Liu      Initial version (for CDF V3.1).
30 *   V3.2  23-Oct-08, M Liu      Modified CDF_getrVarsRecordData,
31 *                               CDF_getzVarsRecordData, CDF_putrVarsRecordData,
32 *                               CDF_putzVarsRecordData to use the number of
33 *                               passed variables to allocate buffers.
34 *   V3.3  10-Jan-09, M Liu      Added CDF_set_Validate and CDF_get_Validate.
35 *
36 ******************************************************************************/
37 
38 /******************************************************************************
39 *
40 * Notes:
41 *
42 *    For the FORTRAN interfaces everything is indexed from one (1) while for
43 *  the C interfaces everything is indexed from zero (0) [eg. variable and
44 *  attribute numbers, record numbers, indices, entry numbers].  For this
45 *  reason one (1) is subtracted from arguments passed in while one (1) is
46 *  added to arguments passed out (where appropriate).
47 *
48 *    The FORTRAN interfaces use INTEGER*4 as the data type for all numerical
49 *  values passed in/out while the C interfaces use `long'.  These are the same
50 *  on all supported platforms except the DEC Alpha (where `long' is 8 bytes).
51 *  For this reason temporary variables/arrays of size `long' are used in the
52 *  calls to the CDF library (the direct C interface).  This causes a small
53 *  performance loss on the other platforms mainly when calling CDF_var_get or
54 *  CDF_var_put (but then CDF_var_hyper_get and CDF_var_hyper_put should have
55 *  been used instead).
56 *
57 ******************************************************************************/
58 
59 /******************************************************************************
60 *
61 *  Notes for VMS version:
62 *
63 *	To make the user's life a little easier, all names and attribute
64 *  values (for attributes of data types CDF_CHAR and CDF_UCHAR) may be passed
65 *  in and out by either reference or descriptor.  The default passing mode
66 *  for an embedded character string (e.g., CALL subr (..., 'string', ...)) or
67 *  a CHARACTER variable symbol (e.g., CALL subr (..., ATTR_NAME, ...) where
68 *  ATTR_NAME is defined as CHARACTER*8) is by descriptor when passing from
69 *  FORTRAN to C in VMS.
70 *
71 *	An embedded character string could be enclosed in %REF() to force
72 *  passing by reference since the FORTRAN compiler puts a NUL character at
73 *  the end of these strings as expected by the CDF V2.0 library (written in
74 *  C).  Enclosing a CHARACTER variable symbol in %REF() will result in
75 *  an error, however, because a NUL character is not placed at the ends of
76 *  these type strings by the FORTRAN compiler.  The user would have to
77 *  supply the terminating NUL.  By letting the passing mode default to
78 *  by-descriptor, this interface will supply the terminating NUL.
79 *
80 *	The main difference here from CDF Version 1 is that the %REF() is
81 *  not needed when passing out names and attribute values.  Also, variable
82 *  values for character variables need not be enclosed in %REF().
83 *
84 ******************************************************************************/
85 
86 /******************************************************************************
87 *
88 *  Notes for UNIX version:
89 *
90 *    All passing between FORTRAN and C on UNIX systems is done by reference.
91 *  When character strings are passed between FORTRAN and C, extra arguments
92 *  are added to the argument list containing the lengths of those character
93 *  strings (EXCEPT on NeXT machines - FORTRAN applications must NUL-terminate
94 *  passed character strings).
95 *
96 *    Entry points have been made lowercase because the FORTRAN compiler
97 *  converts all uppercase characters to lowercase in entry points.  This way
98 *  the linker will find everything.  Unix FORTRAN compilers and linkers also
99 *  seem to like trailing '_'s (except on the IBM-RS6000/AIX, HP9000/HP-UX,
100 *  and NeXT/Mach).
101 *
102 ******************************************************************************/
103 
104 /******************************************************************************
105 *
106 *  Notes for IBM PC version:
107 *
108 *    The Standard Interface/FORTRAN is supported for the Microsoft FORTRAN
109 *  compiler.  Microsoft C must be used to compile/link the CDF library
110 *  (including this file).
111 *
112 ******************************************************************************/
113 
114 /******************************************************************************
115 *
116 *  Notes for Macintosh version (MPW Fortran):
117 *
118 *    The Standard Interface/FORTRAN is supported for the MPW FORTRAN compiler.
119 *  MPW C must be used to compile/link the CDF library (including this file).
120 *
121 ******************************************************************************/
122 
123 #include "cdflib.h"
124 #include "cdflib64.h"
125 
126 /******************************************************************************
127 *  CDF_create.
128 ******************************************************************************/
129 
130 VISIBLE_PREFIX
131 Fif_PREFIXa
132 void
133 Fif_PREFIXb
134 Fif_ENTRYPOINT(cdf_create__,cdf_create_,cdf_create,CDF_CREATE)
135 (CDF_name, num_dims, dim_sizes, encoding, majority, id, status
136  Fif_GHOSTARG(len))
137 char	  *CDF_name;		/* In: CDF name. */
138 Int32	  *num_dims;		/* In: Number of dimensions. */
139 Int32	  dim_sizes[];		/* In: Dimension sizes. */
140 Int32	  *encoding;		/* In: Host or network. */
141 Int32	  *majority;		/* In: Row or column major. */
142 Int32	  *id;			/* Out: CDF identifier. */
143 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)144 Fif_GHOSTDEF(len)		/* Invisible length of "CDF_name"
145 				   (generated by FORTRAN compiler). */
146 {
147   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
148   int dimN;
149   long dimSizesT[CDF_MAX_DIMS];
150   CDFid idT;
151   long num_dimsT = (long) *num_dims;
152   long encodingT = (long) *encoding;
153   long majorityT = (long) *majority;
154 
155   if (num_dimsT < 0 || num_dimsT > CDF_MAX_DIMS) {
156     *status = (Int32) BAD_NUM_DIMS;
157     return;
158   }
159 
160   for (dimN = 0; dimN < num_dimsT; dimN++) {
161      dimSizesT[dimN] = (long) dim_sizes[dimN];
162   }
163 
164   *status = (Int32) CDFlib (CREATE_, CDF_,
165 #if defined(Fif_DESCR)
166 					   DESCRtoREFnul(CDF_name,
167 							 CDF_PATHNAME_LEN,
168 							 &ssh),
169 #endif
170 #if defined(Fif_GHOSTLEN)
171 					   NULterminate(CDF_name,
172 							Fif_GHOSTUSE(len),
173 							&ssh),
174 #endif
175 #if defined(Fif_NOLEN)
176 					   FindEndNUL(CDF_name,
177 						      CDF_PATHNAME_LEN,&ssh),
178 #endif
179 					   num_dimsT, dimSizesT, &idT,
180 			    NULL_);
181   FreeStrings (ssh);
182   if (StatusBAD(*status)) return;
183 
184   *status = (Int32) CDFlib (PUT_, CDF_ENCODING_, encodingT,
185 				  CDF_MAJORITY_, majorityT,
186 			    NULL_);
187   if (StatusBAD(*status)) {
188     CDFlib (DELETE_, CDF_,
189 	    NULL_);
190     return;
191   }
192 
193   *id = CDFidToInt32 (idT);
194   return;
195 }
196 
197 /******************************************************************************
198 *  CDF_create_cdf.
199 ******************************************************************************/
200 
201 VISIBLE_PREFIX
202 Fif_PREFIXa
203 void
204 Fif_PREFIXb
205 Fif_ENTRYPOINT(cdf_create_cdf__,
206                cdf_create_cdf_,
207                cdf_create_cdf,
208                CDF_CREATE_CDF)
209 (CDF_name, id, status
210  Fif_GHOSTARG(len))
211 char	  *CDF_name;		/* In: CDF name. */
212 Int32	  *id;			/* Out: CDF identifier. */
213 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)214 Fif_GHOSTDEF(len)		/* Invisible length of "CDF_name"
215 				   (generated by FORTRAN compiler). */
216 {
217   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
218   long dimSizesT[1] = {0};
219   CDFid idT;
220 
221   *status = (Int32) CDFlib (CREATE_, CDF_,
222 #if defined(Fif_DESCR)
223 					   DESCRtoREFnul(CDF_name,
224 							 CDF_PATHNAME_LEN,
225 							 &ssh),
226 #endif
227 #if defined(Fif_GHOSTLEN)
228 					   NULterminate(CDF_name,
229 							Fif_GHOSTUSE(len),
230 							&ssh),
231 #endif
232 #if defined(Fif_NOLEN)
233 					   FindEndNUL(CDF_name,
234 						      CDF_PATHNAME_LEN,&ssh),
235 #endif
236 					   0L, dimSizesT, &idT,
237 			    NULL_);
238 
239   FreeStrings (ssh);
240   if (StatusBAD(*status)) return;
241 
242   *id = CDFidToInt32 (idT);
243   return;
244 }
245 
246 /******************************************************************************
247 *  CDF_open.
248 ******************************************************************************/
249 
250 VISIBLE_PREFIX
251 Fif_PREFIXa
252 void
253 Fif_PREFIXb
254 Fif_ENTRYPOINT(cdf_open__,cdf_open_,cdf_open,CDF_OPEN)
255 (CDF_name, id, status Fif_GHOSTARG(len))
256 void	  *CDF_name;		/* In: CDF name. */
257 Int32	  *id;			/* Out: CDF identifier. */
258 Int32     *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)259 Fif_GHOSTDEF(len)		/* Invisible length of "CDF_name"
260 				   (generated by FORTRAN compiler). */
261 {
262   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
263   CDFid idT;
264 
265   *status = (Int32) CDFlib (OPEN_, CDF_,
266 #if defined(Fif_DESCR)
267 					 DESCRtoREFnul(CDF_name,
268 						       CDF_PATHNAME_LEN,&ssh),
269 #endif
270 #if defined(Fif_GHOSTLEN)
271 					 NULterminate(CDF_name,
272 						      Fif_GHOSTUSE(len),&ssh),
273 #endif
274 #if defined(Fif_NOLEN)
275 					 FindEndNUL(CDF_name,CDF_PATHNAME_LEN,
276 						    &ssh),
277 #endif
278 					 &idT,
279 			    NULL_);
280   FreeStrings (ssh);
281   if (StatusBAD(*status)) return;
282 
283   *id = CDFidToInt32 (idT);
284   return;
285 }
286 
287 /******************************************************************************
288 *  CDF_open_cdf.
289 ******************************************************************************/
290 
291 VISIBLE_PREFIX
292 Fif_PREFIXa
293 void
294 Fif_PREFIXb
295 Fif_ENTRYPOINT(cdf_open_cdf__,cdf_open_cdf_,cdf_open_cdf,CDF_OPEN_CDF)
296 (CDF_name, id, status Fif_GHOSTARG(len))
297 void	  *CDF_name;		/* In: CDF name. */
298 Int32	  *id;			/* Out: CDF identifier. */
299 Int32     *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)300 Fif_GHOSTDEF(len)		/* Invisible length of "CDF_name"
301 				   (generated by FORTRAN compiler). */
302 {
303   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
304   CDFid idT;
305 
306   *status = (Int32) CDFlib (OPEN_, CDF_,
307 #if defined(Fif_DESCR)
308 					 DESCRtoREFnul(CDF_name,
309 						       CDF_PATHNAME_LEN,&ssh),
310 #endif
311 #if defined(Fif_GHOSTLEN)
312 					 NULterminate(CDF_name,
313 						      Fif_GHOSTUSE(len),&ssh),
314 #endif
315 #if defined(Fif_NOLEN)
316 					 FindEndNUL(CDF_name,CDF_PATHNAME_LEN,
317 						    &ssh),
318 #endif
319 					 &idT,
320 			    NULL_);
321   FreeStrings (ssh);
322   if (StatusBAD(*status)) return;
323 
324   *id = CDFidToInt32 (idT);
325   return;
326 }
327 
328 /******************************************************************************
329 *  CDF_doc.
330 ******************************************************************************/
331 
332 VISIBLE_PREFIX
333 Fif_PREFIXa
334 void
335 Fif_PREFIXb
336 Fif_ENTRYPOINT(cdf_doc__,cdf_doc_,cdf_doc,CDF_DOC)
337 (id, version, release, text, status Fif_GHOSTARG(text_len))
338 Int32	  *id;			/* In: CDF identifier. */
339 Int32	  *version;		/* Out: CDF version number (creating library
340 					version number). */
341 Int32	  *release;		/* Out: CDF release number (creating library
342 					release number). */
343 void	  *text;		/* Out: Copyright text. */
344 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(text_len)345 Fif_GHOSTDEF(text_len)		/* Invisible length of "text"
346 				   (generated by FORTRAN compiler). */
347 {
348   char copyRightTextT[CDF_COPYRIGHT_LEN+1];
349   long versionT, releaseT;
350 
351   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
352 			    GET_, CDF_VERSION_, &versionT,
353 				  CDF_RELEASE_, &releaseT,
354 				  CDF_COPYRIGHT_, copyRightTextT,
355 			    NULL_);
356   if (StatusBAD(*status)) return;
357 
358   *version = (Int32) versionT;
359   *release = (Int32) releaseT;
360 #if defined(Fif_GHOSTLEN)
361   CtoFORTstring (copyRightTextT, text, Fif_GHOSTUSE(text_len));
362 #else
363   CtoFORTstring (copyRightTextT, text, CDF_COPYRIGHT_LEN);
364 #endif
365   return;
366 }
367 
368 /******************************************************************************
369 *  CDF_inquire.
370 ******************************************************************************/
371 
372 VISIBLE_PREFIX
373 Fif_PREFIXa
374 void
375 Fif_PREFIXb
376 Fif_ENTRYPOINT(cdf_inquire__,cdf_inquire_,cdf_inquire,CDF_INQUIRE)
377 (id, num_dims, dim_sizes, encoding, majority, max_rec, num_vars, num_attrs,
378 status)
379 Int32	  *id;			/* In: CDF identifier. */
380 Int32	  *num_dims;		/* Out: Number of rDimensions. */
381 Int32	  dim_sizes[];		/* Out: rDimension sizes. */
382 Int32	  *encoding;		/* Out: Host or network. */
383 Int32	  *majority;		/* Out: Row or column major. */
384 Int32	  *max_rec;		/* Out: Maximum rRecord number. */
385 Int32	  *num_vars;		/* Out: Number of rVariables. */
386 Int32	  *num_attrs;		/* Out: Number of attributes. */
387 Int32	  *status;		/* Out: CDF status code. */
388 {
389   long maxRecT, numDimsT, dimSizesT[CDF_MAX_DIMS], encodingT, majorityT,
390        numVarsT, numAttrsT;
391   int dimN;
392 
393   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
394 			    GET_, rVARs_NUMDIMS_, &numDimsT,
395 				  rVARs_DIMSIZES_, dimSizesT,
396 			          CDF_ENCODING_, &encodingT,
397 			      	  CDF_MAJORITY_, &majorityT,
398 			      	  rVARs_MAXREC_, &maxRecT,
399 			      	  CDF_NUMrVARS_, &numVarsT,
400 			      	  CDF_NUMATTRS_, &numAttrsT,
401 			    NULL_);
402   if (StatusBAD(*status)) return;
403 
404   *num_dims = (Int32) numDimsT;
405   for (dimN = 0; dimN < (int) numDimsT; dimN++) {
406      dim_sizes[dimN] = (Int32) dimSizesT[dimN];
407   }
408   *encoding = (Int32) encodingT;
409   *majority = (Int32) majorityT;
410   *max_rec = (Int32) (maxRecT + 1);
411   *num_vars = (Int32) numVarsT;
412   *num_attrs = (Int32) numAttrsT;
413   return;
414 }
415 
416 /******************************************************************************
417 *  CDF_inquire_cdf.
418 ******************************************************************************/
419 
420 VISIBLE_PREFIX
421 Fif_PREFIXa
422 void
423 Fif_PREFIXb
424 Fif_ENTRYPOINT(cdf_inquire_cdf__,cdf_inquire_cdf_,cdf_inquire_cdf,
425                CDF_INQUIRE_CDF)
426 (id, num_dims, dim_sizes, encoding, majority, max_rrec, num_rvars,
427  max_zrec, num_zvars, num_attrs,
428 status)
429 Int32	  *id;			/* In: CDF identifier. */
430 Int32	  *num_dims;		/* Out: Number of rDimensions. */
431 Int32	  dim_sizes[];		/* Out: rDimension sizes. */
432 Int32	  *encoding;		/* Out: Host or network. */
433 Int32	  *majority;		/* Out: Row or column major. */
434 Int32	  *max_rrec;		/* Out: Maximum rRecord number. */
435 Int32	  *num_rvars;		/* Out: Number of rVariables. */
436 Int32     *max_zrec;		/* Out: Maximum zRecord number. */
437 Int32     *num_zvars;		/* Out: Number of zVariables. */
438 Int32	  *num_attrs;		/* Out: Number of attributes. */
439 Int32	  *status;		/* Out: CDF status code. */
440 {
441   long maxrRecT, numDimsT, dimSizesT[CDF_MAX_DIMS], encodingT, majorityT,
442        numrVarsT, numAttrsT, numzVarsT, maxzRecT;
443   int dimN;
444 
445   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
446 			    GET_, rVARs_NUMDIMS_, &numDimsT,
447 				  rVARs_DIMSIZES_, dimSizesT,
448 			          CDF_ENCODING_, &encodingT,
449 			      	  CDF_MAJORITY_, &majorityT,
450 			      	  rVARs_MAXREC_, &maxrRecT,
451 			      	  CDF_NUMrVARS_, &numrVarsT,
452 				  zVARs_MAXREC_, &maxzRecT,
453 				  CDF_NUMzVARS_, &numzVarsT,
454 			      	  CDF_NUMATTRS_, &numAttrsT,
455 			    NULL_);
456   if (StatusBAD(*status)) return;
457 
458   *num_dims = (Int32) numDimsT;
459   for (dimN = 0; dimN < (int) numDimsT; dimN++) {
460      dim_sizes[dimN] = (Int32) dimSizesT[dimN];
461   }
462   *encoding = (Int32) encodingT;
463   *majority = (Int32) majorityT;
464   *max_rrec = (Int32) (maxrRecT + 1);
465   *num_rvars = (Int32) numrVarsT;
466   *num_attrs = (Int32) numAttrsT;
467   *max_zrec = (Int32) (maxzRecT + 1);
468   *num_zvars = (Int32) numzVarsT;
469   return;
470 }
471 
472 /******************************************************************************
473 *  CDF_close.
474 ******************************************************************************/
475 
476 VISIBLE_PREFIX
477 Fif_PREFIXa
478 void
479 Fif_PREFIXb
480 Fif_ENTRYPOINT(cdf_close__,cdf_close_,cdf_close,CDF_CLOSE)
481 (id, status)
482 Int32	  *id;			/* In: CDF identifier. */
483 Int32	  *status;		/* Out: CDF status code. */
484 {
485   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
486 			    CLOSE_, CDF_,
487 			    NULL_);
488   return;
489 }
490 
491 /******************************************************************************
492 *  CDF_close_cdf.
493 ******************************************************************************/
494 
495 VISIBLE_PREFIX
496 Fif_PREFIXa
497 void
498 Fif_PREFIXb
499 Fif_ENTRYPOINT(cdf_close_cdf__,cdf_close_cdf_,cdf_close_cdf,CDF_CLOSE_CDF)
500 (id, status)
501 Int32	  *id;			/* In: CDF identifier. */
502 Int32	  *status;		/* Out: CDF status code. */
503 {
504   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
505 			    CLOSE_, CDF_,
506 			    NULL_);
507   return;
508 }
509 
510 /******************************************************************************
511 *  CDF_delete.
512 ******************************************************************************/
513 
514 VISIBLE_PREFIX
515 Fif_PREFIXa
516 void
517 Fif_PREFIXb
518 Fif_ENTRYPOINT(cdf_delete__,cdf_delete_,cdf_delete,CDF_DELETE)
519 (id, status)
520 Int32	  *id;			/* In: CDF identifier. */
521 Int32	  *status;		/* Out: CDF status code. */
522 {
523   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
524 			    DELETE_, CDF_,
525 			    NULL_);
526   return;
527 }
528 
529 /******************************************************************************
530 *  CDF_delete_cdf.
531 ******************************************************************************/
532 
533 VISIBLE_PREFIX
534 Fif_PREFIXa
535 void
536 Fif_PREFIXb
537 Fif_ENTRYPOINT(cdf_delete_cdf__,cdf_delete_cdf_,cdf_delete_cdf,CDF_DELETE_CDF)
538 (id, status)
539 Int32	  *id;			/* In: CDF identifier. */
540 Int32	  *status;		/* Out: CDF status code. */
541 {
542   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
543 			    DELETE_, CDF_,
544 			    NULL_);
545   return;
546 }
547 
548 /******************************************************************************
549 *  CDF_attr_create.
550 ******************************************************************************/
551 
552 VISIBLE_PREFIX
553 Fif_PREFIXa
554 void
555 Fif_PREFIXb
556 Fif_ENTRYPOINT(cdf_attr_create__,
557 	       cdf_attr_create_,
558 	       cdf_attr_create,
559 	       CDF_ATTR_CREATE)
560 (id, attr_name, attr_scope, attr_num, status Fif_GHOSTARG(len))
561 Int32	  *id;		   	/* In: CDF identifier. */
562 void	  *attr_name;	   	/* In: Attribute name. */
563 Int32	  *attr_scope;		/* In: Attribute scope. */
564 Int32	  *attr_num;	   	/* Out: Attribute number. */
565 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)566 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
567 				   (generated by FORTRAN compiler). */
568 {
569   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
570   long attrNumT;
571   long scopeT = (long) *attr_scope;
572   int LFS = FALSE;
573   struct CDFstruct *CDF;
574 
575   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
576   if (isLFS(CDF)) LFS = TRUE;
577 
578   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
579 			    CREATE_, ATTR_,
580 #if defined(Fif_DESCR)
581 					    DESCRtoREFnul(attr_name,
582 							  (LFS ?
583 							CDF_ATTR_NAME_LEN256 :
584 							CDF_ATTR_NAME_LEN),
585 							  &ssh),
586 #endif
587 #if defined(Fif_GHOSTLEN)
588 					    NULterminate(attr_name,
589 							 Fif_GHOSTUSE(len),
590 							 &ssh),
591 #endif
592 #if defined(Fif_NOLEN)
593 					    FindEndNUL(attr_name,
594                                                           (LFS ?
595                                                         CDF_ATTR_NAME_LEN256 :
596                                                         CDF_ATTR_NAME_LEN),
597 						       &ssh),
598 #endif
599 					    scopeT, &attrNumT,
600 			    NULL_);
601   FreeStrings (ssh);
602   if (StatusBAD(*status)) return;
603 
604   *attr_num = (Int32) (attrNumT + 1);
605   return;
606 }
607 
608 /******************************************************************************
609 *  CDF_create_attr.
610 ******************************************************************************/
611 
612 VISIBLE_PREFIX
613 Fif_PREFIXa
614 void
615 Fif_PREFIXb
616 Fif_ENTRYPOINT(cdf_create_attr__,
617 	       cdf_create_attr_,
618 	       cdf_create_attr,
619 	       CDF_CREATE_ATTR)
620 (id, attr_name, attr_scope, attr_num, status Fif_GHOSTARG(len))
621 Int32	  *id;		   	/* In: CDF identifier. */
622 void	  *attr_name;	   	/* In: Attribute name. */
623 Int32	  *attr_scope;		/* In: Attribute scope. */
624 Int32	  *attr_num;	   	/* Out: Attribute number. */
625 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)626 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
627 				   (generated by FORTRAN compiler). */
628 {
629   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
630   long attrNumT;
631   long scopeT = (long) *attr_scope;
632   int LFS = FALSE;
633   struct CDFstruct *CDF;
634 
635   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
636   if (isLFS(CDF)) LFS = TRUE;
637 
638   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
639 			    CREATE_, ATTR_,
640 #if defined(Fif_DESCR)
641 					    DESCRtoREFnul(attr_name,
642 							  (LFS ?
643 							CDF_ATTR_NAME_LEN256 :
644 							CDF_ATTR_NAME_LEN),
645 							  &ssh),
646 #endif
647 #if defined(Fif_GHOSTLEN)
648 					    NULterminate(attr_name,
649 							 Fif_GHOSTUSE(len),
650 							 &ssh),
651 #endif
652 #if defined(Fif_NOLEN)
653 					    FindEndNUL(attr_name,
654                                                           (LFS ?
655                                                         CDF_ATTR_NAME_LEN256 :
656                                                         CDF_ATTR_NAME_LEN),
657 						       &ssh),
658 #endif
659 					    scopeT, &attrNumT,
660 			    NULL_);
661   FreeStrings (ssh);
662   if (StatusBAD(*status)) return;
663 
664   *attr_num = (Int32) (attrNumT + 1);
665   return;
666 }
667 
668 /******************************************************************************
669 *  CDF_attr_num.
670 ******************************************************************************/
671 
672 VISIBLE_PREFIX
673 Fif_PREFIXa
674 Int32
675 Fif_PREFIXb
676 Fif_ENTRYPOINT(cdf_attr_num__,cdf_attr_num_,cdf_attr_num,CDF_ATTR_NUM)
677 (id, attr_name Fif_GHOSTARG(len))
678 Int32     *id;		   	/* In: CDF identifier. */
679 void	  *attr_name;	   	/* In: Attribute name. */
Fif_GHOSTDEF(len)680 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
681 				   (generated by FORTRAN compiler). */
682 {
683   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
684   CDFstatus status;
685   long attrNumT;
686   int LFS = FALSE;
687   struct CDFstruct *CDF;
688 
689   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
690   if (isLFS(CDF)) LFS = TRUE;
691 
692   status = CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
693 		   GET_, ATTR_NUMBER_,
694 #if defined(Fif_DESCR)
695 				       DESCRtoREFnul(attr_name,
696                                                      (LFS ?
697                                                       CDF_ATTR_NAME_LEN256 :
698                                                       CDF_ATTR_NAME_LEN),
699 						     &ssh),
700 #endif
701 #if defined(Fif_GHOSTLEN)
702 				       NULterminate(attr_name,
703 						    Fif_GHOSTUSE(len),&ssh),
704 #endif
705 #if defined(Fif_NOLEN)
706 				       FindEndNUL(attr_name,
707                                                   (LFS ?
708                                                    CDF_ATTR_NAME_LEN256 :
709                                                    CDF_ATTR_NAME_LEN),
710 						  &ssh),
711 #endif
712 				       &attrNumT,
713 		   NULL_);
714   FreeStrings (ssh);
715 
716   if (StatusOK(status))
717     return ((Int32) (attrNumT + 1));
718   else
719     return ((Int32) status);
720 }
721 
722 /******************************************************************************
723 *  CDF_get_attr_num.
724 ******************************************************************************/
725 
726 VISIBLE_PREFIX
727 Fif_PREFIXa
728 Int32
729 Fif_PREFIXb
730 Fif_ENTRYPOINT(cdf_get_attr_num__,cdf_get_attr_num_,cdf_get_attr_num,
731                CDF_GET_ATTR_NUM)
732 (id, attr_name Fif_GHOSTARG(len))
733 Int32     *id;		   	/* In: CDF identifier. */
734 void	  *attr_name;	   	/* In: Attribute name. */
Fif_GHOSTDEF(len)735 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
736 				   (generated by FORTRAN compiler). */
737 {
738   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
739   CDFstatus status;
740   long attrNumT;
741   int LFS = FALSE;
742   struct CDFstruct *CDF;
743 
744   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
745   if (isLFS(CDF)) LFS = TRUE;
746 
747   status = CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
748 		   GET_, ATTR_NUMBER_,
749 #if defined(Fif_DESCR)
750 				       DESCRtoREFnul(attr_name,
751                                                      (LFS ?
752                                                       CDF_ATTR_NAME_LEN256 :
753                                                       CDF_ATTR_NAME_LEN),
754 						     &ssh),
755 #endif
756 #if defined(Fif_GHOSTLEN)
757 				       NULterminate(attr_name,
758 						    Fif_GHOSTUSE(len),&ssh),
759 #endif
760 #if defined(Fif_NOLEN)
761 				       FindEndNUL(attr_name,
762                                                   (LFS ?
763                                                    CDF_ATTR_NAME_LEN256 :
764                                                    CDF_ATTR_NAME_LEN),
765 						  &ssh),
766 #endif
767 				       &attrNumT,
768 		   NULL_);
769   FreeStrings (ssh);
770 
771   if (StatusOK(status))
772     return ((Int32) (attrNumT + 1));
773   else
774     return ((Int32) status);
775 }
776 
777 /******************************************************************************
778 *  CDF_attr_rename.
779 ******************************************************************************/
780 
781 VISIBLE_PREFIX
782 Fif_PREFIXa
783 void
784 Fif_PREFIXb
785 Fif_ENTRYPOINT(cdf_attr_rename__,
786 	       cdf_attr_rename_,
787 	       cdf_attr_rename,
788 	       CDF_ATTR_RENAME)
789 (id, attr_num, attr_name, status Fif_GHOSTARG(len))
790 Int32     *id;		   	/* In: CDF identifier. */
791 Int32	  *attr_num;	  	/* In: Attribute number. */
792 void	  *attr_name;	   	/* In: New attribute name. */
793 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)794 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
795 				   (generated by FORTRAN compiler). */
796 {
797   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
798   long attrNumT = (long) (*attr_num - 1);
799   int LFS = FALSE;
800   struct CDFstruct *CDF;
801 
802   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
803   if (isLFS(CDF)) LFS = TRUE;
804 
805   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
806 				     ATTR_, attrNumT,
807 			    PUT_, ATTR_NAME_,
808 #if defined(Fif_DESCR)
809 					      DESCRtoREFnul(attr_name,
810                                                             (LFS ?
811                                                         CDF_ATTR_NAME_LEN256 :
812                                                         CDF_ATTR_NAME_LEN),
813 							    &ssh),
814 #endif
815 #if defined(Fif_GHOSTLEN)
816 					      NULterminate(attr_name,
817 							   Fif_GHOSTUSE(len),
818 							   &ssh),
819 #endif
820 #if defined(Fif_NOLEN)
821 					      FindEndNUL(attr_name,
822                                                          (LFS ?
823                                                         CDF_ATTR_NAME_LEN256 :
824                                                         CDF_ATTR_NAME_LEN),
825 							 &ssh),
826 #endif
827 			    NULL_);
828   FreeStrings (ssh);
829   return;
830 }
831 
832 /******************************************************************************
833 *  CDF_rename_attr.
834 ******************************************************************************/
835 
836 VISIBLE_PREFIX
837 Fif_PREFIXa
838 void
839 Fif_PREFIXb
840 Fif_ENTRYPOINT(cdf_rename_attr__,
841 	       cdf_rename_attr_,
842 	       cdf_rename_attr,
843 	       CDF_RENAME_ATTR)
844 (id, attr_num, attr_name, status Fif_GHOSTARG(len))
845 Int32     *id;		   	/* In: CDF identifier. */
846 Int32	  *attr_num;	  	/* In: Attribute number. */
847 void	  *attr_name;	   	/* In: New attribute name. */
848 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)849 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
850 				   (generated by FORTRAN compiler). */
851 {
852   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
853   long attrNumT = (long) (*attr_num - 1);
854   int LFS = FALSE;
855   struct CDFstruct *CDF;
856 
857   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
858   if (isLFS(CDF)) LFS = TRUE;
859 
860   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
861 				     ATTR_, attrNumT,
862 			    PUT_, ATTR_NAME_,
863 #if defined(Fif_DESCR)
864 					      DESCRtoREFnul(attr_name,
865                                                             (LFS ?
866                                                         CDF_ATTR_NAME_LEN256 :
867                                                         CDF_ATTR_NAME_LEN),
868 							    &ssh),
869 #endif
870 #if defined(Fif_GHOSTLEN)
871 					      NULterminate(attr_name,
872 							   Fif_GHOSTUSE(len),
873 							   &ssh),
874 #endif
875 #if defined(Fif_NOLEN)
876 					      FindEndNUL(attr_name,
877                                                          (LFS ?
878                                                         CDF_ATTR_NAME_LEN256 :
879                                                         CDF_ATTR_NAME_LEN),
880 							 &ssh),
881 #endif
882 			    NULL_);
883   FreeStrings (ssh);
884   return;
885 }
886 
887 /******************************************************************************
888 *  CDF_attr_inquire.
889 ******************************************************************************/
890 
891 VISIBLE_PREFIX
892 Fif_PREFIXa
893 void
894 Fif_PREFIXb
895 Fif_ENTRYPOINT(cdf_attr_inquire__,
896 	       cdf_attr_inquire_,
897 	       cdf_attr_inquire,
898 	       CDF_ATTR_INQUIRE)
899 (id, attr_num, attr_name, attr_scope, max_entry, status Fif_GHOSTARG(len))
900 Int32	  *id;		   	/* In: CDF identifier. */
901 Int32	  *attr_num;	  	/* In: Attribute number. */
902 void	  *attr_name;      	/* Out: Attribute name. */
903 Int32	  *attr_scope;	   	/* Out: Attribute scope. */
904 Int32	  *max_entry;	   	/* Out: Maximum gEntry/rEntry number used. */
905 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)906 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
907 				   (generated by FORTRAN compiler). */
908 {
909   char attrNameT[CDF_ATTR_NAME_LEN256];
910   long maxEntryT, attrScopeT;
911   long attrNumT = (long) (*attr_num - 1);
912 
913   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
914 				     ATTR_, attrNumT,
915 			    GET_, ATTR_NAME_, attrNameT,
916 				  ATTR_SCOPE_, &attrScopeT,
917 			    NULL_);
918   if (StatusBAD(*status)) return;
919 
920   *status = (Int32) CDFlib (GET_, BOO(GLOBALscope(attrScopeT),
921 				      ATTR_MAXgENTRY_,
922 				      ATTR_MAXrENTRY_), &maxEntryT,
923 			    NULL_);
924   if (StatusBAD(*status)) return;
925 
926 #if defined(Fif_GHOSTLEN)
927   CtoFORTstring (attrNameT, attr_name, Fif_GHOSTUSE(len));
928 #else
929   CtoFORTstring (attrNameT, attr_name, CDF_ATTR_NAME_LEN256);
930 #endif
931   *attr_scope = (Int32) attrScopeT;
932   *max_entry = (Int32) (maxEntryT + 1);
933   return;
934 }
935 
936 /******************************************************************************
937 *  CDF_inquire_attr.
938 ******************************************************************************/
939 
940 VISIBLE_PREFIX
941 Fif_PREFIXa
942 void
943 Fif_PREFIXb
944 Fif_ENTRYPOINT(cdf_inquire_attr__,
945 	       cdf_inquire_attr_,
946 	       cdf_inquire_attr,
947 	       CDF_INQUIRE_ATTR)
948 (id, attr_num, attr_name, attr_scope, max_gentry, max_rentry, max_zentry,
949  status Fif_GHOSTARG(len))
950 Int32	  *id;		   	/* In: CDF identifier. */
951 Int32	  *attr_num;	  	/* In: Attribute number. */
952 void	  *attr_name;      	/* Out: Attribute name. */
953 Int32	  *attr_scope;	   	/* Out: Attribute scope. */
954 Int32     *max_gentry;          /* Out: Maximum gEntry number if global attribute. */
955 Int32     *max_rentry;          /* Out: Maximum rEntry number if variable attribute. */
956 Int32	  *max_zentry;	   	/* Out: Maximum zEntry number if variable attribute. */
957 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)958 Fif_GHOSTDEF(len)		/* Invisible length of "attr_name"
959 				   (generated by FORTRAN compiler). */
960 {
961   char attrNameT[CDF_ATTR_NAME_LEN256];
962   long maxgEntryT = -1, maxrEntryT = -1, maxzEntryT = -1, attrScopeT;
963   long attrNumT = (long) (*attr_num - 1);
964 
965   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
966 				     ATTR_, attrNumT,
967 			    GET_, ATTR_NAME_, attrNameT,
968 				  ATTR_SCOPE_, &attrScopeT,
969 			    NULL_);
970   if (StatusBAD(*status)) return;
971 
972   if (GLOBALscope(attrScopeT)) {
973     *status = (Int32) CDFlib (GET_, ATTR_MAXgENTRY_, &maxgEntryT,
974                               NULL_);
975     if (StatusBAD(*status)) return;
976   } else {
977     *status = (Int32) CDFlib (GET_, ATTR_MAXrENTRY_, &maxrEntryT,
978                                     ATTR_MAXzENTRY_, &maxzEntryT,
979                               NULL_);
980     if (StatusBAD(*status)) return;
981   }
982 
983 #if defined(Fif_GHOSTLEN)
984   CtoFORTstring (attrNameT, attr_name, Fif_GHOSTUSE(len));
985 #else
986   CtoFORTstring (attrNameT, attr_name, CDF_ATTR_NAME_LEN256);
987 #endif
988   *attr_scope = (Int32) attrScopeT;
989   *max_gentry = (Int32) (maxgEntryT + 1);
990   *max_rentry = (Int32) (maxrEntryT + 1);
991   *max_zentry = (Int32) (maxzEntryT + 1);
992   return;
993 }
994 
995 /******************************************************************************
996 *  CDF_attr_entry_inquire.
997 ******************************************************************************/
998 
999 VISIBLE_PREFIX
1000 Fif_PREFIXa
1001 void
1002 Fif_PREFIXb
1003 Fif_ENTRYPOINT(cdf_attr_entry_inquire__,
1004 	       cdf_attr_entry_inquire_,
1005 	       cdf_attr_entry_inquire,
1006 	       CDF_ATTR_ENTRY_INQUIRE)
1007 (id, attr_num, entry_num, data_type, num_elements, status)
1008 Int32	  *id;		   	/* In: CDF identifier. */
1009 Int32	  *attr_num;	  	/* In: Attribute number. */
1010 Int32	  *entry_num;	 	/* In: gEntry/rEntry number. */
1011 Int32	  *data_type;	   	/* Out: Data type. */
1012 Int32	  *num_elements;   	/* Out: Number of elements. */
1013 Int32	  *status;		/* Out: CDF status code. */
1014 {
1015   long dataTypeT, numElementsT, scope;
1016   long attrNumT = (long) (*attr_num - 1);
1017   long entryNumT = (long) (*entry_num - 1);
1018 
1019   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1020 				     ATTR_, attrNumT,
1021 			    GET_, ATTR_SCOPE_, &scope,
1022 			    NULL_);
1023   if (StatusBAD(*status)) return;
1024 
1025   *status = (Int32) CDFlib (SELECT_, BOO(GLOBALscope(scope),
1026 					 gENTRY_,rENTRY_), entryNumT,
1027 			    GET_, BOO(GLOBALscope(scope),
1028 				      gENTRY_DATATYPE_,
1029 				      rENTRY_DATATYPE_), &dataTypeT,
1030 				  BOO(GLOBALscope(scope),
1031 				      gENTRY_NUMELEMS_,
1032 				      rENTRY_NUMELEMS_), &numElementsT,
1033 			    NULL_);
1034   if (StatusBAD(*status)) return;
1035 
1036   *data_type = (Int32) dataTypeT;
1037   *num_elements = (Int32) numElementsT;
1038   return;
1039 }
1040 
1041 /******************************************************************************
1042 *  CDF_inquire_attr_gentry.
1043 ******************************************************************************/
1044 
1045 VISIBLE_PREFIX
1046 Fif_PREFIXa
1047 void
1048 Fif_PREFIXb
1049 Fif_ENTRYPOINT(cdf_inquire_attr_gentry__,
1050 	       cdf_inquire_attr_gentry_,
1051 	       cdf_inquire_attr_gentry,
1052 	       CDF_INQUIRE_ATTR_GENTRY)
1053 (id, attr_num, entry_num, data_type, num_elements, status)
1054 Int32	  *id;		   	/* In: CDF identifier. */
1055 Int32	  *attr_num;	  	/* In: Attribute number. */
1056 Int32	  *entry_num;	 	/* In: gEntry number. */
1057 Int32	  *data_type;	   	/* Out: Data type. */
1058 Int32	  *num_elements;   	/* Out: Number of elements. */
1059 Int32	  *status;		/* Out: CDF status code. */
1060 {
1061   long dataTypeT, numElementsT, scope;
1062   long attrNumT = (long) (*attr_num - 1);
1063   long entryNumT = (long) (*entry_num - 1);
1064 
1065   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1066 				     ATTR_, attrNumT,
1067 			    GET_, ATTR_SCOPE_, &scope,
1068 			    NULL_);
1069   if (StatusBAD(*status)) return;
1070   if (!GLOBALscope(scope)) {
1071     *status = (Int32) ILLEGAL_FOR_SCOPE;
1072     return;
1073   }
1074 
1075   *status = (Int32) CDFlib (SELECT_, gENTRY_, entryNumT,
1076 			    GET_, gENTRY_DATATYPE_, &dataTypeT,
1077 				  gENTRY_NUMELEMS_, &numElementsT,
1078 			    NULL_);
1079   if (StatusBAD(*status)) return;
1080 
1081   *data_type = (Int32) dataTypeT;
1082   *num_elements = (Int32) numElementsT;
1083   return;
1084 }
1085 
1086 /******************************************************************************
1087 *  CDF_inquire_attr_rentry.
1088 ******************************************************************************/
1089 
1090 VISIBLE_PREFIX
1091 Fif_PREFIXa
1092 void
1093 Fif_PREFIXb
1094 Fif_ENTRYPOINT(cdf_inquire_attr_rentry__,
1095 	       cdf_inquire_attr_rentry_,
1096 	       cdf_inquire_attr_rentry,
1097 	       CDF_INQUIRE_ATTR_RENTRY)
1098 (id, attr_num, entry_num, data_type, num_elements, status)
1099 Int32	  *id;		   	/* In: CDF identifier. */
1100 Int32	  *attr_num;	  	/* In: Attribute number. */
1101 Int32	  *entry_num;	 	/* In: rEntry number. */
1102 Int32	  *data_type;	   	/* Out: Data type. */
1103 Int32	  *num_elements;   	/* Out: Number of elements. */
1104 Int32	  *status;		/* Out: CDF status code. */
1105 {
1106   long dataTypeT, numElementsT, scope;
1107   long attrNumT = (long) (*attr_num - 1);
1108   long entryNumT = (long) (*entry_num - 1);
1109 
1110   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1111 				     ATTR_, attrNumT,
1112 			    GET_, ATTR_SCOPE_, &scope,
1113 			    NULL_);
1114   if (StatusBAD(*status)) return;
1115   if (GLOBALscope(scope)) {
1116     *status = (Int32) ILLEGAL_FOR_SCOPE;
1117     return;
1118   }
1119 
1120   *status = (Int32) CDFlib (SELECT_, rENTRY_, entryNumT,
1121 			    GET_, rENTRY_DATATYPE_, &dataTypeT,
1122 				  rENTRY_NUMELEMS_, &numElementsT,
1123 			    NULL_);
1124   if (StatusBAD(*status)) return;
1125 
1126   *data_type = (Int32) dataTypeT;
1127   *num_elements = (Int32) numElementsT;
1128   return;
1129 }
1130 
1131 /******************************************************************************
1132 *  CDF_inquire_attr_zentry.
1133 ******************************************************************************/
1134 
1135 VISIBLE_PREFIX
1136 Fif_PREFIXa
1137 void
1138 Fif_PREFIXb
1139 Fif_ENTRYPOINT(cdf_inquire_attr_zentry__,
1140 	       cdf_inquire_attr_zentry_,
1141 	       cdf_inquire_attr_zentry,
1142 	       CDF_INQUIRE_ATTR_ZENTRY)
1143 (id, attr_num, entry_num, data_type, num_elements, status)
1144 Int32	  *id;		   	/* In: CDF identifier. */
1145 Int32	  *attr_num;	  	/* In: Attribute number. */
1146 Int32	  *entry_num;	 	/* In: zEntry number. */
1147 Int32	  *data_type;	   	/* Out: Data type. */
1148 Int32	  *num_elements;   	/* Out: Number of elements. */
1149 Int32	  *status;		/* Out: CDF status code. */
1150 {
1151   long dataTypeT, numElementsT, scope;
1152   long attrNumT = (long) (*attr_num - 1);
1153   long entryNumT = (long) (*entry_num - 1);
1154 
1155   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1156 				     ATTR_, attrNumT,
1157 			    GET_, ATTR_SCOPE_, &scope,
1158 			    NULL_);
1159   if (StatusBAD(*status)) return;
1160   if (GLOBALscope(scope)) {
1161     *status = (Int32) ILLEGAL_FOR_SCOPE;
1162     return;
1163   }
1164 
1165   *status = (Int32) CDFlib (SELECT_, zENTRY_, entryNumT,
1166 			    GET_, zENTRY_DATATYPE_, &dataTypeT,
1167 				  zENTRY_NUMELEMS_, &numElementsT,
1168 			    NULL_);
1169   if (StatusBAD(*status)) return;
1170 
1171   *data_type = (Int32) dataTypeT;
1172   *num_elements = (Int32) numElementsT;
1173   return;
1174 }
1175 
1176 /******************************************************************************
1177 *  CDF_attr_put.
1178 ******************************************************************************/
1179 
1180 VISIBLE_PREFIX
1181 Fif_PREFIXa
1182 void
1183 Fif_PREFIXb
1184 Fif_ENTRYPOINT(cdf_attr_put__,cdf_attr_put_,cdf_attr_put,CDF_ATTR_PUT)
1185 (id, attr_num, entry_num, data_type, num_elems, value, status)
1186 Int32	  *id;		   	/* In: CDF identifier. */
1187 Int32	  *attr_num;	  	/* In: Attribute number. */
1188 Int32	  *entry_num; 		/* In: gEntry/rEntry number. */
1189 Int32	  *data_type; 		/* In: Data type. */
1190 Int32	  *num_elems;		/* In: Number of elements. */
1191 void	  *value;	   	/* In: Value.
1192 					VMS: If character data type, could
1193 					     be passed by reference or
1194 					     descriptor. */
1195 Int32	   *status;		/* Out: CDF status code. */
1196 {
1197   long scope;
1198   long attrNumT = (long) (*attr_num - 1);
1199   long entryNumT = (long) (*entry_num - 1);
1200   long dataTypeT = (long) *data_type;
1201   long numElemsT = (long) *num_elems;
1202 
1203   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1204 				     ATTR_, attrNumT,
1205 			    GET_, ATTR_SCOPE_, &scope,
1206 			    NULL_);
1207   if (StatusBAD(*status)) return;
1208 
1209   *status = (Int32) CDFlib (SELECT_, BOO(GLOBALscope(scope),
1210 					 gENTRY_,rENTRY_), entryNumT,
1211 			    PUT_, BOO(GLOBALscope(scope),
1212 				      gENTRY_DATA_,rENTRY_DATA_),
1213 						dataTypeT, numElemsT,
1214 #if defined(Fif_DESCR)
1215 						BOO(STRINGdataType(dataTypeT),
1216 						    DESCRtoREF(value),value),
1217 #else
1218 						value,
1219 #endif
1220 			    NULL_);
1221   return;
1222 }
1223 
1224 /******************************************************************************
1225 *  CDF_put_attr_gentry.
1226 ******************************************************************************/
1227 
1228 VISIBLE_PREFIX
1229 Fif_PREFIXa
1230 void
1231 Fif_PREFIXb
1232 Fif_ENTRYPOINT(cdf_put_attr_gentry__,
1233                cdf_put_attr_gentry_,
1234                cdf_put_attr_gentry,
1235                CDF_PUT_ATTR_GENTRY)
1236 (id, attr_num, entry_num, data_type, num_elems, value, status)
1237 Int32	  *id;		   	/* In: CDF identifier. */
1238 Int32	  *attr_num;	  	/* In: Attribute number. */
1239 Int32	  *entry_num; 		/* In: gEntry number. */
1240 Int32	  *data_type; 		/* In: Data type. */
1241 Int32	  *num_elems;		/* In: Number of elements. */
1242 void	  *value;	   	/* In: Value.
1243 					VMS: If character data type, could
1244 					     be passed by reference or
1245 					     descriptor. */
1246 Int32	   *status;		/* Out: CDF status code. */
1247 {
1248   long scope;
1249   long attrNumT = (long) (*attr_num - 1);
1250   long entryNumT = (long) (*entry_num - 1);
1251   long dataTypeT = (long) *data_type;
1252   long numElemsT = (long) *num_elems;
1253 
1254   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1255 				     ATTR_, attrNumT,
1256 			    GET_, ATTR_SCOPE_, &scope,
1257 			    NULL_);
1258   if (StatusBAD(*status)) return;
1259 
1260   if (!GLOBALscope(scope)) {
1261     *status = (Int32) ILLEGAL_FOR_SCOPE;
1262     return;
1263   }
1264 
1265   *status = (Int32) CDFlib (SELECT_, gENTRY_, entryNumT,
1266 			    PUT_, gENTRY_DATA_, dataTypeT, numElemsT,
1267 #if defined(Fif_DESCR)
1268 						BOO(STRINGdataType(dataTypeT),
1269 						    DESCRtoREF(value),value),
1270 #else
1271 						value,
1272 #endif
1273 			    NULL_);
1274   return;
1275 }
1276 
1277 /******************************************************************************
1278 *  CDF_put_attr_rentry.
1279 ******************************************************************************/
1280 
1281 VISIBLE_PREFIX
1282 Fif_PREFIXa
1283 void
1284 Fif_PREFIXb
1285 Fif_ENTRYPOINT(cdf_put_attr_rentry__,
1286                cdf_put_attr_rentry_,
1287                cdf_put_attr_rentry,
1288                CDF_PUT_ATTR_RENTRY)
1289 (id, attr_num, entry_num, data_type, num_elems, value, status)
1290 Int32	  *id;		   	/* In: CDF identifier. */
1291 Int32	  *attr_num;	  	/* In: Attribute number. */
1292 Int32	  *entry_num; 		/* In: rEntry number. */
1293 Int32	  *data_type; 		/* In: Data type. */
1294 Int32	  *num_elems;		/* In: Number of elements. */
1295 void	  *value;	   	/* In: Value.
1296 					VMS: If character data type, could
1297 					     be passed by reference or
1298 					     descriptor. */
1299 Int32	   *status;		/* Out: CDF status code. */
1300 {
1301   long scope;
1302   long attrNumT = (long) (*attr_num - 1);
1303   long entryNumT = (long) (*entry_num - 1);
1304   long dataTypeT = (long) *data_type;
1305   long numElemsT = (long) *num_elems;
1306 
1307   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1308 				     ATTR_, attrNumT,
1309 			    GET_, ATTR_SCOPE_, &scope,
1310 			    NULL_);
1311   if (StatusBAD(*status)) return;
1312 
1313   if (GLOBALscope(scope)) {
1314     *status = (Int32) ILLEGAL_FOR_SCOPE;
1315     return;
1316   }
1317 
1318   *status = (Int32) CDFlib (SELECT_, rENTRY_, entryNumT,
1319 			    PUT_, rENTRY_DATA_, dataTypeT, numElemsT,
1320 #if defined(Fif_DESCR)
1321 						BOO(STRINGdataType(dataTypeT),
1322 						    DESCRtoREF(value),value),
1323 #else
1324 						value,
1325 #endif
1326 			    NULL_);
1327   return;
1328 }
1329 
1330 /******************************************************************************
1331 *  CDF_put_attr_zentry.
1332 ******************************************************************************/
1333 
1334 VISIBLE_PREFIX
1335 Fif_PREFIXa
1336 void
1337 Fif_PREFIXb
1338 Fif_ENTRYPOINT(cdf_put_attr_zentry__,
1339                cdf_put_attr_zentry_,
1340                cdf_put_attr_zentry,
1341                CDF_PUT_ATTR_ZENTRY)
1342 (id, attr_num, entry_num, data_type, num_elems, value, status)
1343 Int32	  *id;		   	/* In: CDF identifier. */
1344 Int32	  *attr_num;	  	/* In: Attribute number. */
1345 Int32	  *entry_num; 		/* In: zEntry number. */
1346 Int32	  *data_type; 		/* In: Data type. */
1347 Int32	  *num_elems;		/* In: Number of elements. */
1348 void	  *value;	   	/* In: Value.
1349 					VMS: If character data type, could
1350 					     be passed by reference or
1351 					     descriptor. */
1352 Int32	   *status;		/* Out: CDF status code. */
1353 {
1354   long scope;
1355   long attrNumT = (long) (*attr_num - 1);
1356   long entryNumT = (long) (*entry_num - 1);
1357   long dataTypeT = (long) *data_type;
1358   long numElemsT = (long) *num_elems;
1359 
1360   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1361 				     ATTR_, attrNumT,
1362 			    GET_, ATTR_SCOPE_, &scope,
1363 			    NULL_);
1364   if (StatusBAD(*status)) return;
1365 
1366   if (GLOBALscope(scope)) {
1367     *status = (Int32) ILLEGAL_FOR_SCOPE;
1368     return;
1369   }
1370 
1371   *status = (Int32) CDFlib (SELECT_, zENTRY_, entryNumT,
1372 			    PUT_, zENTRY_DATA_, dataTypeT, numElemsT,
1373 #if defined(Fif_DESCR)
1374 						BOO(STRINGdataType(dataTypeT),
1375 						    DESCRtoREF(value),value),
1376 #else
1377 						value,
1378 #endif
1379 			    NULL_);
1380   return;
1381 }
1382 
1383 /******************************************************************************
1384 *  CDF_attr_entry.
1385 ******************************************************************************/
1386 
1387 VISIBLE_PREFIX
1388 Fif_PREFIXa
1389 void
1390 Fif_PREFIXb
1391 Fif_ENTRYPOINT(cdf_attr_get__, cdf_attr_get_, cdf_attr_get, CDF_ATTR_GET)
1392 (id, attr_num, entry_num, value, status)
1393 Int32	  *id;		   	/* In: CDF identifier. */
1394 Int32	  *attr_num;	  	/* In: Attribute number. */
1395 Int32	  *entry_num; 		/* In: gEntry/rEntry number. */
1396 void	  *value;	   	/* Out: Value.
1397 					 VMS: Could be passed out by reference
1398 					      or descriptor if character data
1399 					      type. */
1400 Int32	  *status;		/* Out: CDF status code. */
1401 {
1402   long dataType, scope;
1403   long attrNumT = (long) (*attr_num - 1);
1404   long entryNumT = (long) (*entry_num - 1);
1405 
1406   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1407 				     ATTR_, attrNumT,
1408 			    GET_, ATTR_SCOPE_, &scope,
1409 			    NULL_);
1410   if (StatusBAD(*status)) return;
1411 
1412   *status = (Int32) CDFlib (SELECT_, BOO(GLOBALscope(scope),
1413 					 gENTRY_,rENTRY_), entryNumT,
1414 			    GET_, BOO(GLOBALscope(scope),
1415 				      gENTRY_DATATYPE_,
1416 				      rENTRY_DATATYPE_), &dataType,
1417 			    NULL_);
1418   if (StatusBAD(*status)) return;
1419 
1420   *status = (Int32) CDFlib (GET_, BOO(GLOBALscope(scope),
1421 				      gENTRY_DATA_,rENTRY_DATA_),
1422 #if defined(Fif_DESCR)
1423 					        BOO(STRINGdataType(dataType),
1424 						    DESCRtoREF(value),value),
1425 #else
1426 					        value,
1427 #endif
1428 			    NULL_);
1429   return;
1430 }
1431 
1432 /******************************************************************************
1433 *  CDF_get_attr_gentry.
1434 ******************************************************************************/
1435 
1436 VISIBLE_PREFIX
1437 Fif_PREFIXa
1438 void
1439 Fif_PREFIXb
1440 Fif_ENTRYPOINT(cdf_get_attr_gentry__,
1441                cdf_get_attr_gentry_,
1442                cdf_get_attr_gentry,
1443                CDF_get_ATTR_GENTRY)
1444 (id, attr_num, entry_num, value, status)
1445 Int32	  *id;		   	/* In: CDF identifier. */
1446 Int32	  *attr_num;	  	/* In: Attribute number. */
1447 Int32	  *entry_num; 		/* In: gEntry number. */
1448 void	  *value;	   	/* Out: Value.
1449 					 VMS: Could be passed out by reference
1450 					      or descriptor if character data
1451 					      type. */
1452 Int32	  *status;		/* Out: CDF status code. */
1453 {
1454   long	dataType, scope;
1455   long attrNumT = (long) (*attr_num - 1);
1456   long entryNumT = (long) (*entry_num - 1);
1457 
1458   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1459 				     ATTR_, attrNumT,
1460 			    GET_, ATTR_SCOPE_, &scope,
1461 			    NULL_);
1462   if (StatusBAD(*status)) return;
1463 
1464   if (!GLOBALscope(scope)) {
1465     *status = (Int32) ILLEGAL_FOR_SCOPE;
1466     return;
1467   }
1468 
1469   *status = (Int32) CDFlib (SELECT_, gENTRY_, entryNumT,
1470 			    GET_, gENTRY_DATATYPE_, &dataType,
1471 			    NULL_);
1472   if (StatusBAD(*status)) return;
1473 
1474   *status = (Int32) CDFlib (GET_, gENTRY_DATA_,
1475 #if defined(Fif_DESCR)
1476 			  	  BOO(STRINGdataType(dataType),
1477 			    	      DESCRtoREF(value),value),
1478 #else
1479 				      value,
1480 #endif
1481 			    NULL_);
1482   return;
1483 }
1484 
1485 /******************************************************************************
1486 *  CDF_get_attr_rentry.
1487 ******************************************************************************/
1488 
1489 VISIBLE_PREFIX
1490 Fif_PREFIXa
1491 void
1492 Fif_PREFIXb
1493 Fif_ENTRYPOINT(cdf_get_attr_rentry__,
1494                cdf_get_attr_rentry_,
1495                cdf_get_attr_rentry,
1496                CDF_get_ATTR_RENTRY)
1497 (id, attr_num, entry_num, value, status)
1498 Int32	  *id;		   	/* In: CDF identifier. */
1499 Int32	  *attr_num;	  	/* In: Attribute number. */
1500 Int32	  *entry_num; 		/* In: rEntry number. */
1501 void	  *value;	   	/* Out: Value.
1502 					 VMS: Could be passed out by reference
1503 					      or descriptor if character data
1504 					      type. */
1505 Int32	  *status;		/* Out: CDF status code. */
1506 {
1507   long	dataType, scope;
1508   long attrNumT = (long) (*attr_num - 1);
1509   long entryNumT = (long) (*entry_num - 1);
1510 
1511   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1512 				     ATTR_, attrNumT,
1513 			    GET_, ATTR_SCOPE_, &scope,
1514 			    NULL_);
1515   if (StatusBAD(*status)) return;
1516 
1517   if (GLOBALscope(scope)) {
1518     *status = (Int32) ILLEGAL_FOR_SCOPE;
1519     return;
1520   }
1521 
1522   *status = (Int32) CDFlib (SELECT_, rENTRY_, entryNumT,
1523 			    GET_, rENTRY_DATATYPE_, &dataType,
1524 			    NULL_);
1525   if (StatusBAD(*status)) return;
1526 
1527   *status = (Int32) CDFlib (GET_, rENTRY_DATA_,
1528 #if defined(Fif_DESCR)
1529 			  	  BOO(STRINGdataType(dataType),
1530 			    	      DESCRtoREF(value),value),
1531 #else
1532 				      value,
1533 #endif
1534 			    NULL_);
1535   return;
1536 }
1537 
1538 /******************************************************************************
1539 *  CDF_get_attr_zentry.
1540 ******************************************************************************/
1541 
1542 VISIBLE_PREFIX
1543 Fif_PREFIXa
1544 void
1545 Fif_PREFIXb
1546 Fif_ENTRYPOINT(cdf_get_attr_zentry__,
1547                cdf_get_attr_zentry_,
1548                cdf_get_attr_zentry,
1549                CDF_get_ATTR_ZENTRY)
1550 (id, attr_num, entry_num, value, status)
1551 Int32	  *id;		   	/* In: CDF identifier. */
1552 Int32	  *attr_num;	  	/* In: Attribute number. */
1553 Int32	  *entry_num; 		/* In: zEntry number. */
1554 void	  *value;	   	/* Out: Value.
1555 					 VMS: Could be passed out by reference
1556 					      or descriptor if character data
1557 					      type. */
1558 Int32	  *status;		/* Out: CDF status code. */
1559 {
1560   long	dataType, scope;
1561   long attrNumT = (long) (*attr_num - 1);
1562   long entryNumT = (long) (*entry_num - 1);
1563 
1564   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1565 				     ATTR_, attrNumT,
1566 			    GET_, ATTR_SCOPE_, &scope,
1567 			    NULL_);
1568   if (StatusBAD(*status)) return;
1569 
1570   if (GLOBALscope(scope)) {
1571     *status = (Int32) ILLEGAL_FOR_SCOPE;
1572     return;
1573   }
1574 
1575   *status = (Int32) CDFlib (SELECT_, zENTRY_, entryNumT,
1576 			    GET_, zENTRY_DATATYPE_, &dataType,
1577 			    NULL_);
1578   if (StatusBAD(*status)) return;
1579 
1580   *status = (Int32) CDFlib (GET_, zENTRY_DATA_,
1581 #if defined(Fif_DESCR)
1582 			  	  BOO(STRINGdataType(dataType),
1583 			    	      DESCRtoREF(value),value),
1584 #else
1585 				      value,
1586 #endif
1587 			    NULL_);
1588   return;
1589 }
1590 
1591 /******************************************************************************
1592 *  CDF_var_create.
1593 ******************************************************************************/
1594 
1595 VISIBLE_PREFIX
1596 Fif_PREFIXa
1597 void
1598 Fif_PREFIXb
1599 Fif_ENTRYPOINT(cdf_var_create__,cdf_var_create_,cdf_var_create,CDF_VAR_CREATE)
1600 (id, var_name, data_type, num_elems, rec_variance, dim_variances,
1601 var_num, status Fif_GHOSTARG(len))
1602 Int32	  *id;	   		/* In: CDF identifier. */
1603 void      *var_name;	   	/* In: rVariable name. */
1604 Int32	  *data_type; 		/* In: Data type. */
1605 Int32	  *num_elems;		/* In: Number of elements of data_type. */
1606 Int32	  *rec_variance; 	/* In: Record variance. */
1607 Int32	  dim_variances[];  	/* In: Dimension variances. */
1608 Int32	  *var_num;	    	/* Out: rVariable number. */
1609 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)1610 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1611 				   (generated by FORTRAN compiler). */
1612 {
1613   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1614   long varNumT, dimVarysT[CDF_MAX_DIMS], numDims;
1615   int dimN;
1616   long dataTypeT = (long) *data_type;
1617   long numElemsT = (long) *num_elems;
1618   long recVaryT = (long) *rec_variance;
1619   int LFS = FALSE;
1620   struct CDFstruct *CDF;
1621 
1622   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1623   if (isLFS(CDF)) LFS = TRUE;
1624 
1625   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1626 			    GET_, rVARs_NUMDIMS_, &numDims,
1627 			    NULL_);
1628   if (StatusBAD(*status)) return;
1629 
1630   for (dimN = 0; dimN < (int) numDims; dimN++) {
1631      dimVarysT[dimN] = (long) dim_variances[dimN];
1632   }
1633 
1634   *status = (Int32) CDFlib (CREATE_, rVAR_,
1635 #if defined(Fif_DESCR)
1636 					    DESCRtoREFnul(var_name,
1637                                                           (LFS ?
1638                                                         CDF_VAR_NAME_LEN256 :
1639                                                         CDF_VAR_NAME_LEN),
1640 							  &ssh),
1641 #endif
1642 #if defined(Fif_GHOSTLEN)
1643 					    NULterminate(var_name,
1644 							 Fif_GHOSTUSE(len),
1645 							 &ssh),
1646 #endif
1647 #if defined(Fif_NOLEN)
1648 					    FindEndNUL(var_name,
1649                                                        (LFS ?
1650                                                         CDF_VAR_NAME_LEN256 :
1651                                                         CDF_VAR_NAME_LEN),
1652 						       &ssh),
1653 #endif
1654 					    dataTypeT, numElemsT, recVaryT,
1655 					    dimVarysT, &varNumT,
1656 			    NULL_);
1657   FreeStrings (ssh);
1658   if (StatusBAD(*status)) return;
1659 
1660   *var_num = (Int32) (varNumT + 1);
1661   return;
1662 }
1663 
1664 /******************************************************************************
1665 *  CDF_create_zvar.
1666 ******************************************************************************/
1667 
1668 VISIBLE_PREFIX
1669 Fif_PREFIXa
1670 void
1671 Fif_PREFIXb
1672 Fif_ENTRYPOINT(cdf_create_zvar__,
1673                cdf_create_zvar_,
1674                cdf_create_zvar,
1675                CDF_CREATE_ZVAR)
1676 (id, var_name, data_type, num_elems, num_dims, dim_sizes, rec_variance,
1677 dim_variances, var_num, status Fif_GHOSTARG(len))
1678 Int32	  *id;	   		/* In: CDF identifier. */
1679 void      *var_name;	   	/* In: zVariable name. */
1680 Int32	  *data_type; 		/* In: Data type. */
1681 Int32	  *num_elems;		/* In: Number of elements of data_type. */
1682 Int32     *num_dims;            /* In: Number of dimension. */
1683 Int32     dim_sizes[];          /* In: Dimension sizes. */
1684 Int32	  *rec_variance; 	/* In: Record variance. */
1685 Int32	  dim_variances[];  	/* In: Dimension variances. */
1686 Int32	  *var_num;	    	/* Out: zVariable number. */
1687 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)1688 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1689 				   (generated by FORTRAN compiler). */
1690 {
1691   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1692   long varNumT, dimVarysT[CDF_MAX_DIMS], dimSizesT[CDF_MAX_DIMS], numDims;
1693   int dimN;
1694   long dataTypeT = (long) *data_type;
1695   long numElemsT = (long) *num_elems;
1696   long recVaryT = (long) *rec_variance;
1697   int LFS = FALSE;
1698   struct CDFstruct *CDF;
1699 
1700   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1701   if (isLFS(CDF)) LFS = TRUE;
1702 
1703   numDims = (long) *num_dims;
1704 
1705   for (dimN = 0; dimN < (int) numDims; dimN++) {
1706      dimSizesT[dimN] = (long) dim_sizes[dimN];
1707      dimVarysT[dimN] = (long) dim_variances[dimN];
1708   }
1709 
1710   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1711                             CREATE_, zVAR_,
1712 #if defined(Fif_DESCR)
1713 					    DESCRtoREFnul(var_name,
1714                                                           (LFS ?
1715                                                         CDF_VAR_NAME_LEN256 :
1716                                                         CDF_VAR_NAME_LEN),
1717 							  &ssh),
1718 #endif
1719 #if defined(Fif_GHOSTLEN)
1720 					    NULterminate(var_name,
1721 							 Fif_GHOSTUSE(len),
1722 							 &ssh),
1723 #endif
1724 #if defined(Fif_NOLEN)
1725 					    FindEndNUL(var_name,
1726                                                        (LFS ?
1727                                                         CDF_VAR_NAME_LEN256 :
1728                                                         CDF_VAR_NAME_LEN),
1729 						       &ssh),
1730 #endif
1731 					    dataTypeT, numElemsT, numDims,
1732                                             dimSizesT, recVaryT,
1733 					    dimVarysT, &varNumT,
1734 			    NULL_);
1735   FreeStrings (ssh);
1736   if (StatusBAD(*status)) return;
1737 
1738   *var_num = (Int32) (varNumT + 1);
1739   return;
1740 }
1741 
1742 /******************************************************************************
1743 *  CDF_var_num.
1744 ******************************************************************************/
1745 
1746 VISIBLE_PREFIX
1747 Fif_PREFIXa
1748 Int32
1749 Fif_PREFIXb
1750 Fif_ENTRYPOINT(cdf_var_num__,cdf_var_num_,cdf_var_num,CDF_VAR_NUM)
1751 (id, var_name Fif_GHOSTARG(len))
1752 Int32	  *id;		   	/* In: CDF identifier. */
1753 void	  *var_name;	   	/* In: Variable name. */
Fif_GHOSTDEF(len)1754 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1755 				   (generated by FORTRAN compiler). */
1756 {
1757   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1758   CDFstatus status;
1759   long varNumT;
1760   int LFS = FALSE;
1761   struct CDFstruct *CDF;
1762 
1763   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1764   if (isLFS(CDF)) LFS = TRUE;
1765 
1766   status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1767 		           GET_, rVAR_NUMBER_,
1768 #if defined(Fif_DESCR)
1769 				       DESCRtoREFnul(var_name,
1770                                                      (LFS ?
1771                                                       CDF_VAR_NAME_LEN256 :
1772                                                       CDF_VAR_NAME_LEN),
1773 						     &ssh),
1774 #endif
1775 #if defined(Fif_GHOSTLEN)
1776 				       NULterminate(var_name,Fif_GHOSTUSE(len),
1777 						    &ssh),
1778 #endif
1779 #if defined(Fif_NOLEN)
1780 				       FindEndNUL(var_name,
1781                                                   (LFS ?
1782                                                    CDF_VAR_NAME_LEN256 :
1783                                                    CDF_VAR_NAME_LEN),
1784 						  &ssh),
1785 #endif
1786 				       &varNumT,
1787 		   NULL_);
1788   if (!StatusOK(status)) {
1789     status = (Int32) CDFlib (GET_, zVAR_NUMBER_,
1790 #if defined(Fif_DESCR)
1791                                          DESCRtoREFnul(var_name,
1792                                                        (LFS ?
1793                                                         CDF_VAR_NAME_LEN256 :
1794                                                         CDF_VAR_NAME_LEN),
1795                                                        &ssh),
1796 #endif
1797 #if defined(Fif_GHOSTLEN)
1798                                          NULterminate(var_name,Fif_GHOSTUSE(len),
1799                                                       &ssh),
1800 #endif
1801 #if defined(Fif_NOLEN)
1802                                          FindEndNUL(var_name,
1803                                                     (LFS ?
1804                                                      CDF_VAR_NAME_LEN256 :
1805                                                      CDF_VAR_NAME_LEN),
1806                                                     &ssh),
1807 #endif
1808                                          &varNumT,
1809                      NULL_);
1810   }
1811 
1812   FreeStrings (ssh);
1813 
1814   if (StatusOK(status))
1815     return ((Int32) (varNumT + 1));
1816   else
1817     return ((Int32) status);
1818 }
1819 
1820 /******************************************************************************
1821 *  CDF_get_var_num.
1822 ******************************************************************************/
1823 
1824 VISIBLE_PREFIX
1825 Fif_PREFIXa
1826 Int32
1827 Fif_PREFIXb
1828 Fif_ENTRYPOINT(cdf_get_var_num__,
1829                cdf_get_var_num_,
1830                cdf_get_var_num,
1831                CDF_GET_VAR_NUM)
1832 (id, var_name Fif_GHOSTARG(len))
1833 Int32	  *id;		   	/* In: CDF identifier. */
1834 void	  *var_name;	   	/* In: Variable name. */
Fif_GHOSTDEF(len)1835 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1836 				   (generated by FORTRAN compiler). */
1837 {
1838   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1839   CDFstatus status;
1840   long varNumT;
1841   int LFS = FALSE;
1842   struct CDFstruct *CDF;
1843 
1844   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1845   if (isLFS(CDF)) LFS = TRUE;
1846 
1847   status = CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1848 	           GET_, rVAR_NUMBER_,
1849 #if defined(Fif_DESCR)
1850 			       DESCRtoREFnul(var_name,
1851                                              (LFS ?
1852                                               CDF_VAR_NAME_LEN256 :
1853                                               CDF_VAR_NAME_LEN),
1854 					     &ssh),
1855 #endif
1856 #if defined(Fif_GHOSTLEN)
1857 			       NULterminate(var_name,Fif_GHOSTUSE(len),
1858 					    &ssh),
1859 #endif
1860 #if defined(Fif_NOLEN)
1861 			       FindEndNUL(var_name,
1862                                           (LFS ?
1863                                            CDF_VAR_NAME_LEN256 :
1864                                            CDF_VAR_NAME_LEN),
1865 					  &ssh),
1866 #endif
1867 			       &varNumT,
1868 		   NULL_);
1869   if (!StatusOK(status)) {
1870     status = CDFlib (GET_, zVAR_NUMBER_,
1871 #if defined(Fif_DESCR)
1872                                  DESCRtoREFnul(var_name,
1873                                                (LFS ?
1874                                                 CDF_VAR_NAME_LEN256 :
1875                                                 CDF_VAR_NAME_LEN),
1876                                                &ssh),
1877 #endif
1878 #if defined(Fif_GHOSTLEN)
1879                                  NULterminate(var_name,Fif_GHOSTUSE(len),
1880                                               &ssh),
1881 #endif
1882 #if defined(Fif_NOLEN)
1883                                  FindEndNUL(var_name,
1884                                             (LFS ?
1885                                              CDF_VAR_NAME_LEN256 :
1886                                              CDF_VAR_NAME_LEN),
1887                                             &ssh),
1888 #endif
1889                                  &varNumT,
1890                      NULL_);
1891   }
1892 
1893   FreeStrings (ssh);
1894 
1895   if (StatusOK(status))
1896     return (Int32) (varNumT + 1);
1897   else
1898     return ((Int32) status);
1899 }
1900 
1901 /******************************************************************************
1902 *  CDF_var_rename.
1903 ******************************************************************************/
1904 
1905 VISIBLE_PREFIX
1906 Fif_PREFIXa
1907 void
1908 Fif_PREFIXb
1909 Fif_ENTRYPOINT(cdf_var_rename__,cdf_var_rename_,cdf_var_rename,CDF_VAR_RENAME)
1910 (id, var_num, var_name, status Fif_GHOSTARG(len))
1911 Int32	  *id;			/* In: CDF identifier. */
1912 Int32	  *var_num;	   	/* In: rVariable number. */
1913 void	  *var_name;	   	/* In: New variable name. */
1914 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)1915 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1916 				   (generated by FORTRAN compiler). */
1917 {
1918   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1919   long varNumT = (long) (*var_num - 1);
1920   int LFS = FALSE;
1921   struct CDFstruct *CDF;
1922 
1923   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1924   if (isLFS(CDF)) LFS = TRUE;
1925 
1926   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1927 				     rVAR_, varNumT,
1928 			    PUT_, rVAR_NAME_,
1929 #if defined(Fif_DESCR)
1930 					      DESCRtoREFnul(var_name,
1931                                                             (LFS ?
1932                                                         CDF_VAR_NAME_LEN256 :
1933                                                         CDF_VAR_NAME_LEN),
1934 							    &ssh),
1935 #endif
1936 #if defined(Fif_GHOSTLEN)
1937 					      NULterminate(var_name,
1938 							   Fif_GHOSTUSE(len),
1939 							   &ssh),
1940 #endif
1941 #if defined(Fif_NOLEN)
1942 					      FindEndNUL(var_name,
1943                                                          (LFS ?
1944                                                           CDF_VAR_NAME_LEN256 :
1945                                                           CDF_VAR_NAME_LEN),
1946 							 &ssh),
1947 #endif
1948 			    NULL_);
1949   FreeStrings (ssh);
1950   return;
1951 }
1952 
1953 /******************************************************************************
1954 *  CDF_rename_zvar.
1955 ******************************************************************************/
1956 
1957 VISIBLE_PREFIX
1958 Fif_PREFIXa
1959 void
1960 Fif_PREFIXb
1961 Fif_ENTRYPOINT(cdf_rename_zvar__,
1962                cdf_rename_zvar_,
1963                cdf_rename_zvar,
1964                CDF_RENAME_ZVAR)
1965 (id, var_num, var_name, status Fif_GHOSTARG(len))
1966 Int32	  *id;			/* In: CDF identifier. */
1967 Int32	  *var_num;	   	/* In: zVariable number. */
1968 void	  *var_name;	   	/* In: New variable name. */
1969 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)1970 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
1971 				   (generated by FORTRAN compiler). */
1972 {
1973   struct STRINGstruct *ssh = NULL;	/* Head of STRINGstruct linked list. */
1974   long varNumT = (long) (*var_num - 1);
1975   int LFS = FALSE;
1976   struct CDFstruct *CDF;
1977 
1978   CDF  = (struct CDFstruct *)Int32ToCDFid(*id);
1979   if (isLFS(CDF)) LFS = TRUE;
1980 
1981   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
1982 				     zVAR_, varNumT,
1983 			    PUT_, zVAR_NAME_,
1984 #if defined(Fif_DESCR)
1985 					      DESCRtoREFnul(var_name,
1986                                                             (LFS ?
1987                                                         CDF_VAR_NAME_LEN256 :
1988                                                         CDF_VAR_NAME_LEN),
1989 							    &ssh),
1990 #endif
1991 #if defined(Fif_GHOSTLEN)
1992 					      NULterminate(var_name,
1993 							   Fif_GHOSTUSE(len),
1994 							   &ssh),
1995 #endif
1996 #if defined(Fif_NOLEN)
1997 					      FindEndNUL(var_name,
1998                                                          (LFS ?
1999                                                           CDF_VAR_NAME_LEN256 :
2000                                                           CDF_VAR_NAME_LEN),
2001 							 &ssh),
2002 #endif
2003 			    NULL_);
2004   FreeStrings (ssh);
2005   return;
2006 }
2007 
2008 /******************************************************************************
2009 *  CDF_var_inquire.
2010 ******************************************************************************/
2011 
2012 VISIBLE_PREFIX
2013 Fif_PREFIXa
2014 void
2015 Fif_PREFIXb
2016 Fif_ENTRYPOINT(cdf_var_inquire__,
2017 	       cdf_var_inquire_,
2018 	       cdf_var_inquire,
2019 	       CDF_VAR_INQUIRE)
2020 (id, var_num, var_name, data_type, num_elements, rec_variance,
2021 dim_variances, status Fif_GHOSTARG(len))
2022 Int32	  *id;		    	/* In: CDF identifier. */
2023 Int32	  *var_num;	   	/* In: rVariable number. */
2024 void	  *var_name;	    	/* Out: rVariable name. */
2025 Int32	  *data_type;	    	/* Out: Data type. */
2026 Int32	  *num_elements;	/* Out: Number of elements. */
2027 Int32	  *rec_variance; 	/* Out: Record variance. */
2028 Int32	  dim_variances[]; 	/* Out: Dimension variances. */
2029 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)2030 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
2031 				   (generated by FORTRAN compiler). */
2032 {
2033   char varNameT[CDF_VAR_NAME_LEN256];
2034   long dataTypeT, numElemsT, recVaryT, dimVarysT[CDF_MAX_DIMS], numDims;
2035   int dimN;
2036   long varNumT = (long) (*var_num - 1);
2037 
2038   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2039 			    GET_, rVARs_NUMDIMS_, &numDims,
2040 			    NULL_);
2041   if (StatusBAD(*status)) {
2042     free (varNameT);
2043     return;
2044   }
2045 
2046   *status = (Int32) CDFlib (SELECT_, rVAR_, varNumT,
2047 			    GET_, rVAR_NAME_, varNameT,
2048 				  rVAR_DATATYPE_, &dataTypeT,
2049 				  rVAR_NUMELEMS_, &numElemsT,
2050 				  rVAR_RECVARY_, &recVaryT,
2051 				  rVAR_DIMVARYS_, dimVarysT,
2052 			    NULL_);
2053   if (StatusBAD(*status)) {
2054     free (varNameT);
2055     return;
2056   }
2057 
2058 #if defined(Fif_GHOSTLEN)
2059   CtoFORTstring (varNameT, var_name, Fif_GHOSTUSE(len));
2060 #else
2061   CtoFORTstring (varNameT, var_name, CDF_VAR_NAME_LEN256);
2062 #endif
2063   *data_type = (Int32) dataTypeT;
2064   *num_elements = (Int32) numElemsT;
2065   *rec_variance = (Int32) recVaryT;
2066   for (dimN = 0; dimN < (int) numDims; dimN++) {
2067      dim_variances[dimN] = (Int32) dimVarysT[dimN];
2068   }
2069   return;
2070 }
2071 
2072 /******************************************************************************
2073 *  CDF_inquire_zvar.
2074 ******************************************************************************/
2075 
2076 VISIBLE_PREFIX
2077 Fif_PREFIXa
2078 void
2079 Fif_PREFIXb
2080 Fif_ENTRYPOINT(cdf_inquire_zvar__,
2081                cdf_inquire_zvar_,
2082                cdf_inquire_zvar,
2083                CDF_INQUIRE_ZVAR)
2084 (id, var_num, var_name, data_type, num_elements, num_dims, dim_sizes,
2085 rec_variance, dim_variances, status Fif_GHOSTARG(len))
2086 Int32	  *id;		    	/* In: CDF identifier. */
2087 Int32	  *var_num;	   	/* In: zVariable number. */
2088 void	  *var_name;	    	/* Out: zVariable name. */
2089 Int32	  *data_type;	    	/* Out: Data type. */
2090 Int32	  *num_elements;        /* Out: Number of elements. */
2091 Int32     *num_dims;            /* Out: Number of dimension. */
2092 Int32     dim_sizes[];          /* Out: Dimension sizes. */
2093 Int32     *rec_variance;        /* Out: Record variance. */
2094 Int32	  dim_variances[]; 	/* Out: Dimension variances. */
2095 Int32	  *status;		/* Out: CDF status code. */
Fif_GHOSTDEF(len)2096 Fif_GHOSTDEF(len)		/* Invisible length of "var_name"
2097 				   (generated by FORTRAN compiler). */
2098 {
2099   char varNameT[CDF_VAR_NAME_LEN256];
2100   long dataTypeT, numElemsT, recVaryT, dimVarysT[CDF_MAX_DIMS];
2101   int dimN;
2102   long numDimsT, dimSizesT[CDF_MAX_DIMS];
2103   long varNumT = (long) (*var_num - 1);
2104 
2105   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2106                                      zVAR_, varNumT,
2107 			    GET_, zVAR_NAME_, varNameT,
2108 				  zVAR_DATATYPE_, &dataTypeT,
2109 				  zVAR_NUMELEMS_, &numElemsT,
2110                                   zVAR_NUMDIMS_, &numDimsT,
2111                                   zVAR_DIMSIZES_, dimSizesT,
2112 				  zVAR_RECVARY_, &recVaryT,
2113 				  zVAR_DIMVARYS_, dimVarysT,
2114 			    NULL_);
2115   if (StatusBAD(*status)) return;
2116 
2117 #if defined(Fif_GHOSTLEN)
2118   CtoFORTstring (varNameT, var_name, Fif_GHOSTUSE(len));
2119 #else
2120   CtoFORTstring (varNameT, var_name, CDF_VAR_NAME_LEN256);
2121 #endif
2122   *data_type = (Int32) dataTypeT;
2123   *num_elements = (Int32) numElemsT;
2124   *num_dims = (Int32) numDimsT;
2125   *rec_variance = (Int32) recVaryT;
2126   for (dimN = 0; dimN < (int) numDimsT; dimN++) {
2127      dim_variances[dimN] = (Int32) dimVarysT[dimN];
2128      dim_sizes[dimN] = (Int32) dimSizesT[dimN];
2129   }
2130   return;
2131 }
2132 
2133 /******************************************************************************
2134 *  CDF_var_put.
2135 ******************************************************************************/
2136 
2137 VISIBLE_PREFIX
2138 Fif_PREFIXa
2139 void
2140 Fif_PREFIXb
2141 Fif_ENTRYPOINT(cdf_var_put__,cdf_var_put_,cdf_var_put,CDF_VAR_PUT)
2142 (id, var_num, record_num, indices, value, status)
2143 Int32	  *id;		    	/* In: CDF identifier. */
2144 Int32	  *var_num;	   	/* In: rVariable number. */
2145 Int32	  *record_num;		/* In: Record number. */
2146 Int32	  indices[];	    	/* In: Dimension indices. */
2147 void	  *value;	    	/* In: Value.
2148 					VMS: If character data type, could
2149 					     be passed by reference or by
2150 					     descriptor. */
2151 Int32	  *status;		/* Out: CDF status code. */
2152 {
2153   int dimN;
2154   long indicesT[CDF_MAX_DIMS], numDims, dataType;
2155   long varNumT = (long) (*var_num - 1);
2156   long recNumT = (long) (*record_num - 1);
2157 
2158   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2159 				     rVAR_, varNumT,
2160 			    GET_, rVARs_NUMDIMS_, &numDims,
2161 				  rVAR_DATATYPE_, &dataType,
2162 			    NULL_);
2163   if (StatusBAD(*status)) return;
2164 
2165   for (dimN = 0; dimN < (int) numDims; dimN++) {
2166      indicesT[dimN] = (long) (indices[dimN] - 1);
2167   }
2168 
2169   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recNumT,
2170 				     rVARs_DIMINDICES_, indicesT,
2171 			    PUT_, rVAR_DATA_,
2172 #if defined(Fif_DESCR)
2173 					      BOO(STRINGdataType(dataType),
2174 						  DESCRtoREF(value),value),
2175 #else
2176 					      value,
2177 #endif
2178 			    NULL_);
2179   return;
2180 }
2181 
2182 /******************************************************************************
2183 *  CDF_put_zvar_data.
2184 ******************************************************************************/
2185 
2186 VISIBLE_PREFIX
2187 Fif_PREFIXa
2188 void
2189 Fif_PREFIXb
2190 Fif_ENTRYPOINT(cdf_put_zvar_data__,
2191                cdf_put_zvar_data_,
2192                cdf_put_zvar_data,
2193                CDF_PUT_ZVAR_DATA)
2194 (id, var_num, record_num, indices, value, status)
2195 Int32	  *id;		    	/* In: CDF identifier. */
2196 Int32	  *var_num;	   	/* In: zVariable number. */
2197 Int32	  *record_num;		/* In: Record number. */
2198 Int32	  indices[];	    	/* In: Dimension indices. */
2199 void	  *value;	    	/* In: Value.
2200 					VMS: If character data type, could
2201 					     be passed by reference or by
2202 					     descriptor. */
2203 Int32	  *status;		/* Out: CDF status code. */
2204 {
2205   int dimN;
2206   long indicesT[CDF_MAX_DIMS], numDims, dataType;
2207   long varNumT = (long) (*var_num - 1);
2208   long recNumT = (long) (*record_num - 1);
2209 
2210   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2211 				     zVAR_, varNumT,
2212 			    GET_, zVAR_NUMDIMS_, &numDims,
2213 				  zVAR_DATATYPE_, &dataType,
2214 			    NULL_);
2215   if (StatusBAD(*status)) return;
2216 
2217   for (dimN = 0; dimN < (int) numDims; dimN++) {
2218      indicesT[dimN] = (long) (indices[dimN] - 1);
2219   }
2220 
2221   *status = (Int32) CDFlib (SELECT_, zVAR_RECNUMBER_, recNumT,
2222 				     zVAR_DIMINDICES_, indicesT,
2223 			    PUT_, zVAR_DATA_,
2224 #if defined(Fif_DESCR)
2225 					      BOO(STRINGdataType(dataType),
2226 						  DESCRtoREF(value),value),
2227 #else
2228 					      value,
2229 #endif
2230 			    NULL_);
2231   return;
2232 }
2233 
2234 /******************************************************************************
2235 *  CDF_var_get.
2236 ******************************************************************************/
2237 
2238 VISIBLE_PREFIX
2239 Fif_PREFIXa
2240 void
2241 Fif_PREFIXb
2242 Fif_ENTRYPOINT(cdf_var_get__,cdf_var_get_,cdf_var_get,CDF_VAR_GET)
2243 (id, var_num, record_num, indices, value, status)
2244 Int32	  *id;		    	/* In: CDF identifier. */
2245 Int32	  *var_num;  	 	/* In: rVariable number. */
2246 Int32	  *record_num;		/* In: Record number. */
2247 Int32	  indices[];	    	/* In: Dimension indices. */
2248 void	  *value;	    	/* In: Value.
2249 					VMS: If character data type, could
2250 					     be passed by reference or by
2251 					     descriptor. */
2252 Int32	  *status;		/* Out: CDF status code. */
2253 {
2254   long indicesT[CDF_MAX_DIMS], numDims, dataType;
2255   int dimN;
2256   long varNumT = (long) (*var_num - 1);
2257   long recNumT = (long) (*record_num - 1);
2258 
2259   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2260 				     rVAR_, varNumT,
2261 			    GET_, rVARs_NUMDIMS_, &numDims,
2262 				  rVAR_DATATYPE_, &dataType,
2263 			    NULL_);
2264   if (StatusBAD(*status)) return;
2265 
2266   for (dimN = 0; dimN < (int) numDims; dimN++) {
2267      indicesT[dimN] = (long) (indices[dimN] - 1);
2268   }
2269 
2270   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recNumT,
2271 				     rVARs_DIMINDICES_, indicesT,
2272 			    GET_, rVAR_DATA_,
2273 #if defined(Fif_DESCR)
2274 					      BOO(STRINGdataType(dataType),
2275 						  DESCRtoREF(value),value),
2276 #else
2277 					      value,
2278 #endif
2279 			    NULL_);
2280   return;
2281 }
2282 
2283 /******************************************************************************
2284 *  CDF_get_zvar_data.
2285 ******************************************************************************/
2286 
2287 VISIBLE_PREFIX
2288 Fif_PREFIXa
2289 void
2290 Fif_PREFIXb
2291 Fif_ENTRYPOINT(cdf_get_zvar_data__,
2292                cdf_get_zvar_data_,
2293                cdf_get_zvar_data,
2294                CDF_get_ZVAR_DATA)
2295 (id, var_num, record_num, indices, value, status)
2296 Int32	  *id;		    	/* In: CDF identifier. */
2297 Int32	  *var_num;  	 	/* In: zVariable number. */
2298 Int32	  *record_num;		/* In: Record number. */
2299 Int32	  indices[];	    	/* In: Dimension indices. */
2300 void	  *value;	    	/* In: Value.
2301 					VMS: If character data type, could
2302 					     be passed by reference or by
2303 					     descriptor. */
2304 Int32	  *status;		/* Out: CDF status code. */
2305 {
2306   long indicesT[CDF_MAX_DIMS], numDims, dataType;
2307   int dimN;
2308   long varNumT = (long) (*var_num - 1);
2309   long recNumT = (long) (*record_num - 1);
2310 
2311   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2312 				     zVAR_, varNumT,
2313 			    GET_, zVAR_NUMDIMS_, &numDims,
2314 				  zVAR_DATATYPE_, &dataType,
2315 			    NULL_);
2316   if (StatusBAD(*status)) return;
2317 
2318   for (dimN = 0; dimN < (int) numDims; dimN++) {
2319      indicesT[dimN] = (long) (indices[dimN] - 1);
2320   }
2321 
2322   *status = (Int32) CDFlib (SELECT_, zVAR_RECNUMBER_, recNumT,
2323 				     zVAR_DIMINDICES_, indicesT,
2324 			    GET_, zVAR_DATA_,
2325 #if defined(Fif_DESCR)
2326 					      BOO(STRINGdataType(dataType),
2327 						  DESCRtoREF(value),value),
2328 #else
2329 					      value,
2330 #endif
2331 			    NULL_);
2332   return;
2333 }
2334 
2335 /******************************************************************************
2336 *  CDF_var_hyper_put.
2337 ******************************************************************************/
2338 
2339 VISIBLE_PREFIX
2340 Fif_PREFIXa
2341 void
2342 Fif_PREFIXb
2343 Fif_ENTRYPOINT(cdf_var_hyper_put__,
2344 	       cdf_var_hyper_put_,
2345 	       cdf_var_hyper_put,
2346 	       CDF_VAR_HYPER_PUT)
2347 (id, var_num, rec_start, rec_count, rec_int, indices, counts,
2348 intervals, buffer, status)
2349 Int32	  *id;	  	  	/* In: CDF identifier. */
2350 Int32	  *var_num;   		/* In: rVariable number. */
2351 Int32	  *rec_start;		/* In: Starting record number. */
2352 Int32	  *rec_count;		/* In: Record count. */
2353 Int32	  *rec_int;		/* In: Record interval. */
2354 Int32	  indices[];	    	/* In: Dimension indices. */
2355 Int32	  counts[];	    	/* In: Dimension counts. */
2356 Int32	  intervals[];	    	/* In: Dimension intervals. */
2357 void	  *buffer;	    	/* In: Values.
2358 					VMS: If character data type, could
2359 					     be passed by reference or
2360 					     descriptor. */
2361 Int32	  *status;		/* Out: CDF status code. */
2362 {
2363   int dimN;
2364   long indicesT[CDF_MAX_DIMS], countsT[CDF_MAX_DIMS], intervalsT[CDF_MAX_DIMS],
2365        numDims, dataType;
2366   long varNumT = (long) (*var_num - 1);
2367   long recStartT = (long) (*rec_start - 1);
2368   long recCountT = (long) *rec_count;
2369   long recIntervalT = (long) *rec_int;
2370 
2371   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2372 				     rVAR_, varNumT,
2373 			    GET_, rVARs_NUMDIMS_, &numDims,
2374 				  rVAR_DATATYPE_, &dataType,
2375 			    NULL_);
2376   if (StatusBAD(*status)) return;
2377 
2378   for (dimN = 0; dimN < (int) numDims; dimN++) {
2379      indicesT[dimN] = (long) (indices[dimN] - 1);
2380      countsT[dimN] = (long) counts[dimN];
2381      intervalsT[dimN] = (long) intervals[dimN];
2382   }
2383 
2384   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recStartT,
2385 				     rVARs_RECCOUNT_, recCountT,
2386 				     rVARs_RECINTERVAL_, recIntervalT,
2387 				     rVARs_DIMINDICES_, indicesT,
2388 				     rVARs_DIMCOUNTS_, countsT,
2389 				     rVARs_DIMINTERVALS_, intervalsT,
2390 			    PUT_, rVAR_HYPERDATA_,
2391 #if defined(Fif_DESCR)
2392 						BOO(STRINGdataType(dataType),
2393 						    DESCRtoREF(buffer),buffer),
2394 #else
2395 						buffer,
2396 #endif
2397 			    NULL_);
2398   return;
2399 }
2400 
2401 /******************************************************************************
2402 *  CDF_hyper_put_zvar_data.
2403 ******************************************************************************/
2404 
2405 VISIBLE_PREFIX
2406 Fif_PREFIXa
2407 void
2408 Fif_PREFIXb
2409 Fif_ENTRYPOINT(cdf_hyper_put_zvar_data__,
2410 	       cdf_hyper_put_zvar_data_,
2411 	       cdf_hyper_put_zvar_data,
2412 	       CDF_HYPER_PUT_ZVAR_DATA)
2413 (id, var_num, rec_start, rec_count, rec_int, indices, counts,
2414 intervals, buffer, status)
2415 Int32	  *id;	  	  	/* In: CDF identifier. */
2416 Int32	  *var_num;   		/* In: zVariable number. */
2417 Int32	  *rec_start;		/* In: Starting record number. */
2418 Int32	  *rec_count;		/* In: Record count. */
2419 Int32	  *rec_int;		/* In: Record interval. */
2420 Int32	  indices[];	    	/* In: Dimension indices. */
2421 Int32	  counts[];	    	/* In: Dimension counts. */
2422 Int32	  intervals[];	    	/* In: Dimension intervals. */
2423 void	  *buffer;	    	/* In: Values.
2424 					VMS: If character data type, could
2425 					     be passed by reference or
2426 					     descriptor. */
2427 Int32	  *status;		/* Out: CDF status code. */
2428 {
2429   int dimN;
2430   long indicesT[CDF_MAX_DIMS], countsT[CDF_MAX_DIMS], intervalsT[CDF_MAX_DIMS],
2431        numDims, dataType;
2432   long varNumT = (long) (*var_num - 1);
2433   long recStartT = (long) (*rec_start - 1);
2434   long recCountT = (long) *rec_count;
2435   long recIntervalT = (long) *rec_int;
2436 
2437   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2438 				     zVAR_, varNumT,
2439 			    GET_, zVAR_NUMDIMS_, &numDims,
2440 				  zVAR_DATATYPE_, &dataType,
2441 			    NULL_);
2442   if (StatusBAD(*status)) return;
2443 
2444   for (dimN = 0; dimN < (int) numDims; dimN++) {
2445      indicesT[dimN] = (long) (indices[dimN] - 1);
2446      countsT[dimN] = (long) counts[dimN];
2447      intervalsT[dimN] = (long) intervals[dimN];
2448   }
2449 
2450   *status = (Int32) CDFlib (SELECT_, zVAR_RECNUMBER_, recStartT,
2451 				     zVAR_RECCOUNT_, recCountT,
2452 				     zVAR_RECINTERVAL_, recIntervalT,
2453 				     zVAR_DIMINDICES_, indicesT,
2454 				     zVAR_DIMCOUNTS_, countsT,
2455 				     zVAR_DIMINTERVALS_, intervalsT,
2456 			    PUT_, zVAR_HYPERDATA_,
2457 #if defined(Fif_DESCR)
2458 						BOO(STRINGdataType(dataType),
2459 						    DESCRtoREF(buffer),buffer),
2460 #else
2461 						buffer,
2462 #endif
2463 			    NULL_);
2464   return;
2465 }
2466 
2467 /******************************************************************************
2468 *  CDF_var_hyper_get.
2469 ******************************************************************************/
2470 
2471 VISIBLE_PREFIX
2472 Fif_PREFIXa
2473 void
2474 Fif_PREFIXb
2475 Fif_ENTRYPOINT(cdf_var_hyper_get__,
2476 	       cdf_var_hyper_get_,
2477 	       cdf_var_hyper_get,
2478 	       CDF_VAR_HYPER_GET)
2479 (id, var_num, rec_start, rec_count, rec_int, indices, counts,
2480 intervals, buffer, status)
2481 Int32	  *id;		    	/* In: CDF identifier. */
2482 Int32	  *var_num;	   	/* In: rVariable number. */
2483 Int32	  *rec_start; 		/* In: Starting record number. */
2484 Int32	  *rec_count; 		/* In: Record count. */
2485 Int32	  *rec_int; 		/* In: Record interval. */
2486 Int32	  indices[];	    	/* In: Dimension indices. */
2487 Int32	  counts[];	    	/* In: Dimension counts. */
2488 Int32	  intervals[];	    	/* In: Dimension intervals. */
2489 void	  *buffer;	    	/* In: Values.
2490 					VMS: If character data type, could
2491 					     be passed by reference or
2492 					     descriptor. */
2493 Int32	  *status;		/* Out: CDF status code. */
2494 {
2495   int dimN;
2496   long indicesT[CDF_MAX_DIMS], countsT[CDF_MAX_DIMS], intervalsT[CDF_MAX_DIMS],
2497        numDims, dataType;
2498   long varNumT = (long) (*var_num - 1);
2499   long recStartT = (long) (*rec_start - 1);
2500   long recCountT = (long) *rec_count;
2501   long recIntervalT = (long) *rec_int;
2502 
2503   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2504 				     rVAR_, varNumT,
2505 			    GET_, rVARs_NUMDIMS_, &numDims,
2506 				  rVAR_DATATYPE_, &dataType,
2507 			    NULL_);
2508   if (StatusBAD(*status)) return;
2509 
2510   for (dimN = 0; dimN < (int) numDims; dimN++) {
2511      indicesT[dimN] = (long) (indices[dimN] - 1);
2512      countsT[dimN] = (long) counts[dimN];
2513      intervalsT[dimN] = (long) intervals[dimN];
2514   }
2515 
2516   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recStartT,
2517 				     rVARs_RECCOUNT_, recCountT,
2518 				     rVARs_RECINTERVAL_, recIntervalT,
2519 				     rVARs_DIMINDICES_, indicesT,
2520 				     rVARs_DIMCOUNTS_, countsT,
2521 				     rVARs_DIMINTERVALS_, intervalsT,
2522 			    GET_, rVAR_HYPERDATA_,
2523 #if defined(Fif_DESCR)
2524 						BOO(STRINGdataType(dataType),
2525 						    DESCRtoREF(buffer),buffer),
2526 #else
2527 						buffer,
2528 #endif
2529 			    NULL_);
2530   return;
2531 }
2532 
2533 /******************************************************************************
2534 *  CDF_hyper_get_zvar_data.
2535 ******************************************************************************/
2536 
2537 VISIBLE_PREFIX
2538 Fif_PREFIXa
2539 void
2540 Fif_PREFIXb
2541 Fif_ENTRYPOINT(cdf_hyper_get_zvar_data__,
2542 	       cdf_hyper_get_zvar_data_,
2543 	       cdf_hyper_get_zvar_data,
2544 	       CDF_HYPER_GET_ZVAR_DATA)
2545 (id, var_num, rec_start, rec_count, rec_int, indices, counts,
2546 intervals, buffer, status)
2547 Int32	  *id;		    	/* In: CDF identifier. */
2548 Int32	  *var_num;	   	/* In: zVariable number. */
2549 Int32	  *rec_start; 		/* In: Starting record number. */
2550 Int32	  *rec_count; 		/* In: Record count. */
2551 Int32	  *rec_int; 		/* In: Record interval. */
2552 Int32	  indices[];	    	/* In: Dimension indices. */
2553 Int32	  counts[];	    	/* In: Dimension counts. */
2554 Int32	  intervals[];	    	/* In: Dimension intervals. */
2555 void	  *buffer;	    	/* In: Values.
2556 					VMS: If character data type, could
2557 					     be passed by reference or
2558 					     descriptor. */
2559 Int32	  *status;		/* Out: CDF status code. */
2560 {
2561   int dimN;
2562   long indicesT[CDF_MAX_DIMS], countsT[CDF_MAX_DIMS], intervalsT[CDF_MAX_DIMS],
2563        numDims, dataType;
2564   long varNumT = (long) (*var_num - 1);
2565   long recStartT = (long) (*rec_start - 1);
2566   long recCountT = (long) *rec_count;
2567   long recIntervalT = (long) *rec_int;
2568 
2569   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2570 				     zVAR_, varNumT,
2571 			    GET_, zVAR_NUMDIMS_, &numDims,
2572 				  zVAR_DATATYPE_, &dataType,
2573 			    NULL_);
2574   if (StatusBAD(*status)) return;
2575 
2576   for (dimN = 0; dimN < (int) numDims; dimN++) {
2577      indicesT[dimN] = (long) (indices[dimN] - 1);
2578      countsT[dimN] = (long) counts[dimN];
2579      intervalsT[dimN] = (long) intervals[dimN];
2580   }
2581 
2582   *status = (Int32) CDFlib (SELECT_, zVAR_RECNUMBER_, recStartT,
2583 				     zVAR_RECCOUNT_, recCountT,
2584 				     zVAR_RECINTERVAL_, recIntervalT,
2585 				     zVAR_DIMINDICES_, indicesT,
2586 				     zVAR_DIMCOUNTS_, countsT,
2587 				     zVAR_DIMINTERVALS_, intervalsT,
2588 			    GET_, zVAR_HYPERDATA_,
2589 #if defined(Fif_DESCR)
2590 						BOO(STRINGdataType(dataType),
2591 						    DESCRtoREF(buffer),buffer),
2592 #else
2593 						buffer,
2594 #endif
2595 			    NULL_);
2596   return;
2597 }
2598 
2599 /******************************************************************************
2600 *  CDF_var_close.
2601 ******************************************************************************/
2602 
2603 VISIBLE_PREFIX
2604 Fif_PREFIXa
2605 void
2606 Fif_PREFIXb
2607 Fif_ENTRYPOINT(cdf_var_close__,cdf_var_close_,cdf_var_close,CDF_VAR_CLOSE)
2608 (id, var_num, status)
2609 Int32	  *id;	  	  	/* In: CDF identifier. */
2610 Int32	  *var_num;   		/* In: rVariable number. */
2611 Int32	  *status;		/* Out: CDF status code. */
2612 {
2613   long varNumT = (long) (*var_num - 1);
2614   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2615 				     rVAR_, varNumT,
2616 			    CLOSE_, rVAR_,
2617 			    NULL_);
2618   return;
2619 }
2620 
2621 /******************************************************************************
2622 *  CDF_close_zvar.
2623 ******************************************************************************/
2624 
2625 VISIBLE_PREFIX
2626 Fif_PREFIXa
2627 void
2628 Fif_PREFIXb
2629 Fif_ENTRYPOINT(cdf_close_zvar__,cdf_close_zvar_,cdf_close_zvar,CDF_CLOSE_ZVAR)
2630 (id, var_num, status)
2631 Int32	  *id;	  	  	/* In: CDF identifier. */
2632 Int32	  *var_num;   		/* In: zVariable number. */
2633 Int32	  *status;		/* Out: CDF status code. */
2634 {
2635   long varNumT = (long) (*var_num - 1);
2636   CDFstatus statusT;
2637 
2638   statusT = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2639 				     zVAR_, varNumT,
2640 			    CLOSE_, zVAR_,
2641 			    NULL_);
2642   return;
2643 }
2644 
2645 /******************************************************************************
2646 *  CDF_error.
2647 ******************************************************************************/
2648 
2649 VISIBLE_PREFIX
2650 Fif_PREFIXa
2651 void
2652 Fif_PREFIXb
2653 Fif_ENTRYPOINT(cdf_error__,cdf_error_,cdf_error,CDF_ERROR)
2654 (statusI, text, statusO Fif_GHOSTARG(text_len))
2655 Int32	  *statusI;		/* In: CDF status code. */
2656 void	  *text;		/* Out: Character string to receive
2657 					explanation. */
2658 Int32     *statusO;             /* Out: CDF operation status. */
Fif_GHOSTDEF(text_len)2659 Fif_GHOSTDEF(text_len)		/* Invisible length of "text"
2660 				   (generated by FORTRAN compiler). */
2661 {
2662   char statusTextT[CDF_ERRTEXT_LEN+1];
2663   *statusO = (Int32) CDFlib (SELECT_, CDF_STATUS_, (CDFstatus) *statusI,
2664 		             GET_, STATUS_TEXT_, statusTextT,
2665 		             NULL_);
2666   if (StatusOK(*statusO))
2667 #if defined(Fif_GHOSTLEN)
2668     CtoFORTstring (statusTextT, text, Fif_GHOSTUSE(text_len));
2669 #else
2670     CtoFORTstring (statusTextT, text, CDF_STATUSTEXT_LEN);
2671 #endif
2672   else
2673 #if defined(Fif_GHOSTLEN)
2674     CtoFORTstring ("Unknown CDF status code", text, Fif_GHOSTUSE(text_len));
2675 #else
2676     CtoFORTstring ("Unknown CDF status code", text, CDF_STATUSTEXT_LEN);
2677 #endif
2678   return;
2679 }
2680 
2681 /******************************************************************************
2682 *  CDF_get_status_text.
2683 ******************************************************************************/
2684 
2685 VISIBLE_PREFIX
2686 Fif_PREFIXa
2687 void
2688 Fif_PREFIXb
2689 Fif_ENTRYPOINT(cdf_get_status_text__,
2690                cdf_get_status_text_,
2691                cdf_get_status_text,
2692                CDF_GET_STATUS_TEXT)
2693 (statusI, text, statusO Fif_GHOSTARG(text_len))
2694 Int32	  *statusI;		/* In: CDF status code. */
2695 void	  *text;		/* Out: Character string to receive
2696 					explanation. */
2697 Int32     *statusO;             /* Out: CDF operation status. */
Fif_GHOSTDEF(text_len)2698 Fif_GHOSTDEF(text_len)		/* Invisible length of "text"
2699 				   (generated by FORTRAN compiler). */
2700 {
2701   char statusTextT[CDF_ERRTEXT_LEN+1];
2702   *statusO = (Int32) CDFlib (SELECT_, CDF_STATUS_, (CDFstatus) *statusI,
2703 		             GET_, STATUS_TEXT_, statusTextT,
2704 		             NULL_);
2705   if (StatusOK(*statusO))
2706 #if defined(Fif_GHOSTLEN)
2707     CtoFORTstring (statusTextT, text, Fif_GHOSTUSE(text_len));
2708 #else
2709     CtoFORTstring (statusTextT, text, CDF_STATUSTEXT_LEN);
2710 #endif
2711   else
2712 #if defined(Fif_GHOSTLEN)
2713     CtoFORTstring ("Unknown CDF status code", text, Fif_GHOSTUSE(text_len));
2714 #else
2715     CtoFORTstring ("Unknown CDF status code", text, CDF_STATUSTEXT_LEN);
2716 #endif
2717   return;
2718 }
2719 
2720 /******************************************************************************
2721 *  CDF_getrVarsRecordData.
2722 ******************************************************************************/
2723 
2724 VISIBLE_PREFIX
2725 Fif_PREFIXa
2726 void
2727 Fif_PREFIXb
2728 Fif_ENTRYPOINT(cdf_getrvarsrecorddata__,
2729                cdf_getrvarsrecorddata_,
2730                cdf_getrvarsrecorddata,
2731                CDF_GETRVARSRECORDDATA)
2732 (id, num_vars, varNums, rec_num, buffptr, status)
2733 Int32     *id;                  /* In: CDF identifier. */
2734 Int32     *num_vars;            /* In: Number of rVariables. */
2735 Int32     varNums[];            /* In: rVariable numbers. */
2736 Int32     *rec_num;             /* In: Record number. */
2737 void      *buffptr;             /* In: Pointer for input data */
2738 Int32     *status;              /* Out: CDF status code. */
2739 {
2740   long num_varsT = (long) *num_vars;
2741   long recNumT = (long) (*rec_num - 1);
2742   long *varNumsT;
2743   int i;
2744 
2745   if (*num_vars < 1) {
2746     *status = (Int32) CDF_OK;
2747     return;
2748   }
2749 
2750   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2751   if (varNumsT == NULL) {
2752     *status = BAD_MALLOC;
2753     return;
2754   }
2755 
2756   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
2757 
2758   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2759                             NULL_);
2760   if (StatusBAD(*status)) return;
2761 
2762   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recNumT,
2763                             GET_, rVARs_RECDATA_, num_varsT, varNumsT, buffptr,
2764                             NULL_);
2765   cdf_FreeMemory (varNumsT, NULL);
2766   return;
2767 
2768 }
2769 
2770 /******************************************************************************
2771 *  CDF_getzVarsRecordData.
2772 ******************************************************************************/
2773 
2774 VISIBLE_PREFIX
2775 Fif_PREFIXa
2776 void
2777 Fif_PREFIXb
2778 Fif_ENTRYPOINT(cdf_getzvarsrecorddata__,
2779                cdf_getzvarsrecorddata_,
2780                cdf_getzvarsrecorddata,
2781                CDF_GETZVARSRECORDDATA)
2782 (id, num_vars, varNums, rec_num, buffptr, status)
2783 Int32     *id;                  /* In: CDF identifier. */
2784 Int32     *num_vars;            /* In: Number of zVariables. */
2785 Int32     varNums[];            /* In: zVariable numbers. */
2786 Int32     *rec_num;             /* In: Record number. */
2787 void      *buffptr;             /* In: Pointer for input data */
2788 Int32     *status;              /* Out: CDF status code. */
2789 {
2790   long num_varsT = (long) *num_vars;
2791   long recNumT = (long) (*rec_num - 1);
2792   long *varNumsT;
2793   int i;
2794 
2795   if (*num_vars < 1) {
2796     *status = (Int32) CDF_OK;
2797     return;
2798   }
2799 
2800   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2801   if (varNumsT == NULL) {
2802     *status = BAD_MALLOC;
2803     return;
2804   }
2805 
2806   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
2807 
2808   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2809                             NULL_);
2810   if (StatusBAD(*status)) return;
2811 
2812   *status = (Int32) CDFlib (SELECT_, zVARs_RECNUMBER_, recNumT,
2813                             GET_, zVARs_RECDATA_, num_varsT, varNumsT, buffptr,
2814                             NULL_);
2815   cdf_FreeMemory (varNumsT, NULL);
2816 
2817   return;
2818 
2819 }
2820 
2821 /******************************************************************************
2822 *  CDF_putrVarsRecordData.
2823 ******************************************************************************/
2824 
2825 VISIBLE_PREFIX
2826 Fif_PREFIXa
2827 void
2828 Fif_PREFIXb
2829 Fif_ENTRYPOINT(cdf_putrvarsrecorddata__,
2830                cdf_putrvarsrecorddata_,
2831                cdf_putrvarsrecorddata,
2832                CDF_PUTRVARSRECORDDATA)
2833 (id, num_vars, varNums, rec_num, buffptr, status)
2834 Int32     *id;                  /* In: CDF identifier. */
2835 Int32     *num_vars;            /* In: Number of rVariables. */
2836 Int32     varNums[];            /* In: rVariable numbers. */
2837 Int32     *rec_num;             /* In: Record number. */
2838 void      *buffptr;             /* In: Pointer for output data */
2839 Int32     *status;              /* Out: CDF status code. */
2840 {
2841   long num_varsT = (long) *num_vars;
2842   long recNumT = (long) (*rec_num - 1);
2843   long *varNumsT;
2844   int i;
2845 
2846   if (*num_vars < 1) {
2847     *status = (Int32) CDF_OK;
2848     return;
2849   }
2850 
2851   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2852   if (varNumsT == NULL) {
2853     *status = BAD_MALLOC;
2854     return;
2855   }
2856 
2857   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2858                             NULL_);
2859   if (StatusBAD(*status)) return;
2860 
2861   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
2862 
2863   *status = (Int32) CDFlib (SELECT_, rVARs_RECNUMBER_, recNumT,
2864                             PUT_, rVARs_RECDATA_, num_varsT, varNumsT, buffptr,
2865                             NULL_);
2866   cdf_FreeMemory (varNumsT, NULL);
2867   return;
2868 }
2869 
2870 /******************************************************************************
2871 *  CDF_putzVarsRecordData.
2872 ******************************************************************************/
2873 
2874 VISIBLE_PREFIX
2875 Fif_PREFIXa
2876 void
2877 Fif_PREFIXb
2878 Fif_ENTRYPOINT(cdf_putzvarsrecorddata__,
2879                cdf_putzvarsrecorddata_,
2880                cdf_putzvarsrecorddata,
2881                CDF_PUTZVARSRECORDDATA)
2882 (id, num_vars, varNums, rec_num, buffptr, status)
2883 Int32     *id;                  /* In: CDF identifier. */
2884 Int32     *num_vars;            /* In: Number of zVariables. */
2885 Int32     varNums[];            /* In: zVariable numbers. */
2886 Int32     *rec_num;             /* In: Record number. */
2887 void      *buffptr;             /* In: Pointer for output data */
2888 Int32     *status;              /* Out: CDF status code. */
2889 {
2890   long num_varsT = (long) *num_vars;
2891   long recNumT = (long) (*rec_num - 1);
2892   long *varNumsT;
2893   int i;
2894 
2895   if (*num_vars < 1) {
2896     *status = (Int32) CDF_OK;
2897     return;
2898   }
2899 
2900   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2901   if (varNumsT == NULL) {
2902     *status = BAD_MALLOC;
2903     return;
2904   }
2905 
2906   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2907                             NULL_);
2908   if (StatusBAD(*status)) return;
2909 
2910   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
2911 
2912   *status = (Int32) CDFlib (SELECT_, zVARs_RECNUMBER_, recNumT,
2913                             PUT_, zVARs_RECDATA_, num_varsT, varNumsT, buffptr,
2914                             NULL_);
2915   cdf_FreeMemory (varNumsT, NULL);
2916   return;
2917 }
2918 
2919 /******************************************************************************
2920 *  CDF_get_zVars_RecordData.
2921 ******************************************************************************/
2922 
2923 VISIBLE_PREFIX
2924 Fif_PREFIXa
2925 void
2926 Fif_PREFIXb
2927 Fif_ENTRYPOINT(cdf_get_zvars_recorddata__,
2928                cdf_get_zvars_recorddata_,
2929                cdf_get_zvars_recorddata,
2930                CDF_GET_ZVARS_RECORDDATA)
2931 (id, num_vars, varNums, rec_num, buffptr, status)
2932 Int32     *id;                  /* In: CDF identifier. */
2933 Int32     *num_vars;            /* In: Number of zVariables. */
2934 Int32     varNums[];            /* In: zVariable numbers. */
2935 Int32     *rec_num;             /* In: Record number. */
2936 void      *buffptr;             /* In: Pointer for input data */
2937 Int32     *status;              /* Out: CDF status code. */
2938 {
2939   long num_varsT = (long) *num_vars;
2940   long recNumT = (long) (*rec_num - 1);
2941   long *varNumsT;
2942   int i;
2943 
2944   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2945                             NULL_);
2946   if (StatusBAD(*status)) return;
2947 
2948   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2949   if (varNumsT == NULL) {
2950     *status = BAD_MALLOC;
2951     return;
2952   }
2953 
2954   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
2955 
2956   *status = (Int32) CDFlib (SELECT_, zVARs_RECNUMBER_, recNumT,
2957                             GET_, zVARs_RECDATA_, num_varsT, varNumsT, buffptr,
2958                             NULL_);
2959   cdf_FreeMemory (varNumsT, NULL);
2960   return;
2961 
2962 }
2963 
2964 /******************************************************************************
2965 *  CDF_put_zVars_RecordData.
2966 ******************************************************************************/
2967 
2968 VISIBLE_PREFIX
2969 Fif_PREFIXa
2970 void
2971 Fif_PREFIXb
2972 Fif_ENTRYPOINT(cdf_put_zvars_recorddata__,
2973                cdf_put_zvars_recorddata_,
2974                cdf_put_zvars_recorddata,
2975                CDF_PUT_ZVARS_RECORDDATA)
2976 (id, num_vars, varNums, rec_num, buffptr, status)
2977 Int32     *id;                  /* In: CDF identifier. */
2978 Int32     *num_vars;            /* In: Number of zVariables. */
2979 Int32     varNums[];            /* In: zVariable numbers. */
2980 Int32     *rec_num;             /* In: Record number. */
2981 void      *buffptr;             /* In: Pointer for output data */
2982 Int32     *status;              /* Out: CDF status code. */
2983 {
2984   long num_varsT = (long) *num_vars;
2985   long recNumT = (long) (*rec_num - 1);
2986   long *varNumsT;
2987   int i;
2988 
2989   if (*num_vars < 1) {
2990     *status = (Int32) CDF_OK;
2991     return;
2992   }
2993 
2994   *status = (Int32) CDFlib (SELECT_, CDF_, Int32ToCDFid(*id),
2995                             NULL_);
2996   if (StatusBAD(*status)) return;
2997 
2998   varNumsT = cdf_AllocateMemory (*num_vars*sizeof(long), NULL);
2999   if (varNumsT == NULL) {
3000     *status = BAD_MALLOC;
3001     return;
3002   }
3003 
3004   for (i = 0; i < *num_vars; i++) varNumsT[i] = (long) varNums[i] - 1;
3005 
3006   *status = (Int32) CDFlib (SELECT_, zVARs_RECNUMBER_, recNumT,
3007                             PUT_, zVARs_RECDATA_, num_varsT, varNumsT, buffptr,
3008                             NULL_);
3009   cdf_FreeMemory (varNumsT, NULL);
3010   return;
3011 }
3012 
3013 /******************************************************************************
3014 *  CDF_set_FileBackward.
3015 ******************************************************************************/
3016 
3017 VISIBLE_PREFIX
3018 Fif_PREFIXa
3019 void
3020 Fif_PREFIXb
3021 Fif_ENTRYPOINT(cdf_set_filebackward__,cdf_set_filebackward_,
3022                cdf_set_filebackward, CDF_SET_FILEBACKWARD)
3023 (flag)
3024 Int32     *flag;                /* In: Flag to set the file to old version. */
3025 {
3026   int fg = (int) *flag;
3027   CDFsetFileBackward(fg);
3028   return;
3029 }
3030 
3031 /******************************************************************************
3032 *  CDF_get_FileBackward.
3033 ******************************************************************************/
3034 
3035 VISIBLE_PREFIX
3036 Fif_PREFIXa
3037 Int32
3038 Fif_PREFIXb
Fif_ENTRYPOINT(cdf_get_filebackward__,cdf_get_filebackward_,cdf_get_filebackward,CDF_GET_FILEBACKWARD)3039 Fif_ENTRYPOINT(cdf_get_filebackward__,cdf_get_filebackward_,
3040                cdf_get_filebackward, CDF_GET_FILEBACKWARD)
3041 ()
3042 {
3043 
3044   int flag;
3045   flag = CDFgetFileBackward();
3046   if (flag == 0) return (Int32) 0;
3047   else return (Int32) 1;
3048 }
3049 
3050 /******************************************************************************
3051 *  CDF_set_Validate.
3052 ******************************************************************************/
3053 
3054 VISIBLE_PREFIX
3055 Fif_PREFIXa
3056 void
3057 Fif_PREFIXb
3058 Fif_ENTRYPOINT(cdf_set_validate__,cdf_set_validate_,
3059                cdf_set_validate, CDF_SET_VALIDATE)
3060 (flag)
3061 Int32     *flag;                /* In: Flag to set the file to old version. */
3062 {
3063   int fg = (int) *flag;
3064   CDFsetValidate(fg);
3065   return;
3066 }
3067 
3068 /******************************************************************************
3069 *  CDF_get_validate.
3070 ******************************************************************************/
3071 
3072 VISIBLE_PREFIX
3073 Fif_PREFIXa
3074 Int32
3075 Fif_PREFIXb
Fif_ENTRYPOINT(cdf_get_validate__,cdf_get_validate_,cdf_get_validate,CDF_GET_VALIDATE)3076 Fif_ENTRYPOINT(cdf_get_validate__,cdf_get_validate_,
3077                cdf_get_validate, CDF_GET_VALIDATE)
3078 ()
3079 {
3080 
3081   int flag;
3082   flag = CDFgetValidate();
3083   if (flag == 0) return (Int32) 0;
3084   else return (Int32) 1;
3085 }
3086 
3087