Merge pull request #257 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop

* commit '7e73366e912920eb374a404653cd7ad026c63970':
  HDFFV-10118 fix data
  HDFFV-10118 change h5ls to not display extra info
  HDFFV-10118 fixed plugin tests for tools
This commit is contained in:
Larry Knox 2017-01-20 22:54:11 -06:00
commit f5389fb6e9
14 changed files with 127 additions and 129 deletions

View File

@ -151,7 +151,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* layout of the source and destination, and the data for the array passed as a block of bytes, for instance,
*
* <pre>
* herr_t H5Dread(int fid, int filetype, int memtype, int memspace,
* herr_t H5Dread(long fid, long filetype, long memtype, long memspace,
* void * data);
* </pre>
*
@ -171,7 +171,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* library. So the function above would be declared:
*
* <pre>
* public synchronized static native int H5Dread(int fid, int filetype, int memtype, int memspace, Object data);
* public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data);
* </pre>
* OPEN_IDS.addElement(id);
@ -192,7 +192,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* can be accessed as public variables of the Java class, such as:
*
* <pre>
* int data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
* long data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
* </pre>
*
* The Java application uses both types of constants the same way, the only difference is that the

View File

@ -12,59 +12,52 @@
* to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Raymond Lu
* 13 February 2013
*
* Purpose: Tests the plugin module (H5PL)
* Purpose: Tests the plugin module (H5PL)
*/
#include <stdlib.h>
#include <stdio.h>
#include "H5PLextern.h"
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIBUD 300
#define MULTIPLIER 3
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB2[1] = {{
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIB2, /* Filter id number */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
"dynlib2", /* Filter name for debugging */
"dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
(H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
(H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib2
* Function: H5Z_filter_dynlibud
*
* Purpose: A dynlib2 filter method that multiplies the original value
* Purpose: A dynlib2 filter method that multiplies the original value
* during write and divide the original value during read. It
* will be built as a shared library. plugin.c test will load
* and use this filter library.
* will be built as a shared library. plugin.c test will load
* and use this filter library.
*
* Return: Success: Data chunk size
*
* Failure: 0
*
* Programmer: Raymond Lu
* 29 March 2013
* Return: Success: Data chunk size
*
* Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
int *int_ptr = (int *)*buf; /* Pointer to the data values */
char *int_ptr = (char *)*buf; /* Pointer to the data values */
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
cd_values = cd_values;
if(flags & H5Z_FLAG_REVERSE) { /*read*/
/* Divide the original value with MULTIPLIER */
/* Subtract the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ /= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp - MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end if */
else { /*write*/
/* Multiply the original value with MULTIPLIER */
/* Add the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ *= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp + MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end else */
return nbytes;
} /* end H5Z_filter_dynlib2() */
} /* end H5Z_filter_dynlibud() */

View File

@ -2,10 +2,10 @@
file1 file2
---------------------------------------
x x /
x x /dynlib2
x x /dynlibud
group : </> and </>
0 differences found
dataset: </dynlib2> and </dynlib2>
dataset: </dynlibud> and </dynlibud>
0 differences found
EXIT CODE: 0

View File

@ -2,11 +2,11 @@
file1 file2
---------------------------------------
x x /
x x /dynlib2
x x /dynlibud
group : </> and </>
0 differences found
dataset: </dynlib2> and </dynlib2>
dataset: </dynlibud> and </dynlibud>
0 differences found
warning: dataset </dynlib2> cannot be read, user defined filter is not available
warning: dataset </dynlibud> cannot be read, user defined filter is not available
EXIT CODE: 2

View File

@ -12,59 +12,52 @@
* to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Raymond Lu
* 13 February 2013
*
* Purpose: Tests the plugin module (H5PL)
* Purpose: Tests the plugin module (H5PL)
*/
#include <stdlib.h>
#include <stdio.h>
#include "H5PLextern.h"
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIBUD 300
#define MULTIPLIER 3
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB2[1] = {{
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIB2, /* Filter id number */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
"dynlib2", /* Filter name for debugging */
"dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
(H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
(H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib2
* Function: H5Z_filter_dynlibud
*
* Purpose: A dynlib2 filter method that multiplies the original value
* Purpose: A dynlib2 filter method that multiplies the original value
* during write and divide the original value during read. It
* will be built as a shared library. plugin.c test will load
* and use this filter library.
* will be built as a shared library. plugin.c test will load
* and use this filter library.
*
* Return: Success: Data chunk size
*
* Failure: 0
*
* Programmer: Raymond Lu
* 29 March 2013
* Return: Success: Data chunk size
*
* Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
int *int_ptr = (int *)*buf; /* Pointer to the data values */
char *int_ptr = (char *)*buf; /* Pointer to the data values */
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
cd_values = cd_values;
if(flags & H5Z_FLAG_REVERSE) { /*read*/
/* Divide the original value with MULTIPLIER */
/* Subtract the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ /= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp - MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end if */
else { /*write*/
/* Multiply the original value with MULTIPLIER */
/* Add the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ *= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp + MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end else */
return nbytes;
} /* end H5Z_filter_dynlib2() */
} /* end H5Z_filter_dynlibud() */

View File

@ -154,21 +154,21 @@ const H5Z_class2_t H5Z_MYFILTER[1] = {{
myfilter, /* The actual filter function */
}};
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIBUD 300
#define MULTIPLIER 3
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB2[1] = {{
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIB2, /* Filter id number */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
"dynlib2", /* Filter name for debugging */
"dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
(H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
(H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
@ -10314,6 +10314,7 @@ static void gent_udfilter(void)
{
hid_t fid; /* file id */
hid_t dcpl; /* dataset creation property list */
hid_t dsid; /* dataset ID */
hid_t sid; /* dataspace ID */
hid_t tid; /* datatype ID */
@ -10344,13 +10345,22 @@ static void gent_udfilter(void)
ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
HDassert(ret >= 0);
ret = H5Zregister (H5Z_DYNLIB2);
ret = H5Zregister (H5Z_DYNLIBUD);
HDassert(ret >= 0);
ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL);
ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL);
HDassert(ret >= 0);
ret=make_dset(fid, "dynlib2", sid, H5T_NATIVE_INT, dcpl, buf1);
/* create the dataset */
dsid = H5Dcreate2(fid, "dynlibud", H5T_STD_I32LE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
HDassert(dsid >= 0);
/* write */
ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1);
HDassert(ret >= 0);
/* close */
ret = H5Dclose(dsid);
HDassert(ret >= 0);
/* remove the filters from the dcpl */
@ -10372,9 +10382,9 @@ static void gent_udfilter(void)
}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib2
* Function: H5Z_filter_dynlibud
*
* Purpose: A dynlib2 filter method that multiplies the original value
* Purpose: A dynlibud filter method that multiplies the original value
* during write and divide the original value during read. It
* will be built as a shared library. tools tests will load
* and use this filter as a plugin library.
@ -10385,11 +10395,11 @@ static void gent_udfilter(void)
*-------------------------------------------------------------------------
*/
static size_t
H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
int *int_ptr = (int *)*buf; /* Pointer to the data values */
char *int_ptr = (char *)*buf; /* Pointer to the data values */
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
@ -10400,22 +10410,26 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
cd_values = cd_values;
if(flags & H5Z_FLAG_REVERSE) { /*read*/
/* Divide the original value with MULTIPLIER */
/* Subtract the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ /= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp - MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end if */
else { /*write*/
/* Multiply the original value with MULTIPLIER */
/* Add the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ *= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp + MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end else */
return nbytes;
} /* end H5Z_filter_dynlib2() */
} /* end H5Z_filter_dynlibud() */
/*-------------------------------------------------------------------------
* Function: main

View File

@ -443,4 +443,4 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -v -d tudfilter.h5)
ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5)

View File

@ -12,59 +12,52 @@
* to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Raymond Lu
* 13 February 2013
*
* Purpose: Tests the plugin module (H5PL)
* Purpose: Tests the plugin module (H5PL)
*/
#include <stdlib.h>
#include <stdio.h>
#include "H5PLextern.h"
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIBUD 300
#define MULTIPLIER 3
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB2[1] = {{
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIB2, /* Filter id number */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
"dynlib2", /* Filter name for debugging */
"dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
(H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
(H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib2
* Function: H5Z_filter_dynlibud
*
* Purpose: A dynlib2 filter method that multiplies the original value
* Purpose: A dynlib2 filter method that multiplies the original value
* during write and divide the original value during read. It
* will be built as a shared library. plugin.c test will load
* and use this filter library.
* will be built as a shared library. plugin.c test will load
* and use this filter library.
*
* Return: Success: Data chunk size
*
* Failure: 0
*
* Programmer: Raymond Lu
* 29 March 2013
* Return: Success: Data chunk size
*
* Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
int *int_ptr = (int *)*buf; /* Pointer to the data values */
char *int_ptr = (char *)*buf; /* Pointer to the data values */
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
cd_values = cd_values;
if(flags & H5Z_FLAG_REVERSE) { /*read*/
/* Divide the original value with MULTIPLIER */
/* Subtract the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ /= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp - MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end if */
else { /*write*/
/* Multiply the original value with MULTIPLIER */
/* Add the original value with MULTIPLIER */
while(buf_left > 0) {
*int_ptr++ *= MULTIPLIER;
buf_left -= sizeof(int);
char temp = *int_ptr;
*int_ptr = temp + MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end else */
return nbytes;
} /* end H5Z_filter_dynlib2() */
} /* end H5Z_filter_dynlibud() */

View File

@ -233,7 +233,7 @@ TOOLTEST() {
COPY_TESTFILES_TO_TESTDIR
# Run the test
TOOLTEST tudfilter.ls 0 -w80 -v -d tudfilter.h5
TOOLTEST tudfilter.ls 0 -w80 -d tudfilter.h5
# print results
if test $nerrors -ne 0 ; then

View File

@ -1,6 +1,6 @@
HDF5 "tudfilter.h5" {
GROUP "/" {
DATASET "dynlib2" {
DATASET "dynlibud" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
DATA {

Binary file not shown.

View File

@ -1,11 +1,4 @@
Opened "tudfilter.h5" with sec2 driver.
dynlib2 Dataset {20/20, 10/10}
Location: 1:800
Links: 1
Chunks: {10, 5} 200 bytes
Storage: 800 logical bytes, 800 allocated bytes, 100.00% utilization
Filter-0: dynlib2-258 {}
Type: native int
dynlibud Dataset {20, 10}
Data:
(0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
(1,9) 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,