diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-06 19:45:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-06 19:45:35 (GMT) |
commit | 98754fa9d12090f5e048fdb05cc5e9ce9111676f (patch) | |
tree | 407e611b19ee551d8153779104022dd886a467e5 /tools/lib | |
parent | 29321bcafa9f1c6108bb92b5a844a9d4d9c2c8e7 (diff) | |
download | hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.zip hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.gz hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.bz2 |
[svn-r19050] Description:
Bring r18704:19049 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.3 (amazon) in debug mode
Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/CMakeLists.txt | 70 | ||||
-rw-r--r-- | tools/lib/Makefile.in | 2 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 4 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 6 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 39 | ||||
-rw-r--r-- | tools/lib/h5tools_error.h | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 7 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.h | 14 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 38 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 43 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 22 |
11 files changed, 184 insertions, 67 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt new file mode 100644 index 0000000..e12a7a6 --- /dev/null +++ b/tools/lib/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_TOOLS_LIB) + +#----------------------------------------------------------------------------- +# Define Sources +#----------------------------------------------------------------------------- +#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +#INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) + +SET (H5_TOOLS_LIB_SRCS + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_array.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_attr.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_dset.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_util.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_filters.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_type.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.c + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.c +) + +SET (H5_TOOLS_LIB_HDRS + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.h + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.h + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.h + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.h + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.h + ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.h +) + +#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together +ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS}) +TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") +H5_SET_LIB_OPTIONS ( + ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} + ${LIB_TYPE} + HDF5_TOOLS_LIB_NAME_RELEASE + HDF5_TOOLS_LIB_NAME_DEBUG +) + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +INSTALL ( + FILES + ${H5_TOOLS_LIB_HDRS} + DESTINATION + include/tools + COMPONENT + toolsheaders +) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +IF (HDF5_EXPORTED_TARGETS) + INSTALL ( + TARGETS + ${HDF5_TOOLS_LIB_TARGET} + EXPORT + ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION lib/tools COMPONENT toolslibraries + ARCHIVE DESTINATION lib/tools COMPONENT toolslibraries + RUNTIME DESTINATION bin/tools COMPONENT toolslibraries + ) +ENDIF (HDF5_EXPORTED_TARGETS) diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index d55d229..7568a89 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -185,12 +185,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTRUMENT = @INSTRUMENT@ INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ +LARGEFILE = @LARGEFILE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LINUX_LFS = @LINUX_LFS@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 5f18ab3..c3d74b5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -209,10 +209,10 @@ static int is_valid_options(diff_opt_t *options) } /* ------------------------------------------------------- - * only allow --no-dangling-links along with --follow-links */ + * only allow --no-dangling-links along with --follow-symlinks */ if(options->no_dangle_links && !options->follow_links) { - parallel_print("Error: --no-dangling-links must be used along with --follow-links option.\n"); + parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n"); options->err_stat=1; ret = 0; goto out; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 6718d9a..ede6ea0 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -55,15 +55,15 @@ typedef struct { extern "C" { #endif -hsize_t h5diff(const char *fname1, +H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *options); #ifdef H5_HAVE_PARALLEL -void phdiff_dismiss_workers(void); -void print_manager_output(void); +H5TOOLS_DLL void phdiff_dismiss_workers(void); +H5TOOLS_DLL void print_manager_output(void); #endif #ifdef __cplusplus diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 7d207ba..ab72025 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -521,10 +521,14 @@ struct subset_t { #include "h5tools_str.h" -extern FILE *rawdatastream; /* output stream for raw data */ -extern int bin_output; /* binary output */ -extern int bin_form; /* binary form */ -extern int region_output; /* region output */ +#ifdef __cplusplus +extern "C" { +#endif + +H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ +H5TOOLS_DLLVAR int bin_output; /* binary output */ +H5TOOLS_DLLVAR int bin_form; /* binary form */ +H5TOOLS_DLLVAR int region_output; /* region output */ /* Strings for output */ #define H5_TOOLS_GROUP "GROUP" @@ -532,26 +536,26 @@ extern int region_output; /* region output */ #define H5_TOOLS_DATATYPE "DATATYPE" /* Definitions of useful routines */ -extern void h5tools_init(void); -extern void h5tools_close(void); -extern hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, +H5TOOLS_DLL void h5tools_init(void); +H5TOOLS_DLL void h5tools_close(void); +H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, char *drivername, size_t drivername_len); -extern int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, +H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, hid_t p_typ, struct subset_t *sset, int indentlevel); -extern int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, +H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem, int indentlevel); -extern hid_t h5tools_get_native_type(hid_t type); -extern hid_t h5tools_get_little_endian_type(hid_t type); -extern hid_t h5tools_get_big_endian_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); -extern void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, +H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, h5tools_context_t *ctx/*in,out*/, unsigned flags, hsize_t nelmts, hid_t type, void *_mem); -extern int h5tools_canreadf(const char* name, +H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id); -extern int h5tools_can_encode(H5Z_filter_t filtn); +H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); /* @@ -564,5 +568,10 @@ int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t type); int h5tools_print_enum(h5tools_str_t *buffer/*in,out*/, hid_t type); + +#ifdef __cplusplus +} +#endif + #endif /* H5TOOLS_H__ */ diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index a7c0d3c..207218e 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -22,9 +22,9 @@ #include "H5Epublic.h" /* tools-HDF5 Error variables */ -extern hid_t H5tools_ERR_CLS_g; -extern hid_t H5E_tools_g; -extern hid_t H5E_tools_min_id_g; +H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g; +H5TOOLS_DLLVAR hid_t H5E_tools_g; +H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; /* Use FUNC to safely handle variations of C99 __func__ keyword handling */ #ifdef H5_HAVE_C99_FUNC diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 03e6efd..07d2a57 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -45,9 +45,6 @@ typedef struct { static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */ static hid_t thefile = (-1); -extern char *progname; -extern int d_status; - static int ref_path_table_put(const char *, haddr_t objno); /*------------------------------------------------------------------------- @@ -122,8 +119,8 @@ init_ref_path_table(void) /* Iterate over objects in this file */ if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) { - error_msg(progname, "unable to construct reference path table\n"); - d_status = EXIT_FAILURE; + error_msg("unable to construct reference path table\n"); + h5tools_setstatus(EXIT_FAILURE); } /* end if */ return(0); diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index 567ca4b..7ddb91a 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -22,13 +22,13 @@ extern "C" { #endif -herr_t fill_ref_path_table(hid_t fid); -const char *lookup_ref_path(haddr_t ref); -int get_next_xid(void); -haddr_t get_fake_xid(void); -haddr_t ref_path_table_lookup(const char *); -haddr_t ref_path_table_gen_fake(const char *); -int term_ref_path_table(void); +H5TOOLS_DLL herr_t fill_ref_path_table(hid_t fid); +H5TOOLS_DLL const char *lookup_ref_path(haddr_t ref); +H5TOOLS_DLL int get_next_xid(void); +H5TOOLS_DLL haddr_t get_fake_xid(void); +H5TOOLS_DLL haddr_t ref_path_table_lookup(const char *); +H5TOOLS_DLL haddr_t ref_path_table_gen_fake(const char *); +H5TOOLS_DLL int term_ref_path_table(void); #ifdef __cplusplus } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a51a286..ca1caa1 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -39,6 +39,8 @@ int nCols = 80; int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ const char *opt_arg; /*flag argument (or value) */ +static int h5tools_d_status = 0; +static const char *h5tools_progname = "h5tools"; /* local functions */ static void init_table(table_t **tbl); @@ -64,13 +66,13 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t *------------------------------------------------------------------------- */ void -error_msg(const char *progname, const char *fmt, ...) +error_msg(const char *fmt, ...) { va_list ap; va_start(ap, fmt); HDfflush(stdout); - HDfprintf(stderr, "%s error: ", progname); + HDfprintf(stderr, "%s error: ", h5tools_getprogname()); HDvfprintf(stderr, fmt, ap); va_end(ap); @@ -93,13 +95,13 @@ error_msg(const char *progname, const char *fmt, ...) *------------------------------------------------------------------------- */ void -warn_msg(const char *progname, const char *fmt, ...) +warn_msg(const char *fmt, ...) { va_list ap; va_start(ap, fmt); HDfflush(stdout); - HDfprintf(stderr, "%s warning: ", progname); + HDfprintf(stderr, "%s warning: ", h5tools_getprogname()); HDvfprintf(stderr, fmt, ap); va_end(ap); } @@ -758,3 +760,31 @@ out: return Ret; } + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Initialize the name and operation status of the H5 Tools library + * Description: + * These are utility functions to set/get the program name and operation status. + *------------------------------------------------------------------------- + */ +void h5tools_setprogname(const char *Progname) +{ + h5tools_progname = Progname; +} + +void h5tools_setstatus(int D_status) +{ + h5tools_d_status = D_status; +} + +const char*h5tools_getprogname() +{ + return h5tools_progname; +} + +int h5tools_getstatus() +{ + return h5tools_d_status; +} diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index dcd8f2b..14a7daa 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -24,12 +24,16 @@ #include "hdf5.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * begin get_option section */ -extern int opt_err; /* getoption prints errors if this is on */ -extern int opt_ind; /* token pointer */ -extern const char *opt_arg; /* flag argument (or value) */ +H5TOOLS_DLLVAR int opt_err; /* getoption prints errors if this is on */ +H5TOOLS_DLLVAR int opt_ind; /* token pointer */ +H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) */ enum { no_arg = 0, /* doesn't take an argument */ @@ -72,7 +76,7 @@ typedef struct long_options { * this gets returned from get_option */ } long_options; -extern int get_option(int argc, const char **argv, const char *opt, +H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); /* * end get_option section @@ -101,25 +105,24 @@ typedef struct find_objs_t { table_t *dset_table; } find_objs_t; -extern int nCols; /*max number of columns for outputting */ +H5TOOLS_DLLVAR int nCols; /*max number of columns for outputting */ /* Definitions of useful routines */ -extern void indentation(int); -extern void print_version(const char *progname); -extern void error_msg(const char *progname, const char *fmt, ...); -extern void warn_msg(const char *progname, const char *fmt, ...); -extern void free_table(table_t *table); +H5TOOLS_DLL void indentation(int); +H5TOOLS_DLL void print_version(const char *progname); +H5TOOLS_DLL void error_msg(const char *fmt, ...); +H5TOOLS_DLL void warn_msg(const char *fmt, ...); +H5TOOLS_DLL void free_table(table_t *table); #ifdef H5DUMP_DEBUG -extern void dump_tables(find_objs_t *info) +H5TOOLS_DLL void dump_tables(find_objs_t *info) #endif /* H5DUMP_DEBUG */ -extern herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, +H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table); -extern obj_t *search_obj(table_t *temp, haddr_t objno); +H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno); #ifndef H5_HAVE_TMPFILE -extern FILE * tmpfile(void); +H5TOOLS_DLL FILE * tmpfile(void); #endif - /************************************************************* * * candidate functions to be public @@ -148,6 +151,14 @@ typedef struct { /* Definitions of routines */ -extern int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info); +H5TOOLS_DLL int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info); +H5TOOLS_DLL const char *h5tools_getprogname(void); +H5TOOLS_DLL void h5tools_setprogname(const char*progname); +H5TOOLS_DLL int h5tools_getstatus(void); +H5TOOLS_DLL void h5tools_setstatus(int d_status); + +#ifdef __cplusplus +} +#endif #endif /* H5TOOLS_UTILS_H__ */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 5c07331..bb31461 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -110,7 +110,7 @@ extern "C" { * "h5trav general" public functions *------------------------------------------------------------------------- */ -int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, +H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk, void *udata); @@ -118,22 +118,22 @@ int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, * "h5trav info" public functions *------------------------------------------------------------------------- */ -int h5trav_getinfo(hid_t file_id, trav_info_t *info); -ssize_t h5trav_getindex(const trav_info_t *info, const char *obj); +H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info); +H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj); /*------------------------------------------------------------------------- * "h5trav table" public functions *------------------------------------------------------------------------- */ -int h5trav_gettable(hid_t fid, trav_table_t *travt); -int h5trav_getindext(const char *obj, const trav_table_t *travt); +H5TOOLS_DLL int h5trav_gettable(hid_t fid, trav_table_t *travt); +H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt); /*------------------------------------------------------------------------- * "h5trav print" public functions *------------------------------------------------------------------------- */ -int h5trav_print(hid_t fid); +H5TOOLS_DLL int h5trav_print(hid_t fid); #ifdef __cplusplus } @@ -144,20 +144,20 @@ int h5trav_print(hid_t fid); *------------------------------------------------------------------------- */ -void trav_info_init(trav_info_t **info); +H5TOOLS_DLL void trav_info_init(trav_info_t **info); -void trav_info_free(trav_info_t *info); +H5TOOLS_DLL void trav_info_free(trav_info_t *info); /*------------------------------------------------------------------------- * table private functions *------------------------------------------------------------------------- */ -void trav_table_init(trav_table_t **table); +H5TOOLS_DLL void trav_table_init(trav_table_t **table); -void trav_table_free(trav_table_t *table); +H5TOOLS_DLL void trav_table_free(trav_table_t *table); -void trav_table_addflags(unsigned *flags, +H5TOOLS_DLL void trav_table_addflags(unsigned *flags, char *objname, h5trav_type_t type, trav_table_t *table); |