diff options
author | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 2000-04-20 16:53:57 (GMT) |
---|---|---|
committer | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 2000-04-20 16:53:57 (GMT) |
commit | 8a006fd0ca62d5e1abf0f946b290882c92dda0b4 (patch) | |
tree | 4c78e7716d63b92357baffea536aa6b2f86ca4e0 /tools | |
parent | ba8fbc02dbee6abeeb8eddd3a3e47aeb5c58ae1e (diff) | |
download | hdf5-8a006fd0ca62d5e1abf0f946b290882c92dda0b4.zip hdf5-8a006fd0ca62d5e1abf0f946b290882c92dda0b4.tar.gz hdf5-8a006fd0ca62d5e1abf0f946b290882c92dda0b4.tar.bz2 |
[svn-r2167] i removed unneeded code from the tool lib.
from h5tools.h just got rid of a prototype for copy_atmoic_char which was never used
in the h5tools.c i removed the copy_atomic_char, all the display_*_data, where the * is numeric, string
or compound, the print_data, h5dump_attr. also removed a block of codfe that was surrounded by #if 0
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5tools.c | 869 | ||||
-rw-r--r-- | tools/h5tools.h | 2 |
2 files changed, 4 insertions, 867 deletions
diff --git a/tools/h5tools.c b/tools/h5tools.c index 58b53ed..8c6391e 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -26,19 +26,8 @@ int indent = 0; int compound_data=0; int nCols = 80; -static void display_numeric_data(hsize_t hs_nelmts, hid_t p_type, - unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t dim_n_size, - hsize_t elmtno, hid_t container); -static void display_string(hsize_t hs_nelmts, hid_t p_type, - unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t dim_n_size, - hsize_t elmtno); -static void display_compound_data(hsize_t hs_nelmts, hid_t p_type, - unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t elmtno); - -int h5dump_attr(hid_t oid, hid_t ptype); + + int print_data(hid_t oid, hid_t _p_type, int obj_data); @@ -1444,66 +1433,7 @@ h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, h5dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts, p_type, sm_buf); -#if 0 - if (programtype == UNKNOWN){ - return FAIL; - } else if (programtype == H5LS){ - h5dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts, - p_type, sm_buf); - } else if (programtype == H5DUMP){ - switch (H5Tget_class(p_type)) { - case H5T_INTEGER: - display_numeric_data (hs_nelmts, p_type, sm_buf, p_type_nbytes, - p_nelmts, dim_n_size, elmtno, dset); - break; - - case H5T_FLOAT: - display_numeric_data (hs_nelmts, p_type, sm_buf, p_type_nbytes, - p_nelmts, dim_n_size, elmtno, dset); - break; - - case H5T_TIME: - break; - - case H5T_STRING: - display_string (hs_nelmts, p_type, sm_buf, p_type_nbytes, - p_nelmts, dim_n_size, elmtno); - break; - - case H5T_BITFIELD: - break; - - case H5T_OPAQUE: - break; - - case H5T_COMPOUND: - compound_data = 1; - display_compound_data (hs_nelmts, p_type, sm_buf, - p_type_nbytes, p_nelmts, elmtno); - compound_data = 0; - break; - - case H5T_REFERENCE: - display_numeric_data(hs_nelmts, p_type, sm_buf, p_type_nbytes, - p_nelmts, dim_n_size, elmtno, dset); - break; -#if 0 - display_reference_data(hs_nelmts, p_type, sm_buf, - p_type_nbytes, p_nelmts, dim_n_size, - elmtno, dset); -#endif - case H5T_ENUM: - display_numeric_data(hs_nelmts, p_type, sm_buf, - p_type_nbytes, p_nelmts, dim_n_size, - elmtno, dset); - break; - default: - break; - } - - } -#endif /* Calculate the next hyperslab offset */ for (i=ctx.ndims, carry=1; i>0 && carry; --i) { ctx.p_min_idx[i-1] = ctx.p_max_idx[i-1]; @@ -1889,575 +1819,11 @@ h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, /*************************************************************************/ /*************************************************************************/ -/*------------------------------------------------------------------------- - * Function: display_numeric_data - * - * Purpose: Display numeric data in ddl format. - * - * Return: void - * - * Comment: hs_nelmts number of elements to be printed - * p_type memory data type - * sm_buf data buffer - * p_type_nbytes size of p_type - * p_nelmts total number of elements - * dim_n_size size of dimemsion n - * elmtno element index - * - *------------------------------------------------------------------------- - */ -static void display_numeric_data -(hsize_t hs_nelmts, hid_t p_type, unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t dim_n_size, hsize_t elmtno, hid_t container) { - -hsize_t i; -/*char p_buf[256]; */ -char* out_buf = malloc(sizeof(char) * nCols); -struct h5dump_str_t tempstr; -hsize_t x; -hbool_t isref = FALSE; -hsize_t totalspace; -hbool_t done; -int temp; - - -/******************************************************************************************/ - h5dump_t info; - - /* Set to all default values and then override */ - memset(&info, 0, sizeof info); - info.idx_fmt = "(%s)"; - info.line_ncols = nCols; - info.line_multi_new = 1; - - /* - * If a compound datatype is split across multiple lines then add an - * ellipsis to the beginning of the continuation line. - */ - info.line_pre = " %s "; - info.line_cont = " %s "; -/*********************************************************************************************/ - - /* i added this too*/ - if (H5Tequal(p_type, H5T_STD_REF_DSETREG)) { - isref = TRUE; - } - - out_buf[0] = '\0'; - if ((indent+COL) > nCols) indent = 0; - memset(&tempstr, 0, sizeof(h5dump_str_t)); - - for (i=0; i<hs_nelmts && (elmtno+i) < p_nelmts; i++) { - h5dump_str_reset(&tempstr); - h5dump_sprint(&tempstr, &info, container, p_type, sm_buf+i*p_type_nbytes,NULL); - if (isref) { - for (x = 0; x <tempstr.len; x++){ - /* removes the strange characters */ - if (tempstr.s[x] == 1){ - memmove(tempstr.s+x, tempstr.s+(x+1), strlen(tempstr.s+x)); - tempstr.len --; - } - - } - } - totalspace = nCols - indent - COL; - - if ((int)(strlen(out_buf)+tempstr.len+1) > (nCols-indent-COL)) { - if (isref){ - /* i added this */ - temp = (int)strlen(out_buf); - if ((strlen(out_buf) + 7) < (totalspace)){ /* 7 for the word dataset */ - memcpy(out_buf+strlen(out_buf), tempstr.s, totalspace - strlen(out_buf)); - out_buf[totalspace] = '\0'; - memmove(tempstr.s, tempstr.s+(totalspace - temp), tempstr.len - (totalspace - temp)); - tempstr.s[tempstr.len - totalspace + temp] = '\0'; - tempstr.len = strlen(tempstr.s); - } - } - /* first row of member */ - if (compound_data && (elmtno+i+1) == dim_n_size) - printf("%s\n", out_buf); - else { - indentation(indent+COL); - printf("%s\n", out_buf); - } - strcpy(out_buf, tempstr.s); - - /* i added this too*/ - if (isref) { - done = FALSE; - while (!done) { - if (tempstr.len > totalspace) { - /* keep printing until we can fit in the totalspace */ - memmove(out_buf,tempstr.s, totalspace); - out_buf[totalspace] = '\0'; - memmove(tempstr.s,tempstr.s+totalspace, strlen(tempstr.s + totalspace)); - tempstr.s[tempstr.len - totalspace] = '\0'; - tempstr.len = strlen(tempstr.s); - indentation(indent+COL); - printf(out_buf); - - } else { - strcpy(out_buf, tempstr.s); - done = TRUE; - } - } - } - - if ((elmtno+i+1) % dim_n_size) - strcat(out_buf, ", "); - else { /* end of a row, flush out_buf */ - indentation(indent+COL); - printf("%s", out_buf); - if ((elmtno+i+1) != p_nelmts) /* not last element */ - printf(",\n"); - else if (compound_data) { /* last element of member data*/ - if ((nCols-strlen(out_buf)-indent-COL) < 2) { - /* 2 for space and ] */ - printf("\n"); - indentation(indent+COL-3); - } - } else - printf("\n"); /* last row */ - *out_buf = '\0'; - } - } else { - strcat(out_buf, tempstr.s); - if ((elmtno+i+1) % dim_n_size) { - if ((nCols-strlen(out_buf)-indent-COL-1) > 0) - strcat(out_buf, ", "); - else - strcat(out_buf, ","); - } else { /* end of a row */ - /* 1st row of member data */ - if (compound_data && (elmtno+i+1) == dim_n_size) - printf("%s", out_buf); - else { - indentation(indent+COL); - printf("%s", out_buf); - } - - /* if it's the last element */ - if ((elmtno+i+1) != p_nelmts) - printf(",\n"); - else if (compound_data) { /* last row of member data*/ - /* 2 for space and ] */ - if ((nCols-strlen(out_buf)-indent-COL) < 2) { - printf("\n"); - indentation(indent+COL-3); - } - } else - printf("\n"); /* last row */ - *out_buf = '\0'; - } - } - } -#if !defined (WIN32) && !defined (_DEBUG) - free(out_buf); -#endif -} /*------------------------------------------------------------------------- - * Function: display_string - * - * Purpose: Display string in ddl format - * - * Return: void - * - * Comment: concatenator operator : '//' - * separator between elements: ',' - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void display_string -(hsize_t hs_nelmts, hid_t p_type, unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t dim_n_size, hsize_t elmtno) { - hsize_t i, row_size=0; - int j, m, x, y, first_row=1; - int free_space, long_string = 0; - char* out_buf = malloc(sizeof(char) * nCols); - struct h5dump_str_t tempstr; - int temp; - -/******************************************************************************************/ - h5dump_t info; - - /* Set to all default values and then override */ - memset(&info, 0, sizeof info); - info.idx_fmt = "(%s)"; - info.line_ncols = nCols; - info.line_multi_new = 1; - - /* - * If a compound datatype is split across multiple lines then add an - * ellipsis to the beginning of the continuation line. - */ - info.line_pre = " %s "; - info.line_cont = " %s "; -/*********************************************************************************************/ - out_buf[0] = '\0'; - - memset(&tempstr, 0, sizeof(h5dump_str_t)); - - - h5dump_str_reset(&tempstr); - for (i=0; i<hs_nelmts && (elmtno+i) < p_nelmts; i++) { - row_size++; - - h5dump_str_reset(&tempstr); - h5dump_sprint(&tempstr, &info, -1/*no container*/, p_type, - sm_buf+i*p_type_nbytes,NULL); - - memmove(tempstr.s, tempstr.s + 1, tempstr.len -1); - tempstr.s[tempstr.len - 2] = '\0'; - tempstr.len = tempstr.len - 2; - - free_space = (int)(nCols - indent - COL - strlen(out_buf)); - - if ((elmtno+i+1) == p_nelmts) { /* last element */ - /* 2 for double quotes */ - if (((int)tempstr.len + 2) > free_space) long_string = 1; - } else - /* 3 for double quotes and one comma */ - if (((int)tempstr.len + 3) > free_space) long_string = 1; - - if (long_string) { - - if (free_space < 5) { /* 5 for double quotes, one space and two '/'s */ - /* flush out_buf */ - if (compound_data && first_row) { - printf("%s\n", out_buf); - first_row = 0; - } else { - indentation(indent+COL); - printf("%s\n", out_buf); - } - out_buf[0] = '\0'; - x = 0 ; - } else { - x = free_space - 5; - if (compound_data && first_row) { - printf("%s\"", out_buf); - strncpy(out_buf, tempstr.s, x); - out_buf[x] = '\0'; - printf("%s\" %s\n", out_buf,CONCATENATOR); - first_row = 0; - out_buf[0] = '\0'; - } else { - indentation(indent+COL); - printf("%s\"", out_buf); - memset(out_buf, '\0', nCols); - temp = copy_atomic_char(out_buf,tempstr.s,(int)tempstr.len,x); - out_buf[x] = '\0'; - printf("%s\" %s\n",out_buf,CONCATENATOR); - x = temp; - } - } - - y = nCols - indent -COL - 5; - - m = (int)((tempstr.len - x)/y); - - for (j = 0; j < m - 1 ; j++) { - indentation(indent+COL); - strncpy(out_buf, tempstr.s+x+j*y, y); - out_buf[y] = '\0'; - printf("\"%s\" %s\n", out_buf,CONCATENATOR); - } - - if ((elmtno+i+1) == p_nelmts) { /* last element */ - if ((int)strlen(tempstr.s+x+j*y) > (nCols - indent - COL -2)) { /* 2 for double quotes */ - indentation(indent+COL); - strncpy(out_buf, tempstr.s+x+j*y, y); - out_buf[y] = '\0'; - printf("\"%s\" %s\n", out_buf, CONCATENATOR); - indentation(indent+COL); - printf("\"%s\"", tempstr.s+x+m*y); - if (compound_data) { - if ((nCols-strlen(out_buf)-indent-COL) < 2) { - printf("\n"); - indentation(indent+COL-3); - } - } else - printf("\n"); - - } else { - indentation(indent+COL); - printf("\"%s\"", tempstr.s+x+j*y); - if (compound_data) { - if ((nCols-strlen(out_buf)-indent-COL) < 2) { - printf("\n"); - indentation(indent+COL-3); - } - - } else - printf("\n"); - } - out_buf[0] = '\0'; - } else if ( row_size == dim_n_size) { - if ((int)strlen(tempstr.s+x+j*y) > (nCols - indent - COL -3)) { /* 3 for 2 "'s and 1 , */ - indentation(indent+COL); - strncpy(out_buf, tempstr.s+x+j*y, y); - out_buf[y] = '\0'; - printf("\"%s\" %s\n", out_buf, CONCATENATOR); - indentation(indent+COL); - printf("\"%s\",\n", tempstr.s+x+m*y); - } else { - indentation(indent+COL); - printf("\"%s\",\n", tempstr.s+x+j*y); - - } - out_buf[0] = '\0'; - row_size = 0; - - } else { - if ((int)strlen(tempstr.s+x+j*y) > (nCols - indent - COL -3)) { /* 3 for 2 "'s and 1 , */ - indentation(indent+COL); - strncpy(out_buf, tempstr.s+x+j*y, y); - out_buf[y] = '\0'; - printf("\"%s\" %s\n", out_buf, CONCATENATOR); - strcpy(out_buf, "\""); - strcat(out_buf, tempstr.s+x+m*y); - strcat(out_buf, "\","); - if ((int)strlen(out_buf) < (nCols-indent-COL)) strcat(out_buf, " "); - } else { - strcpy(out_buf, "\""); - strcat (out_buf, tempstr.s+x+j*y); - strcat(out_buf, "\","); - if ((int)strlen(out_buf) < (nCols-indent-COL)) strcat(out_buf, " "); - } - } - long_string = 0; - - } else { - - /* flush out_buf if it's end of a row */ - if (row_size == dim_n_size) { - if (compound_data && (elmtno+i+1) == dim_n_size) { /* 1st row */ - - printf("%s\"%s\"", out_buf, tempstr.s); - first_row = 0; - } else { - indentation(indent+COL); - - printf("%s\"%s\"", out_buf, tempstr.s); - } - - if ((elmtno+i+1) != p_nelmts) - printf(",\n"); - else if (compound_data) { - if ((nCols-strlen(out_buf)-tempstr.len-indent-COL) < 2) { - /* 2 for space and ] */ - printf("\n"); - indentation(indent+COL-3); - } - } else - printf("\n"); - - out_buf[0] = '\0'; - row_size = 0; - } else { - strcat(out_buf, "\""); - strcat(out_buf, tempstr.s); - strcat(out_buf, "\","); - if ((int)strlen(out_buf) < (nCols-indent-COL)) strcat(out_buf, " "); - } - - } - } - free(out_buf); -} - - -/*------------------------------------------------------------------------- - * Function: display_compound_data - * - * Purpose: Display compound data in ddl format - * - * Return: void - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - static void display_compound_data - (hsize_t hs_nelmts, hid_t p_type, unsigned char *sm_buf, size_t p_type_nbytes, - hsize_t p_nelmts, hsize_t elmtno) { - - - size_t offset, size, dims[4]; - hsize_t nelmts, dim_n_size=0; - hid_t memb; - int nmembs, i, j, k, ndims, perm[4]; - - if ((indent+COL) > nCols) indent = 0; - - for (i=0; i<(int)hs_nelmts && (elmtno+i) < p_nelmts; i++) { - - nmembs = H5Tget_nmembers(p_type); - - indentation(indent+COL); - printf("{\n"); - - indent+= COL; - for (j=0; j<nmembs; j++) { - - offset = H5Tget_member_offset(p_type, j); - memb = H5Tget_member_type(p_type, j); - size = H5Tget_size(memb); - ndims = H5Tget_member_dims(p_type, j, dims, perm); - if (ndims > 0) dim_n_size = dims[ndims-1]; - else dim_n_size = 1; - for (k=0, nelmts=1; k<ndims; k++) nelmts *= dims[k]; - - - - - switch (H5Tget_class(memb)) { - case H5T_INTEGER: - indentation(indent+COL); - indent += 2; - if (nelmts > 1) { - printf("[ "); - } - display_numeric_data - (nelmts, memb, sm_buf+offset+i*p_type_nbytes, size, nelmts, dim_n_size, 0, -1) ; - if (nelmts > 1) { - printf(" ]"); - } - indent -= 2; - break; - - case H5T_FLOAT: - indentation(indent+COL); - indent += 2; - if (nelmts > 1) { - printf("[ "); - } - display_numeric_data - (nelmts, memb, sm_buf+offset+i*p_type_nbytes, size, nelmts, dim_n_size, 0, -1) ; - if (nelmts > 1) { - printf(" ]"); - } - indent -= 2; - break; - - case H5T_TIME: - - break; - - case H5T_STRING: - indentation(indent+COL); - indent += 2; - if (nelmts > 1) { - printf("[ "); - } - display_string - (nelmts, memb, sm_buf+offset+i*p_type_nbytes, size, nelmts, dim_n_size, 0 ) ; - if (nelmts > 1) { - printf(" ]"); - } - indent -= 2; - break; - - case H5T_BITFIELD: - - break; - - case H5T_OPAQUE: - - break; - case H5T_COMPOUND: - display_compound_data (nelmts, memb, sm_buf+offset+i*p_type_nbytes, size, nelmts, 0); - indentation(indent); - break; - default: break; - - } - - if ( j == nmembs-1) printf("\n"); - else printf(",\n"); - - H5Tclose(memb); - } - indent-= COL; - - indentation(indent+COL); - if ((elmtno+i+1) == p_nelmts) printf("}\n"); - else printf("},\n"); - } - - } -/*------------------------------------------------------------------------- - * Function: print_data - * - * Purpose: Print some values from a dataset or an attribute to the - * file STREAM after converting all types to P_TYPE (which - * should be a native type). If P_TYPE is a negative value - * then it will be computed from the dataset/attribute type - * using only native types. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -print_data(hid_t oid, hid_t _p_type, int obj_data) -{ - hid_t f_space; - hid_t p_type = _p_type; - hid_t f_type; - int status = -1; - - if (p_type < 0) { - - if (obj_data == DATASET_DATA) - f_type = H5Dget_type(oid); - else - f_type = H5Aget_type(oid); - - if (f_type < 0) return status; - - p_type = h5dump_fixtype(f_type); - - H5Tclose(f_type); - - if (p_type < 0) return status; - } - - /* Check the data space */ - if (obj_data == DATASET_DATA) - f_space = H5Dget_space(oid); - else - f_space = H5Aget_space(oid); - - if (f_space < 0) return status; - - if (H5Sis_simple(f_space) >= 0) { - if (obj_data == DATASET_DATA) { - status = h5dump_simple_dset(NULL,NULL, oid,p_type,0); - } - else { /*attribute data*/ - status = h5dump_attr(oid,p_type); - } - } - H5Sclose(f_space); - - if (p_type != _p_type) H5Tclose(p_type); - - return status; -} - -/*------------------------------------------------------------------------- * Function: indentation * * Purpose: Print spaces for indentation @@ -2482,151 +1848,7 @@ void indentation(int x) { -/*------------------------------------------------------------------------- - * Function: copy_atomic_char - * - * Purpose: copies the atomic characters from 1 string to another - * assumes there will be enough room in output for the input string - * - * Return: returns the number of actual characters copied - * - * Programmer: Patrick Lu - * - * Modifications: - * - *-----------------------------------------------------------------------*/ -int copy_atomic_char(char* output, char* input, int numchar, int freespace){ - - int x = 0; - - while (freespace || (x == numchar)){ - if (input[x] == '\\'){ - if (freespace == 1){ - break; - } - else { - if ((input[x+1] == '"') || (input[x+1] == '\\') || - (input[x+1] == 'b') || (input[x+1] == 'f') || - (input[x+1] == 'n') || (input[x+1] == 'r') || - (input[x+1] == 't')){ /*escape characters*/ - strncat(output,input,2); - x += 2; - freespace = freespace - 2; - } - else { /* octal number */ - if (freespace < 4){ - break; - } - else { - strncat(output,input,4); - x += 4; - freespace = freespace - 4; - } - } - } - } - else { - strncat(output,input+x,1); - freespace = freespace - 1; - x++; - } - } - if (x == 0) x = FAIL; - return(x); -} - -/*------------------------------------------------------------------------- - * Function: h5dump_attr - * - * Purpose: dumps an attribute - * - * Return: 0 = succeed or -1 for fail - * - * Programmer: Patrick Lu - * - * Modifications: - * - *-----------------------------------------------------------------------*/ - -int h5dump_attr(hid_t oid, hid_t p_type){ - - hid_t f_space; - void *sm_buf; - hid_t type; - hsize_t size[64], nelmts = 1, dim_n_size; - size_t p_type_nbytes, need; - int ndims, i; - int status = -1; - - f_space = H5Aget_space(oid); - - /* get the size of the attribute and allocate enough mem*/ - type = H5Aget_type(oid); - ndims = H5Sget_simple_extent_dims(f_space, size, NULL); - if (ndims){ - for (i = 0; i < ndims; i++){ - nelmts *= size[i]; - } - dim_n_size = size[ndims - 1]; - } - else { - dim_n_size = 1; - } - need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - sm_buf = malloc(need); - p_type_nbytes = H5Tget_size(p_type); - - /*read the attr*/ - if (H5Aread(oid, p_type, sm_buf) < 0){ - return (status); - } - status = 0; - /*print it*/ - switch (H5Tget_class(p_type)) { - case H5T_INTEGER: - display_numeric_data (nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0, oid); - break; - - case H5T_FLOAT: - display_numeric_data (nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0, oid); - break; - - case H5T_TIME: - break; - - case H5T_STRING: - display_string (nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0); - break; - - case H5T_BITFIELD: - break; - - case H5T_OPAQUE: - break; - - case H5T_COMPOUND: - compound_data = 1; - display_compound_data (nelmts, p_type, sm_buf, p_type_nbytes, nelmts, 0); - compound_data = 0; - break; - case H5T_REFERENCE: - display_numeric_data(nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0, oid); - case H5T_ENUM: - display_numeric_data(nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0, oid); -/* display_reference_data(nelmts, p_type, sm_buf, p_type_nbytes, - nelmts, dim_n_size, 0, oid);*/ - break; - default: break; - } - free(sm_buf); - return (status); -} /* Print the program name and the version information which is */ /* defined the same as the HDF5 library version. */ @@ -2940,30 +2162,7 @@ int get_table_idx(table_t *table, unsigned long *objno) { int idx = -1; -/* - switch (type) { - - case H5G_GROUP: - - idx = search_obj(&group_table, objno); - break; - - case H5G_DATASET: - - idx = search_obj(&dset_table, objno); - break; - - case H5G_TYPE: - - idx = search_obj(&type_table, objno); - break; - - default: - idx = -1; - - } -*/ idx = search_obj(table, objno); return idx; @@ -2985,26 +2184,7 @@ int idx = -1; int get_tableflag(table_t *table, int idx) { - /* - switch (type) { - - case H5G_GROUP: - - return group_table.objs[idx].objflag; - - case H5G_DATASET: - - return dset_table.objs[idx].objflag; - - case H5G_TYPE: - - return type_table.objs[idx].objflag; - - default: - - return -1; -} - */ + return(table->objs[idx].objflag); @@ -3026,29 +2206,7 @@ get_tableflag(table_t *table, int idx) int set_tableflag(table_t *table, int idx) { -/* - switch (type) { - - case H5G_GROUP: - - group_table.objs[idx].objflag = TRUE; - return SUCCEED; - - case H5G_DATASET: - dset_table.objs[idx].objflag = TRUE; - return SUCCEED; - - case H5G_TYPE: - - type_table.objs[idx].objflag = TRUE; - return SUCCEED; - - default: - - return FAIL; -} -*/ table->objs[idx].objflag = TRUE; return(SUCCEED); @@ -3069,27 +2227,6 @@ set_tableflag(table_t *table, int idx) char * get_objectname(table_t* table, int idx) { - /* - switch (type) { - - case H5G_GROUP: - - return strdup(group_table.objs[idx].objname); - - case H5G_DATASET: - - return strdup(dset_table.objs[idx].objname); - - case H5G_TYPE: - - return strdup(type_table.objs[idx].objname); - - default: - - return NULL; - - } - */ return(strdup(table->objs[idx].objname)); } diff --git a/tools/h5tools.h b/tools/h5tools.h index 28ec6fd..e6c4e40 100644 --- a/tools/h5tools.h +++ b/tools/h5tools.h @@ -332,7 +332,7 @@ hid_t h5dump_fixtype(hid_t f_type); int h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_typ,int indentlevel); int h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, void *mem, int indentlevel); -int copy_atomic_char(char* output, char* input, int numchar, int freespace); + /*if we get a new program that needs to use the library add its name here*/ typedef enum { |