diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-04-12 21:21:38 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-04-12 21:21:38 (GMT) |
commit | bc66efc788bc77c9c133a9fc3cc29e26fa659bab (patch) | |
tree | d94f011f1813b4bc479a74f29048418c83f86d02 /hl/src | |
parent | 3dfec8d73b65c5c715581e41844e075b84e8f581 (diff) | |
download | hdf5-bc66efc788bc77c9c133a9fc3cc29e26fa659bab.zip hdf5-bc66efc788bc77c9c133a9fc3cc29e26fa659bab.tar.gz hdf5-bc66efc788bc77c9c133a9fc3cc29e26fa659bab.tar.bz2 |
[svn-r12229] Purpose:
new feature
Description:
1) separated the HL library into "public" and "private" header files, with the same caracteristics as the basic library
2) added the public headers to hdf5.h (with a conditional include macro, defined in configure.in)
3) added the path to HL in all Makefile.am 's , because of the inclusion in hdf5.h
Solution:
Platforms tested:
linux 32, 64
AIX
solaris
with fortran and c++
(one packet table example fails)
Misc. update:
Diffstat (limited to 'hl/src')
-rw-r--r-- | hl/src/H5DS.c | 27 | ||||
-rw-r--r-- | hl/src/H5DSprivate.h | 58 | ||||
-rw-r--r-- | hl/src/H5DSpublic.h (renamed from hl/src/H5DS.h) | 32 | ||||
-rw-r--r-- | hl/src/H5HL_private.c | 169 | ||||
-rw-r--r-- | hl/src/H5IM.c | 6 | ||||
-rw-r--r-- | hl/src/H5IMprivate.h | 43 | ||||
-rw-r--r-- | hl/src/H5IMpublic.h (renamed from hl/src/H5IM.h) | 14 | ||||
-rw-r--r-- | hl/src/H5LT.c | 8 | ||||
-rw-r--r-- | hl/src/H5LTprivate.h | 70 | ||||
-rw-r--r-- | hl/src/H5LTpublic.h (renamed from hl/src/H5LT.h) | 55 | ||||
-rw-r--r-- | hl/src/H5PT.c | 4 | ||||
-rw-r--r-- | hl/src/H5PTprivate.h | 22 | ||||
-rw-r--r-- | hl/src/H5PTpublic.h (renamed from hl/src/H5PT.h) | 22 | ||||
-rw-r--r-- | hl/src/H5TB.c | 196 | ||||
-rw-r--r-- | hl/src/H5TBprivate.h | 58 | ||||
-rw-r--r-- | hl/src/H5TBpublic.h (renamed from hl/src/H5TB.h) | 22 | ||||
-rw-r--r-- | hl/src/Makefile.am | 4 | ||||
-rw-r--r-- | hl/src/Makefile.in | 10 |
18 files changed, 480 insertions, 340 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 5d5001d..0c8c201 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -12,12 +12,11 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "H5private.h" -#include "H5DS.h" -#include "H5LT.h" #include <stdlib.h> -#include "H5IM.h" -#include "H5TB.h" +#include "H5DSprivate.h" +#include "H5LTprivate.h" +#include "H5IMprivate.h" +#include "H5TBprivate.h" @@ -30,7 +29,7 @@ * If DIMNAME is specified, then an attribute called NAME is created, * with the value DIMNAME. * - * Return: Success: SUCCESS, Failure: FAIL + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: pvn@ncsa.uiuc.edu * @@ -86,7 +85,7 @@ herr_t H5DSset_scale(hid_t dsid, return FAIL; } - return SUCCESS; + return SUCCEED; } @@ -99,7 +98,7 @@ herr_t H5DSset_scale(hid_t dsid, * REFERENCE_LIST attributes. * * Return: - * Success: SUCCESS + * Success: SUCCEED * Failure: FAIL * * Fails if: Bad arguments @@ -540,7 +539,7 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; } - return SUCCESS; + return SUCCEED; /* error zone, gracefully close */ out: @@ -560,7 +559,7 @@ out: * DIMENSION_LIST and REFERENCE_LIST attributes. * * Return: - * Success: SUCCESS + * Success: SUCCEED * Failure: FAIL * * Fails if: Bad arguments @@ -901,7 +900,7 @@ herr_t H5DSdetach_scale(hid_t did, } - return SUCCESS; + return SUCCEED; /* error zone, gracefully close */ out: @@ -1287,7 +1286,7 @@ herr_t H5DSiterate_scales(hid_t did, return FAIL; if (has_dimlist == 0) - return SUCCESS; + return SUCCEED; else if (has_dimlist == 1 ) { @@ -1385,7 +1384,7 @@ out: * * Purpose: Set label for the dimension IDX of dataset DID to the value LABEL * - * Return: Success: SUCCESS, Failure: FAIL + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: pvn@ncsa.uiuc.edu * @@ -1533,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, free(buf); } - return SUCCESS; + return SUCCEED; /* error zone, gracefully close */ out: diff --git a/hl/src/H5DSprivate.h b/hl/src/H5DSprivate.h new file mode 100644 index 0000000..1d922be --- /dev/null +++ b/hl/src/H5DSprivate.h @@ -0,0 +1,58 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5DSprivate_H +#define _H5DSprivate_H + +/* public hdf5 prototypes */ +#include "H5Ipublic.h" +#include "H5Tpublic.h" +#include "H5Spublic.h" +#include "H5Dpublic.h" +#include "H5Ppublic.h" +#include "H5Gpublic.h" +#include "H5Apublic.h" +#include "H5Epublic.h" +#include "H5Rpublic.h" + +/* public LT prototypes */ +#include "H5LTpublic.h" +#include "H5DSpublic.h" + + +#define DIMENSION_SCALE_CLASS "DIMENSION_SCALE" +#define DIMENSION_LIST "DIMENSION_LIST" +#define REFERENCE_LIST "REFERENCE_LIST" +#define DIMENSION_LABELS "DIMENSION_LABELS" + + + +/* attribute type of a DS dataset */ +typedef struct ds_list_t { + hobj_ref_t ref; /* object reference */ + int dim_idx; /* dimension index of the dataset */ +} ds_list_t; + + +/*------------------------------------------------------------------------- + * private functions + *------------------------------------------------------------------------- + */ + + +H5_HLDLL herr_t H5DS_is_reserved( hid_t did); + + + +#endif diff --git a/hl/src/H5DS.h b/hl/src/H5DSpublic.h index b56590b..cfec471 100644 --- a/hl/src/H5DS.h +++ b/hl/src/H5DSpublic.h @@ -12,30 +12,12 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DS_H -#define _H5DS_H - -#include <hdf5.h> - -#ifndef TRUE -#define TRUE 1 -#endif - -#define DIMENSION_SCALE_CLASS "DIMENSION_SCALE" -#define DIMENSION_LIST "DIMENSION_LIST" -#define REFERENCE_LIST "REFERENCE_LIST" -#define DIMENSION_LABELS "DIMENSION_LABELS" +#ifndef _H5DSpublic_H +#define _H5DSpublic_H typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data); -/* attribute type of a DS dataset */ -typedef struct ds_list_t { - hobj_ref_t ref; /* object reference */ - int dim_idx; /* dimension index of the dataset */ -} ds_list_t; - - #ifdef __cplusplus extern "C" { #endif @@ -81,16 +63,6 @@ H5_HLDLL htri_t H5DSis_attached( hid_t did, -/*------------------------------------------------------------------------- - * private functions - *------------------------------------------------------------------------- - */ - - -H5_HLDLL herr_t H5DS_is_reserved( hid_t did); - - - #ifdef __cplusplus } #endif diff --git a/hl/src/H5HL_private.c b/hl/src/H5HL_private.c deleted file mode 100644 index 3b6377f..0000000 --- a/hl/src/H5HL_private.c +++ /dev/null @@ -1,169 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "H5HL_private.h" - -/*------------------------------------------------------------------------- - * - * Functions shared between H5TB and H5PT - * - *------------------------------------------------------------------------- - */ - -/*------------------------------------------------------------------------- - * Function: H5TBcommon_append_records - * - * Purpose: Common code for reading records shared between H5PT and H5TB - * - * Return: Success: 0, Failure: -1 - * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu - * - * Date: March 8, 2004 - * - * Comments: Called by H5TBappend_records and H5PTappend_records - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t H5TBcommon_append_records( hid_t dataset_id, - hid_t mem_type_id, - hsize_t nrecords, - hsize_t orig_table_size, - const void * data) -{ - hsize_t count[1]; - hsize_t offset[1]; - hid_t space_id = H5I_BADID; - hid_t mem_space_id = H5I_BADID; - hsize_t dims[1]; - hsize_t mem_dims[1]; - - /* Extend the dataset */ - dims[0] = nrecords + orig_table_size; - if ( H5Dextend ( dataset_id, dims ) < 0 ) - goto out; - - /* Create a simple memory data space */ - mem_dims[0]=nrecords; - if ( (mem_space_id = H5Screate_simple( 1, mem_dims, NULL )) < 0 ) - goto out; - - /* Get a copy of the new file data space for writing */ - if ( (space_id = H5Dget_space( dataset_id )) < 0 ) - goto out; - - /* Define a hyperslab in the dataset */ - offset[0] = orig_table_size; - count[0] = nrecords; - if ( H5Sselect_hyperslab( space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) - goto out; - - /* Write the records */ - if ( H5Dwrite( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data ) < -0 ) - goto out; - - /* Terminate access to the dataspace */ - if ( H5Sclose( mem_space_id ) < 0 ) - goto out; - - if ( H5Sclose( space_id ) < 0 ) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - H5Sclose(mem_space_id); - H5Sclose(space_id); - H5E_END_TRY - return -1; -} - - -/*------------------------------------------------------------------------- - * Function: H5TBcommon_read_records - * - * Purpose: Common code for reading records shared between H5PT and H5TB - * - * Return: Success: 0, Failure: -1 - * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu - * - * Date: March 8, 2004 - * - * Comments: Called by H5TBread_records and H5PTread_records - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ -herr_t H5TBcommon_read_records( hid_t dataset_id, - hid_t mem_type_id, - hsize_t start, - hsize_t nrecords, - hsize_t table_size, - void *data) -{ - hsize_t count[1]; - hsize_t offset[1]; - hid_t space_id = H5I_BADID; - hid_t mem_space_id = H5I_BADID; - hsize_t mem_size[1]; - - /* Make sure the read request is in bounds */ - if ( start + nrecords > table_size ) - goto out; - - /* Get the dataspace handle */ - if ( (space_id = H5Dget_space( dataset_id )) < 0 ) - goto out; - - /* Define a hyperslab in the dataset of the size of the records */ - offset[0] = start; - count[0] = nrecords; - if ( H5Sselect_hyperslab( space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) - goto out; - - /* Create a memory dataspace handle */ - mem_size[0] = count[0]; - if ((mem_space_id = H5Screate_simple( 1, mem_size, NULL )) < 0 ) - goto out; - if ((H5Dread( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data)) < 0 - ) - goto out; - - /* Terminate access to the memory dataspace */ - if ( H5Sclose( mem_space_id ) < 0 ) - goto out; - - /* Terminate access to the dataspace */ - if ( H5Sclose( space_id ) < 0 ) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - H5Sclose(space_id); - H5Sclose(mem_space_id); - H5E_END_TRY - return -1; -} - diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 19eb805..12269c4 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -12,11 +12,11 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "H5IM.h" - - +#include "H5IMprivate.h" +#include "H5LTprivate.h" #include <string.h> #include <stdlib.h> + /*------------------------------------------------------------------------- * Function: H5IMmake_image_8bit * diff --git a/hl/src/H5IMprivate.h b/hl/src/H5IMprivate.h new file mode 100644 index 0000000..bca5a84 --- /dev/null +++ b/hl/src/H5IMprivate.h @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5IMprivate_H +#define _H5IMprivate_H + +/* public hdf5 prototypes */ +#include "H5Rpublic.h" +#include "H5Apublic.h" +#include "H5Spublic.h" +#include "H5Dpublic.h" + +/* public LT prototypes */ +#include "H5LTpublic.h" +#include "H5IMpublic.h" + + +#define IMAGE_CLASS "IMAGE" +#define PALETTE_CLASS "PALETTE" +#define IMAGE_VERSION "1.2" +#define IMAGE8_RANK 3 +#define IMAGE24_RANK 3 + + +/*------------------------------------------------------------------------- + * Private functions + *------------------------------------------------------------------------- + */ +H5_HLDLL herr_t H5IM_find_palette(hid_t loc_id ); + + +#endif diff --git a/hl/src/H5IM.h b/hl/src/H5IMpublic.h index 54dc404..a14f2f2 100644 --- a/hl/src/H5IM.h +++ b/hl/src/H5IMpublic.h @@ -12,21 +12,14 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5IM_H -#define _H5IM_H +#ifndef _H5IMpublic_H +#define _H5IMpublic_H -#include "H5LT.h" #ifdef __cplusplus extern "C" { #endif -#define IMAGE_CLASS "IMAGE" -#define PALETTE_CLASS "PALETTE" -#define IMAGE_VERSION "1.2" -#define IMAGE8_RANK 3 -#define IMAGE24_RANK 3 - H5_HLDLL herr_t H5IMmake_image_8bit( hid_t loc_id, const char *dset_name, @@ -53,8 +46,6 @@ H5_HLDLL herr_t H5IMread_image( hid_t loc_id, const char *dset_name, unsigned char *buffer ); - - H5_HLDLL herr_t H5IMmake_palette( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, @@ -77,7 +68,6 @@ H5_HLDLL herr_t H5IMget_palette_info( hid_t loc_id, int pal_number, hsize_t *pal_dims ); - H5_HLDLL herr_t H5IMget_palette( hid_t loc_id, const char *image_name, int pal_number, diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 4598dc5..5d281a7 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -12,14 +12,14 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "H5LT.h" +#include "H5LTprivate.h" #include <string.h> #include <stdlib.h> #include <assert.h> +#include <stdio.h> + /* For Lex and Yacc */ -#define SUCCEED 0 -#define FAIL -1 #define COL 3 #define LIMIT 512 #define INCREMENT 1024 @@ -3590,7 +3590,7 @@ herr_t H5LT_set_attribute_string(hid_t dset_id, if (H5Tclose(tid)<0) goto out; - return SUCCESS; + return SUCCEED; /* error zone, gracefully close */ out: diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h new file mode 100644 index 0000000..22d753c --- /dev/null +++ b/hl/src/H5LTprivate.h @@ -0,0 +1,70 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5LTprivate_H +#define _H5LTprivate_H + +#include "H5private.h" +/* public hdf5 prototypes */ +#include "H5Ipublic.h" +#include "H5Tpublic.h" +#include "H5Spublic.h" +#include "H5Dpublic.h" +#include "H5Ppublic.h" +#include "H5Gpublic.h" +#include "H5Apublic.h" +#include "H5Epublic.h" +/* public LT prototypes */ +#include "H5LTpublic.h" + +#define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} +#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} +#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);} +#define PASSED() {puts(" PASSED");fflush(stdout);} +#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} +#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} +#define EXAMPLE(WHAT) {printf("%-70s", "Example " WHAT); fflush(stdout);} + +/*------------------------------------------------------------------------- + * Private functions + *------------------------------------------------------------------------- + */ + +H5_HLDLL herr_t H5LT_get_attribute_mem( hid_t obj_id, + const char *attr_name, + hid_t mem_type_id, + void *data ); + +H5_HLDLL herr_t H5LT_get_attribute_disk( hid_t obj_id, + const char *attr_name, + void *data ); + +H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); + +H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id, + const char *obj_name, + const char *attr_name, + size_t size, + hid_t type_id, + const void *data ); + +H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, + char *name, + char *buf ); + +H5_HLDLL herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, + size_t *slen, hbool_t no_user_buf); + + +#endif diff --git a/hl/src/H5LT.h b/hl/src/H5LTpublic.h index 0024fcf..cfccb08 100644 --- a/hl/src/H5LT.h +++ b/hl/src/H5LTpublic.h @@ -12,27 +12,12 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5LT_H -#define _H5LT_H +#ifndef _H5LTpublic_H +#define _H5LTpublic_H -#include <hdf5.h> - -#ifndef FAIL -#define FAIL -1 -#endif - -#ifndef SUCCESS -#define SUCCESS 0 -#endif - -#define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} -#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} -#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);} -#define PASSED() {puts(" PASSED");fflush(stdout);} -#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} -#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} -#define EXAMPLE(WHAT) {printf("%-70s", "Example " WHAT); fflush(stdout);} +/* Public headers needed by this file */ +#include "H5public.h" typedef enum H5LT_lang_t { H5LT_LANG_ERR = -1, /*this is the first*/ @@ -42,6 +27,8 @@ typedef enum H5LT_lang_t { H5LT_NO_LANG = 3 /*this is the last*/ } H5LT_lang_t; + + #ifdef __cplusplus extern "C" { #endif @@ -367,36 +354,6 @@ H5_HLDLL herr_t H5LTrepack( hsize_t nfields, -/*------------------------------------------------------------------------- - * - * Private functions - * - *------------------------------------------------------------------------- - */ -H5_HLDLL herr_t H5LT_get_attribute_mem( hid_t obj_id, - const char *attr_name, - hid_t mem_type_id, - void *data ); - -H5_HLDLL herr_t H5LT_get_attribute_disk( hid_t obj_id, - const char *attr_name, - void *data ); - -H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); - -H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id, - const char *obj_name, - const char *attr_name, - size_t size, - hid_t type_id, - const void *data ); - -H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, - char *name, - char *buf ); - -H5_HLDLL herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, - size_t *slen, hbool_t no_user_buf); #ifdef __cplusplus } diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index d9ff03b..09c9074 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -12,8 +12,8 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "H5PT.h" -#include "H5HL_private.h" +#include "H5PTprivate.h" +#include "H5TBprivate.h" #include <stdlib.h> /* Packet Table private data */ diff --git a/hl/src/H5PTprivate.h b/hl/src/H5PTprivate.h new file mode 100644 index 0000000..bf6a00b --- /dev/null +++ b/hl/src/H5PTprivate.h @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5PTprivate_H +#define _H5PTprivate_H + + +/* public LT prototypes */ +#include "H5PTpublic.h" + +#endif diff --git a/hl/src/H5PT.h b/hl/src/H5PTpublic.h index aaf378b..5bcb203 100644 --- a/hl/src/H5PT.h +++ b/hl/src/H5PTpublic.h @@ -12,14 +12,20 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5PT_H -#define _H5PT_H - -#include <hdf5.h> - -#if 0 -#define H5_PT_DEBUG -#endif +#ifndef _H5PTpublic_H +#define _H5PTpublic_H + + +/* public hdf5 prototypes */ +#include "H5Ipublic.h" +#include "H5Tpublic.h" +#include "H5Spublic.h" +#include "H5Dpublic.h" +#include "H5Ppublic.h" +#include "H5Gpublic.h" +#include "H5Apublic.h" +#include "H5Epublic.h" +#include "H5Rpublic.h" #ifdef __cplusplus extern "C" { diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 8a2cdd6..720bb0a 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -12,38 +12,33 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "H5TB.h" -#include "H5HL_private.h" +#include "H5TBprivate.h" #include <stdlib.h> #include <string.h> -#if 0 -#define SHRINK -#endif - /*------------------------------------------------------------------------- * - * Private functions + * internal functions * *------------------------------------------------------------------------- */ -int H5TB_find_field(const char *field, - const char *field_list); +static int H5TB_find_field(const char *field, + const char *field_list); -herr_t H5TB_attach_attributes(const char *table_title, - hid_t loc_id, - const char *dset_name, - hsize_t nfields, - hid_t tid ); +static herr_t H5TB_attach_attributes(const char *table_title, + hid_t loc_id, + const char *dset_name, + hsize_t nfields, + hid_t tid ); -hid_t H5TB_create_type(hid_t loc_id, - const char *dset_name, - size_t dst_size, - const size_t *dst_offset, - const size_t *dst_sizes, - hid_t ftype_id); +static hid_t H5TB_create_type(hid_t loc_id, + const char *dset_name, + size_t dst_size, + const size_t *dst_offset, + const size_t *dst_sizes, + hid_t ftype_id); /*------------------------------------------------------------------------- * @@ -3439,7 +3434,7 @@ out: /*------------------------------------------------------------------------- * - * Private functions + * internal functions * *------------------------------------------------------------------------- */ @@ -3458,7 +3453,7 @@ out: *------------------------------------------------------------------------- */ - +static int H5TB_find_field( const char *field, const char *field_list ) { const char *start = field_list; @@ -3496,7 +3491,7 @@ int H5TB_find_field( const char *field, const char *field_list ) *------------------------------------------------------------------------- */ - +static herr_t H5TB_attach_attributes( const char *table_title, hid_t loc_id, const char *dset_name, @@ -3567,6 +3562,7 @@ out: *------------------------------------------------------------------------- */ +static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, size_t dst_size, @@ -3651,3 +3647,157 @@ out: } + +/*------------------------------------------------------------------------- + * + * Functions shared between H5TB and H5PT + * + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: H5TBcommon_append_records + * + * Purpose: Common code for reading records shared between H5PT and H5TB + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu + * James Laird, jlaird@ncsa.uiuc.edu + * + * Date: March 8, 2004 + * + * Comments: Called by H5TBappend_records and H5PTappend_records + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5TBcommon_append_records( hid_t dataset_id, + hid_t mem_type_id, + hsize_t nrecords, + hsize_t orig_table_size, + const void * data) +{ + hsize_t count[1]; + hsize_t offset[1]; + hid_t space_id = H5I_BADID; + hid_t mem_space_id = H5I_BADID; + hsize_t dims[1]; + hsize_t mem_dims[1]; + + /* Extend the dataset */ + dims[0] = nrecords + orig_table_size; + if ( H5Dextend ( dataset_id, dims ) < 0 ) + goto out; + + /* Create a simple memory data space */ + mem_dims[0]=nrecords; + if ( (mem_space_id = H5Screate_simple( 1, mem_dims, NULL )) < 0 ) + goto out; + + /* Get a copy of the new file data space for writing */ + if ( (space_id = H5Dget_space( dataset_id )) < 0 ) + goto out; + + /* Define a hyperslab in the dataset */ + offset[0] = orig_table_size; + count[0] = nrecords; + if ( H5Sselect_hyperslab( space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) + goto out; + + /* Write the records */ + if ( H5Dwrite( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data ) < +0 ) + goto out; + + /* Terminate access to the dataspace */ + if ( H5Sclose( mem_space_id ) < 0 ) + goto out; + + if ( H5Sclose( space_id ) < 0 ) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY + H5Sclose(mem_space_id); + H5Sclose(space_id); + H5E_END_TRY + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: H5TBcommon_read_records + * + * Purpose: Common code for reading records shared between H5PT and H5TB + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu + * James Laird, jlaird@ncsa.uiuc.edu + * + * Date: March 8, 2004 + * + * Comments: Called by H5TBread_records and H5PTread_records + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ +herr_t H5TBcommon_read_records( hid_t dataset_id, + hid_t mem_type_id, + hsize_t start, + hsize_t nrecords, + hsize_t table_size, + void *data) +{ + hsize_t count[1]; + hsize_t offset[1]; + hid_t space_id = H5I_BADID; + hid_t mem_space_id = H5I_BADID; + hsize_t mem_size[1]; + + /* Make sure the read request is in bounds */ + if ( start + nrecords > table_size ) + goto out; + + /* Get the dataspace handle */ + if ( (space_id = H5Dget_space( dataset_id )) < 0 ) + goto out; + + /* Define a hyperslab in the dataset of the size of the records */ + offset[0] = start; + count[0] = nrecords; + if ( H5Sselect_hyperslab( space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) + goto out; + + /* Create a memory dataspace handle */ + mem_size[0] = count[0]; + if ((mem_space_id = H5Screate_simple( 1, mem_size, NULL )) < 0 ) + goto out; + if ((H5Dread( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data)) < 0 + ) + goto out; + + /* Terminate access to the memory dataspace */ + if ( H5Sclose( mem_space_id ) < 0 ) + goto out; + + /* Terminate access to the dataspace */ + if ( H5Sclose( space_id ) < 0 ) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY + H5Sclose(space_id); + H5Sclose(mem_space_id); + H5E_END_TRY + return -1; +} + diff --git a/hl/src/H5TBprivate.h b/hl/src/H5TBprivate.h new file mode 100644 index 0000000..68fe303 --- /dev/null +++ b/hl/src/H5TBprivate.h @@ -0,0 +1,58 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5TBprivate_H +#define _H5TBprivate_H + + +#include "H5LTprivate.h" +#include "H5TBpublic.h" + + +#define TABLE_CLASS "TABLE" +#define HLTB_MAX_FIELD_LEN 255 + +/*------------------------------------------------------------------------- + * + * Private write function used by H5TB and H5PT + * + *------------------------------------------------------------------------- + */ + +herr_t H5TBcommon_append_records( hid_t dataset_id, + hid_t mem_type_id, + hsize_t nrecords, + hsize_t orig_table_size, + const void * data); + +/*------------------------------------------------------------------------- + * + * Private read function used by H5TB and H5PT + * + *------------------------------------------------------------------------- + */ + + +herr_t H5TBcommon_read_records( hid_t dataset_id, + hid_t mem_type_id, + hsize_t start, + hsize_t nrecords, + hsize_t table_size, + void *data); + + + + +#endif + diff --git a/hl/src/H5TB.h b/hl/src/H5TBpublic.h index ccc1776..e1c47ec 100644 --- a/hl/src/H5TB.h +++ b/hl/src/H5TBpublic.h @@ -12,26 +12,8 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5TB_H -#define _H5TB_H - -#if 0 -#define H5_TB_DEBUG -#endif - -#include "H5LT.h" - - -#define TABLE_CLASS "TABLE" - - -#define HLTB_MAX_FIELD_LEN 255 - -#if !defined(MAX) -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) -#endif - - +#ifndef _H5TBpublic_H +#define _H5TBpublic_H #ifdef __cplusplus diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index 002438d..e8e5588 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -25,10 +25,10 @@ AM_CPPFLAGS=-I$(top_srcdir)/src # This library is our main target. lib_LTLIBRARIES=libhdf5_hl.la -libhdf5_hl_la_SOURCES=H5LT.c H5TB.c H5IM.c H5DS.c H5PT.c H5HL_private.c H5LTparse.c H5LTanalyze.c +libhdf5_hl_la_SOURCES=H5LT.c H5TB.c H5IM.c H5DS.c H5PT.c H5LTparse.c H5LTanalyze.c # Public header files (to be installed) -include_HEADERS=H5IM.h H5LT.h H5TB.h H5DS.h H5PT.h H5LTparse.h +include_HEADERS=H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LTparse.h # Automake naturally assumes that we want it to remove H5LTparse.c on distclean. # Convince it otherwise. diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index a51a244..ae10548 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -77,7 +77,7 @@ libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_hl_la_LIBADD = am_libhdf5_hl_la_OBJECTS = H5LT.lo H5TB.lo H5IM.lo H5DS.lo H5PT.lo \ - H5HL_private.lo H5LTparse.lo H5LTanalyze.lo + H5LTparse.lo H5LTanalyze.lo libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/bin/depcomp @@ -291,6 +291,9 @@ RM = rm -f CP = cp TIME = time +# Path for hl needed in hdf5.h +INCLUDES = -I$(top_srcdir)/hl/src + # Some machines need a command to run executables; this is that command # so that our tests will run. # We use RUNTESTS instead of RUNSERIAL directly because it may be that @@ -340,10 +343,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/src # This library is our main target. lib_LTLIBRARIES = libhdf5_hl.la -libhdf5_hl_la_SOURCES = H5LT.c H5TB.c H5IM.c H5DS.c H5PT.c H5HL_private.c H5LTparse.c H5LTanalyze.c +libhdf5_hl_la_SOURCES = H5LT.c H5TB.c H5IM.c H5DS.c H5PT.c H5LTparse.c H5LTanalyze.c # Public header files (to be installed) -include_HEADERS = H5IM.h H5LT.h H5TB.h H5DS.h H5PT.h H5LTparse.h +include_HEADERS = H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LTparse.h # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -428,7 +431,6 @@ mostlyclean-compile: -rm -f *.$(OBJEXT) @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HL_private.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IM.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LT.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LTanalyze.Plo@am__quote@ |