summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-05-05 15:05:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-05-05 15:05:17 (GMT)
commit548eec307006ebd01294fad2886421f07c3c92c8 (patch)
treef12a7a425e7c90e8895a205491fd8a85d21d5e90 /hl
parent4ffc0b6acb36064e91a1afeb6eceee704e5af7f2 (diff)
downloadhdf5-548eec307006ebd01294fad2886421f07c3c92c8.zip
hdf5-548eec307006ebd01294fad2886421f07c3c92c8.tar.gz
hdf5-548eec307006ebd01294fad2886421f07c3c92c8.tar.bz2
[svn-r16920] Description:
Merge these trunk revisions which occurred during the 1.8.3 release code freeze back to the 1.8 branch: From Quincey: 16845 16847 16849 16851 16858 16869 16897 From Ray: 16859 16880 From Allen: 16863 Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.6 (amazon) in debug mode Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'hl')
-rw-r--r--hl/src/H5LT.c12
-rw-r--r--hl/src/H5LTparse.c78
-rw-r--r--hl/src/H5LTparse.y27
-rw-r--r--hl/test/Makefile.am2
-rw-r--r--hl/test/test_lite.c33
5 files changed, 102 insertions, 50 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 7c073d6..e797d14 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -1792,6 +1792,7 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *
if((ret = H5LT_dtype_to_text(dtype, &text_str, lang_type, &str_len, 1)) < 0)
goto out;
*len = strlen(text_str) + 1;
+ free(text_str);
} else if(len && str) {
if((ret = H5LT_dtype_to_text(dtype, &str, lang_type, len, 0)) < 0)
goto out;
@@ -2076,6 +2077,9 @@ next:
break;
}
case H5T_OPAQUE:
+ {
+ char *tag;
+
/* Print lead-in */
sprintf(*dt_str, "H5T_OPAQUE {\n");
indent += COL;
@@ -2085,7 +2089,12 @@ next:
strcat(*dt_str, tmp_str);
indentation(indent + COL, *dt_str);
- sprintf(tmp_str, "OPQ_TAG \"%s\";\n", H5Tget_tag(dtype));
+ tag = H5Tget_tag(dtype);
+ if(tag) {
+ sprintf(tmp_str, "OPQ_TAG \"%s\";\n", tag);
+ free(tag);
+ } else
+ sprintf(tmp_str, "OPQ_TAG \"\";\n");
strcat(*dt_str, tmp_str);
/* Print closing */
@@ -2094,6 +2103,7 @@ next:
strcat(*dt_str, "}");
break;
+ }
case H5T_ENUM:
{
hid_t super;
diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c
index 6e5e08b..98dcbd5 100644
--- a/hl/src/H5LTparse.c
+++ b/hl/src/H5LTparse.c
@@ -14,11 +14,10 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This file was generated by Yacc with the command "yacc -pH5LTyy -o H5LTparse.c -d H5LTparse.y"
- * Do NOT modify it by hand.
+ * on jam. Do NOT modify it by hand.
*/
-
#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>
@@ -92,7 +91,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*/
@@ -100,7 +99,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*/
@@ -823,9 +822,9 @@ case 46:
break;
case 47:
#line 156 "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;
@@ -835,7 +834,7 @@ case 50:
break;
case 51:
#line 167 "H5LTparse.y"
-{
+{
size_t origin_size, new_size;
hid_t dtype_id = cmpd_stack[csindex].id;
@@ -849,7 +848,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);
@@ -860,10 +859,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;
@@ -887,7 +886,7 @@ case 56:
break;
case 57:
#line 213 "H5LTparse.y"
-{
+{
yyval.ival = H5Tarray_create2(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims);
arr_stack[asindex].ndims = 0;
asindex--;
@@ -901,9 +900,9 @@ break;
case 61:
#line 224 "H5LTparse.y"
{ unsigned 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:
@@ -916,10 +915,10 @@ case 65:
break;
case 66:
#line 241 "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:
@@ -928,7 +927,7 @@ case 67:
break;
case 68:
#line 247 "H5LTparse.y"
-{
+{
H5Tset_tag(yyvsp[-6].ival, yylval.sval);
is_opq_tag = 0;
}
@@ -943,12 +942,12 @@ case 72:
break;
case 73:
#line 260 "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:
@@ -964,7 +963,7 @@ case 74:
break;
case 75:
#line 277 "H5LTparse.y"
-{
+{
if(yyvsp[-1].ival == H5T_CSET_ASCII_TOKEN)
str_cset = H5T_CSET_ASCII;
else if(yyvsp[-1].ival == H5T_CSET_UTF8_TOKEN)
@@ -982,7 +981,7 @@ case 76:
break;
case 77:
#line 291 "H5LTparse.y"
-{
+{
hid_t str_id = yyvsp[-1].ival;
/*set string size*/
@@ -991,12 +990,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:
@@ -1043,7 +1042,7 @@ case 91:
#line 330 "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:
@@ -1056,21 +1055,34 @@ 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);
-
+ H5T_order_t super_order = H5Tget_order(super);
+ H5T_order_t native_order = H5Tget_order(native);
+
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))
+ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
- else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT))
+ } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
- else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT))
+ } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
- else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
- else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
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);
}
@@ -1078,7 +1090,7 @@ case 92:
H5Tclose(native);
}
break;
-#line 1063 "H5LTparse.c"
+#line 1076 "H5LTparse.c"
}
yyssp -= yym;
yystate = *yyssp;
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index 7866add..a021efc 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -337,22 +337,35 @@ enum_def : '"' enum_symbol '"' {
short short_val=(short)yylval.ival;
int int_val=(int)yylval.ival;
long long_val=(long)yylval.ival;
- long_long llong_val=(long_long)yylval.ival;
+ 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);
-
+ H5T_order_t super_order = H5Tget_order(super);
+ H5T_order_t native_order = H5Tget_order(native);
+
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))
+ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
- else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT))
+ } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
- else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT))
+ } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
- else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
- else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val);
+ }
is_enum_memb = 0;
if(enum_memb_symbol) free(enum_memb_symbol);
diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am
index 99832e8..1e8a380 100644
--- a/hl/test/Makefile.am
+++ b/hl/test/Makefile.am
@@ -33,7 +33,7 @@ TEST_PROG=test_lite test_image test_table test_ds test_packet
check_PROGRAMS=$(TEST_PROG)
# Temporary files. These files are the ones created by running `make test'.
-CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-6].h5 test_image[1-3].h5 \
+CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-7].h5 test_image[1-3].h5 \
test_lite[1-2].h5 test_table.h5 test_packet_table.h5 \
test_packet_compress.h5
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 6de2e31..ad12fb2 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1291,6 +1291,7 @@ static int test_enums(void)
H5T_class_t type_class;
char* dt_str;
size_t str_len;
+ H5T_order_t native_order = H5Tget_order(H5T_NATIVE_INT);
TESTING3(" text for enum types");
@@ -1302,6 +1303,12 @@ static int test_enums(void)
if(type_class != H5T_ENUM)
goto out;
+ /* Convert the variable before using it */
+ if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
+ if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value1, NULL, H5P_DEFAULT) < 0)
+ goto out;
+ }
+
if(H5Tenum_nameof(dtype, &value1, name1, size)<0)
goto out;
if(strcmp(name1, "BLUE"))
@@ -1309,6 +1316,13 @@ static int test_enums(void)
if(H5Tenum_valueof(dtype, name2, &value2)<0)
goto out;
+
+ /* Convert the variable before comparing it */
+ if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
+ if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value2, NULL, H5P_DEFAULT) < 0)
+ goto out;
+ }
+
if(value2 != 8)
goto out;
@@ -1317,10 +1331,12 @@ static int test_enums(void)
dt_str = (char*)calloc(str_len, sizeof(char));
if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
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;
- }*/
+ 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)
@@ -1427,10 +1443,11 @@ static int test_arrays(void)
dt_str = (char*)calloc(str_len, sizeof(char));
if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
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;
- }*/
+ if(strcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) {
+ printf("dt=\n%s\n", dt_str);
+ goto out;
+ }
+
free(dt_str);
if(H5Tclose(dtype)<0)