mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Update Java util lib, Refactor H5D write VL to match read
This commit is contained in:
parent
4095b9260d
commit
792771d52a
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -192,12 +192,12 @@ java/examples/testfiles/examples.intro.H5_CreateGroup.txt -text
|
||||
java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt -text
|
||||
java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt -text
|
||||
java/examples/testfiles/examples.intro.H5_ReadWrite.txt -text
|
||||
java/lib/ext/slf4j-nop-1.7.5.jar -text svneol=unset#application/zip
|
||||
java/lib/ext/slf4j-simple-1.7.5.jar -text svneol=unset#application/zip
|
||||
java/lib/ext/slf4j-nop-1.7.25.jar -text svneol=unset#application/zip
|
||||
java/lib/ext/slf4j-simple-1.7.25.jar -text svneol=unset#application/zip
|
||||
java/lib/hamcrest-core.jar -text svneol=unset#application/java-archive
|
||||
java/lib/junit.jar -text svneol=unset#application/java-archive
|
||||
java/lib/simplelogger.properties -text
|
||||
java/lib/slf4j-api-1.7.5.jar -text svneol=unset#application/zip
|
||||
java/lib/slf4j-api-1.7.25.jar -text svneol=unset#application/zip
|
||||
java/src/CMakeLists.txt -text
|
||||
java/src/Makefile.am -text
|
||||
java/src/hdf/CMakeLists.txt -text
|
||||
|
@ -195,9 +195,9 @@ set (HDF5_JAVA_JNI_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/jni)
|
||||
set (HDF5_JAVA_HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/hdf)
|
||||
set (HDF5_JAVA_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/java/test)
|
||||
set (HDF5_JAVA_LIB_DIR ${HDF5_SOURCE_DIR}/java/lib)
|
||||
set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.jar)
|
||||
set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar)
|
||||
set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar)
|
||||
set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.25.jar)
|
||||
set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.25.jar)
|
||||
set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.25.jar)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# parse the full version number from H5public.h and include in H5_VERS_INFO
|
||||
|
6
MANIFEST
6
MANIFEST
@ -3128,9 +3128,9 @@
|
||||
./java/lib/hamcrest-core.jar
|
||||
./java/lib/junit.jar
|
||||
./java/lib/simplelogger.properties
|
||||
./java/lib/slf4j-api-1.7.5.jar
|
||||
./java/lib/ext/slf4j-nop-1.7.5.jar
|
||||
./java/lib/ext/slf4j-simple-1.7.5.jar
|
||||
./java/lib/slf4j-api-1.7.25.jar
|
||||
./java/lib/ext/slf4j-nop-1.7.25.jar
|
||||
./java/lib/ext/slf4j-simple-1.7.25.jar
|
||||
|
||||
# CMake-specific Files
|
||||
./config/cmake/cacheinit.cmake
|
||||
|
@ -61,8 +61,8 @@ endif ()
|
||||
if (${HDF5_PACKAGE_NAME}_BUILD_JAVA)
|
||||
set (${HDF5_PACKAGE_NAME}_JAVA_INCLUDE_DIRS
|
||||
@PACKAGE_CURRENT_BUILD_DIR@/lib/jarhdf5-@HDF5_VERSION_STRING@.jar
|
||||
@PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.5.jar
|
||||
@PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.5.jar
|
||||
@PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.25.jar
|
||||
@PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.25.jar
|
||||
)
|
||||
set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib")
|
||||
set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}")
|
||||
|
@ -52,8 +52,8 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
|
||||
# Comment '#' without space can be used.
|
||||
# --------------------------------------------------------------------
|
||||
LIST_LIBRARY_FILES="
|
||||
$HDFLIB_HOME/slf4j-api-1.7.5.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.25.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
|
||||
$top_builddir/src/.libs/libhdf5.*
|
||||
$top_builddir/java/src/jni/.libs/libhdf5_java.*
|
||||
$top_builddir/java/src/$JARFILE
|
||||
@ -117,7 +117,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
|
||||
# skip rm if srcdir is same as destdir
|
||||
# this occurs when build/test performed in source dir and
|
||||
# make cp fail
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
|
||||
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
|
||||
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
|
||||
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
|
||||
@ -183,7 +183,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
|
||||
COPY_LIBFILES_TO_BLDLIBDIR
|
||||
COPY_DATAFILES_TO_BLDDIR
|
||||
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
|
||||
|
||||
TEST=/usr/bin/test
|
||||
if [ ! -x /usr/bin/test ]
|
||||
|
@ -28,7 +28,7 @@ classes:
|
||||
|
||||
pkgpath = examples/datasets
|
||||
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
jarfile = jar$(PACKAGE_TARNAME)datasets.jar
|
||||
|
||||
|
@ -49,8 +49,8 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
|
||||
# Comment '#' without space can be used.
|
||||
# --------------------------------------------------------------------
|
||||
LIST_LIBRARY_FILES="
|
||||
$HDFLIB_HOME/slf4j-api-1.7.5.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.25.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
|
||||
$top_builddir/src/.libs/libhdf5.*
|
||||
$top_builddir/java/src/jni/.libs/libhdf5_java.*
|
||||
$top_builddir/java/src/$JARFILE
|
||||
@ -114,7 +114,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
|
||||
# skip rm if srcdir is same as destdir
|
||||
# this occurs when build/test performed in source dir and
|
||||
# make cp fail
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
|
||||
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
|
||||
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
|
||||
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
|
||||
@ -179,7 +179,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
|
||||
COPY_LIBFILES_TO_BLDLIBDIR
|
||||
COPY_DATAFILES_TO_BLDDIR
|
||||
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
|
||||
|
||||
TEST=/usr/bin/test
|
||||
if [ ! -x /usr/bin/test ]
|
||||
|
@ -28,7 +28,7 @@ classes:
|
||||
|
||||
pkgpath = examples/datatypes
|
||||
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
jarfile = jar$(PACKAGE_TARNAME)datatypes.jar
|
||||
|
||||
|
@ -51,8 +51,8 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR
|
||||
# Comment '#' without space can be used.
|
||||
# --------------------------------------------------------------------
|
||||
LIST_LIBRARY_FILES="
|
||||
$HDFLIB_HOME/slf4j-api-1.7.5.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.25.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
|
||||
$top_builddir/src/.libs/libhdf5.*
|
||||
$top_builddir/java/src/jni/.libs/libhdf5_java.*
|
||||
$top_builddir/java/src/$JARFILE
|
||||
@ -109,7 +109,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
|
||||
# skip rm if srcdir is same as destdir
|
||||
# this occurs when build/test performed in source dir and
|
||||
# make cp fail
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
|
||||
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
|
||||
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
|
||||
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
|
||||
@ -225,7 +225,7 @@ COPY_LIBFILES_TO_BLDLIBDIR
|
||||
COPY_DATAFILES_TO_BLDDIR
|
||||
COPY_REFFILES_TO_BLDREFDIR
|
||||
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
|
||||
|
||||
TEST=/usr/bin/test
|
||||
if [ ! -x /usr/bin/test ]
|
||||
|
@ -28,7 +28,7 @@ classes:
|
||||
|
||||
pkgpath = examples/groups
|
||||
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
jarfile = jar$(PACKAGE_TARNAME)groups.jar
|
||||
|
||||
|
@ -49,8 +49,8 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
|
||||
# Comment '#' without space can be used.
|
||||
# --------------------------------------------------------------------
|
||||
LIST_LIBRARY_FILES="
|
||||
$HDFLIB_HOME/slf4j-api-1.7.5.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.25.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
|
||||
$top_builddir/src/.libs/libhdf5.*
|
||||
$top_builddir/java/src/jni/.libs/libhdf5_java.*
|
||||
$top_builddir/java/src/$JARFILE
|
||||
@ -103,7 +103,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
|
||||
# skip rm if srcdir is same as destdir
|
||||
# this occurs when build/test performed in source dir and
|
||||
# make cp fail
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
|
||||
SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
|
||||
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
|
||||
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
|
||||
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
|
||||
@ -168,7 +168,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
|
||||
COPY_LIBFILES_TO_BLDLIBDIR
|
||||
COPY_DATAFILES_TO_BLDDIR
|
||||
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
|
||||
|
||||
TEST=/usr/bin/test
|
||||
if [ ! -x /usr/bin/test ]
|
||||
|
@ -28,7 +28,7 @@ classes:
|
||||
|
||||
pkgpath = examples/intro
|
||||
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
jarfile = jar$(PACKAGE_TARNAME)intro.jar
|
||||
|
||||
|
BIN
java/lib/ext/slf4j-nop-1.7.25.jar
Normal file
BIN
java/lib/ext/slf4j-nop-1.7.25.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
java/lib/ext/slf4j-simple-1.7.25.jar
Normal file
BIN
java/lib/ext/slf4j-simple-1.7.25.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
java/lib/slf4j-api-1.7.25.jar
Normal file
BIN
java/lib/slf4j-api-1.7.25.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -37,7 +37,7 @@ jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
hdf5_javadir = $(libdir)
|
||||
|
||||
pkgpath = hdf/hdf5lib
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
|
||||
|
||||
|
@ -1752,14 +1752,8 @@ public class H5 implements java.io.Serializable {
|
||||
(String[]) obj);
|
||||
}
|
||||
else if (is1D && (dataClass.getComponentType() == String.class)) {
|
||||
log.trace("H5Dread_string type");
|
||||
if (H5.H5Tis_variable_str(mem_type_id)) {
|
||||
status = H5Dread_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
|
||||
}
|
||||
else {
|
||||
status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
|
||||
(String[]) obj);
|
||||
}
|
||||
log.trace("H5DreadVL type");
|
||||
status = H5DreadVL(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
|
||||
}
|
||||
else {
|
||||
// Create a data buffer to hold the data into a Java Array
|
||||
@ -1979,7 +1973,7 @@ public class H5 implements java.io.Serializable {
|
||||
|
||||
Class dataClass = obj.getClass();
|
||||
if (!dataClass.isArray()) {
|
||||
throw (new HDF5JavaException("H5Dread: data is not an array"));
|
||||
throw (new HDF5JavaException("H5Dwrite: data is not an array"));
|
||||
}
|
||||
|
||||
String cname = dataClass.getName();
|
||||
@ -2011,14 +2005,8 @@ public class H5 implements java.io.Serializable {
|
||||
(double[]) obj, isCriticalPinning);
|
||||
}
|
||||
else if (is1D && (dataClass.getComponentType() == String.class)) {
|
||||
log.trace("H5Dwrite_string type");
|
||||
if (H5.H5Tis_variable_str(mem_type_id)) {
|
||||
status = H5Dwrite_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
|
||||
}
|
||||
else {
|
||||
status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
|
||||
(String[]) obj);
|
||||
}
|
||||
log.trace("H5DwriteVL type");
|
||||
status = H5DwriteVL(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
|
||||
}
|
||||
else {
|
||||
HDFArray theArray = new HDFArray(obj);
|
||||
@ -2084,6 +2072,9 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id,
|
||||
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
public synchronized static native int H5DwriteVL(long dataset_id, long mem_type_id, long mem_space_id,
|
||||
long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
/**
|
||||
* H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from
|
||||
* the application memory buffer buf into the file.
|
||||
|
@ -56,6 +56,7 @@ extern jobject visit_callback;
|
||||
static herr_t H5DreadVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
static herr_t H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
static herr_t H5DreadVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
static herr_t H5DwriteVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
static herr_t H5DwriteVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
static herr_t H5DwriteVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
|
||||
|
||||
@ -1194,7 +1195,7 @@ H5DreadVL_asstr
|
||||
/* we will need to read n number of hvl_t structures */
|
||||
rdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
|
||||
if (rdata == NULL) {
|
||||
h5JNIFatalError(env, "H5DreadVL_notstr: failed to allocate buff for read");
|
||||
h5JNIFatalError(env, "H5DreadVL_asstr: failed to allocate buff for read");
|
||||
} /* end if */
|
||||
else {
|
||||
status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, rdata);
|
||||
@ -1202,7 +1203,7 @@ H5DreadVL_asstr
|
||||
if (status < 0) {
|
||||
H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
|
||||
HDfree(rdata);
|
||||
h5JNIFatalError(env, "H5DreadVL_notstr: failed to read data");
|
||||
h5JNIFatalError(env, "H5DreadVL_asstr: failed to read data");
|
||||
} /* end if */
|
||||
else {
|
||||
/* calculate the largest size of all the hvl_t structures read */
|
||||
@ -1220,7 +1221,7 @@ H5DreadVL_asstr
|
||||
if (h5str.s == NULL) {
|
||||
H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
|
||||
HDfree(rdata);
|
||||
h5JNIFatalError(env, "H5DreadVL_notstr: failed to allocate buf");
|
||||
h5JNIFatalError(env, "H5DreadVL_asstr: failed to allocate buf");
|
||||
} /* end if */
|
||||
else {
|
||||
H5T_class_t tclass = H5Tget_class(tid);
|
||||
@ -1327,6 +1328,104 @@ H5DreadVL_str
|
||||
} /* end H5DreadVL_str */
|
||||
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5DwriteVL
|
||||
* Signature: (JJJJJ[Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5DwriteVL
|
||||
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
|
||||
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
|
||||
{
|
||||
herr_t status = -1;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isComplex = 0;
|
||||
|
||||
if (buf == NULL) {
|
||||
h5nullArgument(env, "H5DwriteVL: buf is NULL");
|
||||
} /* end if */
|
||||
else {
|
||||
isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
|
||||
if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) {
|
||||
unsigned i;
|
||||
int nm = H5Tget_nmembers(mem_type_id);
|
||||
for(i = 0; i <nm; i++) {
|
||||
hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
|
||||
isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
|
||||
H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
|
||||
H5Tclose(nested_tid);
|
||||
}
|
||||
}
|
||||
else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
|
||||
isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
|
||||
}
|
||||
if (isStr == 0 || isComplex>0 || isVlenStr) {
|
||||
status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
|
||||
(hid_t)mem_space_id, (hid_t)file_space_id,
|
||||
(hid_t)xfer_plist_id, buf);
|
||||
}
|
||||
else if (isStr > 0) {
|
||||
status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
|
||||
(hid_t)mem_space_id, (hid_t)file_space_id,
|
||||
(hid_t)xfer_plist_id, buf);
|
||||
}
|
||||
} /* end else */
|
||||
|
||||
return (jint)status;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VL */
|
||||
|
||||
herr_t
|
||||
H5DwriteVL_asstr
|
||||
(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
|
||||
{
|
||||
herr_t status = -1;
|
||||
hvl_t *wdata;
|
||||
jsize size;
|
||||
jint i;
|
||||
jint n;
|
||||
|
||||
/* Get size of string array */
|
||||
n = ENVPTR->GetArrayLength(ENVPAR buf);
|
||||
wdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
|
||||
|
||||
if (wdata == NULL) {
|
||||
h5JNIFatalError(env, "H5DwriteVL_asstr: failed to allocate buff for write");
|
||||
} /* end if */
|
||||
else {
|
||||
for (i = 0; i < n; ++i) {
|
||||
jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i);
|
||||
if (obj != 0) {
|
||||
jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
|
||||
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
|
||||
|
||||
if (utf8) {
|
||||
h5str_vlconvert(utf8, did, tid, wdata+i, 0);
|
||||
} /* end if */
|
||||
|
||||
ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
|
||||
ENVPTR->DeleteLocalRef(ENVPAR obj);
|
||||
} /* end if */
|
||||
} /* end for (i = 0; i < size; ++i) */
|
||||
|
||||
status = H5Dwrite(did, tid, mem_sid, file_sid, xfer_plist_id, wdata);
|
||||
|
||||
/* now free memory*/
|
||||
for (i = 0; i < n; i++) {
|
||||
if(wdata+i) {
|
||||
HDfree(wdata+i);
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
HDfree(wdata);
|
||||
|
||||
if (status < 0)
|
||||
h5libraryError(env);
|
||||
} /* end else */
|
||||
|
||||
return status;
|
||||
} /* end H5DwriteVL_asstr */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Dwrite_VLStrings
|
||||
|
@ -211,6 +211,15 @@ JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5DreadVL
|
||||
(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5DwriteVL
|
||||
* Signature: (JJJJJ[Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5DwriteVL
|
||||
(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Dread_string
|
||||
|
@ -153,6 +153,428 @@ h5str_append
|
||||
return HDstrcat(str->s, cstr);
|
||||
} /* end h5str_append */
|
||||
|
||||
/** print value of a vlen data point into string.
|
||||
Return Value:
|
||||
On success, the total number of characters printed is returned.
|
||||
On error, a negative number is returned.
|
||||
*/
|
||||
size_t
|
||||
h5str_vlconvert
|
||||
(char *str, hid_t container, hid_t tid, hvl_t *ptr, int expand_data)
|
||||
{
|
||||
unsigned char tmp_uchar = 0;
|
||||
char tmp_char = 0;
|
||||
unsigned short tmp_ushort = 0;
|
||||
short tmp_short = 0;
|
||||
unsigned int tmp_uint = 0;
|
||||
int tmp_int = 0;
|
||||
unsigned long tmp_ulong = 0;
|
||||
long tmp_long = 0;
|
||||
unsigned long long tmp_ullong = 0;
|
||||
long long tmp_llong = 0;
|
||||
float tmp_float = 0.0;
|
||||
double tmp_double = 0.0;
|
||||
long double tmp_ldouble = 0.0;
|
||||
static char fmt_llong[8], fmt_ullong[8];
|
||||
|
||||
hid_t mtid = -1;
|
||||
size_t offset;
|
||||
size_t nll;
|
||||
char *this_str;
|
||||
size_t this_strlen;
|
||||
int n;
|
||||
H5T_class_t tclass = H5Tget_class(tid);
|
||||
size_t size = H5Tget_size(tid);
|
||||
H5T_sign_t nsign = H5Tget_sign(tid);
|
||||
int bdata_print = 0;
|
||||
|
||||
if (!str || !ptr)
|
||||
return 0;
|
||||
|
||||
this_str = NULL;
|
||||
this_strlen = 0;
|
||||
|
||||
switch (tclass) {
|
||||
case H5T_COMPOUND:
|
||||
{
|
||||
unsigned i;
|
||||
n = H5Tget_nmembers(tid);
|
||||
|
||||
/* remove compound indicators */
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
if (str[0] == '{')
|
||||
str++;
|
||||
|
||||
ptr->p = HDcalloc((size_t)1, size);
|
||||
ptr->len = size;
|
||||
for (i = 0; i < n; i++) {
|
||||
offset = H5Tget_member_offset(tid, i);
|
||||
mtid = H5Tget_member_type(tid, i);
|
||||
str += offset;
|
||||
h5str_convert(&str, container, mtid, ptr, 0, expand_data);
|
||||
/* remove compound indicators */
|
||||
if (str[0] == ',')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
H5Tclose(mtid);
|
||||
}
|
||||
/* remove compound indicators */
|
||||
if (str[0] == '}')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
break;
|
||||
case H5T_ARRAY:
|
||||
{
|
||||
int rank = 0;
|
||||
hsize_t i, dims[H5S_MAX_RANK], total_elmts;
|
||||
|
||||
/* remove array indicators */
|
||||
if (str[0] == '[')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
|
||||
mtid = H5Tget_super(tid);
|
||||
size = H5Tget_size(mtid);
|
||||
rank = H5Tget_array_ndims(tid);
|
||||
|
||||
H5Tget_array_dims2(tid, dims);
|
||||
|
||||
total_elmts = 1;
|
||||
for (i = 0; i < rank; i++)
|
||||
total_elmts *= dims[i];
|
||||
|
||||
ptr->p = HDcalloc((size_t)total_elmts, size);
|
||||
ptr->len = total_elmts;
|
||||
h5str_convert(&str, container, mtid, ptr, 0, expand_data);
|
||||
H5Tclose(mtid);
|
||||
/* remove array indicators */
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
if (str[0] == ']')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ptr->len = size;
|
||||
ptr->p = HDcalloc(1, size);
|
||||
this_strlen = h5str_convert(&str, container, tid, ptr, 0, expand_data);
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
return this_strlen;
|
||||
} /* end h5str_vlconvert */
|
||||
|
||||
/** print value of a data point into string.
|
||||
Return Value:
|
||||
On success, the total number of characters printed is returned.
|
||||
On error, a negative number is returned.
|
||||
*/
|
||||
size_t
|
||||
h5str_convert
|
||||
(char **str, hid_t container, hid_t tid, hvl_t *ptr, int ptroffset, int expand_data)
|
||||
{
|
||||
unsigned char tmp_uchar = 0;
|
||||
char tmp_char = 0;
|
||||
unsigned short tmp_ushort = 0;
|
||||
short tmp_short = 0;
|
||||
unsigned int tmp_uint = 0;
|
||||
int tmp_int = 0;
|
||||
unsigned long tmp_ulong = 0;
|
||||
long tmp_long = 0;
|
||||
unsigned long long tmp_ullong = 0;
|
||||
long long tmp_llong = 0;
|
||||
float tmp_float = 0.0;
|
||||
double tmp_double = 0.0;
|
||||
long double tmp_ldouble = 0.0;
|
||||
static char fmt_llong[8], fmt_ullong[8];
|
||||
const char delimiter[] = " ,}]";
|
||||
|
||||
char *token;
|
||||
hid_t mtid = -1;
|
||||
size_t offset;
|
||||
size_t nll;
|
||||
char *this_str = *str;
|
||||
size_t this_strlen;
|
||||
int n;
|
||||
char *cptr = (char*) ((ptr->p) + ptroffset);
|
||||
unsigned char *ucptr = (unsigned char*) ((ptr->p) + ptroffset);
|
||||
H5T_class_t tclass = H5Tget_class(tid);
|
||||
size_t size = H5Tget_size(tid);
|
||||
H5T_sign_t nsign = H5Tget_sign(tid);
|
||||
int bdata_print = 0;
|
||||
|
||||
if (!str || !ptr)
|
||||
return 0;
|
||||
|
||||
/* Build default formats for long long types */
|
||||
if (!fmt_llong[0]) {
|
||||
sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
|
||||
sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
|
||||
} /* end if */
|
||||
|
||||
this_strlen = HDstrlen(this_str);
|
||||
|
||||
switch (tclass) {
|
||||
case H5T_FLOAT:
|
||||
if (sizeof(float) == size) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_float = 0;
|
||||
sscanf(token, "%f", &tmp_float);
|
||||
HDmemcpy(cptr, &tmp_float, sizeof(float));
|
||||
}
|
||||
else if (sizeof(double) == size) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_double = 0;
|
||||
sscanf(token, "%%lf", &tmp_double);
|
||||
HDmemcpy(cptr, &tmp_double, sizeof(double));
|
||||
}
|
||||
#if H5_SIZEOF_LONG_DOUBLE !=0
|
||||
else if (sizeof(long double) == size) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_ldouble = 0;
|
||||
sscanf(token, "%Lf", &tmp_ldouble);
|
||||
HDmemcpy(cptr, &tmp_ldouble, sizeof(long double));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case H5T_STRING:
|
||||
{
|
||||
if (this_strlen > 0) {
|
||||
HDstrncpy(cptr, this_str, size);
|
||||
}
|
||||
else {
|
||||
cptr = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case H5T_INTEGER:
|
||||
if (sizeof(char) == size) {
|
||||
if(H5T_SGN_NONE == nsign) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_uchar = 0;
|
||||
sscanf(token, "%hu", &tmp_uchar);
|
||||
HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char));
|
||||
}
|
||||
else {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_char = 0;
|
||||
sscanf(token, "%hd", &tmp_char);
|
||||
HDmemcpy(cptr, &tmp_char, sizeof(char));
|
||||
}
|
||||
}
|
||||
else if (sizeof(int) == size) {
|
||||
if(H5T_SGN_NONE == nsign) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_UINT)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_uint = 0;
|
||||
sscanf(token, "%u", &tmp_uint);
|
||||
HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int));
|
||||
}
|
||||
else {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_INT)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_int = 0;
|
||||
sscanf(token, "%d", &tmp_int);
|
||||
HDmemcpy(cptr, &tmp_int, sizeof(int));
|
||||
}
|
||||
}
|
||||
else if (sizeof(short) == size) {
|
||||
if(H5T_SGN_NONE == nsign) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_ushort = 0;
|
||||
sscanf(token, "%u", &tmp_ushort);
|
||||
HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
|
||||
}
|
||||
else {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_short = 0;
|
||||
sscanf(token, "%d", &tmp_short);
|
||||
HDmemcpy(&tmp_short, cptr, sizeof(short));
|
||||
}
|
||||
}
|
||||
else if (sizeof(long) == size) {
|
||||
if(H5T_SGN_NONE == nsign) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_ulong = 0;
|
||||
sscanf(token, "%lu", &tmp_ulong);
|
||||
HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long));
|
||||
}
|
||||
else {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_LONG)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_long = 0;
|
||||
sscanf(token, "%ld", &tmp_long);
|
||||
HDmemcpy(cptr, &tmp_long, sizeof(long));
|
||||
}
|
||||
}
|
||||
else if (sizeof(long long) == size) {
|
||||
if(H5T_SGN_NONE == nsign) {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_ullong = 0;
|
||||
sscanf(token, fmt_ullong, &tmp_ullong);
|
||||
HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long));
|
||||
}
|
||||
else {
|
||||
/* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
tmp_llong = 0;
|
||||
sscanf(token, fmt_llong, &tmp_llong);
|
||||
HDmemcpy(cptr, &tmp_llong, sizeof(long long));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case H5T_COMPOUND:
|
||||
{
|
||||
unsigned i;
|
||||
n = H5Tget_nmembers(tid);
|
||||
/* remove compound indicators */
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
if (str[0] == '{')
|
||||
str++;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
offset = H5Tget_member_offset(tid, i);
|
||||
mtid = H5Tget_member_type(tid, i);
|
||||
h5str_convert(str, container, mtid, ptr, offset, expand_data);
|
||||
/* remove compound indicators */
|
||||
if (str[0] == ',')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
H5Tclose(mtid);
|
||||
}
|
||||
/* remove compound indicators */
|
||||
if (str[0] == '}')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
break;
|
||||
case H5T_ENUM:
|
||||
{
|
||||
char enum_name[1024];
|
||||
void *value;
|
||||
if (sizeof(char) == size) {
|
||||
tmp_uchar = 0;
|
||||
value = &tmp_uchar;
|
||||
}
|
||||
else if (sizeof(short) == size) {
|
||||
tmp_ushort = 0;
|
||||
value = &tmp_ushort;
|
||||
}
|
||||
else if (sizeof(long) == size) {
|
||||
tmp_ulong = 0;
|
||||
value = &tmp_ulong;
|
||||
}
|
||||
else if (sizeof(long long) == size) {
|
||||
tmp_ullong = 0;
|
||||
value = &tmp_ullong;
|
||||
}
|
||||
else {
|
||||
tmp_uint = 0;
|
||||
value = &tmp_uint;
|
||||
}
|
||||
token = HDstrtok (this_str, delimiter);
|
||||
H5Tenum_valueof(tid, token, value);
|
||||
HDmemcpy(ucptr, value, size);
|
||||
}
|
||||
break;
|
||||
case H5T_REFERENCE:
|
||||
/* TODO handle reference writing */
|
||||
cptr = NULL;
|
||||
break;
|
||||
case H5T_ARRAY:
|
||||
{
|
||||
int rank = 0;
|
||||
hsize_t i, dims[H5S_MAX_RANK], total_elmts;
|
||||
/* remove array indicators */
|
||||
if (str[0] == '[')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
|
||||
mtid = H5Tget_super(tid);
|
||||
offset = H5Tget_size(mtid);
|
||||
rank = H5Tget_array_ndims(tid);
|
||||
|
||||
H5Tget_array_dims2(tid, dims);
|
||||
|
||||
total_elmts = 1;
|
||||
for (i = 0; i < rank; i++)
|
||||
total_elmts *= dims[i];
|
||||
|
||||
cptr = HDcalloc((size_t)total_elmts, offset);
|
||||
for (i = 0; i < total_elmts; i++) {
|
||||
h5str_convert(str, container, mtid, cptr + (i*offset), offset, expand_data);
|
||||
/* remove array indicators */
|
||||
if (str[0] == ',')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
H5Tclose(mtid);
|
||||
/* remove array indicators */
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
if (str[0] == ']')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
break;
|
||||
case H5T_VLEN:
|
||||
{
|
||||
unsigned int i;
|
||||
mtid = H5Tget_super(tid);
|
||||
offset = H5Tget_size(mtid);
|
||||
|
||||
/* remove vlen indicators */
|
||||
if (str[0] == '{')
|
||||
str++;
|
||||
cptr = HDcalloc(offset, sizeof(hvl_t));
|
||||
for (i = 0; (i*offset) < (int)size; i++) {
|
||||
h5str_sprintf(str, container, mtid, cptr + (i*offset), offset, expand_data);
|
||||
/* remove vlen indicators */
|
||||
if (str[0] == ',')
|
||||
str++;
|
||||
if (str[0] == ' ')
|
||||
str++;
|
||||
}
|
||||
H5Tclose(mtid);
|
||||
/* remove vlen indicators */
|
||||
if (str[0] == '}')
|
||||
str++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* All other types get copied raw */
|
||||
HDmemcpy(ucptr, this_str, size);
|
||||
}
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
return this_strlen;
|
||||
} /* end h5str_convert */
|
||||
|
||||
/** print value of a vlen data point into string.
|
||||
Return Value:
|
||||
On success, the total number of characters printed is returned.
|
||||
|
@ -41,6 +41,8 @@ extern void h5str_resize (h5str_t *str, size_t new_len);
|
||||
extern char* h5str_append (h5str_t *str, const char* cstr);
|
||||
extern size_t h5str_vlsprintf(h5str_t *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
|
||||
extern size_t h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int ptrlen, int expand_data);
|
||||
extern size_t h5str_vlsconvert(char *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
|
||||
extern size_t h5str_convert(char **str, hid_t container, hid_t tid, hvl_t *buf, int ptroffset, int expand_data);
|
||||
extern void h5str_array_free(char **strs, size_t len);
|
||||
extern int h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order);
|
||||
extern int h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_obj);
|
||||
|
@ -28,7 +28,7 @@ classes:
|
||||
|
||||
pkgpath = test
|
||||
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
|
||||
CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
|
||||
|
||||
jarfile = jar$(PACKAGE_TARNAME)test.jar
|
||||
|
||||
|
@ -62,8 +62,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.*
|
||||
LIST_JAR_FILES="
|
||||
$HDFLIB_HOME/hamcrest-core.jar
|
||||
$HDFLIB_HOME/junit.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.5.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
|
||||
$HDFLIB_HOME/slf4j-api-1.7.25.jar
|
||||
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
|
||||
$top_builddir/java/src/$JARFILE
|
||||
"
|
||||
LIST_DATA_FILES="
|
||||
@ -249,7 +249,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
|
||||
COPY_LIBFILES_TO_BLDLIBDIR
|
||||
COPY_DATAFILES_TO_BLDDIR
|
||||
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
|
||||
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
|
||||
|
||||
TEST=/usr/bin/test
|
||||
if [ ! -x /usr/bin/test ]
|
||||
@ -309,7 +309,9 @@ if diff JUnit-TestH5.out JUnit-TestH5.txt > /dev/null; then
|
||||
echo " PASSED JUnit-TestH5"
|
||||
else
|
||||
echo "**FAILED** JUnit-TestH5"
|
||||
echo " Expected result differs from actual result"
|
||||
nerrors="`expr $nerrors + 1`"
|
||||
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams"
|
||||
|
Loading…
x
Reference in New Issue
Block a user