home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / hdf / unix / hdf3_2r2 / src / hfilef.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-29  |  4.0 KB  |  125 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. #ifdef RCSID
  26. static char RcsId[] = "@(#)$Revision: 1.3 $";
  27. #endif
  28. /*
  29. $Header: /hdf/hdf/v3.2r2/src/RCS/hfilef.c,v 1.3 1992/10/23 00:14:11 koziol beta koziol $
  30.  
  31. $Log: hfilef.c,v $
  32.  * Revision 1.3  1992/10/23  00:14:11  koziol
  33.  * Changed all DFIstr*() and DFImem*() calls to HDstr*() and HDmem*() calls
  34.  * #ifdef'd out the macros Jason defined for Hopen, Hclose, etc. for Vsets
  35.  * Replaced Vset VFREESPACE and VGETSPACE calls with actual calls to HDfreespace
  36.  * and HDgetspace
  37.  * Added a MS-Windows lower lower for file I/O (which may not be completely working
  38.  *
  39.  * Revision 1.2  1992/09/11  14:15:04  koziol
  40.  * Changed Fortran stubs' parameter passing to use a new typedef, intf,
  41.  * which should be typed to the size of an INTEGER*4 in whatever Fortran
  42.  * compiler the C functions need to be compatible with.  (This is mostly
  43.  * for the PC and possibly for the Mac)
  44.  *
  45.  * Revision 1.1  1992/08/25  21:40:44  koziol
  46.  * Initial revision
  47.  *
  48. */
  49. /*-----------------------------------------------------------------------------
  50.  * File:    hfileF.c
  51.  * Purpose: C stubs for Fortran low level routines
  52.  * Invokes: hfile.c
  53.  * Contents: 
  54.  *  hiopen_:   call Hopen to open HDF file
  55.  *  hclose_:   call Hclose to close HDF file
  56.  *---------------------------------------------------------------------------*/
  57.  
  58. #include "hdf.h"
  59.  
  60. #ifndef HFILE_FNAMES
  61. #   define HFILE_FNAMES
  62. #ifdef DF_CAPFNAMES
  63. #   define nhiopen   FNAME(HIOPEN)
  64. #   define nhclose   FNAME(HCLOSE)
  65. #else
  66. #   define nhiopen   FNAME(hiopen)
  67. #   define nhclose  FNAME(hclose)
  68. #endif /* DF_CAPFNAMES */
  69. #endif /* HFILE_FNAMES */
  70.  
  71. /*-----------------------------------------------------------------------------
  72.  * Name:    hiopen
  73.  * Purpose: call Hopen to open HDF file
  74.  * Inputs:  name: name of file to open
  75.  *          access: access mode - integer with value DFACC_READ etc. 
  76.  *          defdds: default number of DDs per header block
  77.  *          namelen: length of name
  78.  * Returns: 0 on success, -1 on failure with error set
  79.  * Users:   HDF Fortran programmers
  80.  * Invokes: Hopen
  81.  * Method:  Convert filename to C string, call Hopen
  82.  *---------------------------------------------------------------------------*/
  83.  
  84.     FRETVAL(intf)
  85. #ifdef PROTOTYPE
  86. nhiopen(_fcd name, intf *access, intf *defdds, intf *namelen)
  87. #else
  88. nhiopen(name, access, defdds, namelen)
  89.     _fcd name;
  90.     intf *access;
  91.     intf *defdds;
  92.     intf *namelen;
  93. #endif /* PROTOTYPE */
  94. {
  95.     char *fn;
  96.     intf ret;
  97.     
  98.     fn = HDf2cstring(name, *namelen);
  99.     ret = (intf) Hopen(fn, *access, *defdds);
  100.     HDfreespace(fn);
  101.     return(ret);
  102. }
  103.  
  104.  
  105. /*-----------------------------------------------------------------------------
  106.  * Name:    hclose
  107.  * Purpose: Call DFclose to close HDF file
  108.  * Inputs:  file_id: handle to HDF file to close
  109.  * Returns: 0 on success, FAIL on failure with error set
  110.  * Users:   HDF Fortran programmers
  111.  * Invokes: Hclose
  112.  *---------------------------------------------------------------------------*/
  113.  
  114.     FRETVAL(intf)
  115. #ifdef PROTOTYPE
  116. nhclose(intf *file_id)
  117. #else
  118. nhclose(file_id)
  119.     intf *file_id;
  120. #endif /* PROTOTYPE */
  121. {
  122.     return(Hclose(*file_id));
  123. }
  124.  
  125.