From 9c9bebf83993e9d35551a3d0f53f6d06a2f0cf9f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 14 Feb 2007 14:55:27 -0500 Subject: [svn-r13305] Description: Clean up indentation. Tested on: Linux/32 2.6 (chicago) --- tools/h5ls/h5ls.c | 817 +++++++++++++++++++++++++++--------------------------- 1 file changed, 406 insertions(+), 411 deletions(-) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 8ae42b7..2c3bfd8 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -304,99 +304,99 @@ static hbool_t display_native_type(hid_t type, int UNUSED ind) { if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) { - printf("native signed char"); + printf("native signed char"); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { - printf("native unsigned char"); + printf("native unsigned char"); } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { - printf("native int"); + printf("native int"); } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { - printf("native unsigned int"); + printf("native unsigned int"); } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { - printf("native short"); + printf("native short"); } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { - printf("native unsigned short"); + printf("native unsigned short"); } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { - printf("native long"); + printf("native long"); } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { - printf("native unsigned long"); + printf("native unsigned long"); } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { - printf("native long long"); + printf("native long long"); } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { - printf("native unsigned long long"); + printf("native unsigned long long"); } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { - printf("native float"); + printf("native float"); } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { - printf("native double"); + printf("native double"); #if H5_SIZEOF_LONG_DOUBLE !=0 } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { - printf("native long double"); + printf("native long double"); #endif } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { - printf("native int8_t"); + printf("native int8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { - printf("native uint8_t"); + printf("native uint8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { - printf("native int16_t"); + printf("native int16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { - printf("native uint16_t"); + printf("native uint16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { - printf("native int32_t"); + printf("native int32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { - printf("native uint32_t"); + printf("native uint32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { - printf("native int64_t"); + printf("native int64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { - printf("native uint64_t"); + printf("native uint64_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { - printf("native int_least8_t"); + printf("native int_least8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { - printf("native uint_least8_t"); + printf("native uint_least8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { - printf("native int_least16_t"); + printf("native int_least16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { - printf("native uint_least16_t"); + printf("native uint_least16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { - printf("native int_least32_t"); + printf("native int_least32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { - printf("native uint_least32_t"); + printf("native uint_least32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { - printf("native int_least64_t"); + printf("native int_least64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { - printf("native uint_least64_t"); + printf("native uint_least64_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { - printf("native int_fast8_t"); + printf("native int_fast8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { - printf("native uint_fast8_t"); + printf("native uint_fast8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { - printf("native int_fast16_t"); + printf("native int_fast16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { - printf("native uint_fast16_t"); + printf("native uint_fast16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { - printf("native int_fast32_t"); + printf("native int_fast32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { - printf("native uint_fast32_t"); + printf("native uint_fast32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { - printf("native int_fast64_t"); + printf("native int_fast64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { - printf("native uint_fast64_t"); + printf("native uint_fast64_t"); } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { - printf("native 8-bit field"); + printf("native 8-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { - printf("native 16-bit field"); + printf("native 16-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { - printf("native 32-bit field"); + printf("native 32-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { - printf("native 64-bit field"); + printf("native 64-bit field"); } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { - printf("native hsize_t"); + printf("native hsize_t"); } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { - printf("native hssize_t"); + printf("native hssize_t"); } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { - printf("native herr_t"); + printf("native herr_t"); } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { - printf("native hbool_t"); + printf("native hbool_t"); } else { - return FALSE; + return FALSE; } return TRUE; } @@ -422,15 +422,15 @@ static hbool_t display_ieee_type(hid_t type, int UNUSED ind) { if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) { - printf("IEEE 32-bit big-endian float"); + printf("IEEE 32-bit big-endian float"); } else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { - printf("IEEE 32-bit little-endian float"); + printf("IEEE 32-bit little-endian float"); } else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { - printf("IEEE 64-bit big-endian float"); + printf("IEEE 64-bit big-endian float"); } else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { - printf("IEEE 64-bit little-endian float"); + printf("IEEE 64-bit little-endian float"); } else { - return FALSE; + return FALSE; } return TRUE; } @@ -465,61 +465,61 @@ display_precision(hid_t type, int ind) * and offset on the following line. Also display the padding * information. */ if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { - printf("\n%*s(%lu bit%s of precision beginning at bit %lu)", - ind, "", (unsigned long)prec, 1==prec?"":"s", - (unsigned long)H5Tget_offset(type)); - - H5Tget_pad(type, &plsb, &pmsb); - if (H5Tget_offset(type)>0) { - switch (plsb) { - case H5T_PAD_ZERO: - plsb_s = "zero"; - break; - case H5T_PAD_ONE: - plsb_s = "one"; - break; - case H5T_PAD_BACKGROUND: - plsb_s = "bkg"; - break; - case H5T_PAD_ERROR: - case H5T_NPAD: - plsb_s = "unknown"; - break; - } - } - if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { - switch (pmsb) { - case H5T_PAD_ZERO: - pmsb_s = "zero"; - break; - case H5T_PAD_ONE: - pmsb_s = "one"; - break; - case H5T_PAD_BACKGROUND: - pmsb_s = "bkg"; - break; - case H5T_PAD_ERROR: - case H5T_NPAD: - pmsb_s = "unknown"; - break; - } - } - if (plsb_s || pmsb_s) { - printf("\n%*s(", ind, ""); - if (plsb_s) { - nbits = H5Tget_offset(type); - printf("%lu %s bit%s at bit 0", - (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); - } - if (plsb_s && pmsb_s) printf(", "); - if (pmsb_s) { - nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); - printf("%lu %s bit%s at bit %lu", - (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", - (unsigned long)(8*H5Tget_size(type)-nbits)); - } - printf(")"); - } + printf("\n%*s(%lu bit%s of precision beginning at bit %lu)", + ind, "", (unsigned long)prec, 1==prec?"":"s", + (unsigned long)H5Tget_offset(type)); + + H5Tget_pad(type, &plsb, &pmsb); + if (H5Tget_offset(type)>0) { + switch (plsb) { + case H5T_PAD_ZERO: + plsb_s = "zero"; + break; + case H5T_PAD_ONE: + plsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + plsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + plsb_s = "unknown"; + break; + } + } + if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { + switch (pmsb) { + case H5T_PAD_ZERO: + pmsb_s = "zero"; + break; + case H5T_PAD_ONE: + pmsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pmsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pmsb_s = "unknown"; + break; + } + } + if (plsb_s || pmsb_s) { + printf("\n%*s(", ind, ""); + if (plsb_s) { + nbits = H5Tget_offset(type); + printf("%lu %s bit%s at bit 0", + (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); + } + if (plsb_s && pmsb_s) printf(", "); + if (pmsb_s) { + nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); + printf("%lu %s bit%s at bit %lu", + (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", + (unsigned long)(8*H5Tget_size(type)-nbits)); + } + printf(")"); + } } } @@ -555,37 +555,37 @@ display_int_type(hid_t type, int ind) /* Byte order */ if (H5Tget_size(type)>1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE==order) { - order_s = " little-endian"; - } else if (H5T_ORDER_BE==order) { - order_s = " big-endian"; - } else if (H5T_ORDER_VAX==order) { - order_s = " mixed-endian"; - } else { - order_s = " unknown-byte-order"; - } + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } } else { - order_s = ""; + order_s = ""; } /* Sign */ if ((sign=H5Tget_sign(type))>=0) { - if (H5T_SGN_NONE==sign) { - sign_s = " unsigned"; - } else if (H5T_SGN_2==sign) { - sign_s = ""; - } else { - sign_s = " unknown-sign"; - } + if (H5T_SGN_NONE==sign) { + sign_s = " unsigned"; + } else if (H5T_SGN_2==sign) { + sign_s = ""; + } else { + sign_s = " unknown-sign"; + } } else { - sign_s = " unknown-sign"; + sign_s = " unknown-sign"; } /* Print size, order, and sign on first line, precision and padding * information on the subsequent lines */ printf("%lu-bit%s%s integer", - (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); display_precision(type, ind); return TRUE; } @@ -625,24 +625,24 @@ display_float_type(hid_t type, int ind) /* Byte order */ if (H5Tget_size(type)>1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE==order) { - order_s = " little-endian"; - } else if (H5T_ORDER_BE==order) { - order_s = " big-endian"; - } else if (H5T_ORDER_VAX==order) { - order_s = " mixed-endian"; - } else { - order_s = " unknown-byte-order"; - } + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } } else { - order_s = ""; + order_s = ""; } /* Print size and byte order on first line, precision and padding on * subsequent lines. */ printf("%lu-bit%s floating-point", - (unsigned long)(8*H5Tget_size(type)), order_s); + (unsigned long)(8*H5Tget_size(type)), order_s); display_precision(type, ind); /* Print sizes, locations, and other information about each field */ @@ -650,46 +650,46 @@ display_float_type(hid_t type, int ind) ebias = H5Tget_ebias(type); norm = H5Tget_norm(type); switch (norm) { - case H5T_NORM_IMPLIED: - norm_s = ", msb implied"; - break; - case H5T_NORM_MSBSET: - norm_s = ", msb always set"; - break; - case H5T_NORM_NONE: - norm_s = ", no normalization"; - break; - case H5T_NORM_ERROR: - norm_s = ", unknown normalization"; - break; + case H5T_NORM_IMPLIED: + norm_s = ", msb implied"; + break; + case H5T_NORM_MSBSET: + norm_s = ", msb always set"; + break; + case H5T_NORM_NONE: + norm_s = ", no normalization"; + break; + case H5T_NORM_ERROR: + norm_s = ", unknown normalization"; + break; } printf("\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", - (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, - norm_s); + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, + norm_s); printf("\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", - ind, "", (unsigned long)esize, 1==esize?"":"s", - (unsigned long)epos, (unsigned long)ebias); + ind, "", (unsigned long)esize, 1==esize?"":"s", + (unsigned long)epos, (unsigned long)ebias); printf("\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); /* Display internal padding */ if (1+esize+msize0) { - HDfprintf(stdout, "/%Hu", max_size[i]); - } + HDfprintf (stdout, "%s%Hu", i?", ":"", cur_size[i]); + if (max_size[i]==H5S_UNLIMITED) { + HDfprintf (stdout, "/%s", "Inf"); + } else if (max_size[i]!=cur_size[i] || verbose_g>0) { + HDfprintf(stdout, "/%Hu", max_size[i]); + } } if (space_type==H5S_SCALAR) printf("SCALAR"); else if (space_type==H5S_NULL) printf("NULL"); @@ -1526,115 +1529,113 @@ dataset_list2(hid_t dset, const char UNUSED *name) int i; if (verbose_g>0) { - dcpl = H5Dget_create_plist(dset); - space = H5Dget_space(dset); - type = H5Dget_type(dset); - - /* Print information about chunked storage */ - if (H5D_CHUNKED==H5Pget_layout(dcpl)) { - ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/); - printf(" %-10s {", "Chunks:"); - total = H5Tget_size(type); - for (i=0; i0) { + dcpl = H5Dget_create_plist(dset); + space = H5Dget_space(dset); + type = H5Dget_type(dset); + + /* Print information about chunked storage */ + if (H5D_CHUNKED==H5Pget_layout(dcpl)) { + ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/); + printf(" %-10s {", "Chunks:"); + total = H5Tget_size(type); + for (i=0; i0) { #ifdef WIN32 - utilization = (hssize_t)total * 100.0 / (hssize_t)used; + utilization = (hssize_t)total * 100.0 / (hssize_t)used; #else - utilization = (total*100.0)/used; + utilization = (total*100.0)/used; #endif - printf(", %1.2f%% utilization", utilization); - } - putchar('\n'); - - /* Print information about external strorage */ - if ((nf = H5Pget_external_count(dcpl))>0) { - for (i=0, max_len=0; i0) { - for (i=0; i0) { + for (i=0, max_len=0; i0) { + for (i=0; i0) { - printf(" %-10s ", "Type:"); - display_type(type, 15); - printf("\n"); + printf(" %-10s ", "Type:"); + display_type(type, 15); + printf("\n"); } return 0; } @@ -1733,6 +1734,8 @@ slink_open(hid_t location, const char *name) return 0; } + + /*------------------------------------------------------------------------- * Function: udlink_open * @@ -1989,56 +1992,53 @@ get_width(void) /* Try to get it from the COLUMNS environment variable first since it's * value is sometimes wrong. */ - if ((s=getenv("COLUMNS")) && *s && isdigit((int)*s)) { - width = (int)strtol(s, NULL, 0); - } + if ((s=getenv("COLUMNS")) && *s && isdigit((int)*s)) + width = (int)strtol(s, NULL, 0); #if defined(H5_HAVE_STRUCT_VIDEOCONFIG) && defined(H5_HAVE__GETVIDEOCONFIG) { - /* Microsoft C */ - struct videoconfig w; - _getvideoconfig(&w); - width = w.numtextcols; + /* Microsoft C */ + struct videoconfig w; + _getvideoconfig(&w); + width = w.numtextcols; } #elif defined(H5_HAVE_STRUCT_TEXT_INFO) && defined(H5_HAVE_GETTEXTINFO) { - /* Borland C or DJGPPC */ - struct text_info w; - gettextinfo(&w); - width = w.screenwidth; + /* Borland C or DJGPPC */ + struct text_info w; + gettextinfo(&w); + width = w.screenwidth; } #elif defined(H5_HAVE_GETCONSOLESCREENBUFFERINFO) { - /* Win32 C */ - CONSOLE_SCREEN_BUFFER_INFO scr; - GetConsoleScreenBufferInfo(con_out, &scr); - width = scr.srWindow.Right - scr.srWindow.Left + 1; + /* Win32 C */ + CONSOLE_SCREEN_BUFFER_INFO scr; + GetConsoleScreenBufferInfo(con_out, &scr); + width = scr.srWindow.Right - scr.srWindow.Left + 1; } #elif defined(H5_HAVE__SCRSIZE) { - /* OS/2 */ - int w[2]; - _scrsize(w); - width = w[0]; + /* OS/2 */ + int w[2]; + _scrsize(w); + width = w[0]; } #elif defined(H5_HAVE_TIOCGWINSZ) && defined(H5_HAVE_IOCTL) #ifndef __PUMAGON__ /* the ioctl() call coredump on TFLOPS. Turn it off for now. */ { - /* Unix with ioctl(TIOCGWINSZ) */ - struct winsize w; - if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0) { - width = w.ws_col; - } + /* Unix with ioctl(TIOCGWINSZ) */ + struct winsize w; + if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0) + width = w.ws_col; } #endif #elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL) { - /* Unix with ioctl(TIOCGETD) */ - struct uwdata w; - if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0) { - width = w.uw_width / w.uw_hs; - } + /* Unix with ioctl(TIOCGETD) */ + struct uwdata w; + if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0) + width = w.uw_width / w.uw_hs; } #endif @@ -2105,16 +2105,11 @@ main (int argc, const char *argv[]) h5tools_init(); /* Build display table */ - DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose, - dataset_list1, dataset_list2); - DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, - NULL, group_list2); - DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, - NULL, datatype_list2); - DISPATCH(H5G_LINK, "-> ", slink_open, NULL, - NULL, NULL); - DISPATCH(H5G_UDLINK, "-> ", udlink_open, NULL, - NULL, NULL); + DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose, dataset_list1, dataset_list2); + DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, NULL, group_list2); + DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, NULL, datatype_list2); + DISPATCH(H5G_LINK, "-> ", slink_open, NULL, NULL, NULL); + DISPATCH(H5G_UDLINK, "-> ", udlink_open, NULL, NULL, NULL); #if 0 /* Name of this program without the path */ -- cgit v0.12