summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-07-16 16:45:24 (GMT)
committerPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-07-16 16:45:24 (GMT)
commit04e309953892847f42c8c3f8cffffbc862c462f2 (patch)
tree3b5d820fdddbf40396217e220335f82d2d6520f2 /tools
parent758ee9ca3f3c724e06644288e06e4d409f8034e1 (diff)
downloadhdf5-04e309953892847f42c8c3f8cffffbc862c462f2.zip
hdf5-04e309953892847f42c8c3f8cffffbc862c462f2.tar.gz
hdf5-04e309953892847f42c8c3f8cffffbc862c462f2.tar.bz2
[svn-r1491] removed teh extra funtion that wasn't being used and now if the
indentation is greater than the number of columns it will generate an error
Diffstat (limited to 'tools')
-rw-r--r--tools/h5tools.c166
1 files changed, 7 insertions, 159 deletions
diff --git a/tools/h5tools.c b/tools/h5tools.c
index 481c5b6..a991028 100644
--- a/tools/h5tools.c
+++ b/tools/h5tools.c
@@ -2469,8 +2469,13 @@ print_data(hid_t oid, hid_t _p_type, int obj_data)
*-----------------------------------------------------------------------*/
void indentation(int x) {
- while (x>0) { printf(" "); x--; }
-
+ if(x < nCols) {
+ while (x>0) { printf(" "); x--; }
+ }
+ else {
+ printf("The indentation exceeds the number of cols. Exiting....\n");
+ exit(1);
+ }
}
@@ -2620,162 +2625,5 @@ int h5dump_attr(hid_t oid, hid_t p_type){
free(sm_buf);
return (status);
}
-#if 0
-
-/*-------------------------------------------------------------------------
- * 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_reference_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;
-int x;
-int 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 ";
-/*********************************************************************************************/
-
-
- 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);
- 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) > (totalspace)) {
- /* first row of member */
-
- /* i added this */
- temp = 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*/
- 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';
- }
- }
- }
- free(out_buf);
-}
-#endif