From 68bff3d352a5a8d87f582fb1a84361f3006b5ff4 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Thu, 19 Nov 1998 12:36:27 -0500 Subject: [svn-r928] Changes since 19981118 ---------------------- ./src/H5.c ./src/H5Smpio.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpublic.h ./src/H5detect.c ./src/H5private.h ./src/H5public.h ./test/big.c The `long long' type isn't quite as prevalent as we had hoped; there is at least one system that defines `__int64' but not `long long'. Therefore, I've temporarily changed all occurrences of `long long' to `long_long' and then #define that in H5private.h based on the existence of `long long' or `__int64'. This gets rid of some #ifdef's in other parts of the code. The semantics of the hdf5 types are: *int8_t Exactly one byte *int16_t At least two bytes. We favor 32-bit integers over 16-bit integers if the 16-bit integer is 4-bytes wide (Cray) *int32_t At least four bytes. *int64_t At least eight bytes long_long The widest integral integer type The H5Smpio.c contains debugging code which is non-portable. ./tools/h5ls.c Changed the order native types are detected so we favor the name `int' over `short' or `long' if two of them are the same. ./config/conclude.in Added a rule to make test programs depend on the hdf5 library. This fixes a minor bug where changing H5detect.c and then running `make test' caused H5Tinit.c to not be recompiled and therefore the test files are not relinked. --- config/conclude.in | 2 +- src/H5.c | 3 - src/H5Smpio.c | 19 +++-- src/H5T.c | 2 +- src/H5Tconv.c | 136 ++++++++++++++++---------------- src/H5Tpublic.h | 2 +- src/H5detect.c | 43 +---------- src/H5private.h | 219 ++++++++++++++++++++++++++++++++++------------------ src/H5public.h | 4 +- test/big.c | 4 +- testpar/Makefile.in | 2 +- tools/h5ls.c | 8 +- 12 files changed, 238 insertions(+), 206 deletions(-) diff --git a/config/conclude.in b/config/conclude.in index a11ced7..b39fb96 100644 --- a/config/conclude.in +++ b/config/conclude.in @@ -20,7 +20,7 @@ TAGS: $(LIB_SRC) -etags $(LIB_SRC) # Runs each test in order, passing $(TEST_FLAGS) to the program. -tests: $(TEST_PROGS) +tests: $(TEST_PROGS) $(LIB) test _test: tests @for test in $(TEST_PROGS) dummy; do \ if test $$test != dummy; then \ diff --git a/src/H5.c b/src/H5.c index 47a0024..42d19dc 100644 --- a/src/H5.c +++ b/src/H5.c @@ -777,9 +777,6 @@ HDfprintf (FILE *stream, const char *fmt, ...) } else if (sizeof(x->offset)==SIZEOF_LONG_LONG) { HDstrcat(template, PRINTF_LL_WIDTH); HDstrcat(template, "d"); - } else if (sizeof(x->offset)==SIZEOF___INT64) { - HDstrcat(template, PRINTF_LL_WIDTH); - HDstrcat(template, "d"); } n = fprintf(stream, template, x->offset); } else { diff --git a/src/H5Smpio.c b/src/H5Smpio.c index fdfa569..e49916e 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -103,7 +103,8 @@ H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size, *is_derived_type = 0; #ifdef H5Smpi_DEBUG - fprintf(stdout, "Leave %s total_bytes=%lld\n", FUNC, (long long)total_bytes ); + fprintf(stdout, "Leave %s total_bytes=%lld\n", + FUNC, (long_long)total_bytes ); #endif FUNC_LEAVE (SUCCEED); } /* H5S_mpio_all_type() */ @@ -166,9 +167,10 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, d[i].count = diminfo[i].count; d[i].xtent = space->extent.u.simple.size[i]; #ifdef H5Smpi_DEBUG - fprintf(stdout, - "hyper_type: start=%lld stride=%lld count=%lld block=%lld xtent=%lld", - (long long)d[i].start, (long long)d[i].strid, (long long)d[i].count, (long long)d[i].block, (long long)d[i].xtent ); + fprintf(stdout, "hyper_type: start=%lld stride=%lld count=%lld " + "block=%lld xtent=%lld", (long_long)d[i].start, + (long_long)d[i].strid, (long_long)d[i].count, + (long_long)d[i].block, (long_long)d[i].xtent ); if (i==0) fprintf(stdout, " rank=%d\n", rank ); else fprintf(stdout, "\n" ); #endif @@ -251,7 +253,9 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, /* construct the type by walking the hyperslab dims from the inside out */ for ( i=new_rank-1; i>=0; --i) { #ifdef H5Smpi_DEBUG - fprintf(stdout, "hyper_type: i=%d Making vector type\n count=%lld block=%lld stride=%lld\n", i, (long long)d[i].count, (long long)d[i].block, (long long)d[i].strid ); + fprintf(stdout, "hyper_type: i=%d Making vector type\n count=%lld " + "block=%lld stride=%lld\n", i, (long_long)d[i].count, + (long_long)d[i].block, (long_long)d[i].strid ); #endif err = MPI_Type_vector( (int)(d[i].count), /* count */ (int)(d[i].block), /* blocklength */ @@ -311,7 +315,8 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, * The struct's first "field" is the displacement, * and its second "field" is the just-created vector type */ #ifdef H5Smpi_DEBUG - fprintf(stdout, "hyper_type: i=%d Making struct type\n b[1]=%d d[1]=%lld\n", i, b[1], (long long)s[1] ); + fprintf(stdout, "hyper_type: i=%d Making struct type\n " + "b[1]=%d d[1]=%lld\n", i, b[1], (long_long)s[1] ); #endif err = MPI_Type_struct( 2, b, s, t, &inner_type/*becomes outer*/ ); MPI_Type_free( &outer_type ); /* no longer needed */ @@ -508,7 +513,7 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout, H5F_addr_add( &disp, &(layout->addr) ); f->shared->access_parms->u.mpio.disp = disp; #ifdef H5Smpi_DEBUG - fprintf(stdout, "spaces_xfer: disp=%lld\n", (long long)disp.offset ); + fprintf(stdout, "spaces_xfer: disp=%lld\n", (long_long)disp.offset ); #endif /* Effective address determined by base addr and the MPI file type */ diff --git a/src/H5T.c b/src/H5T.c index 2dc75d9..e3d84d4 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -703,7 +703,7 @@ H5T_init_interface(void) "unable to register conversion function"); } - /* from long long */ + /* from long_long */ if (H5Tregister_hard("llong_ullong", H5T_NATIVE_LLONG, H5T_NATIVE_ULLONG, H5T_conv_llong_ullong)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, diff --git a/src/H5Tconv.c b/src/H5Tconv.c index cbbeb13..a1fc1aa 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2354,7 +2354,7 @@ H5T_conv_uchar_ulong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_char_llong * - * Purpose: Converts `signed char' to `long long' + * Purpose: Converts `signed char' to `long_long' * * Return: Success: Non-negative * @@ -2373,7 +2373,7 @@ H5T_conv_char_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_char_llong, FAIL); - H5T_CONV_sS(cdata, buf, nelmts, signed char, long long); + H5T_CONV_sS(cdata, buf, nelmts, signed char, long_long); FUNC_LEAVE(SUCCEED); } @@ -2381,7 +2381,7 @@ H5T_conv_char_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_char_ullong * - * Purpose: Converts `signed char' to `unsigned long long' + * Purpose: Converts `signed char' to `unsigned long_long' * * Return: Success: Non-negative * @@ -2400,7 +2400,7 @@ H5T_conv_char_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_char_ullong, FAIL); H5T_CONV_sU(cdata, src_id, dst_id, buf, nelmts, - signed char, unsigned long long); + signed char, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -2408,7 +2408,7 @@ H5T_conv_char_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_uchar_llong * - * Purpose: Converts `unsigned char' to `long long' + * Purpose: Converts `unsigned char' to `long_long' * * Return: Success: Non-negative * @@ -2427,7 +2427,7 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_uchar_llong, FAIL); H5T_CONV_uS(cdata, src_id, dst_id, buf, nelmts, - unsigned char, long long, LLONG_MAX); + unsigned char, long_long, LLONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -2435,7 +2435,7 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_uchar_ullong * - * Purpose: Converts `unsigned char' to `unsigned long long' + * Purpose: Converts `unsigned char' to `unsigned long_long' * * Return: Success: Non-negative * @@ -2454,7 +2454,7 @@ H5T_conv_uchar_ullong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_uchar_ullong, FAIL); - H5T_CONV_uU(cdata, buf, nelmts, unsigned char, unsigned long long); + H5T_CONV_uU(cdata, buf, nelmts, unsigned char, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -2838,7 +2838,7 @@ H5T_conv_ushort_ulong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_short_llong * - * Purpose: Converts `short' to `long long' + * Purpose: Converts `short' to `long_long' * * Return: Success: Non-negative * @@ -2857,7 +2857,7 @@ H5T_conv_short_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_short_llong, FAIL); - H5T_CONV_sS(cdata, buf, nelmts, short, long long); + H5T_CONV_sS(cdata, buf, nelmts, short, long_long); FUNC_LEAVE(SUCCEED); } @@ -2865,7 +2865,7 @@ H5T_conv_short_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_short_ullong * - * Purpose: Converts `short' to `unsigned long long' + * Purpose: Converts `short' to `unsigned long_long' * * Return: Success: Non-negative * @@ -2884,7 +2884,7 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_short_ullong, FAIL); H5T_CONV_sU(cdata, src_id, dst_id, buf, nelmts, - short, unsigned long long); + short, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -2892,7 +2892,7 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ushort_llong * - * Purpose: Converts `unsigned short' to `long long' + * Purpose: Converts `unsigned short' to `long_long' * * Return: Success: Non-negative * @@ -2911,7 +2911,7 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ushort_llong, FAIL); H5T_CONV_uS(cdata, src_id, dst_id, buf, nelmts, - unsigned short, long long, LLONG_MAX); + unsigned short, long_long, LLONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -2919,7 +2919,7 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ushort_ullong * - * Purpose: Converts `unsigned short' to `unsigned long long' + * Purpose: Converts `unsigned short' to `unsigned long_long' * * Return: Success: Non-negative * @@ -2938,7 +2938,7 @@ H5T_conv_ushort_ullong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_ushort_ullong, FAIL); - H5T_CONV_uU(cdata, buf, nelmts, unsigned short, unsigned long long); + H5T_CONV_uU(cdata, buf, nelmts, unsigned short, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -3323,7 +3323,7 @@ H5T_conv_uint_ulong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_int_llong * - * Purpose: Converts `int' to `long long' + * Purpose: Converts `int' to `long_long' * * Return: Success: Non-negative * @@ -3342,7 +3342,7 @@ H5T_conv_int_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_int_llong, FAIL); - H5T_CONV_sS(cdata, buf, nelmts, int, long long); + H5T_CONV_sS(cdata, buf, nelmts, int, long_long); FUNC_LEAVE(SUCCEED); } @@ -3350,7 +3350,7 @@ H5T_conv_int_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_int_ullong * - * Purpose: Converts `int' to `unsigned long long' + * Purpose: Converts `int' to `unsigned long_long' * * Return: Success: Non-negative * @@ -3369,7 +3369,7 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_int_ullong, FAIL); H5T_CONV_sU(cdata, src_id, dst_id, buf, nelmts, - int, unsigned long long); + int, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -3377,7 +3377,7 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_uint_llong * - * Purpose: Converts `unsigned int' to `long long' + * Purpose: Converts `unsigned int' to `long_long' * * Return: Success: Non-negative * @@ -3396,7 +3396,7 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_uint_llong, FAIL); H5T_CONV_uS(cdata, src_id, dst_id, buf, nelmts, - unsigned, long long, LLONG_MAX); + unsigned, long_long, LLONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -3404,7 +3404,7 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_uint_ullong * - * Purpose: Converts `unsigned int' to `unsigned long long' + * Purpose: Converts `unsigned int' to `unsigned long_long' * * Return: Success: Non-negative * @@ -3423,7 +3423,7 @@ H5T_conv_uint_ullong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_uint_ullong, FAIL); - H5T_CONV_uU(cdata, buf, nelmts, unsigned, unsigned long long); + H5T_CONV_uU(cdata, buf, nelmts, unsigned, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -3809,7 +3809,7 @@ H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_long_llong * - * Purpose: Converts `long' to `long long' + * Purpose: Converts `long' to `long_long' * * Return: Success: Non-negative * @@ -3828,7 +3828,7 @@ H5T_conv_long_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_long_llong, FAIL); - H5T_CONV_sS(cdata, buf, nelmts, long, long long); + H5T_CONV_sS(cdata, buf, nelmts, long, long_long); FUNC_LEAVE(SUCCEED); } @@ -3836,7 +3836,7 @@ H5T_conv_long_llong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_long_ullong * - * Purpose: Converts `long' to `unsigned long long' + * Purpose: Converts `long' to `unsigned long_long' * * Return: Success: Non-negative * @@ -3855,7 +3855,7 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_long_ullong, FAIL); H5T_CONV_sU(cdata, src_id, dst_id, buf, nelmts, - long, unsigned long long); + long, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -3863,7 +3863,7 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ulong_llong * - * Purpose: Converts `unsigned long' to `long long' + * Purpose: Converts `unsigned long' to `long_long' * * Return: Success: Non-negative * @@ -3882,7 +3882,7 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_long_llong, FAIL); H5T_CONV_uS(cdata, src_id, dst_id, buf, nelmts, - unsigned long, long long, LLONG_MAX); + unsigned long, long_long, LLONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -3890,7 +3890,7 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ulong_ullong * - * Purpose: Converts `unsigned long' to `unsigned long long' + * Purpose: Converts `unsigned long' to `unsigned long_long' * * Return: Success: Non-negative * @@ -3909,7 +3909,7 @@ H5T_conv_ulong_ullong(hid_t __unused__ src_id, hid_t __unused__ dst_id, void __unused__ *bkg) { FUNC_ENTER(H5T_conv_ulong_ullong, FAIL); - H5T_CONV_uU(cdata, buf, nelmts, unsigned long, unsigned long long); + H5T_CONV_uU(cdata, buf, nelmts, unsigned long, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -3917,7 +3917,7 @@ H5T_conv_ulong_ullong(hid_t __unused__ src_id, hid_t __unused__ dst_id, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_char * - * Purpose: Converts `long long' to `signed char' + * Purpose: Converts `long_long' to `signed char' * * Return: Success: Non-negative * @@ -3936,7 +3936,7 @@ H5T_conv_llong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_char, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long long, signed char, CHAR_MIN, CHAR_MAX); + long_long, signed char, CHAR_MIN, CHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3944,7 +3944,7 @@ H5T_conv_llong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_uchar * - * Purpose: Converts `long long' to `unsigned char' + * Purpose: Converts `long_long' to `unsigned char' * * Return: Success: Non-negative * @@ -3963,7 +3963,7 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_uchar, FAIL); H5T_CONV_Su(cdata, src_id, dst_id, buf, nelmts, - long long, unsigned char, UCHAR_MAX); + long_long, unsigned char, UCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3971,7 +3971,7 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_char * - * Purpose: Converts `unsigned long long' to `signed char' + * Purpose: Converts `unsigned long_long' to `signed char' * * Return: Success: Non-negative * @@ -3990,7 +3990,7 @@ H5T_conv_ullong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_char, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, signed char, CHAR_MAX); + unsigned long_long, signed char, CHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3998,7 +3998,7 @@ H5T_conv_ullong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_uchar * - * Purpose: Converts `unsigned long long' to `unsigned char' + * Purpose: Converts `unsigned long_long' to `unsigned char' * * Return: Success: Non-negative * @@ -4017,7 +4017,7 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_uchar, FAIL); H5T_CONV_Uu(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, unsigned char, UCHAR_MAX); + unsigned long_long, unsigned char, UCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -4025,7 +4025,7 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_short * - * Purpose: Converts `long long' to `short' + * Purpose: Converts `long_long' to `short' * * Return: Success: Non-negative * @@ -4044,7 +4044,7 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_short, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long long, short, SHRT_MIN, SHRT_MAX); + long_long, short, SHRT_MIN, SHRT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4052,7 +4052,7 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ushort * - * Purpose: Converts `long long' to `unsigned short' + * Purpose: Converts `long_long' to `unsigned short' * * Return: Success: Non-negative * @@ -4071,7 +4071,7 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_ushort, FAIL); H5T_CONV_Su(cdata, src_id, dst_id, buf, nelmts, - long long, unsigned short, USHRT_MAX); + long_long, unsigned short, USHRT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4079,7 +4079,7 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_short * - * Purpose: Converts `unsigned long long' to `short' + * Purpose: Converts `unsigned long_long' to `short' * * Return: Success: Non-negative * @@ -4098,7 +4098,7 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_short, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, short, SHRT_MAX); + unsigned long_long, short, SHRT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4106,7 +4106,7 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_ushort * - * Purpose: Converts `unsigned long long' to `unsigned short' + * Purpose: Converts `unsigned long_long' to `unsigned short' * * Return: Success: Non-negative * @@ -4125,7 +4125,7 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_ushort, FAIL); H5T_CONV_Uu(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, unsigned short, USHRT_MAX); + unsigned long_long, unsigned short, USHRT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4133,7 +4133,7 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_int * - * Purpose: Converts `long long' to `int' + * Purpose: Converts `long_long' to `int' * * Return: Success: Non-negative * @@ -4152,7 +4152,7 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_int, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long long, int, INT_MIN, INT_MAX); + long_long, int, INT_MIN, INT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4160,7 +4160,7 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_uint * - * Purpose: Converts `long long' to `unsigned int' + * Purpose: Converts `long_long' to `unsigned int' * * Return: Success: Non-negative * @@ -4179,7 +4179,7 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_uint, FAIL); H5T_CONV_Su(cdata, src_id, dst_id, buf, nelmts, - long long, unsigned, UINT_MAX); + long_long, unsigned, UINT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4187,7 +4187,7 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_int * - * Purpose: Converts `unsigned long long' to `int' + * Purpose: Converts `unsigned long_long' to `int' * * Return: Success: Non-negative * @@ -4206,7 +4206,7 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_int, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, int, INT_MAX); + unsigned long_long, int, INT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4214,7 +4214,7 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_uint * - * Purpose: Converts `unsigned long long' to `unsigned int' + * Purpose: Converts `unsigned long_long' to `unsigned int' * * Return: Success: Non-negative * @@ -4233,7 +4233,7 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_uint, FAIL); H5T_CONV_Uu(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, unsigned, UINT_MAX); + unsigned long_long, unsigned, UINT_MAX); FUNC_LEAVE(SUCCEED); } @@ -4241,7 +4241,7 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_long * - * Purpose: Converts `long long' to `long' + * Purpose: Converts `long_long' to `long' * * Return: Success: Non-negative * @@ -4260,7 +4260,7 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_long, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long long, long, LONG_MIN, LONG_MAX); + long_long, long, LONG_MIN, LONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -4268,7 +4268,7 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ulong * - * Purpose: Converts `long long' to `unsigned long' + * Purpose: Converts `long_long' to `unsigned long' * * Return: Success: Non-negative * @@ -4287,7 +4287,7 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_ulong, FAIL); H5T_CONV_Su(cdata, src_id, dst_id, buf, nelmts, - long long, unsigned long, ULONG_MAX); + long_long, unsigned long, ULONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -4295,7 +4295,7 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_long * - * Purpose: Converts `unsigned long long' to `long' + * Purpose: Converts `unsigned long_long' to `long' * * Return: Success: Non-negative * @@ -4314,7 +4314,7 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_long, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, long, LONG_MAX); + unsigned long_long, long, LONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -4322,7 +4322,7 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_ulong * - * Purpose: Converts `unsigned long long' to `unsigned long' + * Purpose: Converts `unsigned long_long' to `unsigned long' * * Return: Success: Non-negative * @@ -4341,7 +4341,7 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_ulong, FAIL); H5T_CONV_Uu(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, unsigned long, ULONG_MAX); + unsigned long_long, unsigned long, ULONG_MAX); FUNC_LEAVE(SUCCEED); } @@ -4349,7 +4349,7 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ullong * - * Purpose: Converts `long long' to `unsigned long long' + * Purpose: Converts `long_long' to `unsigned long_long' * * Return: Success: non-negative * @@ -4368,7 +4368,7 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_ullong, FAIL); H5T_CONV_su(cdata, src_id, dst_id, buf, nelmts, - long long, unsigned long long); + long_long, unsigned long_long); FUNC_LEAVE(SUCCEED); } @@ -4376,7 +4376,7 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_llong * - * Purpose: Converts `unsigned long long' to `long long' + * Purpose: Converts `unsigned long_long' to `long_long' * * Return: Success: non-negative * @@ -4395,7 +4395,7 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_llong, FAIL); H5T_CONV_us(cdata, src_id, dst_id, buf, nelmts, - unsigned long long, long long, LLONG_MAX); + unsigned long_long, long_long, LLONG_MAX); FUNC_LEAVE(SUCCEED); } diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index c2f8279..55651a2 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -326,7 +326,7 @@ extern hid_t H5T_FORTRAN_S1_g; * precision and byte order as the last component, they have a C-like type * name. If the type begins with `U' then it is the unsigned version of the * integer type; other integer types are signed. The type LLONG corresponds - * to C's `long long' and LDOUBLE is `long double' (these types might be the + * to C's `long_long' and LDOUBLE is `long double' (these types might be the * same as `LONG' and `DOUBLE' respectively. */ #define H5T_NATIVE_CHAR (H5open(), H5T_NATIVE_CHAR_g) diff --git a/src/H5detect.c b/src/H5detect.c index 26024b1..44b0486 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -30,41 +30,9 @@ static const char *FileHeader = "\n\ *------------------------------------------------------------------------- */ #undef NDEBUG -#include - -/* See H5private.h for how to include files */ -#ifdef STDC_HEADERS -# include -# include -# include -# include -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -# include -#endif -#ifdef _POSIX_VERSION -# include -#endif - -#if defined(TIME_WITH_SYS_TIME) -# include -# include -#elif defined(HAVE_SYS_TIME_H) -# include -#else -# include -#endif +#include #define MAXDETECT 16 - -#ifndef MIN -# define MIN(X,Y) ((X)<(Y)?(X):(Y)) -# define MIN3(X,Y,Z) MIN(X,MIN(Y,Z)) -#endif - /* * This structure holds information about a type that * was detected. @@ -976,12 +944,9 @@ main(void) DETECT_I(long, LONG, d[nd]); nd++; DETECT_I(unsigned long, ULONG, d[nd]); nd++; -#if SIZEOF_LONG_LONG > SIZEOF_LONG - DETECT_I(long long, LLONG, d[nd]); nd++; - DETECT_I(unsigned long long, ULLONG, d[nd]); nd++; -#elif SIZEOF___INT64 > SIZEOF_LONG - DETECT_I(__int64, LLONG, d[nd]); nd++; - DETECT_I(unsigned __int64, ULLONG, d[nd]); nd++; +#if SIZEOF_LONG_LONG>0 + DETECT_I(long_long, LLONG, d[nd]); nd++; + DETECT_I(unsigned long_long, ULLONG, d[nd]); nd++; #else /* * This architecture doesn't support an integer type larger than `long' diff --git a/src/H5private.h b/src/H5private.h index f9e16f4..87d973a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -196,94 +196,159 @@ #endif /* + * Although `long long' is part of the revised ANSI-C some compilers don't + * support it yet. We define `long_long' as the longest integral integer type + * supported by the compiler, usually 64 bits. It must be legal to qualify + * `long_long' with `unsigned'. + */ +#if SIZEOF_LONG_LONG>0 +# define long_long long long +#elif SIZEOF___INT64>0 +# define long_long __int64 /*Win32*/ +# undef SIZEOF_LONG_LONG +# define SIZEOF_LONG_LONG SIZEOF___INT64 +#else +# define long_long long int +# undef SIZEOF_LONG_LONG +# define SIZEOF_LONG_LONG SIZEOF_LONG +#endif + +/* * Numeric data types. Some of these might be defined in Posix.1g, otherwise * we define them with the closest available type which is at least as large - * as the number of bits indicated in the type name. + * as the number of bits indicated in the type name. The `int8' types *must* + * be exactly one byte wide because we use it for pointer calculations to + * void* memory. + * + * For int16_t and uint16_t we use `short' only if it's exactly 2 bytes. + * Otherwise we use `int' because it's probably faster. */ #if SIZEOF_INT8_T==0 -typedef signed char int8_t; + typedef signed char int8_t; +# undef SIZEOF_INT8_T +# define SIZEOF_INT8_T SIZEOF_CHAR +#elif SIZEOF_INT8_T==1 +#else +# error "the int8_t type must be 1 byte wide" #endif #if SIZEOF_UINT8_T==0 -typedef unsigned char uint8_t; -#endif - -#if SIZEOF_INT16_T==0 -# if SIZEOF_SHORT==2 -typedef short int16_t; -# else -typedef int int16_t; /*not really */ -# endif -#endif - -#if SIZEOF_UINT16_T==0 -# if SIZEOF_SHORT==2 -typedef unsigned short uint16_t; -# else -typedef unsigned uint16_t; /*not really */ -# endif -#endif - -#if SIZEOF_INT32_T==0 -# if SIZEOF_INT==4 -typedef int int32_t; -# elif SIZEOF_LONG==4 -typedef long int32_t; -# else -typedef int int32_t; /*not really */ -# endif -#endif - -#if SIZEOF_UINT32_T==0 -# if SIZEOF_INT==4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG==4 -typedef unsigned long uint32_t; -# else -typedef unsigned uint32_t; /*not really */ -# endif -#endif - -#if SIZEOF_INT64_T==0 -# if SIZEOF_INT==8 -typedef int int64_t; -# elif SIZEOF_LONG==8 -typedef long int64_t; -# elif SIZEOF_LONG_LONG==8 -typedef long long int64_t; -# elif SIZEOF___INT64==8 -typedef __int64 int64_t; -# else -# error "no signed 64-bit integer type" -# endif -#endif - -#if SIZEOF_UINT64_T==0 -# if SIZEOF_INT==8 -typedef unsigned uint64_t; -# elif SIZEOF_LONG==8 -typedef unsigned long uint64_t; -# elif SIZEOF_LONG_LONG==8 -typedef unsigned long long uint64_t; -# elif SIZEOF___INT64==8 -typedef unsigned __int64 uint64_t; -# else -# error "no unsigned 64-bit integer type" -# endif -#endif - -#if SIZEOF_FLOAT==4 + typedef unsigned char uint8_t; +# undef SIZEOF_UINT8_T +# define SIZEOF_UINT8_T SIZEOF_CHAR +#elif SIZEOF_UINT8_T==1 +#else +# error "the uint8_t type must be 1 byte wide" +#endif + +#if SIZEOF_INT16_T>=2 +#elif SIZEOF_SHORT==2 + typedef short int16_t +# undef SIZEOF_INT16_T +# define SIZEOF_INT16_T SIZEOF_SHORT +#elif SIZEOF_INT>=2 + typedef int int16_t +# undef SIZEOF_INT16_T +# define SIZEOF_INT16_T SIZEOF_INT +#else +# error "nothing appropriate for int16_t" +#endif + +#if SIZEOF_UINT16_T>=2 +#elif SIZEOF_SHORT>=2 + typedef unsigned short uint16_t; +# undef SIZEOF_UINT16_T +# define SIZEOF_UINT16_T SIZEOF_SHORT +#elif SIZEOF_INT>=2 + typedef unsigned uint16_t; +# undef SIZEOF_UINT16_T +# define SIZEOF_UINT16_T SIZEOF_INT +#else +# error "nothing appropriate for uint16_t" +#endif + +#if SIZEOF_INT32_T>=4 +#elif SIZEOF_SHORT>=4 + typedef short int32_t +# undef SIZEOF_INT32_T +# define SIZEOF_INT32_T SIZEOF_SHORT +#elif SIZEOF_INT>=4 + typedef int int32_t; +# undef SIZEOF_INT32_T +# define SIZEOF_INT32_T SIZEOF_INT +#elif SIZEOF_LONG>=4 + typedef long int32_t; +# undef SIZEOF_INT32_T +# define SIZEOF_INT32_T SIZEOF_LONG +#else +# error "nothing appropriate for int32_t" +#endif + +#if SIZEOF_UINT32_T>=4 +#elif SIZEOF_SHORT>=4 + typedef short uint32_t; +# undef SIZEOF_UINT32_T +# define SIZEOF_UINT32_T SIZEOF_SHORT +#elif SIZEOF_INT>=4 + typedef unsigned int uint32_t; +# undef SIZEOF_UINT32_T +# define SIZEOF_UINT32_T SIZEOF_INT +#elif SIZEOF_LONG>=4 + typedef unsigned long uint32_t; +# undef SIZEOF_UINT32_T +# define SIZEOF_UINT32_T SIZEOF_LONG +#else +# error "nothing appropriate for uint32_t" +#endif + +#if SIZEOF_INT64_T>=8 +#elif SIZEOF_INT>=8 + typedef int int64_t; +# undef SIZEOF_INT64_T +# define SIZEOF_INT64_T SIZEOF_INT +#elif SIZEOF_LONG>=8 + typedef long int64_t; +# undef SIZEOF_INT64_T +# define SIZEOF_INT64_T SIZEOF_LONG +#elif SIZEOF_LONG_LONG>=8 + typedef long_long int64_t; +# undef SIZEOF_INT64_T +# define SIZEOF_INT64_T SIZEOF_LONG_LONG +#else +# error "nothing appropriate for int64_t" +#endif + +#if SIZEOF_UINT64_T>=8 +#elif SIZEOF_INT>=8 + typedef unsigned uint64_t; +# undef SIZEOF_UINT64_T +# define SIZEOF_UINT64_T SIZEOF_INT +#elif SIZEOF_LONG>=8 + typedef unsigned long uint64_t; +# undef SIZEOF_UINT64_T +# define SIZEOF_UINT64_T SIZEOF_LONG +#elif SIZEOF_LONG_LONG>=8 + typedef unsigned long_long uint64_t; +# undef SIZEOF_UINT64_T +# define SIZEOF_UINT64_T SIZEOF_LONG_LONG +#else +# error "nothing appropriate for uint64_t" +#endif + +#if SIZEOF_FLOAT>=4 typedef float float32; +#elif SIZEOF_DOUBLE>=4 +typedef double float32; #else -typedef float float32; /*not really */ +# error "nothing appropriate for float32" #endif -#if SIZEOF_FLOAT==8 +#if SIZEOF_FLOAT>=8 typedef float float64; -#elif SIZEOF_DOUBLE==8 +#elif SIZEOF_DOUBLE>=8 typedef double float64; #else -# error "no 64-bit floating point type" +# error "nothing appropriate for float64" #endif /* @@ -307,9 +372,9 @@ typedef struct { * most part. */ #ifndef LLONG_MAX -# define LLONG_MAX ((long long)(((unsigned long long)1 \ - <<(8*sizeof(long long)-1))-1)) -# define ULLONG_MAX ((unsigned long long)((long long)(-1))) +# define LLONG_MAX ((long_long)(((unsigned long_long)1 \ + <<(8*sizeof(long_long)-1))-1)) +# define ULLONG_MAX ((unsigned long_long)((long_long)(-1))) #endif #ifndef SIZET_MAX # define SIZET_MAX ((hsize_t)(size_t)(ssize_t)(-1)) diff --git a/src/H5public.h b/src/H5public.h index da14914..7e4a9ca 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -70,10 +70,10 @@ typedef int htri_t; * memory objects. */ #ifdef HAVE_LARGE_HSIZET -# if SIZEOF_LONG_LONG==8 +# if SIZEOF_LONG_LONG>=8 typedef unsigned long long hsize_t; typedef signed long long hssize_t; -# elif SIZEOF___INT64==8 +# elif SIZEOF___INT64>=8 typedef unsigned __int64 hsize_t; typedef signed __int64 hssize_t; # endif diff --git a/test/big.c b/test/big.c index 9de9f3d..7b2b68c 100644 --- a/test/big.c +++ b/test/big.c @@ -21,7 +21,7 @@ #endif #include -#include /*needed for HDfprintf() */ +#include /*needed for HDfprintf() and long_long*/ #define FNAME "big%05d.h5" #define DNAME "big.data" @@ -30,7 +30,7 @@ #define FAMILY_SIZE 1024*1024*1024 #if SIZEOF_LONG_LONG > SIZEOF_LONG -#define GB8LL ((unsigned long long)8*1024*1024*1024) +#define GB8LL ((unsigned long_long)8*1024*1024*1024) #elif SIZEOF___INT64 > SIZEOF_LONG #define GB8LL ((unsigned __int64)8*1024*1024*1024) #elif SIZEOF_LONG >= 8 diff --git a/testpar/Makefile.in b/testpar/Makefile.in index ee6bf46..2f6e5d8 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -1,4 +1,4 @@ -# hdf5 Parallel Library Test Makefile(.in) -*- makefile -*- +# hdf5 Parallel Library Test Makefile(.in) # # Copyright (C) 1998 National Center for Supercomputing Applications # All rights reserved diff --git a/tools/h5ls.c b/tools/h5ls.c index 4423b31..4e21cca 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -176,14 +176,14 @@ display_native_type(hid_t type, int __unused__ indent) printf("native char"); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { printf("native unsigned char"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - printf("native short"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - printf("native unsigned short"); } else if (H5Tequal(type, H5T_NATIVE_INT)) { printf("native int"); } else if (H5Tequal(type, H5T_NATIVE_UINT)) { printf("native unsigned int"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + printf("native short"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + printf("native unsigned short"); } else if (H5Tequal(type, H5T_NATIVE_LONG)) { printf("native long"); } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { -- cgit v0.12