From 1b7ae2a5b729ce09209b36a47dd80a74b8cdadbc Mon Sep 17 00:00:00 2001 From: James Laird Date: Fri, 29 Apr 2005 17:00:32 -0500 Subject: [svn-r10701] Purpose: Bug fix Description: Some platforms (Windows) don't have the long long type, which causes automatic Fortran type matching to fail. A solution is to use HDF5's long_long type. Solution: Changed H5match_types.c to use long_long type. Moved definition of long_long out of H5private.h and into H5public.h. Platforms tested: mir, copper, pommier --- fortran/src/H5match_types.c | 4 +++- src/H5private.h | 18 ------------------ src/H5public.h | 44 +++++++++++++++++++++++--------------------- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 47164c7..6a4a930 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -37,7 +37,9 @@ void initCfile() \#ifndef _H5f90i_gen_H\n\ \#define _H5f90i_gen_H\n\ \n\ -/* This file is automatically generated by H5match_types.c at build time. */\n\n"); +/* This file is automatically generated by H5match_types.c at build time. */\n\ +\n\ +#include \"H5public.h\"\n\n"); } void initFfile() diff --git a/src/H5private.h b/src/H5private.h index 95694c6..cc31395 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -283,24 +283,6 @@ #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 H5_SIZEOF_LONG_LONG>0 -# define long_long long long -#elif H5_SIZEOF___INT64>0 -# define long_long __int64 /*Win32*/ -# undef H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_LONG_LONG H5_SIZEOF___INT64 -#else -# define long_long long int -# undef H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_LONG_LONG H5_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. The `int8' types *must* diff --git a/src/H5public.h b/src/H5public.h index a5678a6..99437d7 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -106,6 +106,24 @@ typedef int herr_t; typedef unsigned int hbool_t; typedef int htri_t; +/* + * 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 H5_SIZEOF_LONG_LONG>0 +# define long_long long long +#elif H5_SIZEOF___INT64>0 +# define long_long __int64 /*Win32*/ +# undef H5_SIZEOF_LONG_LONG +# define H5_SIZEOF_LONG_LONG H5_SIZEOF___INT64 +#else +# define long_long long int +# undef H5_SIZEOF_LONG_LONG +# define H5_SIZEOF_LONG_LONG H5_SIZEOF_LONG +#endif + /* Define the ssize_t type if it not is defined */ #if H5_SIZEOF_SSIZE_T==0 /* Undefine this size, we will re-define it in one of the sections below */ @@ -117,11 +135,8 @@ typedef int ssize_t; typedef long ssize_t; # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG #elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG_LONG -typedef long long ssize_t; +typedef long_long ssize_t; # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG -#elif H5_SIZEOF_SIZE_T==H5_SIZEOF___INT64 -typedef __int64 ssize_t; -# define H5_SIZEOF_SSIZE_T H5_SIZEOF___INT64 #else /* Can't find matching type for ssize_t */ # error "nothing appropriate for ssize_t" #endif @@ -134,13 +149,9 @@ typedef __int64 ssize_t; */ #ifdef H5_HAVE_LARGE_HSIZET # if H5_SIZEOF_LONG_LONG>=8 -typedef unsigned long long hsize_t; -typedef signed long long hssize_t; +typedef unsigned long_long hsize_t; +typedef signed long_long hssize_t; # define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG -# elif H5_SIZEOF___INT64>=8 -typedef unsigned __int64 hsize_t; -typedef signed __int64 hssize_t; -# define H5_SIZEOF_HSIZE_T H5_SIZEOF___INT64 # endif #else /* H5_HAVE_LARGE_HSIZET */ typedef size_t hsize_t; @@ -149,7 +160,7 @@ typedef ssize_t hssize_t; #endif /* H5_HAVE_LARGE_HSIZET */ /* - * File addresses have there own types. + * File addresses have their own types. */ #if H5_SIZEOF_INT64_T>=8 typedef uint64_t haddr_t; @@ -173,19 +184,12 @@ typedef ssize_t hssize_t; # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG_LONG>=8 - typedef unsigned long long haddr_t; + typedef unsigned long_long haddr_t; # define HADDR_UNDEF ((haddr_t)(long long)(-1)) # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT # endif /* H5_HAVE_PARALLEL */ -#elif H5_SIZEOF___INT64>=8 - typedef unsigned __int64 haddr_t; -# define HADDR_UNDEF ((haddr_t)(__int64)(-1)) -# define H5_SIZEOF_HADDR_T H5_SIZEOF___INT64 -# ifdef H5_HAVE_PARALLEL -# define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT -# endif /* H5_HAVE_PARALLEL */ #else # error "nothing appropriate for haddr_t" #endif @@ -195,8 +199,6 @@ typedef ssize_t hssize_t; # define H5_PRINTF_HADDR_FMT "%lu" #elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG # define H5_PRINTF_HADDR_FMT "%"H5_PRINTF_LL_WIDTH"u" -#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF___INT64 -# define H5_PRINTF_HADDR_FMT "%"H5_PRINTF_LL_WIDTH"u" #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" #endif -- cgit v0.12