diff options
-rw-r--r-- | src/H5.c | 24 | ||||
-rw-r--r-- | src/H5A.c | 23 | ||||
-rw-r--r-- | src/H5AC.c | 15 | ||||
-rw-r--r-- | src/H5ACprivate.h | 6 | ||||
-rw-r--r-- | src/H5ACpublic.h (renamed from src/H5ACproto.h) | 16 | ||||
-rw-r--r-- | src/H5Aprivate.h | 67 | ||||
-rw-r--r-- | src/H5Apublic.h (renamed from src/H5Aproto.h) | 39 | ||||
-rw-r--r-- | src/H5B.c | 132 | ||||
-rw-r--r-- | src/H5Bprivate.h | 9 | ||||
-rw-r--r-- | src/H5Bpublic.h (renamed from src/H5Bproto.h) | 16 | ||||
-rw-r--r-- | src/H5C.c | 34 | ||||
-rw-r--r-- | src/H5Cprivate.h | 35 | ||||
-rw-r--r-- | src/H5Cproto.h | 41 | ||||
-rw-r--r-- | src/H5Cpublic.h (renamed from src/hdf5type.h) | 55 | ||||
-rw-r--r-- | src/H5D.c | 14 | ||||
-rw-r--r-- | src/H5Dprivate.h | 20 | ||||
-rw-r--r-- | src/H5Dpublic.h (renamed from src/H5Dproto.h) | 26 | ||||
-rw-r--r-- | src/H5E.c | 76 | ||||
-rw-r--r-- | src/H5Eprivate.h | 136 | ||||
-rw-r--r-- | src/H5Epublic.h (renamed from src/H5Eproto.h) | 70 | ||||
-rw-r--r-- | src/H5F.c | 36 | ||||
-rw-r--r-- | src/H5Fprivate.h | 327 | ||||
-rw-r--r-- | src/H5Fpublic.h (renamed from src/H5Fproto.h) | 36 | ||||
-rw-r--r-- | src/H5G.c | 19 | ||||
-rw-r--r-- | src/H5Gnode.c | 20 | ||||
-rw-r--r-- | src/H5Gprivate.h | 12 | ||||
-rw-r--r-- | src/H5Gpublic.h (renamed from src/H5Gproto.h) | 17 | ||||
-rw-r--r-- | src/H5H.c | 14 | ||||
-rw-r--r-- | src/H5Hprivate.h | 7 | ||||
-rw-r--r-- | src/H5Hpublic.h (renamed from src/H5Hproto.h) | 16 | ||||
-rw-r--r-- | src/H5M.c | 85 | ||||
-rw-r--r-- | src/H5MF.c | 10 | ||||
-rw-r--r-- | src/H5MFprivate.h | 5 | ||||
-rw-r--r-- | src/H5MFpublic.h (renamed from src/H5MFproto.h) | 17 | ||||
-rw-r--r-- | src/H5MM.c | 6 | ||||
-rw-r--r-- | src/H5MMprivate.h | 4 | ||||
-rw-r--r-- | src/H5MMpublic.h (renamed from src/H5MMproto.h) | 17 | ||||
-rw-r--r-- | src/H5Mprivate.h | 82 | ||||
-rw-r--r-- | src/H5Mpublic.h (renamed from src/H5Mproto.h) | 27 | ||||
-rw-r--r-- | src/H5O.c | 17 | ||||
-rw-r--r-- | src/H5Ocont.c | 9 | ||||
-rw-r--r-- | src/H5Oname.c | 11 | ||||
-rw-r--r-- | src/H5Onull.c | 5 | ||||
-rw-r--r-- | src/H5Oprivate.h | 8 | ||||
-rw-r--r-- | src/H5Opublic.h (renamed from src/H5Oproto.h) | 18 | ||||
-rw-r--r-- | src/H5Ostab.c | 13 | ||||
-rw-r--r-- | src/H5P.c | 9 | ||||
-rw-r--r-- | src/H5Pprivate.h | 18 | ||||
-rw-r--r-- | src/H5Ppublic.h (renamed from src/H5Pproto.h) | 26 | ||||
-rw-r--r-- | src/H5T.c | 11 | ||||
-rw-r--r-- | src/H5Tprivate.h | 15 | ||||
-rw-r--r-- | src/H5Tpublic.h (renamed from src/H5Tproto.h) | 26 | ||||
-rw-r--r-- | src/H5config.h.in | 32 | ||||
-rw-r--r-- | src/H5private.h | 455 | ||||
-rw-r--r-- | src/H5proto.h | 35 | ||||
-rw-r--r-- | src/H5public.h | 114 | ||||
-rw-r--r-- | src/Makefile.in | 42 | ||||
-rw-r--r-- | src/debug.c | 16 | ||||
-rw-r--r-- | src/h5oplat.h | 555 | ||||
-rw-r--r-- | src/hdf5.h | 69 | ||||
-rw-r--r-- | src/hdf5fort.h | 75 | ||||
-rw-r--r-- | src/hdf5gen.h | 132 | ||||
-rw-r--r-- | src/hdf5glob.h | 58 | ||||
-rw-r--r-- | src/hdf5lims.h | 72 | ||||
-rw-r--r-- | src/hdf5meta.h | 145 | ||||
-rw-r--r-- | src/hdf5pabl.h | 34 | ||||
-rw-r--r-- | src/hdf5plat.h | 781 | ||||
-rw-r--r-- | src/hdf5port.h | 207 |
68 files changed, 1687 insertions, 2932 deletions
@@ -35,21 +35,23 @@ static char RcsId[] = "@(#)$Revision$"; H5_init_interface -- initialize the H5 interface + */ -#define HDF5_MASTER -#include "hdf5.h" -#undef HDF5_MASTER /* private headers */ -#include "H5ACprivate.h" /*cache */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5private.h" /* Generic info */ +#include <H5private.h> /*library */ +#include <H5ACprivate.h> /*cache */ +#include <H5Bprivate.h> /*B-link trees */ +#include <H5Eprivate.h> /*error handling */ #define PABLO_MASK H5_mask /*--------------------- Locally scoped variables -----------------------------*/ /* Whether we've installed the library termination function yet for this interface */ -static intn interface_initialize_g = FALSE; +static hbool_t interface_initialize_g = FALSE; + +hbool_t library_initialize_g = FALSE; +hbool_t thread_initialize_g = FALSE; +hbool_t install_atexit_g = TRUE; /*------------------_-- Local function prototypes ----------------------------*/ static herr_t H5_init_interface(void); @@ -71,8 +73,8 @@ herr_t H5_init_library(void) FUNC_ENTER (H5_init_library, NULL, FAIL); /* Install atexit() library cleanup routine */ - if(install_atexit==TRUE) - if (HDatexit(&H5_term_library) != 0) + if(install_atexit_g==TRUE) + if (atexit(&H5_term_library) != 0) HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL); FUNC_LEAVE (SUCCEED); @@ -173,8 +175,8 @@ herr_t H5dont_atexit(void) { FUNC_ENTER (H5dont_atexit, NULL, FAIL); - if(install_atexit == TRUE) - install_atexit=FALSE; + if(install_atexit_g == TRUE) + install_atexit_g=FALSE; FUNC_LEAVE (SUCCEED); } /* end H5dont_atexit() */ @@ -60,21 +60,30 @@ MODIFICATION HISTORY 6/10/97 - Moved into HDF5 library */ -#define HDF5_ATOM_MASTER -#include "hdf5.h" -#include "H5private.h" -#include "H5Aprivate.h" +#include <H5private.h> +#include <H5Aprivate.h> +#include <H5Eprivate.h> #define PABLO_MASK H5A_mask static int interface_initialize_g = FALSE; -/* Private function prototypes */ -static atom_info_t *H5A_find_atom(hatom_t atm); +#ifdef ATOMS_ARE_CACHED +/* Array of pointers to atomic groups */ +static hatom_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1}; +static VOIDP atom_obj_cache[ATOM_CACHE_SIZE]={NULL}; +#endif -static atom_info_t *H5A_get_atom_node(void); +/* Array of pointers to atomic groups */ +static atom_group_t *atom_group_list[MAXGROUP]={NULL}; +/* Pointer to the atom node free list */ +static atom_info_t *atom_free_list=NULL; + +/* PRIVATE PROTOTYPES */ +static atom_info_t *H5A_find_atom(hatom_t atm); +static atom_info_t *H5A_get_atom_node(void); static herr_t H5A_release_atom_node(atom_info_t *atm); /****************************************************************************** @@ -20,12 +20,10 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include "hdf5.h" - -#include "H5private.h" -#include "H5ACprivate.h" -#include "H5MMprivate.h" +#include <H5private.h> +#include <H5ACprivate.h> +#include <H5Eprivate.h> +#include <H5MMprivate.h> /* * Sorting the cache by address before flushing is sometimes faster @@ -36,7 +34,10 @@ #define PABLO_MASK H5AC_mask static int interface_initialize_g = FALSE; /*initialized?*/ + +#ifdef SORT_BY_ADDR static H5AC_cache_t *current_cache_g = NULL; /*for sorting */ +#endif /*------------------------------------------------------------------------- @@ -224,6 +225,7 @@ H5AC_find_f (hdf5_file_t *f, const H5AC_class_t *type, haddr_t addr, * *------------------------------------------------------------------------- */ +#ifdef SORT_BY_ADDR static int H5AC_compare (const void *_a, const void *_b) { @@ -239,6 +241,7 @@ H5AC_compare (const void *_a, const void *_b) if (current_cache_g[a].addr > current_cache_g[b].addr) return 1; return 0; } +#endif /*------------------------------------------------------------------------- diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 7bee4b6..96d32c9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -17,9 +17,11 @@ */ #ifndef _H5ACprivate_H #define _H5ACprivate_H +#include <H5ACpublic.h> /*public prototypes */ -#include "H5ACproto.h" /*public prototypes */ -#include "H5Fprivate.h" /*for private hdf5_file_t definition */ +/* Pivate headers needed by this header */ +#include <H5private.h> +#include <H5Fprivate.h> /* * Class methods pertaining to caching. Each type of cached object will diff --git a/src/H5ACproto.h b/src/H5ACpublic.h index 1423333..fb20c6d 100644 --- a/src/H5ACproto.h +++ b/src/H5ACpublic.h @@ -8,21 +8,23 @@ * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Function prototypes for the H5AC package. + * Purpose: Public include file for cache functions. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5ACproto_H -#define _H5ACproto_H +#ifndef _H5ACpublic_H +#define _H5ACpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 1a2db6f..572d3be 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -18,34 +18,51 @@ *---------------------------------------------------------------------------*/ /* avoid re-inclusion */ -#ifndef __ATOM_H -#define __ATOM_H +#ifndef _H5Aprivate_H +#define _H5Aprivate_H +#include <H5Apublic.h> /* Include Public Definitions */ -#include "H5Aproto.h" /* Include Public Definitions */ +/* Private headers needed by this file */ +#include <H5private.h> /* Atom Features control */ -/* Define the following macro for fast hash calculations (but limited hash sizes) */ + +/* + * Define the following macro for fast hash calculations (but limited + * hash sizes) + */ #define HASH_SIZE_POWER_2 /* Define the following macro for atom caching over all the atoms */ #define ATOMS_ARE_CACHED -#if defined HDF5_ATOM_MASTER | defined HDF5_ATOM_TESTER #ifdef ATOMS_ARE_CACHED -/* # of previous atoms cached */ -#define ATOM_CACHE_SIZE 4 -#endif /* ATOMS_ARE_CACHED */ +# define ATOM_CACHE_SIZE 4 /* # of previous atoms cached */ +#endif /* Map an atom to a Group number */ #define ATOM_TO_GROUP(a) ((group_t)((((hatom_t)(a))>>((sizeof(hatom_t)*8)-GROUP_BITS))&GROUP_MASK)) #ifdef HASH_SIZE_POWER_2 -/* Map an atom to a hash location (assumes s is a power of 2 and smaller than the ATOM_MASK constant) */ -#define ATOM_TO_LOC(a,s) ((hatom_t)(a)&((s)-1)) -#else /* HASH_SIZE_POWER_2 */ -/* Map an atom to a hash location */ -#define ATOM_TO_LOC(a,s) (((hatom_t)(a)&ATOM_MASK)%(s)) -#endif /* HASH_SIZE_POWER_2 */ +/* + * Map an atom to a hash location (assumes s is a power of 2 and smaller + * than the ATOM_MASK constant). + */ +# define ATOM_TO_LOC(a,s) ((hatom_t)(a)&((s)-1)) +#else +/* + * Map an atom to a hash location. + */ +# define ATOM_TO_LOC(a,s) (((hatom_t)(a)&ATOM_MASK)%(s)) +#endif + +/* Default sizes of the hash-tables for various atom groups */ +#define H5A_ERRSTACK_HASHSIZE 64 +#define H5A_FILEID_HASHSIZE 64 +#define H5A_TEMPID_HASHSIZE 64 +#define H5A_DATATYPEID_HASHSIZE 64 +#define H5A_DATASPACEID_HASHSIZE 64 +#define H5A_DATASETID_HASHSIZE 64 /* Atom information structure used */ typedef struct atom_info_struct_tag { @@ -65,26 +82,6 @@ typedef struct atom_group_struct_tag { atom_info_t **atom_list;/* pointer to an array of ptrs to atoms */ }atom_group_t; -/* Define this in only one place */ -#ifdef HDF5_ATOM_MASTER - -/* Array of pointers to atomic groups */ -static atom_group_t *atom_group_list[MAXGROUP]={NULL}; - -/* Pointer to the atom node free list */ -static atom_info_t *atom_free_list=NULL; - -#ifdef ATOMS_ARE_CACHED -/* Array of pointers to atomic groups */ -static hatom_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1}; -static VOIDP atom_obj_cache[ATOM_CACHE_SIZE]={NULL}; -#endif /* ATOMS_ARE_CACHED */ - -#endif /* HDF5_ATOM_MASTER */ - -/* Useful routines for generally private use */ - -#endif /* HDF5_ATOM_MASTER | HDF5_ATOM_TESTER */ -#endif /* __ATOM_H */ +#endif diff --git a/src/H5Aproto.h b/src/H5Apublic.h index 3e2dd71..a987a62 100644 --- a/src/H5Aproto.h +++ b/src/H5Apublic.h @@ -13,21 +13,25 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5A module + * This file contains function prototypes for each exported function in + * the H5A module. */ +#ifndef _H5Apublic_H +#define _H5Apublic_H -#ifndef H5APROTO_H -#define H5APROTO_H +/* Public headers needed by this file */ +#include <H5public.h> /* Group values allowed */ -typedef enum {BADGROUP=(-1), /* Invalid Group */ -H5_ERR=0, /* Group ID for Error stack objects */ -H5_FILE, /* Group ID for File objects */ -H5_TEMPLATE, /* Group ID for Template objects */ -H5_DATATYPE, /* Group ID for Datatype objects */ -H5_DATASPACE, /* Group ID for Dataspace objects */ -H5_DATASET, /* Group ID for Dataset objects */ -MAXGROUP /* Highest group in group_t (Invalid as true group) */ +typedef enum { + BADGROUP=(-1), /* Invalid Group */ + H5_ERR=0, /* Group ID for Error stack objects */ + H5_FILE, /* Group ID for File objects */ + H5_TEMPLATE, /* Group ID for Template objects */ + H5_DATATYPE, /* Group ID for Datatype objects */ + H5_DATASPACE, /* Group ID for Dataspace objects */ + H5_DATASET, /* Group ID for Dataset objects */ + MAXGROUP /* Highest group in group_t (Invalid as true group) */ } group_t; /* Type of atoms to return to users */ @@ -47,10 +51,9 @@ typedef intn (*H5Asearch_func_t)(const VOIDP obj, const VOIDP key); /* Combine a Group number and an atom index into an atom */ #define MAKE_ATOM(g,i) ((((hatom_t)(g)&GROUP_MASK)<<((sizeof(hatom_t)*8)-GROUP_BITS))|((hatom_t)(i)&ATOM_MASK)) -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5A.c */ /****************************************************************************** @@ -197,9 +200,9 @@ intn H5Ais_reserved(hatom_t atm /* IN: Group to search for the object in */ *******************************************************************************/ intn H5Ashutdown(void); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ +#endif -#endif /* H5APROTO_H */ +#endif @@ -86,36 +86,17 @@ * *------------------------------------------------------------------------- */ - -/* - * Define this if the root address of a B-link tree should never change. - * - * If this isn't defined and the root node of a tree splits, then the - * new root (which points to the old root plus the new node from the - * split) will be at a new file address. - * - * But if this is defined, then the old root will be copied to a new - * location and the new root will occupy the file memory vacated by the - * old root. - */ -#define H5B_ANCHOR_ROOT - -/* system headers */ -#include <assert.h> -#include "hdf5.h" - /* private headers */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5MFprivate.h" /*File memory management */ -#include "H5MMprivate.h" /*Core memory management */ +#include <H5private.h> /*library */ +#include <H5ACprivate.h> /*cache */ +#include <H5Bprivate.h> /*B-link trees */ +#include <H5Eprivate.h> /*error handling */ +#include <H5MFprivate.h> /*File memory management */ +#include <H5MMprivate.h> /*Core memory management */ #define PABLO_MASK H5B_mask #define BOUND(MIN,X,MAX) ((X)<(MIN)?(MIN):((X)>(MAX)?(MAX):(X))) -#define false 0 -#define true 1 /* PRIVATE PROTOTYPES */ static haddr_t H5B_insert_helper (hdf5_file_t *f, haddr_t addr, @@ -784,10 +765,13 @@ haddr_t H5B_insert (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata) { uint8 lt_key[256], md_key[256], rt_key[256]; - intn lt_key_changed=false, rt_key_changed=false; + intn lt_key_changed=FALSE, rt_key_changed=FALSE; haddr_t child, new_root; intn level; H5B_t *bt; + size_t size; + uint8 *buf; + haddr_t tmp_addr; FUNC_ENTER (H5B_insert, NULL, FAIL); @@ -829,62 +813,52 @@ H5B_insert (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata) memcpy (rt_key, bt->key[bt->nchildren].nkey, type->sizeof_nkey); } -#ifdef H5B_ANCHOR_ROOT - { - /* - * Copy the old root node to some other file location and make the new - * root at the old root's previous address. This prevents the B-tree - * from "moving". - */ - size_t size = H5B_nodesize (f, type, NULL, bt->sizeof_rkey); - uint8 *buf = H5MM_xmalloc (size); - haddr_t tmp_addr = H5MF_alloc (f, size); - - if (tmp_addr<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); - } - if (H5AC_flush (f, H5AC_BT, addr, FALSE)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL); - } - if (H5F_block_read (f, addr, size, buf)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_READERROR, FAIL); - } - if (H5F_block_write (f, tmp_addr, size, buf)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_WRITEERROR, FAIL); - } - if (H5AC_rename (f, H5AC_BT, addr, tmp_addr)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTSPLIT, FAIL); - } + /* + * Copy the old root node to some other file location and make the new + * root at the old root's previous address. This prevents the B-tree + * from "moving". + */ + size = H5B_nodesize (f, type, NULL, bt->sizeof_rkey); + buf = H5MM_xmalloc (size); + tmp_addr = H5MF_alloc (f, size); - buf = H5MM_xfree (buf); - new_root = addr; - addr = tmp_addr; + if (tmp_addr<0) { + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + } + if (H5AC_flush (f, H5AC_BT, addr, FALSE)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL); + } + if (H5F_block_read (f, addr, size, buf)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_READERROR, FAIL); + } + if (H5F_block_write (f, tmp_addr, size, buf)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_WRITEERROR, FAIL); + } + if (H5AC_rename (f, H5AC_BT, addr, tmp_addr)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTSPLIT, FAIL); + } - /* update the new child's left pointer */ - if (NULL==(bt=H5AC_find (f, H5AC_BT, child, type))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); - } - bt->dirty += 1; - bt->left = addr; + buf = H5MM_xfree (buf); + new_root = addr; + addr = tmp_addr; - /* clear the old root at the old address */ - if (NULL==(bt=H5AC_find (f, H5AC_BT, new_root, type))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); - } - bt->dirty += 1; - bt->ndirty = 0; - bt->left = 0; - bt->right = 0; - bt->nchildren = 0; + /* update the new child's left pointer */ + if (NULL==(bt=H5AC_find (f, H5AC_BT, child, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); } -#else - /* - * The new root is created at a new file location. - */ - if ((new_root = H5B_new (f, type, bt->sizeof_rkey))<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL); + bt->dirty += 1; + bt->left = addr; + + /* clear the old root at the old address */ + if (NULL==(bt=H5AC_find (f, H5AC_BT, new_root, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); } -#endif + bt->dirty += 1; + bt->ndirty = 0; + bt->left = 0; + bt->right = 0; + bt->nchildren = 0; + /* the new root */ if (NULL==(bt = H5AC_find (f, H5AC_BT, new_root, type))) { @@ -1200,7 +1174,7 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, memcpy (bt->key[idx].nkey, lt_key, type->sizeof_nkey); bt->dirty += 1; bt->key[idx].dirty = 1; - if (idx>0) *lt_key_changed = false; + if (idx>0) *lt_key_changed = FALSE; } if (*rt_key_changed) { bt->key[idx+1].nkey = bt->native + @@ -1208,7 +1182,7 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, memcpy (bt->key[idx+1].nkey, rt_key, type->sizeof_nkey); bt->dirty += 1; bt->key[idx+1].dirty = 1; - if (idx+1<bt->nchildren) *rt_key_changed = false; + if (idx+1<bt->nchildren) *rt_key_changed = FALSE; } /* diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 618e344..5f1d251 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -16,10 +16,11 @@ */ #ifndef _H5Bprivate_H #define _H5Bprivate_H +#include <H5Bpublic.h> /*API prototypes */ -#include "H5Bproto.h" /*API prototypes */ - -#include "H5Fprivate.h" +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Fprivate.h> #define H5B_MAGIC "TREE" /*tree node magic number */ #define H5B_SIZEOF_MAGIC 4 /*size of magic number */ @@ -100,4 +101,4 @@ herr_t H5B_list (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata); -#endif /* !_H5Bprivate_H */ +#endif diff --git a/src/H5Bproto.h b/src/H5Bpublic.h index b1eb82c..593373b 100644 --- a/src/H5Bproto.h +++ b/src/H5Bpublic.h @@ -8,21 +8,23 @@ * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Non-API function prototypes for B-link trees. + * Purpose: Public declarations for the H5B package. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5Bproto_H -#define _H5Bproto_H +#ifndef _H5Bpublic_H +#define _H5Bpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif @@ -32,12 +32,12 @@ static char RcsId[] = "@(#)$Revision$"; H5C_init_interface -- initialize the interface + */ -#include "hdf5.h" - -/* private header files */ -#include "H5private.h" /* Generic Functions */ -#include "H5Bprivate.h" /* B-tree subclass names */ -#include "H5Cprivate.h" /* Template information */ +/* Private header files */ +#include <H5private.h> /* Generic Functions */ +#include <H5Aprivate.h> /* Atoms */ +#include <H5Bprivate.h> /* B-tree subclass names */ +#include <H5Cprivate.h> /* Template information */ +#include <H5Eprivate.h> /* Error handling */ #define PABLO_MASK H5C_mask @@ -48,16 +48,16 @@ static intn interface_initialize_g = FALSE; /* Define the library's default file creation template (constants in hdf5lims.h) */ const file_create_temp_t default_file_create={ - HDF5_USERBLOCK_DEFAULT, /* Default user-block size */ - HDF5_SYM_LEAF_K_DEFAULT, /* Default 1/2 rank for symtab leaf nodes */ - HDF5_BTREE_K_DEFAULT, /* Default 1/2 rank for btree internal nodes */ - HDF5_OFFSETSIZE_DEFAULT, /* Default offset size */ - HDF5_LENGTHSIZE_DEFAULT, /* Default length size */ - HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */ - HDF5_SMALLOBJECT_VERSION, /* Current Small-Object heap version # */ - HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */ - HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */ - HDF5_SHAREDHEADER_VERSION /* Current Shared-Header format version # */ + H5C_USERBLOCK_DEFAULT, /* Default user-block size */ + H5C_SYM_LEAF_K_DEFAULT, /* Default 1/2 rank for symtab leaf nodes */ + H5C_BTREE_K_DEFAULT, /* Default 1/2 rank for btree internal nodes */ + H5C_OFFSETSIZE_DEFAULT, /* Default offset size */ + H5C_LENGTHSIZE_DEFAULT, /* Default length size */ + HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */ + HDF5_SMALLOBJECT_VERSION, /* Current Small-Object heap version # */ + HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */ + HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */ + HDF5_SHAREDHEADER_VERSION /* Current Shared-Header format version # */ }; static hatom_t default_file_id=FAIL; /* Atom for the default file-creation template */ @@ -83,7 +83,7 @@ static herr_t H5C_init_interface(void) FUNC_ENTER (H5C_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ - ret_value=H5Ainit_group(H5_TEMPLATE,HDF5_TEMPID_HASHSIZE,0); + ret_value=H5Ainit_group(H5_TEMPLATE,H5A_TEMPID_HASHSIZE,0); FUNC_LEAVE(ret_value); } /* H5C_init_interface */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 4f7357f..6551d10 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -16,10 +16,37 @@ * This file contains private information about the H5C module */ -#ifndef H5CPRIVATE_H -#define H5CPRIVATE_H +#ifndef _H5Cprivate_H +#define _H5Cprivate_H +#include <H5Cpublic.h> -#include "H5Cproto.h" +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Fprivate.h> -#endif /* H5CPRIVATE_H */ +/* + * Default file-creation template values. + */ +#define H5C_USERBLOCK_DEFAULT 0 /* Default user blocks size in bytes */ +#define H5C_OFFSETSIZE_DEFAULT 4 /* Default file offset size in bytes */ +#define H5C_LENGTHSIZE_DEFAULT 4 /* Default file length size in bytes */ +#define H5C_SYM_LEAF_K_DEFAULT 4 /* Default K for tab leaf nodes */ + +#define H5C_BTREE_K_DEFAULT { \ + 16, /* Symbol table internal nodes */ \ + 0, /* unused */ \ + 0, /* unused */ \ + 0, /* unused */ \ + 0, /* unused */ \ + 0, /* unused */ \ + 0, /* unused */ \ + 0 /* unused */ \ +} + +hatom_t H5C_create(hatom_t owner_id, hobjtype_t type, const char *name); +hatom_t H5C_copy(hatom_t tid); +herr_t H5C_release(hatom_t oid); +hatom_t H5C_get_default_atom(hobjtype_t type); +herr_t H5C_init(hatom_t dst_atm, const file_create_temp_t *src); +#endif diff --git a/src/H5Cproto.h b/src/H5Cproto.h deleted file mode 100644 index 0d8f26d..0000000 --- a/src/H5Cproto.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains function prototypes for each exported function in the H5C module - */ - -#ifndef H5CPROTO_H -#define H5CPROTO_H - -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ - -/* Functions in H5C.c */ -hatom_t H5C_create(hatom_t owner_id, hobjtype_t type, const char *name); -hatom_t H5C_copy(hatom_t tid); -herr_t H5C_release(hatom_t oid); -hatom_t H5C_get_default_atom(hobjtype_t type); -herr_t H5C_init(hatom_t dst_atm, const file_create_temp_t *src); -herr_t H5Cgetparm(hatom_t tid, file_create_param_t parm, VOIDP buf); -herr_t H5Csetparm(hatom_t tid, file_create_param_t parm, const VOIDP buf); - -#if defined c_plusplus || defined __cplusplus -} -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5CPROTO_H */ - diff --git a/src/hdf5type.h b/src/H5Cpublic.h index 25496a3..99a83ae 100644 --- a/src/hdf5type.h +++ b/src/H5Cpublic.h @@ -13,37 +13,20 @@ /* $Id$ */ /* - * Header file for library-global generic typedefs + * This file contains function prototypes for each exported function in the H5C module */ -#ifndef HDF5TYPE_H -#define HDF5TYPE_H +#ifndef _H5Cpublic_H +#define _H5Cpublic_H -/* - * Define the standard error-value return type. This type should be used for - * functions which return SUCCEED/FAIL, instead of intn... - */ -typedef intn herr_t; /* Generic error-value type */ - -/* Object types for "meta" interface */ -typedef group_t hobjtype_t; /* Map the object in the "meta" interface to atom groups */ - -/* File-creation template information structure */ -typedef struct { - /* These object aren't ref. counted, I can't think of a good reason why you'd access each one more than once */ - /* uintn ref_count; Reference count for number of times object is accessed */ - uintn userblock_size; /* Size of the user block in the file in bytes */ - uintn sym_leaf_k; /* 1/2 rank for symbol table leaf nodes */ - uintn btree_k[8]; /* 1/2 rank for btree internal nodes */ - uint8 offset_size; /* Number of bytes for offsets */ - uint8 length_size; /* Number of bytes for lengths */ - uint8 bootblock_ver; /* Version # of the bootblock */ - uint8 smallobject_ver; /* Version # of the small-object heap */ - uint8 freespace_ver; /* Version # of the free-space information */ - uint8 objectdir_ver; /* Version # of the object directory format */ - uint8 sharedheader_ver; /* Version # of the shared header format */ - } file_create_temp_t; +#ifdef __cplusplus +extern "C" { +#endif +/* Public headers needed by this file */ +#include <H5public.h> +#include <H5Apublic.h> + /* Parameters to use when retrieving file-creation template information */ typedef enum { H5_USERBLOCK_SIZE, /* (uintn) Size of the user block in the file in bytes */ @@ -58,15 +41,15 @@ typedef enum { H5_SHAREDHEADER_VER /* (uint8) Version # of the shared-header format */ } file_create_param_t; -/* HDF boolean type */ -typedef enum { - BFAIL=(-1), /* error value */ - BFALSE=0, - BTRUE=1 - } hbool_t; +/* Object types for "meta" interface */ +typedef group_t hobjtype_t; /* Map the object in the "meta" interface to atom groups */ -/* Unsigned integer error value (don't really know where else to put this - QAK) */ -#define UFAIL (unsigned)(-1) +/* Functions in H5C.c */ +herr_t H5Cgetparm(hatom_t tid, file_create_param_t parm, VOIDP buf); +herr_t H5Csetparm(hatom_t tid, file_create_param_t parm, const VOIDP buf); -#endif /* HDF5TYPE_H */ +#ifdef __cplusplus +} +#endif +#endif @@ -32,9 +32,10 @@ static char RcsId[] = "@(#)$Revision$"; H5P_init_interface -- initialize the interface + */ -#include "hdf5.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Dataset functions */ +#include <H5private.h> /* Generic Functions */ +#include <H5Aprivate.h> /* Atoms */ +#include <H5Dprivate.h> /* Dataset functions */ +#include <H5Eprivate.h> /* Error handling */ #define PABLO_MASK H5D_mask @@ -42,6 +43,7 @@ static char RcsId[] = "@(#)$Revision$"; /* Whether we've installed the library termination function yet for this interface */ static intn interface_initialize_g = FALSE; +static herr_t H5D_init_interface(void); /*-------------------------------------------------------------------------- NAME @@ -61,7 +63,7 @@ static herr_t H5D_init_interface(void) FUNC_ENTER (H5D_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ - ret_value=H5Ainit_group(H5_DATASET,HDF5_DATASETID_HASHSIZE,H5D_RESERVED_ATOMS); + ret_value=H5Ainit_group(H5_DATASET,H5A_DATASETID_HASHSIZE,H5D_RESERVED_ATOMS); FUNC_LEAVE(ret_value); } /* H5D_init_interface */ @@ -254,7 +256,9 @@ done: herr_t H5D_flush(hatom_t oid) { H5D_dataset_t *dataset; /* dataset object to release */ +#ifdef QUINCEY H5F_ +#endif herr_t ret_value = SUCCEED; FUNC_ENTER(H5D_flush, H5D_init_interface, FAIL); @@ -281,7 +285,9 @@ herr_t H5D_flush(hatom_t oid) } /* end if */ else { +#ifdef QUINCEY if(root_type +#endif } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 26bab4d..73e4a40 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -16,8 +16,14 @@ * This file contains private information about the H5D module */ -#ifndef H5DPRIVATE_H -#define H5DPRIVATE_H +#ifndef _H5Dprivate_H +#define _H5Dprivate_H +#include <H5Dpublic.h> + +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Cprivate.h> /* for the hobjtype_t type */ + typedef struct { hatom_t file; /* ID of the file-store of this object */ @@ -30,11 +36,11 @@ typedef struct { haddr_t data; /* offset of the data in the file */ } H5D_dataset_t; -#include "H5Dproto.h" #define H5D_RESERVED_ATOMS 0 -/*------------------_-- Local function prototypes ----------------------------*/ -static herr_t H5D_init_interface(void); - -#endif /* H5DPRIVATE_H */ +/*-----------------_-- Local function prototypes ----------------------------*/ +hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name); +herr_t H5D_flush(hatom_t oid); +herr_t H5D_release(hatom_t oid); +#endif diff --git a/src/H5Dproto.h b/src/H5Dpublic.h index d7114c8..4ea7bb2 100644 --- a/src/H5Dproto.h +++ b/src/H5Dpublic.h @@ -13,26 +13,26 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5D module + * This file contains public declarations for the H5D module. */ -#ifndef H5DPROTO_H -#define H5DPROTO_H +#ifndef _H5Dpublic_H +#define _H5Dpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +/* Public headers needed by this file */ +#include <H5public.h> +#include <H5Apublic.h> + +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5D.c */ -hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name); herr_t H5Dset_info(hatom_t oid, hatom_t tid, hatom_t did); -herr_t H5D_release(hatom_t oid); herr_t H5Dwrite(hatom_t oid, hatom_t did, VOIDP buf); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5DPROTO_H */ +#endif +#endif @@ -32,21 +32,79 @@ static char RcsId[] = "@(#)$Revision$"; H5E_init_interface -- initialize the H5E interface + */ -#define HDF5_ERR_MASTER -#include "hdf5.h" -#include "H5Eprivate.h" /* Private error routines */ -#undef HDF5_ERR_MASTER +#include <H5private.h> /* Generic Functions */ +#include <H5Aprivate.h> /* Atoms */ +#include <H5Eprivate.h> /* Private error routines */ -#include "H5private.h" /* Generic Functions */ #define PABLO_MASK H5E_mask -/*--------------------- Locally scoped variables -----------------------------*/ +/*-------------------- Locally scoped variables -----------------------------*/ -/* Whether we've installed the library termination function yet for this interface */ +/* Is the interface initialized? */ static intn interface_initialize_g = FALSE; -/*------------------_-- Local function prototypes ----------------------------*/ +static const hdf_maj_error_messages_t hdf_maj_error_messages[] = +{ + {H5E_NONE_MAJOR, "No error"}, + {H5E_ARGS, "Invalid arguments to routine"}, + {H5E_RESOURCE, "Resource unavailable"}, + {H5E_INTERNAL, "Internal HDF5 error (too specific to document in detail)"}, + {H5E_FILE, "File Accessability"}, + {H5E_IO, "Low-level I/O"}, + {H5E_FUNC, "Function Entry/Exit"}, + {H5E_ATOM, "Object Atom"}, + {H5E_CACHE, "Object Cache"}, + {H5E_BTREE, "B-Tree Node"}, + {H5E_SYM, "Symbol Table"}, + {H5E_HEAP, "Heap"}, + {H5E_OHDR, "Object Header"}, + {H5E_DIRECTORY, "Directory"}, +}; + +static const hdf_min_error_messages_t hdf_min_error_messages[] = +{ + {H5E_NONE_MINOR, "No error"}, + {H5E_UNINITIALIZED, "Information is uninitialized"}, + {H5E_UNSUPPORTED, "Feature is unsupported"}, + {H5E_BADTYPE, "Incorrect type found"}, + {H5E_BADRANGE, "Argument out of range"}, + {H5E_BADVALUE, "Bad value for argument"}, + {H5E_NOSPACE, "No space available for allocation"}, + {H5E_FILEEXISTS, "File already exists"}, + {H5E_FILEOPEN, "File already open"}, + {H5E_CANTCREATE, "Can't create file"}, + {H5E_CANTOPEN, "Can't open file"}, + {H5E_NOTHDF5, "Not an HDF5 format file"}, + {H5E_BADFILE, "Bad file ID accessed"}, + {H5E_SEEKERROR, "Seek failed"}, + {H5E_READERROR, "Read failed"}, + {H5E_WRITEERROR, "Write failed"}, + {H5E_CANTINIT, "Can't initialize interface"}, + {H5E_ALREADYINIT, "Object already initialized"}, + {H5E_BADATOM, "Can't find atom information"}, + {H5E_CANTREGISTER, "Can't register new atom"}, + {H5E_CANTFLUSH, "Can't flush object from cache"}, + {H5E_CANTLOAD, "Can't load object into cache"}, + {H5E_NOTFOUND, "Object not found"}, + {H5E_EXISTS, "Object already exists"}, + {H5E_CANTENCODE, "Can't encode value"}, + {H5E_CANTDECODE, "Can't decode value"}, + {H5E_CANTSPLIT, "Can't split node"}, + {H5E_CANTINSERT, "Can't insert object"}, + {H5E_CANTLIST, "Can't list node"}, + {H5E_LINKCOUNT, "Bad object header link count"}, + {H5E_VERSION, "Wrong version number"}, + {H5E_ALIGNMENT, "Alignment error"}, + {H5E_BADMESG, "Unrecognized message"}, + {H5E_COMPLEN, "Name component is too long"}, + {H5E_LINK, "Link count failure"}, +}; + +/*--------------------- Globally scoped variables ---------------------------*/ +int32 thrderrid; /* Thread-specific "global" error-handler ID */ + +/*------------------_-- Local function prototypes ---------------------------*/ static herr_t H5E_init_interface(void); /*-------------------------------------------------------------------------- @@ -71,7 +129,7 @@ static herr_t H5E_init_interface(void) FUNC_ENTER (H5E_init_interface, NULL, FAIL); /* Initialize the atom group for the error stacks */ - ret_value=H5Ainit_group(H5_ERR,HDF5_ERRSTACK_HASHSIZE,0); + ret_value=H5Ainit_group(H5_ERR,H5A_ERRSTACK_HASHSIZE,0); FUNC_LEAVE(ret_value); } /* H5E_init_interface */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index dcce767..50b8241 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -15,11 +15,12 @@ /* * Header file for error values, etc. */ +#ifndef _H5Eprivate_H +#define _H5Eprivate_H +#include <H5Epublic.h> -#ifndef HDF5ERR_H -#define HDF5ERR_H - -#include "H5Eproto.h" +/* Private headers needed by this file */ +#include <H5private.h> /* ====================================================================== @@ -29,17 +30,61 @@ whenever errors are added/deleted from this list. ====================================================================== */ -/* - * This section of code is designed to be only accessible to the actual - * error-management code. - */ -#ifdef HDF5_ERR_MASTER + +/* HERROR macro, used to facilitate error reporting. Assumes that + there's a variable called FUNC which holds the function name. + Assume that func and file are both stored in static space, or at + least be not corrupted in the meanwhile. */ + +#define HERROR(maj, min) H5Epush(maj, min, FUNC, __FILE__, __LINE__) + +/* HRETURN_ERROR macro, used to facilitate error reporting. Makes + same assumptions as HERROR. IN ADDITION, this macro causes + a return from the calling routine */ + +#define HRETURN_ERROR(maj, min, ret_val) { \ + HERROR (maj, min); \ + PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ + return (ret_val); \ +} + +/* HRETURN macro, similar to HRETURN_ERROR() except for success */ + +#define HRETURN(ret_val) { \ + PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ + return (ret_val); \ +} + +/* HGOTO_ERROR macro, used to facilitate error reporting. Makes + same assumptions as HERROR. IN ADDITION, this macro causes + a jump to the label 'done' which should be in every fucntion + Also there is an assumption of a variable 'ret_value' */ + +#define HGOTO_ERROR(maj, min, ret_val) { \ + HERROR (maj, min); \ + ret_value = ret_val; \ + goto done; \ +} + +/* HGOTO_DONE macro, used to facilitate the new error reporting model. + This macro is just a wrapper to set the return value and jump to the 'done' + label. Also assumption of a variable 'ret_value' */ + +#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} + +/* H5ECLEAR macro, used to facilitate the new error reporting model. + This macro is just a wrapper to clear the error stack with the thread + error ID */ + +#define H5ECLEAR H5Eclear(thrderrid) + +/* Maximum length of function name to push onto error stack */ +#define MAX_FUNC_NAME_LEN 32 /* * error_messages is the list of error messages in the system, kept as * error_code-message pairs. */ - typedef struct { hdf_maj_err_code_t error_code; @@ -47,23 +92,6 @@ typedef struct } hdf_maj_error_messages_t; -static const hdf_maj_error_messages_t hdf_maj_error_messages[] = -{ - {H5E_NONE_MAJOR, "No error"}, - {H5E_ARGS, "Invalid arguments to routine"}, - {H5E_RESOURCE, "Resource unavailable"}, - {H5E_INTERNAL, "Internal HDF5 error (too specific to document in detail)"}, - {H5E_FILE, "File Accessability"}, - {H5E_IO, "Low-level I/O"}, - {H5E_FUNC, "Function Entry/Exit"}, - {H5E_ATOM, "Object Atom"}, - {H5E_CACHE, "Object Cache"}, - {H5E_BTREE, "B-Tree Node"}, - {H5E_SYM, "Symbol Table"}, - {H5E_HEAP, "Heap"}, - {H5E_OHDR, "Object Header"}, - {H5E_DIRECTORY, "Directory"}, -}; typedef struct { @@ -72,44 +100,6 @@ typedef struct } hdf_min_error_messages_t; -static const hdf_min_error_messages_t hdf_min_error_messages[] = -{ - {H5E_NONE_MINOR, "No error"}, - {H5E_UNINITIALIZED, "Information is uninitialized"}, - {H5E_UNSUPPORTED, "Feature is unsupported"}, - {H5E_BADTYPE, "Incorrect type found"}, - {H5E_BADRANGE, "Argument out of range"}, - {H5E_BADVALUE, "Bad value for argument"}, - {H5E_NOSPACE, "No space available for allocation"}, - {H5E_FILEEXISTS, "File already exists"}, - {H5E_FILEOPEN, "File already open"}, - {H5E_CANTCREATE, "Can't create file"}, - {H5E_CANTOPEN, "Can't open file"}, - {H5E_NOTHDF5, "Not an HDF5 format file"}, - {H5E_BADFILE, "Bad file ID accessed"}, - {H5E_SEEKERROR, "Seek failed"}, - {H5E_READERROR, "Read failed"}, - {H5E_WRITEERROR, "Write failed"}, - {H5E_CANTINIT, "Can't initialize interface"}, - {H5E_ALREADYINIT, "Object already initialized"}, - {H5E_BADATOM, "Can't find atom information"}, - {H5E_CANTREGISTER, "Can't register new atom"}, - {H5E_CANTFLUSH, "Can't flush object from cache"}, - {H5E_CANTLOAD, "Can't load object into cache"}, - {H5E_NOTFOUND, "Object not found"}, - {H5E_EXISTS, "Object already exists"}, - {H5E_CANTENCODE, "Can't encode value"}, - {H5E_CANTDECODE, "Can't decode value"}, - {H5E_CANTSPLIT, "Can't split node"}, - {H5E_CANTINSERT, "Can't insert object"}, - {H5E_CANTLIST, "Can't list node"}, - {H5E_LINKCOUNT, "Bad object header link count"}, - {H5E_VERSION, "Wrong version number"}, - {H5E_ALIGNMENT, "Alignment error"}, - {H5E_BADMESG, "Unrecognized message"}, - {H5E_COMPLEN, "Name component is too long"}, - {H5E_LINK, "Link count failure"}, -}; /* We use a stack to hold the errors plus we keep track of the function, file and line where the error occurs. */ @@ -135,19 +125,13 @@ typedef struct errstack_t H5E_push_func_t push; /* Function to call when an error is to be reported */ } H5E_errstack_t; -#endif /* HDF5_ERR_MASTER */ -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ + +/* Private global variables in H5E.c */ +extern int32 thrderrid; /* Thread-specific "global" error-handler ID */ +extern hbool_t install_atexit; /* Whether to install the atexit routine */ /* Private functions in H5E.c */ herr_t H5E_store(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); -#if defined c_plusplus || defined __cplusplus -} -#endif /* c_plusplus || __cplusplus */ - -#endif /* HDF5ERR_H */ - +#endif diff --git a/src/H5Eproto.h b/src/H5Epublic.h index cd3f58a..b1ac9b3 100644 --- a/src/H5Eproto.h +++ b/src/H5Epublic.h @@ -13,58 +13,14 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5E module + * This file contains public declarations for the H5E module. */ -#ifndef H5EPROTO_H -#define H5EPROTO_H +#ifndef _H5Epublic_H +#define _H5Epublic_H -/* HERROR macro, used to facilitate error reporting. Assumes that - there's a variable called FUNC which holds the function name. - Assume that func and file are both stored in static space, or at - least be not corrupted in the meanwhile. */ - -#define HERROR(maj, min) H5Epush(maj, min, FUNC, __FILE__, __LINE__) - -/* HRETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a return from the calling routine */ - -#define HRETURN_ERROR(maj, min, ret_val) { \ - HERROR (maj, min); \ - PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ - return (ret_val); \ -} - -/* HRETURN macro, similar to HRETURN_ERROR() except for success */ - -#define HRETURN(ret_val) { \ - PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ - return (ret_val); \ -} - -/* HGOTO_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a jump to the label 'done' which should be in every fucntion - Also there is an assumption of a variable 'ret_value' */ - -#define HGOTO_ERROR(maj, min, ret_val) { \ - HERROR (maj, min); \ - ret_value = ret_val; \ - goto done; \ -} - -/* HGOTO_DONE macro, used to facilitate the new error reporting model. - This macro is just a wrapper to set the return value and jump to the 'done' - label. Also assumption of a variable 'ret_value' */ - -#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} - -/* H5ECLEAR macro, used to facilitate the new error reporting model. - This macro is just a wrapper to clear the error stack with the thread - error ID */ - -#define H5ECLEAR H5Eclear(thrderrid) +/* Public headers needed by this file */ +#include <H5public.h> /* Declare an enumerated type which holds all the valid major HDF error codes */ typedef enum @@ -150,23 +106,21 @@ hdf_min_err_code_t; /* Function pointer to report errors through */ typedef herr_t (*H5E_push_func_t)(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5E.c */ int32 H5Enew_err_stack(uintn initial_stack_size); intn H5Edelete_err_stack(int32 err_hand); #ifdef H5_ERROR_DEBUG H5E_push_func_t H5Eset_push(H5E_push_func_t func); -#endif /* H5_ERROR_DEBUG */ +#endif herr_t H5Epush(hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); herr_t H5Eclear(int32 err_hand); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5EPROTO_H */ +#endif +#endif @@ -32,17 +32,15 @@ static char RcsId[] = "@(#)$Revision$"; H5F_init_interface -- initialize the H5F interface */ -#include <assert.h> - -#define HDF5_FILE_MASTER -#include "hdf5.h" -#undef HDF5_FILE_MASTER - /* Packages needed by this file... */ -#include "H5private.h" /*library functions */ -#include "H5ACprivate.h" /*cache */ -#include "H5Gprivate.h" /*symbol tables */ -#include "H5MMprivate.h" /*core memory management */ +#include <H5private.h> /*library functions */ +#include <H5Aprivate.h> /*atoms */ +#include <H5ACprivate.h> /*cache */ +#include <H5Cprivate.h> /*templates */ +#include <H5Eprivate.h> /*error handling */ +#include <H5Gprivate.h> /*symbol tables */ +#include <H5Mprivate.h> /*meta data */ +#include <H5MMprivate.h> /*core memory management */ #define PABLO_MASK H5F_mask @@ -79,7 +77,7 @@ static herr_t H5F_init_interface(void) FUNC_ENTER (H5F_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ - ret_value=H5Ainit_group(H5_FILE,HDF5_FILEID_HASHSIZE,0); + ret_value=H5Ainit_group(H5_FILE,H5A_FILEID_HASHSIZE,0); FUNC_LEAVE(ret_value); } /* H5F_init_interface */ @@ -251,7 +249,7 @@ done: hbool_t H5Fis_hdf5(const char *filename) { hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */ - uint8 temp_buf[HDF5_FILE_SIGNATURE_LEN]; /* temporary buffer for checking file signature */ + uint8 temp_buf[H5F_SIGNATURE_LEN]; /* temporary buffer for checking file signature */ haddr_t curr_off=0; /* The current offset to check in the file */ size_t file_len=0; /* The length of the file we are checking */ hbool_t ret_value = BFALSE; @@ -278,9 +276,9 @@ hbool_t H5Fis_hdf5(const char *filename) { if(H5F_SEEK(f_handle,curr_off)==FAIL) HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL); - if(H5F_READ(f_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL) + if(H5F_READ(f_handle,temp_buf, H5F_SIGNATURE_LEN)==FAIL) HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL); - if(HDmemcmp(temp_buf,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==0) + if(HDmemcmp(temp_buf,H5F_SIGNATURE,H5F_SIGNATURE_LEN)==0) { ret_value=BTRUE; break; @@ -496,7 +494,7 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL); /* Write out the file-signature */ - if(H5F_WRITE(new_file->file_handle,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==FAIL) + if(H5F_WRITE(new_file->file_handle,H5F_SIGNATURE,H5F_SIGNATURE_LEN)==FAIL) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL); /* Encode the boot block */ @@ -659,9 +657,9 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp) { if(H5F_SEEK(new_file->file_handle,curr_off)==FAIL) HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL); - if(H5F_READ(new_file->file_handle,temp_buf, HDF5_FILE_SIGNATURE_LEN)==FAIL) + if(H5F_READ(new_file->file_handle,temp_buf, H5F_SIGNATURE_LEN)==FAIL) HGOTO_ERROR(H5E_IO, H5E_READERROR, BFAIL); - if(HDmemcmp(temp_buf,HDF5_FILE_SIGNATURE,HDF5_FILE_SIGNATURE_LEN)==0) + if(HDmemcmp(temp_buf,H5F_SIGNATURE,H5F_SIGNATURE_LEN)==0) { new_file->file_create_parms.userblock_size=curr_off; break; @@ -711,7 +709,9 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL); } /* Set the initial type of the root symbol-entry */ - new_file->root_type= (new_file->root_sym->addr>=0) ? H5F_ROOT_UNKNOWN : H5F_NONE; +#ifdef QUINCEY + new_file->root_type= (new_file->root_sym->header>=0) ? H5F_ROOT_UNKNOWN : H5F_NONE; +#endif /* Get an atom for the file */ if((ret_value=H5Aregister_atom(H5_FILE, new_file))==FAIL) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index eebb55d..e53c233 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -16,42 +16,295 @@ * This file contains macros & information for file access */ -#ifndef HDF5FILE_H -#define HDF5FILE_H +#ifndef _H5Fprivate_H +#define _H5Fprivate_H +#include <H5Fpublic.h> -#include "H5Fproto.h" /* Include Public Definitions */ - - /*****************************************/ - /*** This is the top level header file ***/ - /*** and shouldn't depend on any other ***/ - /*** packages! ***/ - /*****************************************/ +/* Private headers needed by this file */ +#include <H5private.h> /* Maximum size of boot-block buffer */ #define H5F_BOOTBLOCK_SIZE 1024 +/* Define the HDF5 file signature */ +#define H5F_SIGNATURE "\211HDF\r\n\032\n" +#define H5F_SIGNATURE_LEN 8 +/* size of size_t and off_t as they exist on disk */ #define H5F_SIZEOF_OFFSET(F) ((F)->file_create_parms.offset_size) #define H5F_SIZEOF_SIZE(F) ((F)->file_create_parms.length_size) +/* + * Define the low-level file interface. + */ +#if FILELIB == POSIXBUFIO +typedef FILE *hdf_file_t; +# ifdef VMS +# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? \ + fopen ((p), "r+", "mbc=64") : \ + fopen ((p), "r", "mbc=64")) +# define H5F_CREATE(p) fopen ((p), "w+", "mbc=64") +# elif defined SUN && defined (__GNUC__) +# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? \ + fopen ((p), "r+") : \ + fopen ((p), "r")) +# define H5F_CREATE(p) fopen ((p), "w+") +# else +# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? \ + fopen ((p), "rb+") : \ + fopen((p), "rb")) +# define H5F_CREATE(p) fopen((p), "wb+") +# endif + +# define H5F_READ(f, b, n) (((size_t)(n) == (size_t)fread ((b), 1, \ + (size_t)(n), \ + (f))) ? \ + SUCCEED : FAIL) +# define H5F_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite ((b), 1, \ + (size_t)(n), \ + (f))) ? \ + SUCCEED : FAIL) +# define H5F_CLOSE(f) fclose (f) +# define H5F_FLUSH(f) (0==fflush (f) ? SUCCEED : FAIL) +# define H5F_SEEK(f,o) (0==fseek ((f), (long)(o), SEEK_SET) ? \ + SUCCEED : FAIL) +# define H5F_SEEK_CUR(f,o) (0==fseek ((f), (long)(o), SEEK_CUR) ? \ + SUCCEED : FAIL) +# define H5F_SEEKEND(f) (0==fseek ((f), (long)0, SEEK_END) ? \ + SUCCEED : FAIL) +# define H5F_TELL(f) ftell (f) +# define H5F_OPENERR(f) (!f) +# define H5F_INVALID_FILE ((FILE *)NULL) + + +#elif FILELIB == POSIXUNBUFIO +typedef int hdf_file_t; +# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? \ + open ((p), O_RDWR) : \ + open ((p), O_RDONLY)) +# define H5F_CREATE(p) open ((p), O_RDWR | O_CREAT | O_TRUNC, 0666) +# define H5F_CLOSE(f) close(f) +# define H5F_FLUSH(f) SUCCEED +# define H5F_READ(f, b, n) (((n)==read ((f), (char*)(b), (n))) ? \ + SUCCEED : FAIL) +# define H5F_WRITE(f, b, n) (((n)==write ((f), (char*)(b), (n))) ? \ + SUCCEED : FAIL) +# define H5F_SEEK(f, o) (lseek ((f), (off_t)(o), SEEK_SET)<0 ? \ + FAIL : SUCCEED) +# define H5F_SEEKEND(f) (lseek ((f), (off_t)0, SEEK_END)<0 ? \ + FAIL : SUCCEED) +# define H5F_TELL(f) lseek ((f), (off_t)0, SEEK_CUR) +# define H5F_OPENERR(f) ((f) < 0) +# define H5F_INVALID_FILE (-1) + + +#elif FILELIB == MACIO +typedef short hdf_file_t; +# define H5F_OPEN(x,y) mopen (x, y) +# define H5F_CREATE(name) mopen (name, H5ACC_CREATE) +# define H5F_CLOSE(x) mclose (x) +# define H5F_FLUSH(a) SUCCEED +# define H5F_READ(a,b,c) mread (a, (char*)b, (int32)c) +# define H5F_WRITE(a,b,c) mwrite (a, (char*)b, (int32)c) +# define H5F_SEEK(x,y) mlseek (x, (int32)y, 0) +# define H5F_SEEKEND(x) mlseek (x, 0L, 2) +# define H5F_TELL(x) mlseek (x, 0L, 1) +# define H5F_OPENERR(f) (f < 0) +# define H5F_INVALID_FILE (-1) + + +#elif FILELIB == WINNTIO +typedef HFILE hdf_file_t; +# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? \ + _lopen ((p), OF_READWRITE) : \ + _lopen ((p), OF_READ)) +# define H5F_CREATE(p) _lcreat ((p), 0) +# define H5F_READ(f, b, n) (((int32)(n) == _hread ((f), (b), (n))) ? \ + SUCCEED : FAIL) +# define H5F_WRITE(f, b, n) (((int32)(n) == _hwrite ((f), (b), (n))) ? \ + SUCCEED : FAIL) +# define H5F_CLOSE(f) (_lclose(f)==0 ? SUCCEED : FAIL) +# define H5F_FLUSH(f) 0 +# define H5F_SEEK(f, o) _llseek ((f), (long)(o), 0) +# define H5F_SEEKEND(f) _llseek ((f), (long)0, 2) +# define H5F_TELL(f) _llseek ((f), 0l, 1) +# define H5F_OPENERR(f) ((f) == (HFILE)HFILE_ERROR) +# define H5F_INVALID_FILE ((HFILE)HFILE_ERROR) + + +#elif FILELIB == PAGEBUFIO +# include "fmpio.h" +typedef MPFILE *hdf_file_t; +# define H5F_OPEN(p, a) MPopen ((p), (a)) +# define H5F_CREATE(p) MPopen ((p), H5ACC_CREATE) +# define H5F_CLOSE(f) MPclose (f) +# define H5F_FLUSH(f) MPflush (f) +# define H5F_READ(f, b, n) MPread ((f), (char *)(b), (n)) +# define H5F_WRITE(f, b, n) MPwrite ((f), (char *)(b), (n)) +# define H5F_SEEK(f, o) MPseek ((f), (off_t)(o), SEEK_SET) +# define H5F_SEEKEND(f) MPseek ((f), (off_t)0, SEEK_END) +# define H5F_TELL(f) MPseek ((f), (off_t)0, SEEK_CUR) +# define H5F_OPENERR(f) ((f) == (MPFILE *)NULL) +# define H5F_INVALID_FILE ((MPFILE *)NULL) + +#endif + +/* + * Encode and decode macros for file meta-data. + * Currently, all file meta-data is little-endian. + */ + +/* For non-little-endian platforms, encode each byte by itself */ +#ifdef WORDS_BIGENDIAN +# define INT16ENCODE(p, i) { \ + *(p) = (uint8)( (uintn)(i) & 0xff); (p)++; \ + *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \ +} + +# define UINT16ENCODE(p, i) { \ + *(p) = (uint8)( (i) & 0xff); (p)++; \ + *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \ +} + +# define INT32ENCODE(p, i) { \ + *(p) = (uint8)( (uint32)(i) & 0xff); (p)++; \ + *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; \ +} + +# define UINT32ENCODE(p, i) { \ + *(p) = (uint8)( (i) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \ +} + +# define INT64ENCODE(p, i) { \ + *(p) = (uint8)( (uint64)(i) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 24) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 32) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 40) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 48) & 0xff); (p)++; \ + *(p) = (uint8)(((uint64)(i) >> 56) & 0xff); (p)++; \ +} + +# define UINT64ENCODE(p, i) { \ + *(p) = (uint8)( (i) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 32) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 40) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 48) & 0xff); (p)++; \ + *(p) = (uint8)(((i) >> 56) & 0xff); (p)++; \ +} + +# define INT16DECODE(p, i) { \ + (i) = (int16)((*(p) & 0xff)); (p)++; \ + (i) |= (int16)((*(p) & 0xff) << 8); (p)++; \ +} + +# define UINT16DECODE(p, i) { \ + (i) = (uint16) (*(p) & 0xff); (p)++; \ + (i) |= (uint16)((*(p) & 0xff) << 8); (p)++; \ +} + +# define INT32DECODE(p, i) { \ + (i) = ( *(p) & 0xff); (p)++; \ + (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((int32)(*(p) & 0xff) << 24); (p)++; \ +} + +# define UINT32DECODE(p, i) { \ + (i) = (uint32)(*(p) & 0xff); (p)++; \ + (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((uint32)(*(p) & 0xff) << 24); (p)++; \ +} + +# define INT64DECODE(p, i) { \ + (i) = ( *(p) & 0xff); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 24); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 32); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 40); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 48); (p)++; \ + (i) |= ((int64)(*(p) & 0xff) << 56); (p)++; \ +} + +# define UINT64DECODE(p, i) { \ + (i) = (uint64)(*(p) & 0xff); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 24); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 32); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 40); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 48); (p)++; \ + (i) |= ((uint64)(*(p) & 0xff) << 56); (p)++; \ +} + +#else + /* For little-endian platforms, make the compiler do the work */ +# define INT16ENCODE(p, i) { *((int16 *)(p)) = (int16)(i); (p)+=2; } +# define UINT16ENCODE(p, i) { *((uint16 *)(p)) = (uint16)(i); (p)+=2; } +# define INT32ENCODE(p, i) { *((int32 *)(p)) = (int32)(i); (p)+=4; } +# define UINT32ENCODE(p, i) { *((uint32 *)(p)) = (uint32)(i); (p)+=4; } +# define INT64ENCODE(p, i) { *((int64 *)(p)) = (int64)(i); (p)+=8; } +# define UINT64ENCODE(p, i) { *((uint64 *)(p)) = (uint64)(i); (p)+=8; } +# define INT16DECODE(p, i) { (i) = (int16)(*(const int16 *)(p)); (p)+=2; } +# define UINT16DECODE(p, i) { (i) = (uint16)(*(const uint16 *)(p)); (p)+=2; } +# define INT32DECODE(p, i) { (i) = (int32)(*(const int32 *)(p)); (p)+=4; } +# define UINT32DECODE(p, i) { (i) = (uint32)(*(const uint32 *)(p)); (p)+=4; } +# define INT64DECODE(p, i) { (i) = (int64)(*(const int64 *)(p)); (p)+=8; } +# define UINT64DECODE(p, i) { (i) = (uint64)(*(const uint64 *)(p)); (p)+=8; } + +#endif + +#define NBYTEENCODE(d, s, n) { HDmemcpy(d,s,n); p+=n } + +/* Note! the NBYTEDECODE macro is backwards from the memcpy() routine, */ +/* in the spirit of the other DECODE macros */ +#define NBYTEDECODE(s, d, n) { HDmemcpy(d,s,n); p+=n } + +/* + * File-creation template information structure + */ +typedef struct { + uintn userblock_size; /* Size of the file user block in bytes */ + uintn sym_leaf_k; /* 1/2 rank for symbol table leaf nodes */ + uintn btree_k[8]; /* 1/2 rank for btree internal nodes */ + uint8 offset_size; /* Number of bytes for offsets */ + uint8 length_size; /* Number of bytes for lengths */ + uint8 bootblock_ver; /* Version # of the bootblock */ + uint8 smallobject_ver; /* Version # of the small-object heap */ + uint8 freespace_ver; /* Version # of the free-space information */ + uint8 objectdir_ver; /* Version # of the object directory format */ + uint8 sharedheader_ver; /* Version # of the shared header format */ +} file_create_temp_t; + /* Define the structure to store the file information for HDF5 files */ typedef struct { - char *dir; /* Directory the file is located within */ - char *filename; /* Filename of file */ - uintn acc_perm; /* Access Permissions for file */ - hdf_file_t file_handle; /* File handle for actual I/O */ - uintn ref_count; /* Reference count for number of times file is opened */ - uint32 consist_flags; /* File Consistency Flags */ - haddr_t smallobj_off; /* Offset of small-object heap within the file */ - haddr_t freespace_off; /* Offset of free-space info within the file */ - size_t logical_len; /* Logical length of file */ - struct H5AC_cache_t *cache; /* The object cache */ - file_create_temp_t file_create_parms; /* File-creation template parameters */ + char *dir; /* Directory the file is located within */ + char *filename; /* Filename of file */ + uintn acc_perm; /* Access Permissions for file */ + hdf_file_t file_handle; /* File handle for actual I/O */ + uintn ref_count; /* Ref count for times file is opened */ + uint32 consist_flags; /* File Consistency Flags */ + haddr_t smallobj_off; /* Offset of small-obj heap within the file */ + haddr_t freespace_off; /* Offset of free-space info within the file */ + size_t logical_len; /* Logical length of file */ + struct H5AC_cache_t *cache; /* The object cache */ + file_create_temp_t file_create_parms; /* File-creation template */ #ifdef LATER - file_access_temp_t file_access_parms; /* File-access template parameters */ -#endif /* LATER */ - struct H5G_entry_t *root_sym; /* Extra for the root symbol in the file */ - H5F_root_symtype_t root_type; /* What kind of symbol is the root? */ + file_access_temp_t file_access_parms; /* File-access template */ +#endif + struct H5G_entry_t *root_sym; /* Root symbol table entry */ + H5F_root_symtype_t root_type; /* What kind of symbol is the root? */ } hdf5_file_t; @@ -83,15 +336,22 @@ typedef struct { #define H5F_encode_length(f,p,l) (H5F_SIZEOF_SIZE(f)==4 ? UINT32ENCODE(p,l) \ : H5F_SIZEOF_SIZE(f)==8 ? UINT64ENCODE(p,l) \ : H5F_SIZEOF_SIZE(f)==2 ? UINT16ENCODE(p,l) : H5FPencode_unusual_length(f,&(p),(uint8 *)&(l))) -#else /* NOT_YET */ -#define H5F_encode_length(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { case 4: UINT32ENCODE(p,l); break;\ - case 8: UINT64ENCODE(p,l); break;\ - case 2: UINT16ENCODE(p,l); break;} -#endif /* NOT_YET */ +#else +#define H5F_encode_length(f,p,l) \ + switch(H5F_SIZEOF_SIZE(f)) { \ + case 4: UINT32ENCODE(p,l); break; \ + case 8: UINT64ENCODE(p,l); break; \ + case 2: UINT16ENCODE(p,l); break; \ +} +#endif + +#define H5F_decode_length(f,p,l) \ + switch(H5F_SIZEOF_SIZE(f)) { \ + case 4: UINT32DECODE(p,l); break; \ + case 8: UINT64DECODE(p,l); break; \ + case 2: UINT16DECODE(p,l); break; \ +} -#define H5F_decode_length(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { case 4: UINT32DECODE(p,l); break;\ - case 8: UINT64DECODE(p,l); break;\ - case 2: UINT16DECODE(p,l); break;} /* Private functions, not part of the publicly documented API */ void H5F_encode_length_unusual(const hdf5_file_t *f, uint8 **p, uint8 *l); @@ -103,5 +363,4 @@ herr_t H5F_block_write (hdf5_file_t *f, haddr_t addr, size_t size, void *buf); herr_t H5F_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth); -#endif /* HDF5FILE_H */ - +#endif diff --git a/src/H5Fproto.h b/src/H5Fpublic.h index 8872d8d..fab328d 100644 --- a/src/H5Fproto.h +++ b/src/H5Fpublic.h @@ -13,15 +13,19 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5F module + * This file contains public declarations for the H5F module. */ -#ifndef H5FPROTO_H -#define H5FPROTO_H +#ifndef _H5Fpublic_H +#define _H5Fpublic_H + +/* Public header files needed by this file */ +#include <H5public.h> +#include <H5Apublic.h> /* file access codes */ -#define H5ACC_WRITE 0x0001 /* User in H5Fopen to open a file with write access */ -#define H5ACC_OVERWRITE 0x0002 /* User in H5Fcreate truncate an existing file */ +#define H5ACC_WRITE 0x0001 /* Use in H5Fopen to open a file with write access */ +#define H5ACC_OVERWRITE 0x0002 /* Use in H5Fcreate truncate an existing file */ /* Type of root rymbol-table entry */ typedef enum { @@ -32,21 +36,10 @@ typedef enum { H5F_ROOT_ERROR /* Error value */ } H5F_root_symtype_t; -/* - * If we're using POSIXUNBUFIO and lseek64() is available, then use - * 64-bit file offsets. Otherwise use whatever `off_t' is. - */ -#if (FILELIB==POSIXUNBUFIO) && defined(H5_HAVE_OFF64_T) && defined(H5_HAVE_LSEEK64) -typedef off64_t haddr_t; -#else -typedef off_t haddr_t; +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ - /* Functions in H5F.c */ hbool_t H5Fis_hdf5(const char *filename); hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_template, hatom_t access_template); @@ -54,9 +47,8 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_template); herr_t H5Fclose(hatom_t fid); hatom_t H5Fget_create_template(hatom_t fid); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5FPROTO_H */ +#endif +#endif @@ -27,20 +27,17 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> - -#include "hdf5.h" - -#define H5G_INIT_HEAP 8192 /* Packages needed by this file... */ -#include "H5private.h" -#include "H5Bprivate.h" -#include "H5Gprivate.h" -#include "H5Hprivate.h" -#include "H5MMprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Bprivate.h> +#include <H5Eprivate.h> +#include <H5Gprivate.h> +#include <H5Hprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> +#define H5G_INIT_HEAP 8192 #define PABLO_MASK H5G_mask diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 9cab6f1..709753b 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -20,20 +20,16 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include <stdio.h> -#include <string.h> - -#include "hdf5.h" /* Packages needed by this file... */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5Gprivate.h" /*me */ -#include "H5Hprivate.h" /*heap */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ +#include <H5private.h> /*library */ +#include <H5ACprivate.h> /*cache */ +#include <H5Bprivate.h> /*B-link trees */ +#include <H5Eprivate.h> /*error handling */ +#include <H5Gprivate.h> /*me */ +#include <H5Hprivate.h> /*heap */ +#include <H5MFprivate.h> /*file memory management */ +#include <H5MMprivate.h> /*core memory management */ #define PABLO_MASK H5G_node_mask diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index d5956bd..841fbbf 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -16,13 +16,12 @@ */ #ifndef _H5Gprivate_H #define _H5Gprivate_H +#include <H5Gpublic.h> -/*include public declarations */ -#include "H5Gproto.h" - -/*include packages needed by this header*/ -#include "H5Bprivate.h" -#include "H5Fprivate.h" +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Bprivate.h> +#include <H5Fprivate.h> #define H5G_NODE_MAGIC "SNOD" /*symbol table node magic number */ #define H5G_NODE_SIZEOF_MAGIC 4 /*sizeof symbol node magic number */ @@ -166,6 +165,5 @@ herr_t H5G_decode_vec (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent, intn n); herr_t H5G_encode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent); herr_t H5G_encode_vec (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent, intn n); - #endif diff --git a/src/H5Gproto.h b/src/H5Gpublic.h index 4b0569f..797b16a 100644 --- a/src/H5Gproto.h +++ b/src/H5Gpublic.h @@ -8,21 +8,24 @@ * Jul 11 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Prototypes for the H5G package (symbol tables). + * Purpose: Public declarations for the H5G package (symbol + * tables). * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5Gproto_H -#define _H5Gproto_H +#ifndef _H5Gpublic_H +#define _H5Gpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif @@ -18,14 +18,12 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include "hdf5.h" - -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Hprivate.h" /*self */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ +#include <H5private.h> /*library */ +#include <H5ACprivate.h> /*cache */ +#include <H5Eprivate.h> /*error handling */ +#include <H5Hprivate.h> /*self */ +#include <H5MFprivate.h> /*file memory management */ +#include <H5MMprivate.h> /*core memory management */ #define H5H_FREE_NULL 1 /*end of free list on disk */ #define PABLO_MASK H5H_mask diff --git a/src/H5Hprivate.h b/src/H5Hprivate.h index a11adde..99e8e8f 100644 --- a/src/H5Hprivate.h +++ b/src/H5Hprivate.h @@ -16,9 +16,11 @@ */ #ifndef _H5Hprivate_H #define _H5Hprivate_H +#include <H5Hpublic.h> -#include "H5Hproto.h" -#include "H5Fprivate.h" +/* Private headers needed by this file. */ +#include <H5private.h> +#include <H5Fprivate.h> #define H5H_MAGIC "HEAP" /*heap magic number */ #define H5H_SIZEOF_MAGIC 4 @@ -54,5 +56,4 @@ herr_t H5H_remove (hdf5_file_t *f, haddr_t addr, off_t offset, size_t size); herr_t H5H_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth); - #endif diff --git a/src/H5Hproto.h b/src/H5Hpublic.h index 93661ac..7ec8c7c 100644 --- a/src/H5Hproto.h +++ b/src/H5Hpublic.h @@ -8,21 +8,23 @@ * Jul 16 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: + * Purpose: Public declarations for the H5H (heap) package. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5Hproto_H -#define _H5Hproto_H +#ifndef _H5Hpublic_H +#define _H5Hpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif @@ -34,12 +34,14 @@ static char RcsId[] = "@(#)$Revision$"; H5M_init_interface -- initialize the interface + */ -#include "hdf5.h" -#include "H5private.h" /* Generic functions */ -#include "H5Cproto.h" /* Template interface */ -#include "H5Tproto.h" /* Datatype interface */ -#include "H5Mprivate.h" /* Meta-object interface */ -#include "H5Cprivate.h" /* Template interface */ +#include <H5private.h> /* Generic functions */ +#include <H5Cprivate.h> /* Template interface */ +#include <H5Dprivate.h> /* Dataset interface */ +#include <H5Eprivate.h> /*error handling */ +#include <H5Pprivate.h> /* Dataspace functions */ +#include <H5Tprivate.h> /* Datatype interface */ +#include <H5Mprivate.h> /* Meta-object interface */ +#include <H5Cprivate.h> /* Template interface */ #define PABLO_MASK H5M_mask @@ -48,6 +50,77 @@ static char RcsId[] = "@(#)$Revision$"; /* Whether we've installed the library termination function yet for this interface */ static intn interface_initialize_g = FALSE; +static meta_func_t meta_func_arr[]={ + { /* Template object meta-functions (defined in H5C.c) */ + H5_TEMPLATE, /* File-Creation Template Type ID */ + H5C_create, /* File-Creation Template Create */ + NULL, /* File-Creation Template Access */ + H5C_copy, /* File-Creation Template Copy */ + NULL, /* File-Creation Template FindName */ + NULL, /* File-Creation Template NameLen */ + NULL, /* File-Creation Template GetName */ + NULL, /* File-Creation Template SetName */ + NULL, /* File-Creation Template Search */ + NULL, /* File-Creation Template Index */ + NULL, /* File-Creation Template Flush */ + NULL, /* File-Creation Template Delete */ + NULL, /* File-Creation Template GetParent */ + NULL, /* File-Creation Template GetFile */ + H5C_release /* File-Creation Template Release */ + }, + { /* Datatype object meta-functions (defined in H5T.c) */ + H5_DATATYPE, /* Datatype Type ID */ + H5T_create, /* Datatype Create */ + NULL, /* Datatype Access */ + NULL, /* Dataspace Copy */ + NULL, /* Datatype FindName */ + NULL, /* Datatype NameLen */ + NULL, /* Datatype GetName */ + NULL, /* Datatype SetName */ + NULL, /* Datatype Search */ + NULL, /* Datatype Index */ + NULL, /* Datatype Flush */ + NULL, /* Datatype Delete */ + NULL, /* Datatype GetParent */ + NULL, /* Datatype GetFile */ + H5T_release /* Datatype Release */ + }, + { /* Dimensionality object meta-functions (defined in H5P.c) */ + H5_DATASPACE, /* Dimensionality Type ID */ + H5P_create, /* Dimensionality Create */ + NULL, /* Dimensionality Access */ + NULL, /* Dimensionality Copy */ + NULL, /* Dimensionality FindName */ + NULL, /* Dimensionality NameLen */ + NULL, /* Dimensionality GetName */ + NULL, /* Dimensionality SetName */ + NULL, /* Dimensionality Search */ + NULL, /* Dimensionality Index */ + NULL, /* Dimensionality Flush */ + NULL, /* Dimensionality Delete */ + NULL, /* Dimensionality GetParent */ + NULL, /* Dimensionality GetFile */ + H5P_release /* Dimensionality Release */ + }, + { /* Dataset object meta-functions (defined in H5D.c) */ + H5_DATASPACE, /* Dataset Type ID */ + H5D_create, /* Dataset Create */ + NULL, /* Dataset Access */ + NULL, /* Dataset Copy */ + NULL, /* Dataset FindName */ + NULL, /* Dataset NameLen */ + NULL, /* Dataset GetName */ + NULL, /* Dataset SetName */ + NULL, /* Dataset Search */ + NULL, /* Dataset Index */ + H5D_flush, /* Dataset Flush */ + NULL, /* Dataset Delete */ + NULL, /* Dataset GetParent */ + NULL, /* Dataset GetFile */ + H5D_release /* Dataset Release */ + } + }; + /*------------------_-- Local function prototypes ----------------------------*/ static herr_t H5M_init_interface(void); @@ -17,12 +17,10 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include "hdf5.h" - -#include "H5private.h" -#include "H5Fprivate.h" -#include "H5MFprivate.h" +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5Fprivate.h> +#include <H5MFprivate.h> #define PABLO_MASK H5MF_mask diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index e87ca58..7537300 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -16,8 +16,11 @@ */ #ifndef _H5MFprivate_H #define _H5MFprivate_H +#include <H5MFpublic.h> -#include "H5MFproto.h" +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Fprivate.h> /* * Library prototypes... diff --git a/src/H5MFproto.h b/src/H5MFpublic.h index 72e24f6..4a89c25 100644 --- a/src/H5MFproto.h +++ b/src/H5MFpublic.h @@ -8,21 +8,24 @@ * Jul 11 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Prototypes for file memory management. + * Purpose: Public declarations for the H5MF (file memory + * management) package. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5MFproto_H -#define _H5MFproto_H +#ifndef _H5MFpublic_H +#define _H5MFpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif @@ -14,10 +14,8 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include "hdf5.h" - -#include "H5MMprivate.h" +#include <H5private.h> +#include <H5MMprivate.h> /*------------------------------------------------------------------------- diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index f4890df..73ff121 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -16,8 +16,10 @@ */ #ifndef _H5MMprivate_H #define _H5MMprivate_h +#include <H5MMpublic.h> -#include "H5MMproto.h" +/* Private headers needed by this file */ +#include <H5private.h> /* * Library prototypes... diff --git a/src/H5MMproto.h b/src/H5MMpublic.h index c4ef18f..5a2ab26 100644 --- a/src/H5MMproto.h +++ b/src/H5MMpublic.h @@ -8,21 +8,24 @@ * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Function prototypes for memory management. + * Purpose: Public declarations for the H5MM (memory management) + * package. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5MMproto_H -#define _H5MMproto_H +#ifndef _H5MMpublic_H +#define _H5MMpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h index cde2cda..8455dc7 100644 --- a/src/H5Mprivate.h +++ b/src/H5Mprivate.h @@ -16,16 +16,17 @@ * This file contains macros & information for meta-objects */ -#ifndef H5MPRIVATE_H -#define H5MPRIVATE_H +#ifndef _H5Mprivate_H +#define _H5Mprivate_H +#include <H5Mpublic.h> /* Include Public Definitions */ -#include "H5Mproto.h" /* Include Public Definitions */ +/* Private headers needed by this file */ +#include <H5private.h> /* * A function table record for accessing interfaces which use the "meta" * interface to create/access/release objects. */ - typedef struct meta_func_t { hobjtype_t type; /* Object type this interface is for */ @@ -46,78 +47,7 @@ typedef struct meta_func_t } meta_func_t; -meta_func_t meta_func_arr[]={ - { /* Template object meta-functions (defined in H5C.c) */ - H5_TEMPLATE, /* File-Creation Template Type ID */ - H5C_create, /* File-Creation Template Create */ - NULL, /* File-Creation Template Access */ - H5C_copy, /* File-Creation Template Copy */ - NULL, /* File-Creation Template FindName */ - NULL, /* File-Creation Template NameLen */ - NULL, /* File-Creation Template GetName */ - NULL, /* File-Creation Template SetName */ - NULL, /* File-Creation Template Search */ - NULL, /* File-Creation Template Index */ - NULL, /* File-Creation Template Flush */ - NULL, /* File-Creation Template Delete */ - NULL, /* File-Creation Template GetParent */ - NULL, /* File-Creation Template GetFile */ - H5C_release /* File-Creation Template Release */ - }, - { /* Datatype object meta-functions (defined in H5T.c) */ - H5_DATATYPE, /* Datatype Type ID */ - H5T_create, /* Datatype Create */ - NULL, /* Datatype Access */ - NULL, /* Dataspace Copy */ - NULL, /* Datatype FindName */ - NULL, /* Datatype NameLen */ - NULL, /* Datatype GetName */ - NULL, /* Datatype SetName */ - NULL, /* Datatype Search */ - NULL, /* Datatype Index */ - NULL, /* Datatype Flush */ - NULL, /* Datatype Delete */ - NULL, /* Datatype GetParent */ - NULL, /* Datatype GetFile */ - H5T_release /* Datatype Release */ - }, - { /* Dimensionality object meta-functions (defined in H5P.c) */ - H5_DATASPACE, /* Dimensionality Type ID */ - H5P_create, /* Dimensionality Create */ - NULL, /* Dimensionality Access */ - NULL, /* Dimensionality Copy */ - NULL, /* Dimensionality FindName */ - NULL, /* Dimensionality NameLen */ - NULL, /* Dimensionality GetName */ - NULL, /* Dimensionality SetName */ - NULL, /* Dimensionality Search */ - NULL, /* Dimensionality Index */ - NULL, /* Dimensionality Flush */ - NULL, /* Dimensionality Delete */ - NULL, /* Dimensionality GetParent */ - NULL, /* Dimensionality GetFile */ - H5P_release /* Dimensionality Release */ - }, - { /* Dataset object meta-functions (defined in H5D.c) */ - H5_DATASPACE, /* Dataset Type ID */ - H5D_create, /* Dataset Create */ - NULL, /* Dataset Access */ - NULL, /* Dataset Copy */ - NULL, /* Dataset FindName */ - NULL, /* Dataset NameLen */ - NULL, /* Dataset GetName */ - NULL, /* Dataset SetName */ - NULL, /* Dataset Search */ - NULL, /* Dataset Index */ - H5D_flush, /* Dataset Flush */ - NULL, /* Dataset Delete */ - NULL, /* Dataset GetParent */ - NULL, /* Dataset GetFile */ - H5D_release /* Dataset Release */ - } - }; /* Private functions, not part of the publicly documented API */ -#endif /* H5MPRIVATE_H */ - +#endif diff --git a/src/H5Mproto.h b/src/H5Mpublic.h index 3c06412..b542ce5 100644 --- a/src/H5Mproto.h +++ b/src/H5Mpublic.h @@ -13,25 +13,30 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5M module + * This file contains public declarations for the H5M module. */ -#ifndef H5MPROTO_H -#define H5MPROTO_H +#ifndef _H5Mpublic_H +#define _H5Mpublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +/* Public headers needed by this file */ +#include <H5public.h> +#include <H5Cpublic.h> /*for hobjtype_t defn*/ + + +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5M.c */ hatom_t H5Mcreate(hatom_t owner_id, hobjtype_t type, const char *name); hatom_t H5Mcopy(hatom_t oid); +hatom_t H5Mflush(hatom_t oid); +hatom_t H5Mget_file(hatom_t oid); herr_t H5Mrelease(hatom_t oid); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5MPROTO_H */ +#endif +#endif @@ -14,16 +14,13 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> - -#include "hdf5.h" - -#include "H5private.h" -#include "H5ACprivate.h" -#include "H5Fprivate.h" -#include "H5MFprivate.h" -#include "H5MMprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5ACprivate.h> +#include <H5Eprivate.h> +#include <H5Fprivate.h> +#include <H5MFprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> #define PABLO_MASK H5O_mask diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 045489c..2f8bb58 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -17,11 +17,10 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> -#include "hdf5.h" -#include "H5private.h" -#include "H5MMprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> #define PABLO_MASK H5O_cont_mask diff --git a/src/H5Oname.c b/src/H5Oname.c index 643efcc..47d5669 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -14,13 +14,10 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> - -#include "hdf5.h" - -#include "H5private.h" -#include "H5MMprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> #define PABLO_MASK H5O_name_mask diff --git a/src/H5Onull.c b/src/H5Onull.c index 7175273..467e26a 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -14,9 +14,8 @@ * *------------------------------------------------------------------------- */ -#include "hdf5.h" -#include "H5private.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Oprivate.h> #define PABLO_MASK H5O_null_mask diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index f56146c..65d76db 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -16,10 +16,12 @@ */ #ifndef _H5Oprivate_H #define _H5Oprivate_H -#include "H5Oproto.h" +#include <H5Opublic.h> -#include "H5Fprivate.h" -#include "H5Gprivate.h" +/* Private headers neede by this file */ +#include <H5private.h> +#include <H5Fprivate.h> +#include <H5Gprivate.h> #define H5O_MIN_SIZE 16 /*min obj header data size */ #define H5O_NMESGS 32 /*initial number of messages */ diff --git a/src/H5Oproto.h b/src/H5Opublic.h index df94835..4b7b110 100644 --- a/src/H5Oproto.h +++ b/src/H5Opublic.h @@ -8,23 +8,25 @@ * Aug 5 1997 * Robb Matzke <matzke@llnl.gov> * - * Purpose: Object header public prototypes + * Purpose: Public declarations for the H5O (object header) + * package. * * Modifications: * *------------------------------------------------------------------------- */ -#ifndef _H5Oproto_H -#define _H5Oproto_H +#ifndef _H5Opublic_H +#define _H5Opublic_H -#if defined c_plusplus || defined __cplusplus -extern "C" -{ +/* Public headers needed by this file */ +#include <H5public.h> + +#ifdef __cplusplus +extern "C" { #endif -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } #endif - #endif diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 926eeef..760fcb4 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -14,14 +14,11 @@ * *------------------------------------------------------------------------- */ -#include <assert.h> - -#include "hdf5.h" - -#include "H5private.h" -#include "H5Gprivate.h" -#include "H5MMprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5Gprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> #define PABLO_MASK H5O_stab_mask @@ -32,9 +32,10 @@ static char RcsId[] = "@(#)$Revision$"; H5P_init_interface -- initialize the interface + */ -#include "hdf5.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Pprivate.h" /* Data-space functions */ +#include <H5private.h> /* Generic Functions */ +#include <H5Aprivate.h> /* Atom Functions */ +#include <H5Eprivate.h> /* Error handling */ +#include <H5Pprivate.h> /* Data-space functions */ #define PABLO_MASK H5P_mask @@ -61,7 +62,7 @@ static herr_t H5P_init_interface(void) FUNC_ENTER (H5P_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ - ret_value=H5Ainit_group(H5_DATASPACE,HDF5_DATASPACEID_HASHSIZE,H5P_RESERVED_ATOMS); + ret_value=H5Ainit_group(H5_DATASPACE,H5A_DATASPACEID_HASHSIZE,H5P_RESERVED_ATOMS); FUNC_LEAVE(ret_value); } /* H5P_init_interface */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 776367d..455ad4b 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -16,14 +16,18 @@ * This file contains private information about the H5P module */ -#ifndef H5PPRIVATE_H -#define H5PPRIVATE_H +#ifndef _H5Pprivate_H +#define _H5Pprivate_H +#include <H5Ppublic.h> -#include "H5Pproto.h" -#define H5P_RESERVED_ATOMS 1 +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Cprivate.h> /*for hobjtype_t defn*/ -/*------------------_-- Local function prototypes ----------------------------*/ -static herr_t H5P_init_interface(void); +#define H5P_RESERVED_ATOMS 1 -#endif /* H5PPRIVATE_H */ +/* Private functions */ +hatom_t H5P_create(hatom_t owner_id, hobjtype_t type, const char *name); +herr_t H5P_release(hatom_t oid); +#endif diff --git a/src/H5Pproto.h b/src/H5Ppublic.h index b0337a0..e1c4703 100644 --- a/src/H5Pproto.h +++ b/src/H5Ppublic.h @@ -13,11 +13,15 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5P module + * This file contains public declarations for the H5P module. */ -#ifndef H5PPROTO_H -#define H5PPROTO_H +#ifndef _H5pproto_H +#define _H5Pproto_H + +/* Public headers needed by this file */ +#include <H5public.h> +#include <H5Apublic.h> /* Define atomic datatypes */ #define H5P_SCALAR MAKE_ATOM(H5_DATASPACE,0) @@ -27,19 +31,15 @@ typedef struct { uint32 *dims; } H5P_dim_t; -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5P.c */ -hatom_t H5P_create(hatom_t owner_id, hobjtype_t type, const char *name); uintn H5Pnelem(hatom_t dim_id); -herr_t H5P_release(hatom_t oid); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5PPROTO_H */ +#endif +#endif @@ -38,9 +38,12 @@ static char RcsId[] = "@(#)$Revision$"; H5T_init_interface -- initialize the interface + */ -#include "hdf5.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Tprivate.h" /* Data-type functions */ +#include <H5private.h> /* Generic Functions */ +#include <H5Aprivate.h> /* Atom functions */ +#include <H5Eprivate.h> /* Error handling */ +#include <H5Mprivate.h> /* Meta data */ +#include <H5Pprivate.h> /* Data space */ +#include <H5Tprivate.h> /* Data-type functions */ #define PABLO_MASK H5T_mask @@ -70,7 +73,7 @@ static herr_t H5T_init_interface(void) FUNC_ENTER (H5T_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ - ret_value=H5Ainit_group(H5_DATATYPE,HDF5_DATATYPEID_HASHSIZE,H5T_RESERVED_ATOMS); + ret_value=H5Ainit_group(H5_DATATYPE,H5A_DATATYPEID_HASHSIZE,H5T_RESERVED_ATOMS); FUNC_LEAVE(ret_value); } /* H5T_init_interface */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 0224725..c3999a0 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -16,10 +16,14 @@ * This file contains private information about the H5T module */ -#ifndef H5TPRIVATE_H -#define H5TPRIVATE_H +#ifndef _H5Tprivate_H +#define _H5Tprivate_H +#include <H5Tpublic.h> + +/* Private headers needed by this file */ +#include <H5private.h> +#include <H5Cprivate.h> /*for hobjtype_t defn*/ -#include "H5Tproto.h" #define H5T_RESERVED_ATOMS 8 /* Structure for storing information about a field in a compound datatype */ @@ -46,5 +50,8 @@ typedef struct { h5_compound_info_t *ci; /* Information for compound datatypes */ } h5_datatype_t; -#endif /* H5TPRIVATE_H */ +/* Private functions */ +hatom_t H5T_create(hatom_t owner_id, hobjtype_t type, const char *name); +herr_t H5T_release(hatom_t oid); +#endif diff --git a/src/H5Tproto.h b/src/H5Tpublic.h index b40ac10..48fdfce 100644 --- a/src/H5Tproto.h +++ b/src/H5Tpublic.h @@ -13,11 +13,15 @@ /* $Id$ */ /* - * This file contains function prototypes for each exported function in the H5T module + * This file contains public declarations for the H5T module. */ -#ifndef H5TPROTO_H -#define H5TPROTO_H +#ifndef _H5Tpublic_H +#define _H5Tpublic_H + +/* Public headers needed by this file */ +#include <H5public.h> +#include <H5Apublic.h> /* Define atomic datatypes */ #define H5T_CHAR MAKE_ATOM(H5_DATATYPE,0) @@ -35,14 +39,11 @@ typedef struct { uint8 arch; /* Architecture of the base-type */ } h5_atomic_type_t; -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ +#ifdef __cplusplus +extern "C" { +#endif /* Functions in H5T.c */ -hatom_t H5T_create(hatom_t owner_id, hobjtype_t type, const char *name); -herr_t H5T_release(hatom_t oid); uint32 H5Tget_num_fields(hatom_t tid); hbool_t H5Tis_field_atomic(hatom_t tid,uintn fidx); hbool_t H5Tis_atomic(hatom_t tid); @@ -52,9 +53,8 @@ herr_t H5Tadd_field (hatom_t tid, const char *name, hatom_t base, uint8 len, uint8 arch, hatom_t space); herr_t H5Tget_fields(hatom_t tid, hatom_t *field_list); -#if defined c_plusplus || defined __cplusplus +#ifdef __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5TPROTO_H */ +#endif +#endif diff --git a/src/H5config.h.in b/src/H5config.h.in new file mode 100644 index 0000000..20da7a1 --- /dev/null +++ b/src/H5config.h.in @@ -0,0 +1,32 @@ +/* src/H5config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +#undef off_t + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* The number of bytes in a double. */ +#undef SIZEOF_DOUBLE + +/* The number of bytes in a float. */ +#undef SIZEOF_FLOAT + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a long long. */ +#undef SIZEOF_LONG_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT diff --git a/src/H5private.h b/src/H5private.h index 62e7e6c..a321f31 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -13,18 +13,461 @@ /* $Id$ */ /* - * This file contains macros & private information for general HDF5 functions + * This file contains macros & private information for general HDF5 functions. + * Every HDF5 source file will include this file immediately after any + * system include files but before any other private include files. */ +#ifndef _H5private_H +#define _H5private_H +#include <H5public.h> /* Include Public Definitions */ + +/* Version #'s of library code */ +#define HDF5_MAJOR_VERSION 0 /* For major interface changes */ +#define HDF5_MINOR_VERSION 0 /* For minor interface changes */ +#define HDF5_RELEASE_VERSION 0 /* For interface tweaks & bug-fixes */ +#define HDF5_PATCH_VERSION 0 /* For small groups of bug fixes*/ + +/* Version #'s of the major components of the file format */ +#define HDF5_BOOTBLOCK_VERSION 0 /* of the boot block format */ +#define HDF5_SMALLOBJECT_VERSION 0 /* of the Small-Object Heap */ +#define HDF5_FREESPACE_VERSION 0 /* of the Free-Space Info */ +#define HDF5_OBJECTDIR_VERSION 0 /* of the Object Directory format */ +#define HDF5_SHAREDHEADER_VERSION 0 /* of the Shared-Header Info */ + +/* + * Include those things that almost all source files need. + */ +#ifdef STDC_HEADERS +# include <assert.h> +# include <fcntl.h> +# include <stdio.h> +# include <stdlib.h> +# include <string.h> +# include <unistd.h> +#endif + +/* + * Pablo support files. + */ +#ifdef HAVE_PABLO +# define IOTRACE +# include "IOTrace.h" +# include "ProcIDS.h" +#endif + +/* + * Low level I/O library + */ +#define POSIXBUFIO 0 +#define POSIXUNBUFIO 1 +#define MACIO 2 +#define WINNTIO 3 +#define PAGEBUFIO 4 +#define FILELIB POSIXBUFIO + + +/* number of members in an array */ +#ifndef NELMTS +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +#endif + +/* minimum of two values */ +#ifndef MIN +# define MIN(a,b) (((a)<(b)) ? (a) : (b)) +#endif + +/* maximum of two values */ +#ifndef MAX +# define MAX(a,b) (((a)>(b)) ? (a) : (b)) +#endif + +/* maximum of three values */ +#ifndef MAX3 +# define MAX3(a,b,c) MAX(MAX(a,b),c) +#endif + + +/* + * HDF Boolean type. + */ +#ifndef FALSE +# define FALSE 0 +#endif +#ifndef TRUE +# define TRUE (!FALSE) +#endif + +/* + * File offsets. + */ +typedef off_t haddr_t; + +/* + * Some compilers have problems declaring auto variables that point + * to string constants. Use the CONSTR() macro so it's easy to fix + * those compilers. + */ +#ifndef CONSTR +# define CONSTR(VAR,STR) static const char VAR[]=STR +#endif + +/* + * Redefine all the POSIX functions. We should never see a POSIX + * function (or any other non-HDF5 function) in the source! + */ +#define HDabort() abort() +#define HDabs(X) abs(X) +#define HDaccess(F,M) access(F, M) +#define HDacos(X) acos(X) +#define HDalarm(N) alarm(N) +#define HDasctime(T) asctime(T) +#define HDasin(X) asin(X) +#define HDassert(X) assert(X) +#define HDatan(X) atan(X) +#define HDatan2(X,Y) atan2(X,Y) +#define HDatexit(F) atexit(F) +#define HDatof(S) atof(S) +#define HDatoi(S) atoi(S) +#define HDatol(S) atol(S) +#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) +#define HDcalloc(N,Z) calloc(N,Z) +#define HDceil(X) ceil(X) +#define HDcfgetispeed(T) cfgetispeed(T) +#define HDcfgetospeed(T) cfgetospeed(T) +#define HDcfsetispeed(T,S) cfsetispeed(T,S) +#define HDcfsetospeed(T,S) cfsetospeed(T,S) +#define HDchdir(S) chdir(S) +#define HDchmod(S,M) chmod(S,M) +#define HDchown(S,O,G) chown(S,O,G) +#define HDclearerr(F) clearerr(F) +#define HDclock() clock() +#define HDclose(F) close(F) +#define HDclosedir(D) closedir(D) +#define HDcos(X) cos(X) +#define HDcosh(X) cosh(X) +#define HDcreat(S,M) creat(S,M) +#define HDctermid(S) ctermid(S) +#define HDctime(T) ctime(T) +#define HDcuserid(S) cuserid(S) +#define HDdifftime(X,Y) difftime(X,Y) +#define HDdiv(X,Y) div(X,Y) +#define HDdup(F) dup(F) +#define HDdup2(F,I) dup2(F,I) +/* execl() variable arguments */ +/* execle() variable arguments */ +/* execlp() variable arguments */ +#define HDexecv(S,AV) execv(S,AV) +#define HDexecve(S,AV,E) execve(S,AV,E) +#define HDexecvp(S,AV) execvp(S,AV) +#define HDexit(N) exit(N) +#define HD_exit(N) _exit(N) +#define HDexp(X) exp(X) +#define HDfabs(X) fabs(X) +#define HDfclose(F) fclose(F) +/* fcntl() variable arguments */ +#define HDfdopen(N,S) fdopen(N,S) +#define HDfeof(F) feof(F) +#define HDferror(F) ferror(F) +#define HDfflush(F) fflush(F) +#define HDfgetc(F) fgetc(F) +#define HDfgetpos(F,P) fgetpos(F,P) +#define HDfgets(S,N,F) fgets(S,N,F) +#define HDfileno(F) fileno(F) +#define HDfloor(X) floor(X) +#define HDfmod(X,Y) fmod(X,Y) +#define HDfopen(S,M) fopen(S,M) +#define HDfork() fork() +#define HDfpathconf(F,N) fpathconf(F,N) +/* fprintf() variable arguments */ +#define HDfputc(C,F) fputc(C,F) +#define HDfputs(S,F) fputs(S,F) +#define HDfread(M,Z,N,F) fread(M,Z,N,F) +#define HDfree(M) free(M) +#define HDfreopen(S,M,F) freopen(S,M,F) +#define HDfrexp(X,N) frexp(X,N) +/* fscanf() variable arguments */ +#define HDfseek(F,O,W) fseek(F,O,W) +#define HDfsetpos(F,P) fsetpos(F,P) +#define HDfstat(F,B) fstat(F,B) +#define HDftell(F) ftell(F) +#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) +#define HDgetc(F) getc(F) +#define HDgetchar() getchar() +#define HDgetcwd(S,Z) getcwd(S,Z) +#define HDgetegid() getegid() +#define HDgetenv(S) getenv(S) +#define HDgeteuid() geteuid() +#define HDgetgid() getgid() +#define HDgetgrgid(G) getgrgid(G) +#define HDgetgrnam(S) getgrnam(S) +#define HDgetgroups(Z,G) getgroups(Z,G) +#define HDgetlogin() getlogin() +#define HDgetpgrp() getpgrp() +#define HDgetpid() getpid() +#define HDgetppid() getppid() +#define HDgetpwnam(S) getpwnam(S) +#define HDgetpwuid(U) getpwuid(U) +#define HDgets(S) gets(S) +#define HDgetuid() getuid() +#define HDgmtime(T) gmtime(T) +#define HDisalnum(C) isalnum(C) +#define HDisalpha(C) isalpha(C) +#define HDisatty(F) isatty(F) +#define HDiscntrl(C) iscntrl(C) +#define HDisdigit(C) isdigit(C) +#define HDisgraph(C) isgraph(C) +#define HDislower(C) islower(C) +#define HDisprint(C) isprint(C) +#define HDispunct(C) ispunct(C) +#define HDisspace(C) isspace(C) +#define HDisupper(C) isupper(C) +#define HDisxdigit(C) isxdigit(C) +#define HDkill(P,S) kill(P,S) +#define HDlabs(X) labs(X) +#define HDldexp(X,N) ldexp(X,N) +#define HDldiv(X,Y) ldiv(X,Y) +#define HDlink(OLD,NEW) link(OLD,NEW) +#define HDlocaleconv() localeconv() +#define HDlocaltime(T) localtime(T) +#define HDlog(X) log(X) +#define HDlog10(X) log10(X) +#define HDlongjmp(J,N) longjmp(J,N) +#define HDlseek(F,O,W) lseek(F,O,W) +#define HDmalloc(Z) malloc(Z) +#define HDmblen(S,N) mblen(S,N) +#define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z) +#define HDmbtowc(P,S,Z) mbtowc(P,S,Z) +#define HDmemchr(S,C,Z) memchr(S,C,Z) +#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z) +#define HDmemcpy(X,Y,Z) memcpy(X,Y,Z) +#define HDmemmove(X,Y,Z) memmove(X,Y,Z) +#define HDmemset(X,C,Z) memset(X,C,Z) +#define HDmkdir(S,M) mkdir(S,M) +#define HDmkfifo(S,M) mkfifo(S,M) +#define HDmktime(T) mktime(T) +#define HDmodf(X,Y) modf(X,Y) +/* open() variable arguments */ +#define HDopendir(S) opendir(S) +#define HDpathconf(S,N) pathconf(S,N) +#define HDpause() pause() +#define HDperror(S) perror(S) +#define HDpipe(F) pipe(F) +#define HDpow(X,Y) pow(X,Y) +/* printf() variable arguments */ +#define HDputc(C,F) putc(C,F) +#define HDputchar(C) putchar(C) +#define HDputs(S) puts(S) +#define HDqsort(M,N,Z,F) qsort(M,N,Z,F) +#define HDraise(N) raise(N) +#define HDrand() rand() +#define HDread(F,M,Z) read(F,M,Z) +#define HDreaddir(D) readdir(D) +#define HDrealloc(M,Z) realloc(M,Z) +#define HDremove(S) remove(S) +#define HDrename(OLD,NEW) rename(OLD,NEW) +#define HDrewind(F) rewind(F) +#define HDrewinddir(D) rewinddir(D) +#define HDrmdir(S) rmdir(S) +/* scanf() variable arguments */ +#define HDsetbuf(F,S) setbuf(F,S) +#define HDsetgid(G) setgid(G) +#define HDsetjmp(J) setjmp(J) +#define HDsetlocale(N,S) setlocale(N,S) +#define HDsetpgid(P,PG) setpgid(P,PG) +#define HDsetsid() setsid() +#define HDsetuid(U) setuid(U) +#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) +#define HDsigaction(N,A) sigaction(N,A) +#define HDsigaddset(S,N) sigaddset(S,N) +#define HDsigdelset(S,N) sigdelset(S,N) +#define HDsigemptyset(S) sigemptyset(S) +#define HDsigfillset(S) sigfillset(S) +#define HDsigismember(S,N) sigismember(S,N) +#define HDsiglongjmp(J,N) siglongjmp(J,N) +#define HDsignal(N,F) signal(N,F) +#define HDsigpending(S) sigpending(S) +#define HDsigprocmask(H,S,O) sigprocmask(H,S,O) +#define HDsigsetjmp(J,N) sigsetjmp(J,N) +#define HDsigsuspend(S) sigsuspend(S) +#define HDsin(X) sin(X) +#define HDsinh(X) sinh(X) +#define HDsleep(N) sleep(N) +/* sprintf() variable arguments */ +#define HDsqrt(X) sqrt(X) +#define HDsrand(N) srand(N) +/* sscanf() variable arguments */ +#define HDstat(S,B) stat(S,B) +#define HDstrcat(X,Y) strcat(X,Y) +#define HDstrchr(S,C) strchr(S,C) +#define HDstrcmp(X,Y) strcmp(X,Y) +#define HDstrcoll(X,Y) strcoll(X,Y) +#define HDstrcpy(X,Y) strcpy(X,Y) +#define HDstrcspn(X,Y) strcspn(X,Y) +#define HDstrerror(N) strerror(N) +#define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) +#define HDstrlen(S) strlen(S) +#define HDstrncat(X,Y,Z) strncat(X,Y,Z) +#define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) +#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) +#define HDstrpbrk(X,Y) strpbrk(X,Y) +#define HDstrrchr(S,C) strrchr(S,C) +#define HDstrspn(X,Y) strspn(X,Y) +#define HDstrstr(X,Y) strstr(X,Y) +#define HDstrtod(S,R) strtod(S,R) +#define HDstrtok(X,Y) strtok(X,Y) +#define HDstrtol(S,R,N) strtol(S,R,N) +#define HDstrtoul(S,R,N) strtoul(S,R,N) +#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) +#define HDsysconf(N) sysconf(N) +#define HDsystem(S) system(S) +#define HDtan(X) tan(X) +#define HDtanh(X) tanh(X) +#define HDtcdrain(F) tcdrain(F) +#define HDtcflow(F,A) tcflow(F,A) +#define HDtcflush(F,N) tcflush(F,N) +#define HDtcgetattr(F,T) tcgetattr(F,T) +#define HDtcgetpgrp(F) tcgetpgrp(F) +#define HDtcsendbreak(F,N) tcsendbreak(F,N) +#define HDtcsetattr(F,O,T) tcsetattr(F,O,T) +#define HDtcsetpgrp(F,N) tcsetpgrp(F,N) +#define HDtime(T) time(T) +#define HDtimes(T) times(T) +#define HDtmpfile() tmpfile() +#define HDtmpnam(S) tmpnam(S) +#define HDtolower(C) tolower(C) +#define HDtoupper(C) toupper(C) +#define HDttyname(F) ttyname(F) +#define HDtzset() tzset() +#define HDumask(N) umask(N) +#define HDuname(S) uname(S) +#define HDungetc(C,F) ungetc(C,F) +#define HDunlink(S) unlink(S) +#define HDutime(S,T) utime(S,T) +#define HDva_arg(A,T) va_arg(A,T) +#define HDva_end(A) va_end(A) +#define HDva_start(A,P) va_start(A,P) +#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) +#define HDvprintf(FMT,A) vprintf(FMT,A) +#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) +#define HDwait(W) wait(W) +#define HDwaitpid(P,W,O) waitpid(P,W,O) +#define HDwcstombs(S,P,Z) wcstombs(S,P,Z) +#define HDwctomb(S,C) wctomb(S,C) +#define HDwrite(F,M,Z) write(F,M,Z) + +/* + * And now for a couple non-Posix functions... + */ +#define HDstrdup(S) strdup(S) + +/*------------------------------------------------------------------------- + * Purpose: Register function entry for library initialization and code + * profiling. + * + * Notes: Every file must have a file-scope variable called + * `initialize_interface'. + * + * Don't use local variable initializers which contain + * calls to other library functions since the initializer + * would happen before the FUNC_ENTER() gets called. Don't + * use initializers that require special cleanup code to + * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() + * returns immediately without branching to the `done' label. + * + * Programmer: Quincey Koziol + * + * Modifications: + * + * Robb Matzke, 4 Aug 1997 + * The `interface_init_func' can be the null pointer. Changed + * HGOTO_ERROR() to HRETURN_ERROR() since no clean-up needs to occur + * when an error is detected at this point since this must be the + * first executable statement in a function. This allows functions + * to omit the `done:' label when convenient to do so. + * + * Robb Matzke, 4 Aug 1997 + * The pablo mask comes from the constant PABLO_MASK defined on + * a per-file basis. The `pablo_func_id' is generated from the + * `func_name' argument by prepending an `ID_' to the name. The + * pablo function identifier should be saved in a local variable + * so FUNC_LEAVE() can access it. + * + * Robb Matzke, 4 Aug 1997 + * It is safe to call this function even inside various library + * initializing functions. Infinite recursion is no longer a + * danger. + * + *------------------------------------------------------------------------- + */ +extern hbool_t library_initialize_g; /*good thing C's lazy about extern!*/ +extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ + +#define FUNC_ENTER(func_name,interface_init_func,err) \ + CONSTR (FUNC, #func_name); \ + PABLO_SAVE (ID_ ## func_name); \ + \ + PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ + \ + if (!library_initialize_g) { \ + library_initialize_g = TRUE; \ + if (H5_init_library()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + } \ + } \ + \ + if (!thread_initialize_g) { \ + thread_initialize_g = TRUE; \ + if (H5_init_thread()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + } \ + } \ + \ + if (!interface_initialize_g) { \ + interface_initialize_g = TRUE; \ + if (interface_init_func && \ + ((herr_t(*)(void))interface_init_func)()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + } \ + } + + + +/*------------------------------------------------------------------------- + * Purpose: Register function exit for code profiling. This should be + * the last statement executed by a function. + * + * Programmer: Quincey Koziol + * + * Modifications: + * + * Robb Matzke, 4 Aug 1997 + * The pablo mask comes from the constant PABLO_MASK defined on a + * per-file basis. The pablo_func_id comes from an auto variable + * defined by FUNC_ENTER. + * + *------------------------------------------------------------------------- + */ +#define FUNC_LEAVE(return_value) HRETURN(return_value) + +/* + * The FUNC_ENTER() and FUNC_LEAVE() macros make calls to Pablo functions + * through one of these two sets of macros. + */ +#ifdef HAVE_PABLO +# define PABLO_SAVE(func_id) intn pablo_func_id = func_id +# define PABLO_TRACE_ON(m, f) TRACE_ON(m,f) +# define PABLO_TRACE_OFF(m, f) TRACE_OFF(m,f) +#else +# define PABLO_SAVE(func_id) /*void*/ +# define PABLO_TRACE_ON(m, f) /*void*/ +# define PABLO_TRACE_OFF(m, f) /*void*/ +#endif -#ifndef H5PRIVATE_H -#define H5PRIVATE_H -#include "H5proto.h" /* Include Public Definitions */ /* Private functions, not part of the publicly documented API */ herr_t H5_init_library(void); void H5_term_library(void); herr_t H5_init_thread(void); -#endif /* H5PRIVATE_H */ - +#endif diff --git a/src/H5proto.h b/src/H5proto.h deleted file mode 100644 index f425c76..0000000 --- a/src/H5proto.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains function prototypes for each exported function in the H5 module - */ - -#ifndef H5PROTO_H -#define H5PROTO_H - -#if defined c_plusplus || defined __cplusplus -extern "C" -{ -#endif /* c_plusplus || __cplusplus */ - -/* Functions in H5.c */ -herr_t H5dont_atexit(void); -herr_t H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum); - -#if defined c_plusplus || defined __cplusplus -} -#endif /* c_plusplus || __cplusplus */ - -#endif /* H5PROTO_H */ diff --git a/src/H5public.h b/src/H5public.h new file mode 100644 index 0000000..1cc190c --- /dev/null +++ b/src/H5public.h @@ -0,0 +1,114 @@ +/**************************************************************************** + * NCSA HDF * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * * + * For conditions of distribution and use, see the accompanying * + * hdf/COPYING file. * + * * + ****************************************************************************/ + +/* $Id$ */ + +/* + * This file contains public declarations for the H5 module. + */ + +#ifndef _H5public_H +#define _H5public_H +#include <H5config.h> /* From configure */ + +/* + * Data types + */ +typedef void VOID; +typedef void *VOIDP; +typedef char char8; +typedef signed char int8; +typedef unsigned char uchar8, uint8; + +#if SIZEOF_SHORT==2 +typedef short int16; +typedef unsigned short uint16; +#else +typedef int int16; /*not really*/ +typedef unsigned uint16; /*not really*/ +#endif + +#if SIZEOF_INT==4 +typedef int int32; +typedef unsigned int uint32; +#elif SIZEOF_LONG==4 +typedef long int32; +typedef unsigned long uint32; +#endif + +#if SIZEOF_LONG==8 +typedef long int64; +typedef unsigned long uint64; +#elif SIZEOF_LONG_LONG==8 +typedef long long int64; +typedef unsigned long long uint64; +#else +# error "no 64-bit integer type" +#endif + +#if SIZEOF_FLOAT==4 +typedef float float32; +#else +typedef float float32; /*not really*/ +#endif + +#if SIZEOF_FLOAT==8 +typedef float float64; +#elif SIZEOF_DOUBLE==8 +typedef double float64; +#else +# error "no 64-bit floating point type" +#endif + +/* + * Define a type for generic integers. Use this instead of `int' to + * show that some thought went into the algorithm. + */ +typedef int intn; +typedef unsigned uintn; + +/* + * Status return values. + * Since some unix/c routines use 0 and -1 (or more precisely, non-negative + * vs. negative) as their return code, and some assumption had been made in + * the code about that, it is important to keep these constants the same + * values. When checking the success or failure of an integer-valued + * function, remember to compare against zero and not one of these two + * values. + */ +typedef intn herr_t; +#define SUCCEED 0 +#define FAIL (-1) +#define UFAIL (unsigned)(-1) + +/* + * Boolean type. + */ +typedef enum { + BFAIL =(-1), /*error value*/ + BFALSE =0, + BTRUE =1 +} hbool_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Functions in H5.c */ +herr_t H5dont_atexit(void); +herr_t H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..98e609f --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,42 @@ +# HDF5 Library Makefile(.in) -*- makefile -*- +# +# Copyright (C) 1997 National Center for Supercomputing Applications. +# All rights reserved. +# +# +@COMMENCE@ + +# Add `-I.' to the C preprocessor flags. +CPPFLAGS=-I. @CPPFLAGS@ + +# These are our main targets: +LIB=libhdf5.a +PROGS=debug + +# Source and object files for the library (lexicographically)... +LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5E.c H5F.c H5G.c H5Gnode.c \ + H5H.c H5M.c H5MF.c H5MM.c H5O.c H5Ocont.c H5Oname.c H5Onull.c \ + H5Ostab.c H5P.c H5T.c +LIB_OBJ=$(LIB_SRC:.c=.o) + +# Source and object files for programs... +PROG_SRC=debug.c +PROG_OBJ=$(PROG_SRC:.c=.o) + +# Public header files (to be installed)... +PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Cpublic.h \ + H5Dpublic.h H5Epublic.h H5Fpublic.h H5Gpublic.h H5Hpublic.h \ + H5Mpublic.h H5MFpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ + H5Tpublic.h H5config.h hdf5.h + +# Other header files (not to be installed)... +PRIVATE_HDR=H5private.h H5Aprivate.h H5ACprivate.h H5Bprivate.h \ + H5Cprivate.h H5Dprivate.h H5Eprivate.h H5Fprivate.h H5Gprivate.h \ + H5Hprivate.h H5Mprivate.h H5MFprivate.h H5MMprivate.h \ + H5Oprivate.h H5Pprivate.h H5Tprivate.h + +# How to build the programs... +debug: debug.o $(LIB) + $(CC) $(CFLAGS) -o $@ debug.o $(LIB) + +@CONCLUDE@ diff --git a/src/debug.c b/src/debug.c index 882a164..b21a0c8 100644 --- a/src/debug.c +++ b/src/debug.c @@ -14,14 +14,12 @@ * *------------------------------------------------------------------------- */ -#include "hdf5.h" - -#include "H5private.h" -#include "H5Bprivate.h" -#include "H5Fprivate.h" -#include "H5Gprivate.h" -#include "H5Hprivate.h" -#include "H5Oprivate.h" +#include <H5private.h> +#include <H5Bprivate.h> +#include <H5Fprivate.h> +#include <H5Gprivate.h> +#include <H5Hprivate.h> +#include <H5Oprivate.h> #define INDENT 3 #define VCOL 50 @@ -87,7 +85,7 @@ main (int argc, char *argv[]) exit (3); } - if (!memcmp (sig, HDF5_FILE_SIGNATURE, HDF5_FILE_SIGNATURE_LEN)) { + if (!memcmp (sig, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) { /* * Debug the boot block. */ diff --git a/src/h5oplat.h b/src/h5oplat.h deleted file mode 100644 index eb8627f..0000000 --- a/src/h5oplat.h +++ /dev/null @@ -1,555 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -#ifndef H5OPLAT_H -#define H5OPLAT_H - -/* - * This file contains machine definitions for older architectures which once - * were working, but haven't been tested in a long-time. If you wish to use - * and test an architecture from this file, move the entire machine's - * definition from this file into the hdf5plat.h file and make certain to - * delete the entry in this file. -QAK - */ - -/*------------------------------------------------------------------------- - * Define options for each platform - *-------------------------------------------------------------------------*/ - -#if (defined(SUN) || defined(sun) || defined(__sun__) || defined(__SUNPRO_C)) & !defined(__i386) -#ifdef __STDC__ -#define ANSISUN -#else /* __STDC__ */ -#define KNRSUN -#endif /* __STDC__ */ -#endif /* SUN || sun */ - -/* - * CPU: Sparc (possibly Motorola 68K?) - * OS: Solaris 1.x (?), SunOS 4.x - */ -#if defined(KNRSUN) - -#if !defined(SUN) -#define SUN -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -# define BSD -#define DUMBCC /* because it is. for later use in macros */ -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <unistd.h> -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_SUN - -/* Define portable variable types */ -typedef void VOID; -typedef char *VOIDP; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef int intf; /* size of INTEGERs in Fortran compiler */ -typedef float float32; -typedef double float64; - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#ifdef __GNUC__ -#define HAVE_STDC -#define INCLUDES_ARE_ANSI -#endif - -#endif /* SUN */ - -/* - * CPU: Vax & Alpha (yeah, right! this definition is probably not really that portable! -QAK ) - * OS: VMS, OpenVMS - */ -#if defined(VMS) || defined(vms) - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_VAX - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -#ifdef __alpha -typedef int int32; -typedef unsigned int uint32; -#else -typedef long int int32; -typedef unsigned long int uint32; -#endif -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define DF_CAPFNAMES /* fortran names are in all caps */ -#define _fcdtocp(desc) ((char *) *((char **) &desc[4])) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#define FILELIB POSIXBUFIO - -/* - Redef a couple of C routine names to avoid conflicts - since the VMS link command is case-insensitive -*/ -#include "dfivms.h" - - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* VMS */ - -/* - * CPU: HP PA-RISC - * OS: ConvexOS - */ -#if defined(CONVEX) || defined(CONVEXNATIVE) || defined(__convexc__) - -#ifndef CONVEX -#define CONVEX -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#include <sys/types.h> -#include <sys/stat.h> -/* Set machine byte-format */ -#ifdef CONVEXNATIVE -/* For Convex machines with native format floats */ -#define DF_MT DFMT_CONVEXNATIVE -#else -#define DF_MT DFMT_CONVEX -#endif - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define RIGHT_SHIFT_IS_UNSIGNED -#define INCLUDES_ARE_ANSI -#define HAVE_STDC - -#endif /* CONVEX */ - - -/* - * CPU: MIPS - * OS: Ultrix - */ -#if defined(MIPSEL) || ((defined(mips) || defined(__mips)) && (defined(ultrix) || defined(__ultrix))) - -#ifndef MIPSEL -#define MIPSEL -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -#ifndef __GNUC__ -#define DUMBCC /* because it is. for later use in macros -QAK */ -#endif /* __GNUC__ */ - -/* Extra include files required for this platform */ -#include <sys/types.h> -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_MIPSEL - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* MIPSEL */ - -/* - * CPU: Motorola 68K - * OS: NeXTSTEP - */ -#if defined(NEXT) || defined(NeXT) - -#ifndef NEXT -#define NEXT -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#define isascii(c) (isprint(c) || iscntrl(c)) -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_NEXT - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define HAVE_STDC -#define INCLUDES_ARE_ANSI - -#endif /* NEXT */ - -/* - * CPU: Motorola 88K (obscure CISC chip) - * OS: ? - */ -#if defined(MOTOROLA) || defined(m88k) - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <unistd.h> -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> -#ifndef O_RDONLY -#include <fcntl.h> /* for unbuffered i/o stuff */ -#endif /*O_RDONLY*/ - -/* Set machine byte-format */ -#define DF_MT DFMT_MOTOROLA - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#define FILELIB POSIXBUFIO - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* MOTOROLA */ - - -/* - * CPU: ? (Fujitsu VP series) - * OS: ? (UNIX) - */ -#if defined VP | defined __uxpm__ - -#ifndef VP -#define VP -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <memory.h> -#include <sys/types.h> -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_VP - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#define FILELIB POSIXBUFIO - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* VP */ - -/* - * CPU: Intel I860 (in Paragon system) - * OS: ? (UNIX) - */ -#if defined I860 | defined i860 - -#ifndef I860 -#define I860 -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <sys/types.h> -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> -#include <unistd.h> /* mis-using def. for SEEK_SET, but oh well */ - -/* Set machine byte-format */ -#define DF_MT DFMT_I860 - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#define FILELIB POSIXBUFIO - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* I860 */ - -#endif /* H5OPLAT_H */ - @@ -13,49 +13,28 @@ /* $Id$ */ /* - * This is the main HDF5 include file. Put further information in a particular - * header file and include that here, don't fill this file with lots of gunk... + * This is the main public HDF5 include file. Put further information in + * a particular header file and include that here, don't fill this file with + * lots of gunk... */ - -#ifndef HDF5_H -#define HDF5_H - -/* Standard header files needed all the time */ -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <string.h> - -/* PABLO support files */ -#ifdef HAVE_PABLO -#define IOTRACE -#include "IOTrace.h" -#include "ProcIDs.h" -#endif /* HAVE_PABLO */ - - -/* Determine the system and set up basic info. */ -#include "hdf5plat.h" /* Platform/OS/CPU detection header file (should be first header included) */ - -/* Generic Data-Structure/Algorithm include files */ -#include "H5Aproto.h" /* Atom management routines */ - -/* Major HDF5 Include files */ -#include "hdf5meta.h" /* File Meta-data conversion macros, etc. */ -#include "hdf5fort.h" /* Fortran macros, etc. */ -#include "hdf5port.h" /* Portability macros for easier development */ -#include "hdf5gen.h" /* General global macros */ -#include "hdf5type.h" /* General global typedefs (uses basic types defined in hdf5plat.h) */ -#include "hdf5lims.h" /* Various global limits & version numbers on things */ -#include "H5Fproto.h" /* File access information and macros */ -#include "hdf5pabl.h" /* Pablo porting macros */ -#include "H5Eproto.h" /* Error reporting information */ -#include "H5Cproto.h" /* Template information */ -#include "H5Mproto.h" /* Meta-Object information */ -#include "H5Tproto.h" /* Datatype information */ -#include "H5Pproto.h" /* Dataspace information */ -#include "H5proto.h" /* Generic Interface information */ -#include "hdf5glob.h" /* Global & thread-specific variables */ - -#endif /* HDF5_H */ - +#ifndef _HDF5_H +#define _HDF5_H + +#include <H5public.h> +#include <H5Apublic.h> +#include <H5ACpublic.h> +#include <H5Bpublic.h> +#include <H5Cpublic.h> +#include <H5Dpublic.h> +#include <H5Epublic.h> +#include <H5Fpublic.h> +#include <H5Gpublic.h> +#include <H5Hpublic.h> +#include <H5Mpublic.h> +#include <H5MFpublic.h> +#include <H5MMpublic.h> +#include <H5Opublic.h> +#include <H5Ppublic.h> +#include <H5Tpublic.h> + +#endif diff --git a/src/hdf5fort.h b/src/hdf5fort.h deleted file mode 100644 index 21e9ffc..0000000 --- a/src/hdf5fort.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains Fortran compatibility/interface macros, etc. - */ - -#ifndef HDF5FORT_H -#define HDF5FORT_H - -/*---------------------------------------------------------------- -** MACRO FCALLKEYW for any special fortran-C stub keyword -** -** MacIntosh MPW LS-fortran needs pascal since it can interface -** best with pascal functions. -** Microsoft C and Fortran need __fortran for Fortran callable C -** routines. -** -** MACRO FRETVAL for any return value from a fortran-C stub function -** Replaces the older FCALLKEYW macro. -**---------------------------------------------------------------*/ -#ifdef FRETVAL -#undef FRETVAL -#endif - -#if defined(MAC) /* with LS FORTRAN */ -#ifndef ABSOFT -# define FCALLKEYW pascal -# define FRETVAL(x) pascal x -#endif /* ABSOFT */ -#endif - -#ifndef FRETVAL /* !MAC */ -# define FCALLKEYW /*NONE*/ -# define FRETVAL(x) x -#endif - - -/*---------------------------------------------------------------- -** MACRO FNAME for any fortran callable routine name. -** -** This macro prepends, appends, or does not modify a name -** passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE, -** FNAME_POST_UNDERSCORE macros set for a specific system. -** -**---------------------------------------------------------------*/ -#if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) -# define FNAME(x) _##x##_ -#endif -#if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) -# define FNAME(x) _##x -#endif -#if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) -# define FNAME(x) x##_ -#endif -#if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) -# define FNAME(x) x -#endif - - -#endif /* HDF5FORT_H */ - - - diff --git a/src/hdf5gen.h b/src/hdf5gen.h deleted file mode 100644 index 628f5c3..0000000 --- a/src/hdf5gen.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains general macros used throughout HDF5 library & interfaces - */ -#include "hdf5pabl.h" - -#ifndef HDF5GEN_H -#define HDF5GEN_H - -/* return code - since some unix/c routines use 0 and -1 as their return - code, and some assumption had been made in the code about that, it is - important to keep these constants the same values. For explicitly - boolean functions, use TRUE and FALSE */ - -#define SUCCEED 0 -#define FAIL (-1) - -/* boolean values, reminder: NEVER compare with numeric values */ - -#ifndef FALSE -# define FALSE 0 -#endif -#ifndef TRUE -# define TRUE (!FALSE) -#endif - -/* number of members in an array */ -#ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) -#endif - -/*------------------------------------------------------------------------- - * Purpose: Register function entry for library initialization and code - * profiling. - * - * Notes: Every file must have a file-scope variable called - * `initialize_interface'. - * - * Don't use local variable initializers which contain - * calls to other library functions since the initializer - * would happen before the FUNC_ENTER() gets called. Don't - * use initializers that require special cleanup code to - * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() - * returns immediately without branching to the `done' label. - * - * Programmer: Quincey Koziol - * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * The `interface_init_func' can be the null pointer. Changed - * HGOTO_ERROR() to HRETURN_ERROR() since no clean-up needs to occur - * when an error is detected at this point since this must be the - * first executable statement in a function. This allows functions - * to omit the `done:' label when convenient to do so. - * - * Robb Matzke, 4 Aug 1997 - * The pablo mask comes from the constant PABLO_MASK defined on - * a per-file basis. The `pablo_func_id' is generated from the - * `func_name' argument by prepending an `ID_' to the name. The - * pablo function identifier should be saved in a local variable - * so FUNC_LEAVE() can access it. - * - * Robb Matzke, 4 Aug 1997 - * It is safe to call this function even inside various library - * initializing functions. Infinite recursion is no longer a - * danger. - * - *------------------------------------------------------------------------- - */ -#define FUNC_ENTER(func_name,interface_init_func,err) \ - CONSTR (FUNC, #func_name); \ - PABLO_SAVE (ID_ ## func_name); \ - \ - PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ - \ - if (!library_initialize_g) { \ - library_initialize_g = TRUE; \ - if (H5_init_library()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ - } \ - } \ - \ - if (!thread_initialize_g) { \ - thread_initialize_g = TRUE; \ - if (H5_init_thread()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ - } \ - } \ - \ - if (!interface_initialize_g) { \ - interface_initialize_g = TRUE; \ - if (interface_init_func && \ - ((herr_t(*)(void))interface_init_func)()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ - } \ - } - - - -/*------------------------------------------------------------------------- - * Purpose: Register function exit for code profiling. This should be - * the last statement executed by a function. - * - * Programmer: Quincey Koziol - * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * The pablo mask comes from the constant PABLO_MASK defined on a - * per-file basis. The pablo_func_id comes from an auto variable - * defined by FUNC_ENTER. - * - *------------------------------------------------------------------------- - */ -#define FUNC_LEAVE(return_value) HRETURN(return_value) - -#endif /* HDF5GEN_H */ - diff --git a/src/hdf5glob.h b/src/hdf5glob.h deleted file mode 100644 index 5d45bcb..0000000 --- a/src/hdf5glob.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * Header file for global & thread-specific data - */ - -#ifndef HDF5GLOB_H -#define HDF5GLOB_H - -/* Library global variables */ -/* There should only be a few of these, don't add more unless you have a d*mn good reason! */ - -#ifndef HDF5_MASTER -extern -#endif /* HDF5_MASTER */ -intn library_initialize_g /* Whether we've initialized library global information yet */ -#ifdef HDF5_MASTER -= FALSE -#endif /* HDF5_MASTER */ -; -#ifndef HDF5_MASTER -extern -#endif /* HDF5_MASTER */ -intn install_atexit /* Whether to install the atexit routine */ -#ifdef HDF5_MASTER -= TRUE -#endif /* HDF5_MASTER */ -; - -/* Thread-specific variables */ -#ifndef HDF5_MASTER -extern -#endif /* HDF5_MASTER */ -intn thread_initialize_g /* Whether we've initialized thread global information yet */ -#ifdef HDF5_MASTER -= FALSE -#endif /* HDF5_MASTER */ -; - -#ifndef HDF5_MASTER -extern -#endif /* HDF5_MASTER */ -int32 thrderrid; /* Thread-specific "global" error-handler ID */ - -#endif /* HDF5GLOB_H */ - diff --git a/src/hdf5lims.h b/src/hdf5lims.h deleted file mode 100644 index 363ea54..0000000 --- a/src/hdf5lims.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains all global hard coded limits for the library, interface - * particular limits are defined in the interface header file. - */ - -#ifndef HDF5LIMS_H -#define HDF5LIMS_H - -/* Size of an OID in bytes */ -#define HDF5_OID_SIZE 8 - -/* Version #'s of library code */ -#define HDF5_MAJOR_VERSION 0 /* For major interface changes */ -#define HDF5_MINOR_VERSION 0 /* For minor interface changes */ -#define HDF5_RELEASE_VERSION 0 /* For interface tweaks & bug-fixes */ -#define HDF5_PATCH_VERSION 0 /* For small groups of bug fixes */ - -/* Version #'s of the major components of the file format */ -#define HDF5_BOOTBLOCK_VERSION 0 /* Version of the boot block format */ -#define HDF5_SMALLOBJECT_VERSION 0 /* Version of the Small-Object Heap */ -#define HDF5_FREESPACE_VERSION 0 /* Version of the Free-Space Info */ -#define HDF5_OBJECTDIR_VERSION 0 /* Version of the Object Directory format */ -#define HDF5_SHAREDHEADER_VERSION 0 /* Version of the Shared-Header Info */ - -/* Define the HDF5 file signature */ -#define HDF5_FILE_SIGNATURE "\211HDF\r\n\032\n" -#define HDF5_FILE_SIGNATURE_LEN 8 - -/* Maximum length of function name to push onto error stack */ -#define MAX_FUNC_NAME_LEN 32 - -/* Default sizes of the hash-tables for various atom groups */ -#define HDF5_ERRSTACK_HASHSIZE 64 -#define HDF5_FILEID_HASHSIZE 64 -#define HDF5_TEMPID_HASHSIZE 64 -#define HDF5_DATATYPEID_HASHSIZE 64 -#define HDF5_DATASPACEID_HASHSIZE 64 -#define HDF5_DATASETID_HASHSIZE 64 - -/* Default file-creation template values */ -#define HDF5_USERBLOCK_DEFAULT 0 /* Default to 0-byte sized user blocks */ -#define HDF5_OFFSETSIZE_DEFAULT 4 /* Default to 4-byte offsets */ -#define HDF5_LENGTHSIZE_DEFAULT 4 /* Default to 4-byte lengths */ -#define HDF5_SYM_LEAF_K_DEFAULT 4 /* Default 1/2 rank for symtab leaf nodes */ -#define HDF5_BTREE_K_DEFAULT { \ - 16, /* Symbol table internal nodes */ \ - 0, /* unused */ \ - 0, /* unused */ \ - 0, /* unused */ \ - 0, /* unused */ \ - 0, /* unused */ \ - 0, /* unused */ \ - 0 /* unused */ \ -} - - -#endif /* HDF5LIMS_H */ - diff --git a/src/hdf5meta.h b/src/hdf5meta.h deleted file mode 100644 index 2716537..0000000 --- a/src/hdf5meta.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains macros & information for file meta information - * (offsets, lengths, etc.) - */ - -#ifndef HDF5META_H -#define HDF5META_H - -/*-----------------------------------------------------*/ -/* Encode and decode macros for file meta-data */ -/* (Currently, all file meta-data is little-endian) */ -/*-----------------------------------------------------*/ - -/* For non-little-endian platforms, encode each byte by itself */ -#if ((DF_MT&0xFFF0)!=0x4440) -# define INT16ENCODE(p, i) \ -{ *(p) = (uint8)((uintn)(i) & 0xff); (p)++; *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; } - -# define UINT16ENCODE(p, i) \ -{ *(p) = (uint8)((i) & 0xff); (p)++; *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; } - -# define INT32ENCODE(p, i) \ -{ *(p) = (uint8)((uint32)(i) & 0xff); (p)++; \ - *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; } - -# define UINT32ENCODE(p, i) \ -{ *(p) = (uint8)((i) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; } -#ifdef HDF5_HAVE_NATIVE_INT64 -# define INT64ENCODE(p, i) \ -{ *(p) = (uint8)((uint64)(i) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 24) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 32) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 40) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 48) & 0xff); (p)++; \ - *(p) = (uint8)(((uint64)(i) >> 56) & 0xff); (p)++; } - -# define UINT64ENCODE(p, i) \ -{ *(p) = (uint8)((i) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 32) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 40) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 48) & 0xff); (p)++; \ - *(p) = (uint8)(((i) >> 56) & 0xff); (p)++; } -#else /* HDF5_HAVE_NATIVE_INT64 */ -#error "Define int64 on platforms which don't support it" -#endif /* HDF5_HAVE_NATIVE_INT64 */ - -# define INT16DECODE(p, i) \ -{ (i) = (int16)((*(p) & 0xff)); (p)++; \ - (i) |= (int16)((*(p) & 0xff) << 8); (p)++; } - -# define UINT16DECODE(p, i) \ -{ (i) = (uint16)(*(p) & 0xff); (p)++; \ - (i) |= (uint16)((*(p) & 0xff) << 8); (p)++; } - -# define INT32DECODE(p, i) \ -{ (i) = (*(p) & 0xff); (p)++; \ - (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((int32)(*(p) & 0xff) << 24); (p)++; } - -# define UINT32DECODE(p, i) \ -{ (i) = (uint32)(*(p) & 0xff); (p)++; \ - (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((uint32)(*(p) & 0xff) << 24); (p)++; } - -#ifdef HDF5_HAVE_NATIVE_INT64 -#define INT64DECODE(p, i) \ -{ (i) = (*(p) & 0xff); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 24); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 32); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 40); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 48); (p)++; \ - (i) |= ((int64)(*(p) & 0xff) << 56); (p)++; } - -# define UINT64DECODE(p, i) \ -{ (i) = (uint64)(*(p) & 0xff); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 24); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 32); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 40); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 48); (p)++; \ - (i) |= ((uint64)(*(p) & 0xff) << 56); (p)++; } -#else /* HDF5_HAVE_NATIVE_INT64 */ -#error "Define int64 on platforms which don't support it" -#endif /* HDF5_HAVE_NATIVE_INT64 */ -#else /* platform has little-endian integers */ -/* For little-endian platforms, make the compiler do the work */ -# define INT16ENCODE(p, i) { *((int16 *)(p)) = (int16)(i); (p)+=2; } -# define UINT16ENCODE(p, i) { *((uint16 *)(p)) = (uint16)(i); (p)+=2; } -# define INT32ENCODE(p, i) { *((int32 *)(p)) = (int32)(i); (p)+=4; } -# define UINT32ENCODE(p, i) { *((uint32 *)(p)) = (uint32)(i); (p)+=4; } -#ifdef HDF5_HAVE_NATIVE_INT64 -# define INT64ENCODE(p, i) { *((int64 *)(p)) = (int64)(i); (p)+=8; } -# define UINT64ENCODE(p, i) { *((uint64 *)(p)) = (uint64)(i); (p)+=8; } -#else /* HDF5_HAVE_NATIVE_INT64 */ -#error "Define int64 on platforms which don't support it" -#endif /* HDF5_HAVE_NATIVE_INT64 */ -# define INT16DECODE(p, i) { (i) = (int16)(*(const int16 *)(p)); (p)+=2; } -# define UINT16DECODE(p, i) { (i) = (uint16)(*(const uint16 *)(p)); (p)+=2; } -# define INT32DECODE(p, i) { (i) = (int32)(*(const int32 *)(p)); (p)+=4; } -# define UINT32DECODE(p, i) { (i) = (uint32)(*(const uint32 *)(p)); (p)+=4; } -#ifdef HDF5_HAVE_NATIVE_INT64 -# define INT64DECODE(p, i) { (i) = (int64)(*(const int64 *)(p)); (p)+=8; } -# define UINT64DECODE(p, i) { (i) = (uint64)(*(const uint64 *)(p)); (p)+=8; } -#else /* HDF5_HAVE_NATIVE_INT64 */ -#error "Define int64 on platforms which don't support it" -#endif /* HDF5_HAVE_NATIVE_INT64 */ -#endif - -# define NBYTEENCODE(d, s, n) { HDmemcpy(d,s,n); p+=n } - -/* Note! the NBYTEDECODE macro is backwards from the memcpy() routine, */ -/* in the spirit of the other DECODE macros */ -# define NBYTEDECODE(s, d, n) { HDmemcpy(d,s,n); p+=n } - -#endif /* HDF5I_H */ - diff --git a/src/hdf5pabl.h b/src/hdf5pabl.h deleted file mode 100644 index 6fa3922..0000000 --- a/src/hdf5pabl.h +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * Header file for Pablo compatibility - */ - -#ifndef HDF5PABL_H -#define HDF5PABL_H - -#ifdef HAVE_PABLO -#define PABLO_SAVE(func_id) intn pablo_func_id = func_id -#define PABLO_TRACE_ON(m, f) TRACE_ON(m,f) -#define PABLO_TRACE_OFF(m, f) TRACE_OFF(m,f) -#else /* no Pablo tracing enabled */ -#define PABLO_SAVE(func_id) /*void*/ -#define PABLO_TRACE_ON(m, f) /*void*/ -#define PABLO_TRACE_OFF(m, f) /*void*/ -#endif /* HAVE_PABLO */ - -#endif /* HDF5PABL_H */ - - diff --git a/src/hdf5plat.h b/src/hdf5plat.h deleted file mode 100644 index d73e7e6..0000000 --- a/src/hdf5plat.h +++ /dev/null @@ -1,781 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains platform/CPU/OS detection macros, etc. - */ - -#ifndef HDF5PLAT_H -#define HDF5PLAT_H - -/*--------------------------------------------------------------------------*/ -/* MT/NT constants */ -/* Six MT nibbles represent float64, float32, int64, int32, int16, and */ -/* int8 (from most significant to least significant). The unsigned */ -/* form of each type is assumed to be in the same format as the signed */ -/* type. The top two nibbles (8-bits) are currently unused. */ -/* The values for each nibble are: */ -/* 1 - Big Endian */ -/* 2 - VAX */ -/* 3 - Cray */ -/* 4 - Little Endian */ -/* 5 - Convex */ -/* 6 - Fujitsu VP */ -/*--------------------------------------------------------------------------*/ -#define DFMT_SUN 0x00111111 -#define DFMT_ALLIANT 0x00111111 -#define DFMT_IRIX 0x00111111 -#define DFMT_APOLLO 0x00111111 -#define DFMT_IBM6000 0x00111111 -#define DFMT_HP9000 0x00111111 -#define DFMT_CONVEXNATIVE 0x00551111 -#define DFMT_CONVEX 0x00111111 -#define DFMT_UNICOS 0x00333331 -#define DFMT_CTSS 0x00333331 -#define DFMT_VAX 0x00222221 -#define DFMT_MIPSEL 0x00444441 -#define DFMT_PC 0x00444441 -#define DFMT_MAC 0x00111111 -#define DFMT_SUN386 0x00444441 -#define DFMT_NEXT 0x00111111 -#define DFMT_MOTOROLA 0x00111111 -#define DFMT_ALPHA 0x00444441 -#define DFMT_VP 0x00661111 -#define DFMT_I860 0x00444441 -#define DFMT_CRAYMPP 0x00117771 - -/* I/O library constants */ -#define POSIXUNBUFIO 1 /* POSIX-compliant un-buffered I/O */ -#define POSIXBUFIO 2 /* POSIX buffered I/O */ -#define MACIO 3 /* Macintosh I/O */ -#define WINNTIO 4 /* 32-bit Windows File I/O */ -#define PAGEBUFIO 5 /* page buffering - fmpool */ - -#ifdef GOT_MACHINE -#undef GOT_MACHINE -#endif - -/*------------------------------------------------------------------------- - * Define options for each platform - *-------------------------------------------------------------------------*/ - -#if (defined(SUN) || defined(sun) || defined(__sun__) || defined(__SUNPRO_C)) & !defined(__i386) -#ifdef __STDC__ -#define ANSISUN -#else /* __STDC__ */ -#define KNRSUN -#endif /* __STDC__ */ -#endif /* SUN || sun */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Sparc - * OS: Solaris 1.x, SunOS 4.1.x - */ -#if defined(ANSISUN) - -#if !defined(SUN) -#define SUN -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#include <unistd.h> /* for some file I/O stuff */ -#include <sys/time.h> -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_SUN - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define HAVE_STDC -#define INCLUDES_ARE_ANSI - -#endif /* ANSISUN */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: IBM RS/6000 chip/PowerPC - * OS: AIX - */ -#if defined(IBM6000) || defined(_AIX) - -#ifndef IBM6000 -#define IBM6000 -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -# define BSD -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_IBM6000 - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define HAVE_STDC -#define INCLUDES_ARE_ANSI - -#endif /* IBM6000 */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: HP PA-RISC - * OS: HP/UX (ConvexOS?) - */ -#if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux))) - -#ifndef HP9000 -#define HP9000 -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#define HAVE_UNISTD_H /* unistd.h - close, fork,..etc */ -# define BSD -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_HP9000 - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /* HP9000 */ - - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: MIPS - * OS: IRIX - */ -#if defined(IRIX) || defined(IRIS4) || defined(sgi) || defined(__sgi__) || defined(__sgi) - -#ifndef IRIX -#define IRIX -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -# define BSD -#ifndef __GNUC__ -#include <memory.h> -#endif /* __GNUC__ */ -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_IRIX - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef signed char char8; -typedef unsigned char uchar8; -typedef signed char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef int int32; -typedef unsigned int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -#define HDF5_HAVE_NATIVE_INT64 -typedef __int64_t int64; -typedef __uint64_t uint64; - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define HAVE_STDC -#define INCLUDES_ARE_ANSI - -#endif /* IRIX */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Cray Vector CPU (is there a name for these? :-) - * OS: UNICOS - */ -#if (defined(UNICOS) || defined(_UNICOS)) && !defined(_CRAYMPP) - -#ifndef UNICOS -#define UNICOS -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <memory.h> -#include <fortran.h> -#ifndef O_RDONLY -#include <fcntl.h> /* for unbuffered i/o stuff */ -#define L_INCR 1 -#include <sys/stat.h> -#endif /*O_RDONLY*/ - -/* Set machine byte-format */ -#define DF_MT DFMT_UNICOS - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -#ifdef OLD_WAY /* May need to be included on other machines than the C-90 */ -typedef char *_fcd; /* Fortran character descriptor type */ -#endif /* OLD_WAY */ -typedef signed char char8; -typedef unsigned char uchar8; -typedef signed char int8; -typedef unsigned char uint8; -typedef int int16; -typedef unsigned int uint16; -typedef int int32; -typedef unsigned int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define DF_CAPFNAMES /* fortran names are in all caps */ -/* fcdtocp(desc) is defined in compiler header files */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define RIGHT_SHIFT_IS_UNSIGNED -#define CHAR_IS_UNSIGNED - -#endif /* UNICOS */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Cray Vector CPU (is there a name for these? :-) - * OS: UNICOS (on massively parallel systems, like T3D & T3E) - */ -#if defined(_CRAYMPP) - -#ifndef CRAYMPP -#define CRAYMPP -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <memory.h> -#include <fortran.h> -#ifndef O_RDONLY -#include <fcntl.h> /* for unbuffered i/o stuff */ -#define L_INCR 1 -#include <sys/stat.h> -#endif /*O_RDONLY*/ - -/* Set machine byte-format */ -#define DF_MT DFMT_CRAYMPP - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -#ifdef OLD_WAY /* May need to be included on other machines than the C-90 */ -typedef char *_fcd; /* Fortran character descriptor type */ -#endif /* OLD_WAY */ -typedef signed char char8; -typedef unsigned char uchar8; -typedef signed char int8; -typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; -typedef short int32; -typedef unsigned short uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define DF_CAPFNAMES /* fortran names are in all caps */ -/* fcdtocp(desc) is defined in compiler header files */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define RIGHT_SHIFT_IS_UNSIGNED -#define CHAR_IS_UNSIGNED - -#endif /* CRAYMPP */ - - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Motorola 68K, PowerPC (both?) - * OS: MacOS - */ -#if defined(MAC) || defined(macintosh) || defined(__MWERKS__) || defined (SYMANTEC_C) - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <memory.h> /* malloc stuff for MPW */ -#include <fcntl.h> /* unbuffered I/O stuff for MPW */ -#ifdef __MWERKS__ /* Metrowerks */ -#include <sioux.h> -#include <console.h> -#endif -#ifdef SYMANTEC_C /* for SYMANTEC C */ -#include <unix.h> -#define isascii(c) (isprint(c) || iscntrl(c)) -#else /* MPW, possibly others */ -#include <Files.h> /* for unbuffered I/O stuff */ -#endif /* SYMANTEC_C*/ -#define DF_DYNAMIC /* use dynamic allocation */ - -/* Set machine byte-format */ -#define DF_MT DFMT_MAC - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#ifndef ABSOFT -#define DF_CAPFNAMES /* fortran names are in all caps */ -#endif /* ABSOFT */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -void exit(int status); - -/* Choose the I/O package to use when interacting with the file */ -#define FILELIB MACIO - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI - -#endif /*MAC*/ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Intel x86 - * OS: MS Windows '95, Windows NT (& Dos32?), also Linux & FreeBSD - */ -/* Metrowerks compilier defines some PC stuff so need to exclude this on the MAC */ -#if !(defined(__MWERKS__) || defined(MAC)) - -#if defined INTEL86 || defined M_I86 || defined M_I386 || defined DOS386 || defined __i386 || defined UNIX386 -#ifndef INTEL86 -#define INTEL86 -#endif /* INTEL86 */ - -#if !defined UNIX386 && (defined unix || defined __unix) -#define UNIX386 -#endif /* UNIX386 */ - -#if !defined DOS386 && defined M_I386 -#define DOS386 -#endif /* M_I386 && !DOS386 */ - -#if defined _WINDOWS || defined WIN32 -#define WIN386 -#endif /* _WINDOWS | WIN32 */ - -#if defined WIN386 || defined DOS386 || defined UNIX386 -#define INTEL386 -#endif /* WIN386 | DOS386 | UNIX386 */ - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE 1 - -/* Extra include files required for this platform */ -#include <fcntl.h> -#ifdef UNIX386 -#include <sys/types.h> /* for unbuffered file I/O */ -#include <sys/stat.h> -#include <unistd.h> -#else /* !UNIX386 */ -#include <sys\types.h> /* for unbuffered file I/O */ -#include <sys\stat.h> -#include <io.h> -#include <conio.h> /* for debugging getch() calls */ -#include <malloc.h> -#endif /* UNIX386 */ -#include <ctype.h> /* for character macros */ -#ifdef __WATCOMC__ -#include <stddef.h> /* for the 'fortran' pragma */ -#endif -#if defined WIN386 -#ifndef GMEM_MOVEABLE /* check if windows header is already included */ -#include <windows.h> /* include the windows headers */ -#include <winnt.h> -#define HAVE_BOOLEAN -#endif /* GMEM_MOVEABLE */ -#endif /* WIN386 */ - -/* Set machine byte-format */ -#define DF_MT DFMT_PC - -/* Define portable variable types */ -#ifndef VOID /* The stupid windows.h header file uses a #define instead of a typedef */ -typedef void VOID; -#endif /* end VOID */ -typedef void * VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef long int int32; -typedef unsigned long int uint32; -#ifdef __GNUC__ -#define HDF5_HAVE_NATIVE_INT64 -typedef long long int int64; /* 64-bit integers! */ -typedef unsigned long long int uint64; -#endif -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef long intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#if defined UNIX386 -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#elif defined INTEL386 -#define DF_CAPFNAMES /* Fortran function names need to be all-caps */ -#endif -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#if defined WIN386 -#define FILELIB WINNTIO -#else -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif -#endif /* WIN386 */ - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#define HAVE_STDC -#define INCLUDES_ARE_ANSI - -#endif /* INTEL86 */ -#endif /* !(defined(__MWERKS__) || defined(MAC)) */ - - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/* - * CPU: Alpha - * OS: Dec Unix (used to be called OSF/1) - */ -#if defined DEC_ALPHA || (defined __alpha && defined __unix__) - -#ifndef DEC_ALPHA -#define DEC_ALPHA -#endif - -#ifdef GOT_MACHINE -If you get an error on this line more than one machine type has been defined. -Please check your Makefile. -#endif -#define GOT_MACHINE - -/* Extra include files required for this platform */ -#include <sys/file.h> /* for unbuffered i/o stuff */ -#include <sys/stat.h> - -/* Set machine byte-format */ -#define DF_MT DFMT_ALPHA - -/* Define portable variable types */ -typedef void VOID; -typedef void *VOIDP; -typedef char char8; -typedef unsigned char uchar8; -typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -#ifndef __rpc_types_h -typedef int int32; -typedef unsigned int uint32; -#endif /* __rpc_types_h */ -typedef int intn; -typedef unsigned int uintn; -typedef float float32; -typedef double float64; -typedef char *_fcd; /* Fortran character descriptor type */ -typedef int intf; /* size of INTEGERs in Fortran compiler */ - -/* Fortran compatibility macros */ -#define FNAME_POST_UNDERSCORE /* Fortran function names require trailing underscore */ -#define _fcdtocp(desc) (desc) /* Macro to convert from Fortran character descriptor to C 'char *' */ - -/* Choose the I/O package to use when interacting with the file */ -#ifdef HAVE_FMPOOL -#define FILELIB PAGEBUFIO /* enable page buffering */ -#else -#define FILELIB POSIXBUFIO -#endif - -/* JPEG #define's - Look in the JPEG docs before changing - (Q) */ - -/* Determine the memory manager we are going to use. Valid values are: */ -/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */ -/* what each does */ -#define JMEMSYS MEM_ANSI -#ifdef __GNUC__ -#define HAVE_STDC -#define INCLUDES_ARE_ANSI -#endif - -#endif /* DEC_ALPHA */ - -#include "h5oplat.h" /* include definitions for old, untested platforms */ - -/* Check if we've correctly determined the platform we are compiling in/for */ -#ifndef GOT_MACHINE -No machine type has been defined. Your Makefile needs to have someing like --DSUN or -DUNICOS in order for the HDF internal structures to be defined -correctly. -#endif - -#endif /* HDF5PLAT_H */ - diff --git a/src/hdf5port.h b/src/hdf5port.h deleted file mode 100644 index 4045435..0000000 --- a/src/hdf5port.h +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ - -/* - * This file contains portability macros to ease moving the library between - * the various platforms. - */ - -#ifndef HDF5PORT_H -#define HDF5PORT_H - -/************************************************************************** -* Generally useful macro definitions -**************************************************************************/ -#ifndef MIN -# define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#endif -#ifndef MAX -# define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#endif -#ifndef MAX3 -# define MAX3(a,b,c) MAX(MAX(a,b),c) -#endif - -/************************************************************************** -* Macros to work around ANSI C portability problems. -**************************************************************************/ -#ifdef DUMBCC -#define CONSTR(v,s) char *v=s -#else -#define CONSTR(v,s) static const char v[]=s -#endif - -/* -------------------------- File I/O Functions -------------------------- */ -/* FILELIB -- file library to use for file access: 1 stdio, 2 fcntl - default to stdio library i.e. POSIX buffered I/O */ - -#ifndef FILELIB -# define FILELIB POSIXBUFIO /* POSIX buffered I/O is the default */ -#endif /* FILELIB */ - -#if (FILELIB == POSIXBUFIO) -typedef FILE *hdf_file_t; -#ifdef VMS -/* For VMS, use "mbc=64" to improve performance */ -# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p),"r+","mbc=64") : fopen((p), "r", "mbc=64")) -# define H5F_CREATE(p) (fopen((p), "w+", "mbc=64")) -#else /* !VMS */ -#if defined SUN && defined (__GNUC__) -# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "r+") : fopen((p), "r")) -# define H5F_CREATE(p) (fopen((p), "w+")) -#else /* !SUN w/ GNU CC */ -# define H5F_OPEN(p, a) (((a)&H5ACC_WRITE) ? fopen((p), "rb+") : fopen((p), "rb")) -# define H5F_CREATE(p) (fopen((p), "wb+")) -#endif /* !SUN w/ GNU CC */ -#endif /* VMS */ -# define H5F_READ(f, b, n) (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL) -# define H5F_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? SUCCEED : FAIL) -# define H5F_CLOSE(f) (fclose(f)) -# define H5F_FLUSH(f) (fflush(f)==0 ? SUCCEED : FAIL) -# define H5F_SEEK(f,o) (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL) -# define H5F_SEEK_CUR(f,o) (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL) -# define H5F_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL) -# define H5F_TELL(f) (ftell(f)) -# define H5F_OPENERR(f) ((f) == (FILE *)NULL) -# define H5F_INVALID_FILE ((FILE *)NULL) -#endif /* FILELIB == POSIXBUFIO */ - -#if (FILELIB == POSIXUNBUFIO) -/* using POSIX unbuffered file I/O routines to access files */ -typedef int hdf_file_t; -# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? open((p), O_RDWR) : open((p), O_RDONLY)) -# define H5F_CREATE(p) (open((p), O_RDWR | O_CREAT | O_TRUNC)) -# define H5F_CLOSE(f) (close(f)) -# define H5F_FLUSH(f) (SUCCEED) -# define H5F_READ(f, b, n) (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL) -# define H5F_WRITE(f, b, n) (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL) -# define H5F_SEEK(f, o) (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL) -# define H5F_SEEKEND(f) (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL) -# define H5F_TELL(f) (lseek((f), (off_t)0, SEEK_CUR)) -# define H5F_OPENERR(f) (f < 0) -# define H5F_INVALID_FILE ((int)-1) -#endif /* FILELIB == POSIXUNBUFIO */ - -#if (FILELIB == MACIO) -/* using special routines to redirect to Mac Toolkit I/O */ -typedef short hdf_file_t; -# define H5F_OPEN(x,y) mopen(x,y) -# define H5F_CREATE(name) mopen(name, H5ACC_CREATE) -# define H5F_CLOSE(x) mclose(x) -# define H5F_FLUSH(a) (SUCCEED) -# define H5F_READ(a,b,c) mread(a, (char *) b, (int32) c) -# define H5F_WRITE(a,b,c) mwrite(a, (char *) b, (int32) c) -# define H5F_SEEK(x,y) mlseek(x, (int32 )y, 0) -# define H5F_SEEKEND(x) mlseek(x, 0L, 2) -# define H5F_TELL(x) mlseek(x,0L,1) -# define H5F_OPENERR(f) (f < 0) -# define H5F_INVALID_FILE ((short)-1) -#endif /* FILELIB == MACIO */ - -#if (FILELIB == WINNTIO) -/* using special Windows NT functions to enable reading/writing large chunks */ -typedef HFILE hdf_file_t; -# define H5F_OPEN(p, a) (((a) & H5ACC_WRITE) ? _lopen((p), OF_READWRITE) : _lopen((p), OF_READ)) -# define H5F_CREATE(p) (_lcreat((p), 0)) -# define H5F_READ(f, b, n) (((int32)(n) == _hread((f), (b), (n))) ? SUCCEED : FAIL) -# define H5F_WRITE(f, b, n) (((int32)(n) == _hwrite((f), (b), (n))) ? SUCCEED : FAIL) -# define H5F_CLOSE(f) (_lclose(f)==0 ? SUCCEED : FAIL) -# define H5F_FLUSH(f) (0) -# define H5F_SEEK(f, o) (_llseek((f), (long)(o), 0)) -# define H5F_SEEKEND(f) (_llseek((f), (long)0, 2)) -# define H5F_TELL(f) (_llseek((f),0l,1)) -# define H5F_OPENERR(f) ((f) == (HFILE)HFILE_ERROR) -# define H5F_INVALID_FILE ((HFILE)HFILE_ERROR) -#endif /* FILELIB == WINNTIO */ - -#if (FILELIB == PAGEBUFIO) -#include "fmpio.h" -/* using page buffered file I/O routines to access files */ -typedef MPFILE *hdf_file_t; -# define H5F_OPEN(p, a) (MPopen((p), (a))) -# define H5F_CREATE(p) (MPopen((p), H5ACC_CREATE)) -# define H5F_CLOSE(f) (MPclose(f)) -# define H5F_FLUSH(f) (MPflush(f)) -# define H5F_READ(f, b, n) (MPread((f), (char *)(b), (n))) -# define H5F_WRITE(f, b, n) (MPwrite((f), (char *)(b), (n))) -# define H5F_SEEK(f, o) (MPseek((f), (off_t)(o), SEEK_SET)) -# define H5F_SEEKEND(f) (MPseek((f), (off_t)0, SEEK_END)) -# define H5F_TELL(f) (MPseek((f), (off_t)0, SEEK_CUR)) -# define H5F_OPENERR(f) ((f) == (MPFILE *)NULL) -# define H5F_INVALID_FILE ((MPFILE *)NULL) -#endif /* FILELIB == PAGEBUFIO */ - -/************************************************************************** -* Allocation functions defined differently -**************************************************************************/ -#if !defined MALLOC_CHECK -# define HDmalloc(s) (malloc((size_t)s)) -# define HDcalloc(a,b) (calloc((size_t)a,(size_t)b)) -# define HDfree(p) (free((void*)p)) -# define HDrealloc(p,s) (realloc((void*)p,(size_t)s)) -#endif /* !defined MALLOC_CHECK */ -/* Macro to free space and clear pointer to NULL */ -#define HDfreenclear(p) { if((p)!=NULL) HDfree(p); p=NULL; } - -/************************************************************************** -* String functions defined differently -**************************************************************************/ - -# define HDstrcat(s1,s2) (strcat((s1),(s2))) -# define HDstrcmp(s,t) (strcmp((s),(t))) -# define HDstrcpy(s,d) (strcpy((s),(d))) -# define HDstrlen(s) (strlen((const char *)(s))) -# define HDstrncmp(s1,s2,n) (strncmp((s1),(s2),(n))) -# define HDstrncpy(s1,s2,n) (strncpy((s1),(s2),(n))) -# define HDstrchr(s,c) (strchr((s),(c))) -# define HDstrrchr(s,c) (strrchr((s),(c))) -# define HDstrtol(s,e,b) (strtol((s),(e),(b))) -/* non-standard function, not defined on the following mahcines - */ -#if !(defined VMS || defined macintosh || defined MAC || defined __MWERKS__ || defined SYMANTEC_C || defined MIPSEL || defined NEXT || defined CONVEX || defined IBM6000 || defined ANSISUN || defined IRIX) -# define HDstrdup(s) ((char *)strdup((const char *)(s))) -#else -# define HDstrdup(s) strdup(s) -#endif /* !(VMS | etc..) */ - - -/************************************************************************** -* Memory functions defined differently -**************************************************************************/ - -# define HDmemcpy(dst,src,n) (memcpy((void *)(dst),(const void *)(src),(size_t)(n))) -# define HDmemmove(dst,src,n) (memmove((void*)(dst),(const void *)(src),(size_t)(n))) -# define HDmemset(dst,c,n) (memset((void *)(dst),(intn)(c),(size_t)(n))) -# define HDmemcmp(dst,src,n) (memcmp((const void *)(dst),(const void *)(src),(size_t)(n))) - - -/************************************************************************** -* Misc. functions -**************************************************************************/ -#if defined (MAC) || defined (macintosh) || defined(__MWERKS__) || defined (SYMANTEC_C) -#define HDstat(path, result) (mstat(path)) -#else /* !macintosh */ -#define HDstat(path, result) (stat(path, result)) -#endif /* !macintosh */ -#define HDgetcwd(s,l) (getcwd(s,l)) -#define HDgetenv(s1) (getenv(s1)) -#define HDputenv(s1) (putenv(s1)) -#define HDltoa(v) (ltoa(v)) -#if defined (SUN) && defined(__GNUC__) -#define HDatexit(f) (0) /* we punt on the SUN using gcc */ -#else /* !SUN & GCC */ -#define HDatexit(f) (atexit(f)) -#endif /* !SUN & GCC */ - -#endif /* HDF5PORT_H */ - |