summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-07-16 16:35:49 (GMT)
committerPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-07-16 16:35:49 (GMT)
commit0eddb58a27ccc108a2c3295c0b4fb0e9b99f529f (patch)
treeb653e7c844793b7bde518680f8eb48fc28acf508 /tools
parent0e4dda2a794dc489d9173763efa73ba276c00952 (diff)
downloadhdf5-0eddb58a27ccc108a2c3295c0b4fb0e9b99f529f.zip
hdf5-0eddb58a27ccc108a2c3295c0b4fb0e9b99f529f.tar.gz
hdf5-0eddb58a27ccc108a2c3295c0b4fb0e9b99f529f.tar.bz2
[svn-r1489]
removed a function that was not being compiled and put in a preliminary check in case the indentation is more than the number of columns.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5tools.c168
1 files changed, 8 insertions, 160 deletions
diff --git a/tools/h5tools.c b/tools/h5tools.c
index 481c5b6..dbf9ad7 100644
--- a/tools/h5tools.c
+++ b/tools/h5tools.c
@@ -24,7 +24,7 @@
int indent = 0;
int compound_data=0;
-int nCols = 80;
+int nCols = 10;
ProgType programtype = UNKNOWN;
static void display_numeric_data(hsize_t hs_nelmts, hid_t p_type,
unsigned char *sm_buf, size_t p_type_nbytes,
@@ -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