diff options
Diffstat (limited to 'hl')
29 files changed, 471 insertions, 471 deletions
diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am index 63e95b6..32ea8e9 100644 --- a/hl/c++/src/Makefile.am +++ b/hl/c++/src/Makefile.am @@ -15,7 +15,7 @@ ## Run automake to generate a Makefile.in from this file. # # HDF5-C++ Makefile(.in) -# +# include $(top_srcdir)/config/commence.am diff --git a/hl/c++/test/Makefile.am b/hl/c++/test/Makefile.am index d438e41..95917f0 100644 --- a/hl/c++/test/Makefile.am +++ b/hl/c++/test/Makefile.am @@ -15,7 +15,7 @@ ## Run automake to generate a Makefile.in from this file. # # HDF5-C++ Makefile(.in) -# +# include $(top_srcdir)/config/commence.am diff --git a/hl/examples/ex_ds1.c b/hl/examples/ex_ds1.c index 096a452..e89564d 100644 --- a/hl/examples/ex_ds1.c +++ b/hl/examples/ex_ds1.c @@ -59,7 +59,7 @@ int main(void) if (H5LTmake_dataset_int(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf)<0) goto out; - + /*------------------------------------------------------------------------- * attach the DS_1_NAME dimension scale to DSET_NAME at dimension 0 *------------------------------------------------------------------------- @@ -100,7 +100,7 @@ int main(void) /* close file */ H5Fclose(fid); - + return 0; out: diff --git a/hl/examples/ex_image1.c b/hl/examples/ex_image1.c index ec7b4c2..a68a5ca 100644 --- a/hl/examples/ex_image1.c +++ b/hl/examples/ex_image1.c @@ -37,7 +37,7 @@ int main( void ) 252,252,84, /* yellow */ 252,168,0, /* orange */ 252,0,0}; /* red */ - + /* create an image of 9 values divided evenly by the array */ space = WIDTH*HEIGHT / PAL_ENTRIES; for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ ) @@ -50,22 +50,22 @@ int main( void ) } if (n>PAL_ENTRIES-1) n=0; } - + /* create a new HDF5 file using default properties. */ file_id = H5Fcreate( "ex_image1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* make the image */ status = H5IMmake_image_8bit( file_id, "image1", WIDTH, HEIGHT, buf ); - + /* make a palette */ status = H5IMmake_palette( file_id, "pallete", pal_dims, pal ); - + /* attach the palette to the image */ status = H5IMlink_palette( file_id, "image1", "pallete" ); - + /* close the file. */ status = H5Fclose( file_id ); - + return 0; - + } diff --git a/hl/examples/ex_image2.c b/hl/examples/ex_image2.c index 0b7876d..94b05a5 100644 --- a/hl/examples/ex_image2.c +++ b/hl/examples/ex_image2.c @@ -25,7 +25,7 @@ #define PAL_ENTRIES 256 static int read_data(const char* file_name, hsize_t *width, hsize_t *height ); -unsigned char *gbuf = 0; /* global buffer for image data */ +unsigned char *gbuf = 0; /* global buffer for image data */ int main( void ) { @@ -34,20 +34,20 @@ int main( void ) hsize_t height; /* height of image */ unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ - herr_t status, i, n; - + herr_t status, i, n; + /* create a new HDF5 file using default properties. */ file_id = H5Fcreate( "ex_image2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* read first data file */ if (read_data(DATA_FILE1,&width,&height)<0) goto out; - + /* make the image */ status=H5IMmake_image_8bit( file_id, IMAGE1_NAME, width, height, gbuf ); /*------------------------------------------------------------------------- - * define a palette, blue to red tones + * define a palette, blue to red tones *------------------------------------------------------------------------- */ for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++) @@ -71,7 +71,7 @@ int main( void ) /* read second data file */ if (read_data(DATA_FILE2,&width,&height)<0) goto out; - + /* make dataset */ status=H5IMmake_image_24bit( file_id, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf ); diff --git a/hl/examples/ex_lite1.c b/hl/examples/ex_lite1.c index 35abb2c..1346036 100644 --- a/hl/examples/ex_lite1.c +++ b/hl/examples/ex_lite1.c @@ -21,17 +21,17 @@ int main( void ) { - hid_t file_id; + hid_t file_id; hsize_t dims[RANK]={2,3}; int data[6]={1,2,3,4,5,6}; herr_t status; - + /* create a HDF5 file */ - file_id = H5Fcreate ("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + file_id = H5Fcreate ("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* create and write an integer type dataset named "dset" */ status = H5LTmake_dataset(file_id,"/dset",RANK,dims,H5T_NATIVE_INT,data); - + /* close file */ status = H5Fclose (file_id); diff --git a/hl/examples/ex_lite2.c b/hl/examples/ex_lite2.c index fcb1c9d..2816843 100644 --- a/hl/examples/ex_lite2.c +++ b/hl/examples/ex_lite2.c @@ -17,21 +17,21 @@ int main( void ) { - hid_t file_id; + hid_t file_id; int data[6]; hsize_t dims[2]; herr_t status; hsize_t i, j, nrow, n_values; - + /* open file from ex_lite1.c */ - file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT); + file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT); /* read dataset */ status = H5LTread_dataset_int(file_id,"/dset",data); /* get the dimensions of the dataset */ status = H5LTget_dataset_info(file_id,"/dset",dims,NULL,NULL); - + /* print it by rows */ n_values = dims[0] * dims[1]; nrow = dims[1]; @@ -41,7 +41,7 @@ int main( void ) printf (" %d", data[i*nrow + j]); printf ("\n"); } - + /* close file */ status = H5Fclose (file_id); diff --git a/hl/examples/ex_lite3.c b/hl/examples/ex_lite3.c index cc6e591..069f56a 100644 --- a/hl/examples/ex_lite3.c +++ b/hl/examples/ex_lite3.c @@ -20,16 +20,16 @@ int main( void ) { - hid_t file_id; + hid_t file_id; hid_t dset_id; - hid_t space_id; + hid_t space_id; hsize_t dims[1] = { ATTR_SIZE }; int data[ATTR_SIZE] = {1,2,3,4,5}; - herr_t status; + herr_t status; int i; - + /* create a file */ - file_id = H5Fcreate ("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id = H5Fcreate ("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* create a data space */ space_id = H5Screate_simple(1,dims,NULL); @@ -45,7 +45,7 @@ int main( void ) * example of H5LTset_attribute_int *------------------------------------------------------------------------- */ - + /* create and write the attribute "attr1" on the dataset "dset" */ status = H5LTset_attribute_int(file_id,"dset","attr1",data,ATTR_SIZE); diff --git a/hl/examples/ex_table_01.c b/hl/examples/ex_table_01.c index b3771f4..ba1ff57 100644 --- a/hl/examples/ex_table_01.c +++ b/hl/examples/ex_table_01.c @@ -19,7 +19,7 @@ /*------------------------------------------------------------------------- * Table API example * - * H5TBmake_table + * H5TBmake_table * H5TBread_table * *------------------------------------------------------------------------- @@ -32,17 +32,17 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; Particle dst_buf[NRECORDS]; - + /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size = sizeof( Particle ); size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ), @@ -56,10 +56,10 @@ int main( void ) sizeof( dst_buf[0].longi), sizeof( dst_buf[0].pressure), sizeof( dst_buf[0].temperature)}; - - + + /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -71,7 +71,7 @@ int main( void ) }; /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -79,7 +79,7 @@ int main( void ) hsize_t chunk_size = 10; int *fill_data = NULL; int compress = 0; - herr_t status; + herr_t status; int i; /* Initialize field_type */ @@ -90,21 +90,21 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_01.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /*------------------------------------------------------------------------- - * H5TBmake_table + * H5TBmake_table *------------------------------------------------------------------------- */ - status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - + /*------------------------------------------------------------------------- - * H5TBread_table + * H5TBread_table *------------------------------------------------------------------------- */ @@ -112,7 +112,7 @@ int main( void ) /* print it by rows */ for (i=0; i<NRECORDS; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -120,12 +120,12 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /*------------------------------------------------------------------------- * end *------------------------------------------------------------------------- */ - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_02.c b/hl/examples/ex_table_02.c index acefef3..3580151 100644 --- a/hl/examples/ex_table_02.c +++ b/hl/examples/ex_table_02.c @@ -31,19 +31,19 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; Particle dst_buf[NRECORDS+NRECORDS_ADD]; /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -67,9 +67,9 @@ int main( void ) sizeof( p_data[0].longi), sizeof( p_data[0].pressure), sizeof( p_data[0].temperature)}; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -77,11 +77,11 @@ int main( void ) hsize_t chunk_size = 10; int *fill_data = NULL; int compress = 0; - herr_t status; + herr_t status; int i; - /* Append particles */ - Particle particle_in[ NRECORDS_ADD ] = + /* Append particles */ + Particle particle_in[ NRECORDS_ADD ] = {{ "eight",80,80, 8.0f, 80.0}, {"nine",90,90, 9.0f, 90.0} }; @@ -93,17 +93,17 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_02.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* make a table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, - dst_size, field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, + dst_size, field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); /* append two records */ - status=H5TBappend_records(file_id, TABLE_NAME,NRECORDS_ADD, dst_size, dst_offset, dst_sizes, + status=H5TBappend_records(file_id, TABLE_NAME,NRECORDS_ADD, dst_size, dst_offset, dst_sizes, &particle_in ); /* read the table */ @@ -111,7 +111,7 @@ int main( void ) /* print it by rows */ for (i=0; i<NRECORDS+NRECORDS_ADD; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -119,7 +119,7 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_03.c b/hl/examples/ex_table_03.c index 7357dd2..fe4f401 100644 --- a/hl/examples/ex_table_03.c +++ b/hl/examples/ex_table_03.c @@ -32,13 +32,13 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; Particle dst_buf[NRECORDS]; @@ -50,19 +50,19 @@ int main( void ) HOFFSET( Particle, longi ), HOFFSET( Particle, pressure ), HOFFSET( Particle, temperature )}; - + Particle p = {"zero",0,0, 0.0f, 0.0}; size_t dst_sizes[NFIELDS] = { sizeof( p.name), sizeof( p.lati), sizeof( p.longi), sizeof( p.pressure), sizeof( p.temperature)}; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; - /* Fill value particle */ - Particle fill_data[1] = + /* Fill value particle */ + Particle fill_data[1] = { {"no data",-1,-1, -99.0f, -99.0} }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -73,8 +73,8 @@ int main( void ) herr_t status; int i; - /* Define 2 new particles to write */ - Particle particle_in[NRECORDS_WRITE] = + /* Define 2 new particles to write */ + Particle particle_in[NRECORDS_WRITE] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0} }; @@ -95,21 +95,21 @@ int main( void ) file_id, TABLE_NAME, NFIELDS, - NRECORDS, - dst_size, - field_names, - dst_offset, - field_type, - chunk_size, - fill_data, + NRECORDS, + dst_size, + field_names, + dst_offset, + field_type, + chunk_size, + fill_data, 0, /* no compression */ NULL ); /* no data written */ /* Overwrite 2 records starting at record 0 */ - start = 0; - nrecords = NRECORDS_WRITE; - status=H5TBwrite_records( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, + start = 0; + nrecords = NRECORDS_WRITE; + status=H5TBwrite_records( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, dst_sizes, particle_in); /* read the table */ @@ -117,7 +117,7 @@ int main( void ) /* print it by rows */ for (i=0; i<NRECORDS; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -125,7 +125,7 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_04.c b/hl/examples/ex_table_04.c index c9559ef..55f4ee8 100644 --- a/hl/examples/ex_table_04.c +++ b/hl/examples/ex_table_04.c @@ -30,24 +30,24 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; /* Define a subset of Particle, with latitude and longitude fields */ - typedef struct Position + typedef struct Position { int lati; int longi; } Position; /* Define a subset of Particle, with name and pressure fields */ - typedef struct NamePressure + typedef struct NamePressure { char name[16]; float pressure; @@ -76,12 +76,12 @@ int main( void ) hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = - { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ + Particle fill_data[1] = + { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ hsize_t start; /* Record to start reading/writing */ hsize_t nrecords; /* Number of records to read/write */ int compress = 0; - herr_t status; + herr_t status; int i; Particle *p_data = NULL; /* Initially no data */ float pressure_in [NRECORDS] = /* Define new values for the field "Pressure" */ @@ -89,21 +89,21 @@ int main( void ) Position position_in[NRECORDS] = { /* Define new values for "Latitude,Longitude" */ {0,0}, {10,10}, - {20,20}, - {30,30}, + {20,20}, + {30,30}, {40,40}, - {50,50}, - {60,60}, + {50,50}, + {60,60}, {70,70} }; NamePressure namepre_in[NRECORDS] = /* Define new values for "Name,Pressure" */ { {"zero",0.0f}, - {"one", 1.0f}, - {"two", 2.0f}, - {"three", 3.0f}, + {"one", 1.0f}, + {"two", 2.0f}, + {"three", 3.0f}, {"four", 4.0f}, {"five", 5.0f}, - {"six", 6.0f}, - {"seven", 7.0f}, + {"six", 6.0f}, + {"seven", 7.0f}, }; size_t field_sizes_pos[2]= { @@ -111,12 +111,12 @@ int main( void ) sizeof(position_in[0].lati) }; size_t field_sizes_namepre[2]= - { + { sizeof(namepre_in[0].name), sizeof(namepre_in[0].pressure) }; size_t field_sizes_pre[1]= - { + { sizeof(namepre_in[0].pressure) }; @@ -133,20 +133,20 @@ int main( void ) file_id = H5Fcreate( "ex_table_04.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* Make the table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); /* Write the pressure field starting at record 2 */ - start = 2; - nrecords = 3; - status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Pressure", start, nrecords, + start = 2; + nrecords = 3; + status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Pressure", start, nrecords, sizeof( float ), 0, field_sizes_pre, pressure_in ); /* Write the new longitude and latitude information starting at record 2 */ - start = 2; - nrecords = 3; - status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords, + start = 2; + nrecords = 3; + status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords, sizeof( Position ), field_offset_pos, field_sizes_pos, position_in ); /* read the table */ @@ -154,7 +154,7 @@ int main( void ) /* print it by rows */ for (i=0; i<NRECORDS; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -162,12 +162,12 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /*------------------------------------------------------------------------- * end *------------------------------------------------------------------------- */ - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_05.c b/hl/examples/ex_table_05.c index 62c231d..b39ef1d 100644 --- a/hl/examples/ex_table_05.c +++ b/hl/examples/ex_table_05.c @@ -31,29 +31,29 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; /* Define a subset of Particle, with latitude and longitude fields */ - typedef struct Position + typedef struct Position { int lati; int longi; } Position; /* Define a subset of Particle, with name and pressure fields */ - typedef struct NamePressure + typedef struct NamePressure { char name[16]; float pressure; } NamePressure; - + /* Calculate the type_size and the offsets of our struct members */ Particle dst_buf[NRECORDS]; size_t dst_size = sizeof( Particle ); @@ -70,28 +70,28 @@ int main( void ) size_t field_offset_pos[2] = { HOFFSET( Position, lati ), HOFFSET( Position, longi )}; - + /* Initially no data */ Particle *p_data = NULL; /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = - { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ + Particle fill_data[1] = + { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ int compress = 0; hsize_t nfields; hsize_t start; /* Record to start reading/writing */ hsize_t nrecords; /* Number of records to read/write */ - herr_t status; + herr_t status; int i; /* Define new values for the field "Pressure" */ - float pressure_in [NRECORDS] = + float pressure_in [NRECORDS] = { 0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f }; int field_index_pre[1] = { 3 }; @@ -100,11 +100,11 @@ int main( void ) /* Define new values for the fields "Latitude,Longitude" */ Position position_in[NRECORDS] = { {0,0}, {10,10}, - {20,20}, - {30,30}, + {20,20}, + {30,30}, {40,40}, - {50,50}, - {60,60}, + {50,50}, + {60,60}, {70,70} }; size_t field_sizes_pos[2]= @@ -112,9 +112,9 @@ int main( void ) sizeof(position_in[0].longi), sizeof(position_in[0].lati) }; - + size_t field_sizes_pre[1]= - { + { sizeof(float) }; @@ -126,27 +126,27 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_05.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* Make the table */ - status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); /* Write the pressure field starting at record 2 */ nfields = 1; - start = 2; - nrecords = 3; - status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords, + start = 2; + nrecords = 3; + status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords, sizeof( float ), 0, field_sizes_pre, pressure_in ); /* Write the new longitude and latitude information starting at record 2 */ nfields = 2; - start = 2; - nrecords = 3; - status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords, + start = 2; + nrecords = 3; + status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords, sizeof( Position ), field_offset_pos, field_sizes_pos, position_in ); /* read the table */ @@ -154,7 +154,7 @@ int main( void ) /* print it by rows */ for (i=0; i<NRECORDS; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -162,7 +162,7 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_06.c b/hl/examples/ex_table_06.c index 377afc3..a0d6017 100644 --- a/hl/examples/ex_table_06.c +++ b/hl/examples/ex_table_06.c @@ -30,13 +30,13 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; /* Calculate the size and the offsets of our struct members in memory */ @@ -46,20 +46,20 @@ int main( void ) HOFFSET( Particle, longi ), HOFFSET( Particle, pressure ), HOFFSET( Particle, temperature )}; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = - { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ + Particle fill_data[1] = + { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ int compress = 0; hsize_t nfields_out; hsize_t nrecords_out; - herr_t status; + herr_t status; /* Initialize field_type */ string_type = H5Tcopy( H5T_C_S1 ); @@ -69,13 +69,13 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_06.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* Make a table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size, - field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size, + field_names, dst_offset, field_type, chunk_size, fill_data, compress, NULL); /* Get table info */ @@ -83,7 +83,7 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* Close the file. */ H5Fclose( file_id ); diff --git a/hl/examples/ex_table_07.c b/hl/examples/ex_table_07.c index eb365b2..2d80967 100644 --- a/hl/examples/ex_table_07.c +++ b/hl/examples/ex_table_07.c @@ -30,13 +30,13 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; /* Calculate the size and the offsets of our struct members in memory */ @@ -46,9 +46,9 @@ int main( void ) HOFFSET( Particle, longi ), HOFFSET( Particle, pressure ), HOFFSET( Particle, temperature )}; - + /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -66,14 +66,14 @@ int main( void ) hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = + Particle fill_data[1] = { {"no data",-1,-1, -99.0f, -99.0} }; hsize_t start; /* Record to start reading */ hsize_t nrecords; /* Number of records to insert/delete */ hsize_t nfields_out; hsize_t nrecords_out; - herr_t status; - + herr_t status; + /* Initialize the field field_type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -82,18 +82,18 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_07.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make the table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - + /* Delete records */ - start = 3; - nrecords = 3; + start = 3; + nrecords = 3; status=H5TBdelete_record( file_id, TABLE_NAME, start, nrecords ); /* Get table info */ @@ -101,11 +101,11 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* Close the file. */ H5Fclose( file_id ); - + return 0; - + } diff --git a/hl/examples/ex_table_08.c b/hl/examples/ex_table_08.c index 8ce2881..fb6cab9 100644 --- a/hl/examples/ex_table_08.c +++ b/hl/examples/ex_table_08.c @@ -31,19 +31,19 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; Particle dst_buf[ NRECORDS + NRECORDS_INS ]; /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -53,7 +53,7 @@ int main( void ) {"six", 60,60, 6.0f, 60.0}, {"seven",70,70, 7.0f, 70.0} }; - + /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size = sizeof( Particle ); size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ), @@ -66,15 +66,15 @@ int main( void ) sizeof( p_data[0].longi), sizeof( p_data[0].pressure), sizeof( p_data[0].temperature)}; - + /* Define an array of Particles to insert */ - Particle p_data_insert[NRECORDS_INS] = + Particle p_data_insert[NRECORDS_INS] = { {"new",30,30, 3.0f, 30.0}, {"new",40,40, 4.0f, 40.0} }; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -88,7 +88,7 @@ int main( void ) hsize_t nfields_out; hsize_t nrecords_out; int i; - + /* Initialize the field field_type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -97,19 +97,19 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_08.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make the table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); /* Insert records */ - start = 3; - nrecords = NRECORDS_INS; - status=H5TBinsert_record( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, + start = 3; + nrecords = NRECORDS_INS; + status=H5TBinsert_record( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, dst_sizes, p_data_insert ); /* read the table */ @@ -120,10 +120,10 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* print it by rows */ for (i=0; i<nrecords_out; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -131,12 +131,12 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file. */ H5Fclose( file_id ); - + return 0; - + } diff --git a/hl/examples/ex_table_09.c b/hl/examples/ex_table_09.c index 21d1813..b02568c 100644 --- a/hl/examples/ex_table_09.c +++ b/hl/examples/ex_table_09.c @@ -32,13 +32,13 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; Particle dst_buf[ NRECORDS + NRECORDS_INS ]; @@ -57,7 +57,7 @@ int main( void ) sizeof( dst_buf[0].temperature)}; /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -69,15 +69,15 @@ int main( void ) }; /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = - { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ + Particle fill_data[1] = + { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */ hsize_t start1; /* Record to start reading from 1st table */ hsize_t nrecords; /* Number of records to insert */ hsize_t start2; /* Record to start writing in 2nd table */ @@ -85,7 +85,7 @@ int main( void ) int i; hsize_t nfields_out; hsize_t nrecords_out; - + /* Initialize the field field_type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -94,24 +94,24 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_09.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make 2 tables: TABLE2_NAME is empty */ - status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - - status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + + status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, NULL ); - - + + /* Add 2 records from TABLE1_NAME to TABLE2_NAME */ - start1 = 3; - nrecords = NRECORDS_INS; - start2 = 6; + start1 = 3; + nrecords = NRECORDS_INS; + start2 = 6; status=H5TBadd_records_from( file_id, TABLE1_NAME, start1, nrecords, TABLE2_NAME, start2 ); /* read TABLE2_NAME: it should have 2 more records now */ @@ -122,10 +122,10 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* print it by rows */ for (i=0; i<nrecords_out; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -133,10 +133,10 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file. */ H5Fclose( file_id ); - + return 0; } diff --git a/hl/examples/ex_table_10.c b/hl/examples/ex_table_10.c index 5483d52..5e87914 100644 --- a/hl/examples/ex_table_10.c +++ b/hl/examples/ex_table_10.c @@ -32,17 +32,17 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -66,10 +66,10 @@ int main( void ) sizeof( dst_buf[0].longi), sizeof( dst_buf[0].pressure), sizeof( dst_buf[0].temperature)}; - - + + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -77,11 +77,11 @@ int main( void ) hsize_t chunk_size = 10; int compress = 0; int *fill_data = NULL; - herr_t status; + herr_t status; hsize_t nfields_out; hsize_t nrecords_out; int i; - + /* Initialize the field field_type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -90,34 +90,34 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_10.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make two tables */ - status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - - status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS, - dst_size,field_names, dst_offset, field_type, + + status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS, + dst_size,field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - + /* Combine the two tables into a third in the same file */ status=H5TBcombine_tables( file_id, TABLE1_NAME, file_id, TABLE2_NAME, TABLE3_NAME ); /* read the combined table */ status=H5TBread_table( file_id, TABLE3_NAME, dst_size, dst_offset, dst_sizes, dst_buf ); - + /* Get table info */ status=H5TBget_table_info (file_id,TABLE3_NAME, &nfields_out, &nrecords_out ); - + /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* print it by rows */ for (i=0; i<nrecords_out; i++) { - printf ("%-5s %-5d %-5d %-5f %-5f", + printf ("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi, @@ -125,10 +125,10 @@ int main( void ) dst_buf[i].temperature); printf ("\n"); } - + /* Close the file */ H5Fclose( file_id ); - + return 0; } diff --git a/hl/examples/ex_table_11.c b/hl/examples/ex_table_11.c index d082f65..52aa922 100644 --- a/hl/examples/ex_table_11.c +++ b/hl/examples/ex_table_11.c @@ -30,17 +30,17 @@ int main( void ) { - typedef struct Particle1 + typedef struct Particle1 { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle1; - + /* Define an array of Particles */ - Particle1 p_data[NRECORDS] = { + Particle1 p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -50,7 +50,7 @@ int main( void ) {"six", 60,60, 6.0f, 60.0}, {"seven",70,70, 7.0f, 70.0} }; - + /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size1 = sizeof( Particle1 ); size_t dst_offset1[NFIELDS] = { HOFFSET( Particle1, name ), @@ -58,9 +58,9 @@ int main( void ) HOFFSET( Particle1, longi ), HOFFSET( Particle1, pressure ), HOFFSET( Particle1, temperature )}; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; @@ -70,14 +70,14 @@ int main( void ) Particle1 fill_data[1] = { "no data",-1,-1, -99.0f, -99.0 }; int fill_data_new[1] = { -100 }; hsize_t position; - herr_t status; + herr_t status; hsize_t nfields_out; hsize_t nrecords_out; - + /* Define the inserted field information */ hid_t field_type_new = H5T_NATIVE_INT; int data[NRECORDS] = { 0,1,2,3,4,5,6,7 }; - + /* Initialize the field type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -86,18 +86,18 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_11.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make the table */ - status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, - dst_size1,field_names, dst_offset1, field_type, + status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS, + dst_size1,field_names, dst_offset1, field_type, chunk_size, fill_data, compress, p_data ); - + /* Insert the new field at the end of the field list */ position = NFIELDS; - status=H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position, + status=H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position, fill_data_new, data ); /* Get table info */ @@ -105,12 +105,12 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* Close the file. */ H5Fclose( file_id ); - + return 0; - - + + } diff --git a/hl/examples/ex_table_12.c b/hl/examples/ex_table_12.c index 9ec3054..26e238f 100644 --- a/hl/examples/ex_table_12.c +++ b/hl/examples/ex_table_12.c @@ -30,15 +30,15 @@ int main( void ) { - typedef struct Particle + typedef struct Particle { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } Particle; - + /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size = sizeof( Particle ); size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ), @@ -46,9 +46,9 @@ int main( void ) HOFFSET( Particle, longi ), HOFFSET( Particle, pressure ), HOFFSET( Particle, temperature )}; - + /* Define an array of Particles */ - Particle p_data[NRECORDS] = { + Particle p_data[NRECORDS] = { {"zero",0,0, 0.0f, 0.0}, {"one",10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -58,21 +58,21 @@ int main( void ) {"six", 60,60, 6.0f, 60.0}, {"seven",70,70, 7.0f, 70.0} }; - + /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = + Particle fill_data[1] = { {"no data",-1,-1, -99.0f, -99.0} }; - herr_t status; + herr_t status; hsize_t nfields_out; hsize_t nrecords_out; - + /* Initialize the field type */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); @@ -81,15 +81,15 @@ int main( void ) field_type[2] = H5T_NATIVE_INT; field_type[3] = H5T_NATIVE_FLOAT; field_type[4] = H5T_NATIVE_DOUBLE; - + /* Create a new file using default properties. */ file_id = H5Fcreate( "ex_table_12.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - + /* Make a table */ - status=H5TBmake_table( "Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, - field_names, dst_offset, field_type, + status=H5TBmake_table( "Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, + field_names, dst_offset, field_type, chunk_size, fill_data, compress, p_data ); - + /* Delete the field */ status=H5TBdelete_field( file_id, TABLE_NAME, "Pressure" ); @@ -98,11 +98,11 @@ int main( void ) /* print */ printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out); - + /* Close the file. */ H5Fclose( file_id ); - + return 0; - + } diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index 6ee69cf..c341031 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -41,7 +41,7 @@ endif #endif libhdf5hl_fortran_la_SOURCES=H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c H5LTff.f90 \ - H5IMff.f90 H5TBff.f90 + H5IMff.f90 H5TBff.f90 # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules @@ -70,8 +70,8 @@ uninstall-local: # determining this automagically (like we do with the C files). So, when # doing a parallel make, some modules could be made way before the # modules they depend upon are actually made. *sigh* -H5LTff.lo: $(srcdir)/H5LTff.f90 +H5LTff.lo: $(srcdir)/H5LTff.f90 H5IMff.lo: $(srcdir)/H5IMff.f90 -H5TBff.lo: $(srcdir)/H5TBff.f90 +H5TBff.lo: $(srcdir)/H5TBff.f90 include $(top_srcdir)/config/conclude.am diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 254f7df..fa158a5 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -25,11 +25,11 @@ /*------------------------------------------------------------------------- * Function: H5DSset_scale * - * Purpose: The dataset DSID is converted to a Dimension Scale dataset. - * Creates the CLASS attribute, set to the value "DIMENSION_SCALE" - * and an empty REFERENCE_LIST attribute. - * If DIMNAME is specified, then an attribute called NAME is created, - * with the value DIMNAME. + * Purpose: The dataset DSID is converted to a Dimension Scale dataset. + * Creates the CLASS attribute, set to the value "DIMENSION_SCALE" + * and an empty REFERENCE_LIST attribute. + * If DIMNAME is specified, then an attribute called NAME is created, + * with the value DIMNAME. * * Return: Success: SUCCEED, Failure: FAIL * @@ -95,17 +95,17 @@ herr_t H5DSset_scale(hid_t dsid, /*------------------------------------------------------------------------- * Function: H5DSattach_scale * - * Purpose: Define Dimension Scale DSID to be associated with dimension IDX - * of Dataset DID. Entries are created in the DIMENSION_LIST and - * REFERENCE_LIST attributes. + * Purpose: Define Dimension Scale DSID to be associated with dimension IDX + * of Dataset DID. Entries are created in the DIMENSION_LIST and + * REFERENCE_LIST attributes. * * Return: * Success: SUCCEED * Failure: FAIL * - * Fails if: Bad arguments - * If DSID is not a Dimension Scale - * If DID is a Dimension Scale (A Dimension Scale cannot have scales) + * Fails if: Bad arguments + * If DSID is not a Dimension Scale + * If DID is a Dimension Scale (A Dimension Scale cannot have scales) * * Programmer: pvn@ncsa.uiuc.edu * @@ -556,20 +556,20 @@ out: /*------------------------------------------------------------------------- * Function: H5DSdetach_scale * - * Purpose: If possible, deletes association of Dimension Scale DSID with - * dimension IDX of Dataset DID. This deletes the entries in the - * DIMENSION_LIST and REFERENCE_LIST attributes. + * Purpose: If possible, deletes association of Dimension Scale DSID with + * dimension IDX of Dataset DID. This deletes the entries in the + * DIMENSION_LIST and REFERENCE_LIST attributes. * * Return: * Success: SUCCEED * Failure: FAIL * - * Fails if: Bad arguments - * The dataset DID or DSID do not exist. - * The DSID is not a Dimension Scale - * DSID is not attached to DID. - * Note that a scale may be associated with more than dimension of the same dataset. - * If so, the detach operation only deletes one of the associations, for DID. + * Fails if: Bad arguments + * The dataset DID or DSID do not exist. + * The DSID is not a Dimension Scale + * DSID is not attached to DID. + * Note that a scale may be associated with more than dimension of the same dataset. + * If so, the detach operation only deletes one of the associations, for DID. * * Programmer: pvn@ncsa.uiuc.edu * @@ -934,9 +934,9 @@ out: * 0: one of them or both do not match * FAIL (-1): error * - * Fails if: Bad arguments - * If DSID is not a Dimension Scale - * If DID is a Dimension Scale (A Dimension Scale cannot have scales) + * Fails if: Bad arguments + * If DSID is not a Dimension Scale + * If DID is a Dimension Scale (A Dimension Scale cannot have scales) * * Programmer: pvn@ncsa.uiuc.edu * @@ -1209,7 +1209,7 @@ out: * * hid_t DID; IN: the dataset * unsigned int dim; IN: the dimension of the dataset - * int *idx; IN/OUT: input the index to start iterating, output the + * int *idx; IN/OUT: input the index to start iterating, output the * next index to visit. If NULL, start at the first position. * H5DS_iterate_t visitor; IN: the visitor function * void *visitor_data; IN: arbitrary data to pass to the visitor function. @@ -1964,7 +1964,7 @@ int H5DSget_num_scales(hid_t did, *------------------------------------------------------------------------- */ - else + else { if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) goto out; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index acc30b8..5db6cd4 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -985,11 +985,11 @@ herr_t H5LTget_dataset_info( hid_t loc_id, /* get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; - + /* get dimensions */ if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 ) goto out; - + /* terminate access to the dataspace */ if ( H5Sclose( sid ) < 0 ) goto out; @@ -1756,7 +1756,7 @@ static herr_t find_attr( hid_t loc_id, const char *name, void *op_data) /*------------------------------------------------------------------------- * Function: H5LTfind_attribute * - * Purpose: Inquires if an attribute named attr_name exists attached to + * Purpose: Inquires if an attribute named attr_name exists attached to * the object loc_id. * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu @@ -2039,7 +2039,7 @@ out: hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) { extern int yyparse(void); - hid_t type_id; + hid_t type_id; if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -2048,7 +2048,7 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) fprintf(stderr, "only DDL is supported for now.\n"); goto out; } - + input_len = strlen(text); myinput = strdup(text); @@ -2118,17 +2118,17 @@ print_enum(hid_t type, char* str, int indt) size_t dst_size; /*destination value type size */ int i; herr_t ret = SUCCEED; - + if((nmembs = H5Tget_nmembers(type))==0) goto out; assert(nmembs>0); if((super = H5Tget_super(type))<0) goto out; - + /* Use buffer of INT or UNSIGNED INT to print enum values because * we don't expect these values to be so big that INT or UNSIGNED * INT can't hold. - */ + */ if (H5T_SGN_NONE == H5Tget_sign(super)) { native = H5T_NATIVE_UINT; } else { @@ -2137,7 +2137,7 @@ print_enum(hid_t type, char* str, int indt) super_size = H5Tget_size(super); dst_size = H5Tget_size(native); - + /* Get the names and raw values of all members */ name = (char**)calloc((size_t)nmembs, sizeof(char *)); value = (unsigned char*)calloc((size_t)nmembs, MAX(dst_size, super_size)); @@ -2154,7 +2154,7 @@ print_enum(hid_t type, char* str, int indt) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT)<0) goto out; } - + /* * Sort members by increasing value * ***not implemented yet*** @@ -2167,7 +2167,7 @@ print_enum(hid_t type, char* str, int indt) strcat(str, tmp_str); sprintf(tmp_str, "%*s ", MAX(0, 16 - nchars), ""); strcat(str, tmp_str); - + if (H5T_SGN_NONE == H5Tget_sign(native)) { /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" *strangely, unless use another pointer "copy".*/ @@ -2226,7 +2226,7 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t * size_t str_len = INCREMENT; char *text_str; herr_t ret = -1; - + if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -2265,7 +2265,7 @@ out: * *------------------------------------------------------------------------- */ -herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *slen, +herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf) { H5T_class_t tcls; @@ -2282,15 +2282,15 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * *dt_str = tmp; } } - + if(lang != H5LT_DDL) { sprintf(*dt_str, "only DDL is supported for now"); goto out; } - + if((tcls = H5Tget_class(dtype))<0) goto out; - + switch (tcls) { case H5T_INTEGER: if (H5Tequal(dtype, H5T_STD_I8BE)) { @@ -2451,7 +2451,7 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * if (H5Tequal(tmp_type, str_type)) { strcat(*dt_str, "CTYPE H5T_C_S1;\n"); goto next; - } + } /* Change the endianness and see if they're equal. */ if((order = H5Tget_order(tmp_type))<0) @@ -2463,7 +2463,7 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * if(H5Tset_order(str_type, H5T_ORDER_BE)<0) goto out; } - + if (H5Tequal(tmp_type, str_type)) { strcat(*dt_str, "H5T_C_S1;\n"); goto next; @@ -2481,7 +2481,7 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * goto out; if(H5Tset_strpad(str_type, str_pad)<0) goto out; - + /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { strcat(*dt_str, "CTYPE H5T_FORTRAN_S1;\n"); @@ -2523,7 +2523,7 @@ next: /* Print lead-in */ sprintf(*dt_str, "H5T_OPAQUE {\n"); indent += COL; - + indentation(indent + COL, *dt_str); sprintf(tmp_str, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); strcat(*dt_str, tmp_str); @@ -2531,7 +2531,7 @@ next: indentation(indent + COL, *dt_str); sprintf(tmp_str, "OPQ_TAG \"%s\";\n", H5Tget_tag(dtype)); strcat(*dt_str, tmp_str); - + /* Print closing */ indent -= COL; indentation(indent + COL, *dt_str); @@ -2548,14 +2548,14 @@ next: sprintf(*dt_str, "H5T_ENUM {\n"); indent += COL; indentation(indent + COL, *dt_str); - + if((super = H5Tget_super(dtype))<0) goto out; if(H5LTdtype_to_text(super, NULL, lang, &super_len)<0) goto out; stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0) - goto out; + goto out; strcat(*dt_str, stmp); free(stmp); strcat(*dt_str, ";\n"); @@ -2588,7 +2588,7 @@ next: goto out; stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0) - goto out; + goto out; strcat(*dt_str, stmp); free(stmp); strcat(*dt_str, "\n"); @@ -2633,7 +2633,7 @@ next: goto out; stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0) - goto out; + goto out; strcat(*dt_str, stmp); free(stmp); strcat(*dt_str, "\n"); @@ -2655,7 +2655,7 @@ next: size_t mlen; char* mtmp; int nmembs; - + if((nmembs = H5Tget_nmembers(dtype))<0) goto out; @@ -2679,7 +2679,7 @@ next: goto out; mtmp = (char*)calloc(mlen, sizeof(char)); if(H5LTdtype_to_text(mtype, mtmp, lang, &mlen)<0) - goto out; + goto out; strcat(*dt_str, mtmp); free(mtmp); diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 2b31f11..2b2603c 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -829,7 +829,7 @@ hbool_t first_quote = 1; /* For Lex and Yacc */ /*int input_len; char *myinput;*/ - + #define TAG_STRING 1 #line 815 "H5LTanalyze.c" @@ -1268,17 +1268,17 @@ YY_RULE_SETUP case 40: YY_RULE_SETUP #line 120 "H5LTanalyze.l" -{return token(H5T_STR_NULLTERM_TOKEN);} +{return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP #line 121 "H5LTanalyze.l" -{return token(H5T_STR_NULLPAD_TOKEN);} +{return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP #line 122 "H5LTanalyze.l" -{return token(H5T_STR_SPACEPAD_TOKEN);} +{return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP @@ -1343,12 +1343,12 @@ YY_RULE_SETUP case 55: YY_RULE_SETUP #line 138 "H5LTanalyze.l" -{ - if( is_str_size || (is_enum && is_enum_memb) || +{ + if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { yylval.ival = atoi(yytext); - return NUMBER; + return NUMBER; } else REJECT; } @@ -1358,7 +1358,7 @@ YY_RULE_SETUP #line 148 "H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) && first_quote) { first_quote = 0; BEGIN TAG_STRING; @@ -2302,8 +2302,8 @@ int main() int my_yyinput(char *buf, int max_size) { int ret; - - memcpy(buf, myinput, input_len); + + memcpy(buf, myinput, input_len); ret = input_len; return ret; } diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 4867d5a..32258d0 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -17,7 +17,7 @@ */ #ifndef lint -static char const +static char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $"; #endif #include <stdlib.h> @@ -65,7 +65,7 @@ struct arr_info { }; /*stack for nested array type*/ struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ +int asindex = -1; /*pointer to the top of array stack*/ hbool_t is_str_size = 0; /*flag to lexer for string size*/ hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ @@ -73,7 +73,7 @@ H5T_pad_t str_pad; /*variable for string padding*/ H5T_cset_t str_cset; /*variable for string character set*/ hbool_t is_variable = 0; /*variable for variable-length string*/ size_t str_size; /*variable for string size*/ - + hid_t enum_id; /*type ID*/ hbool_t is_enum = 0; /*flag to lexer for enum type*/ hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ @@ -796,9 +796,9 @@ case 46: break; case 47: #line 155 "H5LTparse.y" -{ yyval.ival = cmpd_stack[csindex].id; +{ yyval.ival = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; - cmpd_stack[csindex].first_memb = 1; + cmpd_stack[csindex].first_memb = 1; csindex--; } break; @@ -808,7 +808,7 @@ case 50: break; case 51: #line 166 "H5LTparse.y" -{ +{ size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -822,7 +822,7 @@ case 51: cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - + if(yyvsp[-1].ival == 0) { new_size = origin_size + H5Tget_size(yyvsp[-6].ival); H5Tset_size(dtype_id, new_size); @@ -833,10 +833,10 @@ case 51: H5Tinsert(dtype_id, yyvsp[-3].sval, yyvsp[-1].ival, yyvsp[-6].ival); } } - + cmpd_stack[csindex].is_field = 0; H5Tclose(yyvsp[-6].ival); - + new_size = H5Tget_size(dtype_id); } break; @@ -860,7 +860,7 @@ case 56: break; case 57: #line 212 "H5LTparse.y" -{ +{ yyval.ival = H5Tarray_create(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims, NULL); arr_stack[asindex].ndims = 0; asindex--; @@ -874,9 +874,9 @@ break; case 61: #line 223 "H5LTparse.y" { int ndims = arr_stack[asindex].ndims; - arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; - arr_stack[asindex].is_dim = 0; + arr_stack[asindex].is_dim = 0; } break; case 64: @@ -889,10 +889,10 @@ case 65: break; case 66: #line 240 "H5LTparse.y" -{ +{ size_t size = (size_t)yylval.ival; yyval.ival = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; + is_opq_size = 0; } break; case 67: @@ -901,7 +901,7 @@ case 67: break; case 68: #line 246 "H5LTparse.y" -{ +{ H5Tset_tag(yyvsp[-6].ival, yylval.sval); is_opq_tag = 0; } @@ -916,12 +916,12 @@ case 72: break; case 73: #line 259 "H5LTparse.y" -{ +{ if(yyvsp[-1].ival == H5T_VARIABLE_TOKEN) is_variable = 1; - else + else str_size = yylval.ival; - is_str_size = 0; + is_str_size = 0; } break; case 74: @@ -937,7 +937,7 @@ case 74: break; case 75: #line 276 "H5LTparse.y" -{ +{ if(yyvsp[-1].ival == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if(yyvsp[-1].ival == H5T_CSET_UTF8_TOKEN) @@ -955,7 +955,7 @@ case 76: break; case 77: #line 290 "H5LTparse.y" -{ +{ hid_t str_id = yyvsp[-1].ival; /*set string size*/ @@ -964,12 +964,12 @@ case 77: is_variable = 0; } else H5Tset_size(str_id, str_size); - + /*set string padding and character set*/ H5Tset_strpad(str_id, str_pad); H5Tset_cset(str_id, str_cset); - yyval.ival = str_id; + yyval.ival = str_id; } break; case 78: @@ -1016,7 +1016,7 @@ case 91: #line 329 "H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = strdup(yylval.sval); } break; case 92: @@ -1029,7 +1029,7 @@ case 92: long_long llong_val=(long_long)yylval.ival; hid_t super = H5Tget_super(enum_id); hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); - + if(is_enum && is_enum_memb) { /*if it's an enum member*/ /*To handle machines of different endianness*/ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) @@ -1043,7 +1043,7 @@ case 92: else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); - is_enum_memb = 0; + is_enum_memb = 0; if(enum_memb_symbol) free(enum_memb_symbol); } diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h index 426c223..6e54c54 100644 --- a/hl/src/H5LTprivate.h +++ b/hl/src/H5LTprivate.h @@ -19,7 +19,7 @@ #include "H5HLprivate2.h" /* public LT prototypes */ -#include "H5LTpublic.h" +#include "H5LTpublic.h" /*------------------------------------------------------------------------- * Private functions @@ -49,7 +49,7 @@ H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); -H5_HLDLL herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, +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); diff --git a/hl/src/H5PTprivate.h b/hl/src/H5PTprivate.h index 3bba9d2..4c36813 100644 --- a/hl/src/H5PTprivate.h +++ b/hl/src/H5PTprivate.h @@ -19,7 +19,7 @@ #include "H5HLprivate2.h" /* public LT prototypes */ -#include "H5PTpublic.h" +#include "H5PTpublic.h" #endif diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index d9579c3..7cbd5c4 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -3686,40 +3686,40 @@ herr_t H5TB_common_append_records( hid_t dataset_id, 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); @@ -3760,38 +3760,38 @@ herr_t H5TB_common_read_records( hid_t dataset_id, 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); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 07002e0..19d772f 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1057,31 +1057,31 @@ static int test_integers(void) size_t str_len; TESTING3("\n text for integer types"); - + if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_NATIVE_INT)) goto out; if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_STD_I8BE\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_STD_I8BE)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_STD_I8BE")) goto out; free(dt_str); if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_STD_U16LE\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_STD_U16LE)) @@ -1108,31 +1108,31 @@ static int test_fps(void) size_t str_len; TESTING3(" text for floating-point types"); - + if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) goto out; if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_IEEE_F32BE\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_IEEE_F32BE)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_IEEE_F32BE")) goto out; free(dt_str); if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_IEEE_F64LE\n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_IEEE_F64LE)) @@ -1161,12 +1161,12 @@ static int test_strings(void) H5T_class_t type_class; char* dt_str; size_t str_len; - + TESTING3(" text for string types"); - + if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_STRING) @@ -1175,57 +1175,57 @@ static int test_strings(void) str_size = H5Tget_size(dtype); if(str_size != 13) goto out; - + str_pad = H5Tget_strpad(dtype); if(str_pad != H5T_STR_NULLTERM) goto out; - + str_cset = H5Tget_cset(dtype); if(str_cset != H5T_CSET_ASCII) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { printf("dt=\n%s\n", dt_str); goto out; } free(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_NULLPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0) goto out; - + if(!H5Tis_variable_str(dtype)) goto out; - + str_pad = H5Tget_strpad(dtype); if(str_pad != H5T_STR_NULLPAD) goto out; - + str_cset = H5Tget_cset(dtype); if(str_cset != H5T_CSET_ASCII) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { printf("dt=\n%s\n", dt_str); goto out; } free(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1247,25 +1247,25 @@ static int test_opaques(void) size_t str_len; TESTING3(" text for opaque types"); - + if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_OPAQUE) goto out; - + if((opq_size = H5Tget_size(dtype)) == 0) goto out; if(opq_size != 19) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { printf("dt=\n%s\n", dt_str); goto out; @@ -1274,7 +1274,7 @@ static int test_opaques(void) if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1298,12 +1298,12 @@ static int test_enums(void) H5T_class_t type_class; char* dt_str; size_t str_len; - + TESTING3(" text for enum types"); - + if((dtype = H5LTtext_to_dtype("H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_ENUM) @@ -1312,27 +1312,27 @@ static int test_enums(void) if(H5Tenum_nameof(dtype, &value1, name1, size)<0) goto out; if(strcmp(name1, "BLUE")) - goto out; - + goto out; + if(H5Tenum_valueof(dtype, name2, &value2)<0) goto out; if(value2 != 8) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; /*if(strcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { printf("dt=\n%s\n", dt_str); goto out; }*/ free(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1351,34 +1351,34 @@ static int test_variables(void) H5T_class_t type_class; char* dt_str; size_t str_len; - + TESTING3(" text for variable types"); - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_VLEN) goto out; - + if(H5Tis_variable_str(dtype)) goto out; if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; - + if(H5Tis_variable_str(dtype)) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { printf("dt=\n%s\n", dt_str); goto out; @@ -1387,7 +1387,7 @@ static int test_variables(void) if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1410,19 +1410,19 @@ static int test_arrays(void) size_t str_len; TESTING3(" text for array types"); - + if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_ARRAY) goto out; - + if((ndims = H5Tget_array_ndims(dtype))<0) goto out; if(ndims != 3) - goto out; + goto out; if(H5Tget_array_dims(dtype, dims, NULL)<0) goto out; @@ -1430,10 +1430,10 @@ static int test_arrays(void) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; /*if(strcmp(dt_str, "H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }")) { printf("dt=\n%s\n", dt_str); goto out; @@ -1442,7 +1442,7 @@ static int test_arrays(void) if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1464,12 +1464,12 @@ static int test_compounds(void) H5T_class_t type_class; char* dt_str; size_t str_len; - + TESTING3(" text for compound types"); - + if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_COMPOUND) @@ -1481,26 +1481,26 @@ static int test_compounds(void) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) - goto out; + goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) - goto out; + goto out; if(strcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { printf("dt=\n%s\n", dt_str); goto out; } free(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I32BE \"i32_field\"; H5T_STD_I16BE \"i16_field\"; H5T_COMPOUND { H5T_STD_I16BE \"sec_field\"; H5T_COMPOUND { H5T_STD_I32BE \"thd_field\"; } \"grandchild\"; } \"child_compound\"; H5T_STD_I8BE \"i8_field\"; }", H5LT_DDL))<0) goto out; - + if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) - goto out; + goto out; if(strcmp(memb_name, "i16_field")) - goto out; + goto out; free(memb_name); if((memb_class = H5Tget_member_class(dtype, 2))<0) @@ -1531,7 +1531,7 @@ static int test_complicated_compound(void) int size = 1024; char *srcdir = getenv("srcdir"); /* the source directory */ char filename[1024]=""; - + TESTING3(" text for complicated compound types"); /* compose the name of the file to open, using the srcdir, if appropriate */ @@ -1550,8 +1550,8 @@ static int test_complicated_compound(void) goto out; } - /* This part reads in the input as a string in a slow manner. GNU C - * Library has convenient function getline() but isn't available on + /* This part reads in the input as a string in a slow manner. GNU C + * Library has convenient function getline() but isn't available on * all machines. */ if((line = (char*)calloc(size, sizeof(char)))==NULL) @@ -1574,13 +1574,13 @@ static int test_complicated_compound(void) if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0) goto out; - + if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_COMPOUND) goto out; - /* There should be 101 compound members */ + /* There should be 101 compound members */ if((nmembs = H5Tget_nmembers(dtype))<0) goto out; if(nmembs != 101) @@ -1601,7 +1601,7 @@ out: * test H5LTtext_to_dtype function *------------------------------------------------------------------------- */ -static int test_text_dtype(void) +static int test_text_dtype(void) { TESTING("H5LTtext_to_dtype"); @@ -1613,22 +1613,22 @@ static int test_text_dtype(void) if(test_strings()<0) goto out; - + if(test_opaques()<0) goto out; - + if(test_enums()<0) goto out; - + if(test_variables()<0) goto out; - + if(test_arrays()<0) goto out; - + if(test_compounds()<0) goto out; - + if(test_complicated_compound()<0) goto out; @@ -1651,7 +1651,7 @@ int main( void ) /* test attribute functions */ nerrors += test_attr(); - + /* test text-dtype functions */ nerrors += test_text_dtype(); |