diff options
author | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 1998-10-23 18:23:29 (GMT) |
---|---|---|
committer | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 1998-10-23 18:23:29 (GMT) |
commit | ca5f819b46581716e78b4d086c7104ccf951c3a3 (patch) | |
tree | 8d8846d94da9443e7f6b4b8b9815d29227943997 /src | |
parent | 3a7c54b06f37b0648e1d8f337d11a1f13b67d60c (diff) | |
download | hdf5-ca5f819b46581716e78b4d086c7104ccf951c3a3.zip hdf5-ca5f819b46581716e78b4d086c7104ccf951c3a3.tar.gz hdf5-ca5f819b46581716e78b4d086c7104ccf951c3a3.tar.bz2 |
[svn-r782] Win NT port- tested on Unix and NT
changes - all changes surrounded by a #if defined(WIN32)
defined __undef__ to be equal to nothing, changed long long to __int64
removed body of H5TimerBegin, defined F_OK,R_OK,W_OK, some other
changes involving header files.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 25 | ||||
-rw-r--r-- | src/H5Vprivate.h | 5 | ||||
-rw-r--r-- | src/H5detect.c | 14 | ||||
-rw-r--r-- | src/H5private.h | 21 | ||||
-rw-r--r-- | src/H5public.h | 6 |
5 files changed, 65 insertions, 6 deletions
@@ -39,9 +39,12 @@ static char RcsId[] = "@(#)$Revision$"; #include <errno.h> #include <stdarg.h> #include <stdio.h> +#if defined(WIN32) +#include <time.h> +#else #include <sys/time.h> #include <sys/resource.h> - +#endif /* We need this on Irix64 even though we've included stdio.h as documented */ FILE *fdopen(int fd, const char *mode); @@ -658,14 +661,22 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'H': if (sizeof(hsize_t)==sizeof(long)) { HDstrcpy (modifier, "l"); +#if defined(WIN32) + } else if (sizeof(hsize_t)==sizeof(__int64)) { +#else } else if (sizeof(hsize_t)==sizeof(long long)) { +#endif HDstrcpy (modifier, PRINTF_LL_WIDTH); } break; case 'Z': if (sizeof(size_t)==sizeof(long)) { HDstrcpy (modifier, "l"); +#if defined(WIN32) + } else if (sizeof(size_t)==sizeof(__int64)) { +#else } else if (sizeof(size_t)==sizeof(long long)) { +#endif HDstrcpy (modifier, PRINTF_LL_WIDTH); } else if (sizeof(size_t)==sizeof(int)) { modifier[0] = '\0'; @@ -713,7 +724,11 @@ HDfprintf (FILE *stream, const char *fmt, ...) long x = va_arg (ap, long); n = fprintf (stream, template, x); } else { +#if defined(WIN32) + __int64 x = va_arg(ap, __int64); +#else long long x = va_arg (ap, long long); +#endif n = fprintf (stream, template, x); } break; @@ -732,8 +747,12 @@ HDfprintf (FILE *stream, const char *fmt, ...) unsigned long x = va_arg (ap, unsigned long); n = fprintf (stream, template, x); } else { +#if defined(WIN32) + unsigned __int64 x = va_arg (ap, unsigned __int64); +#else unsigned long long x = va_arg (ap, unsigned long long); - n = fprintf (stream, template, x); +#endif + n = fprintf (stream, template, x); } break; @@ -990,6 +1009,7 @@ H5_timer_reset (H5_timer_t *timer) void H5_timer_begin (H5_timer_t *timer) { +#if !defined(WIN32) #ifdef HAVE_GETRUSAGE struct rusage rusage; #endif @@ -1010,6 +1030,7 @@ H5_timer_begin (H5_timer_t *timer) gettimeofday (&etime, NULL); timer->etime = (double)etime.tv_sec + (double)etime.tv_usec/1e6; +#endif } diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 895a240..0f29e7e 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -22,6 +22,11 @@ #define H5V_vector_le_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<=0) #define H5V_vector_ge_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>=0) +#if defined(WIN32) +#undef inline +#define inline +#endif + /* Other functions */ #define H5V_vector_cpy(N,DST,SRC) { \ assert (sizeof(*(DST))==sizeof(*(SRC))); \ diff --git a/src/H5detect.c b/src/H5detect.c index 3a90dc0..bbd9ba9 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -32,13 +32,15 @@ static const char *FileHeader = "\n\ #undef NDEBUG #include <assert.h> #include <math.h> -#include <pwd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/time.h> #include <time.h> +#if !defined(WIN32) #include <unistd.h> +#include <sys/time.h> +#include <pwd.h> +#endif #include <H5config.h> @@ -893,7 +895,9 @@ bit.\n"; if (pwd || real_name[0] || host_name[0]) { printf(" *\t\t\t"); if (real_name[0]) printf("%s <", real_name); +#if !defined(WIN32) if (pwd) fputs(pwd->pw_name, stdout); +#endif if (host_name[0]) printf("@%s", host_name); if (real_name[0]) printf(">"); putchar('\n'); @@ -958,10 +962,14 @@ main(void) DETECT_I(long, LLONG, d[nd]); nd++; DETECT_I(unsigned long, ULLONG, d[nd]); nd++; #else +#if defined(WIN32) + DETECT_I(__int64, LLONG, d[nd]); nd++; + DETECT_I(unsigned __int64, ULLONG, d[nd]); nd++; +#else DETECT_I(long long, LLONG, d[nd]); nd++; DETECT_I(unsigned long long, ULLONG, d[nd]); nd++; #endif - +#endif DETECT_F(float, FLOAT, d[nd]); nd++; DETECT_F(double, DOUBLE, d[nd]); nd++; diff --git a/src/H5private.h b/src/H5private.h index 2b976e0..2435191 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -37,10 +37,19 @@ # include <stdio.h> # include <stdlib.h> # include <string.h> +# include <time.h> + +#if defined(WIN32) +# include<sys\types.h> +# include<io.h> +#define F_OK 00 +#define R_OK 04 +#define W_OK 02 +#else # include <sys/time.h> # include <sys/types.h> -# include <time.h> # include <unistd.h> +#endif//if defined(WIN32) #endif /* @@ -61,6 +70,11 @@ # define __unused__ __attribute__((unused)) #endif +#if defined(WIN32) +#undef __unused__ +#define __unused__ +#endif + /* Does the compiler expand __FUNCTION__? */ #ifndef HAVE_FUNCTION # define __FUNCTION__ "NoFuntionName" @@ -149,8 +163,13 @@ typedef unsigned uint64; typedef long int64; typedef unsigned long uint64; #elif SIZEOF_LONG_LONG==8 +#if defined(WIN32) +typedef __int64 int64; +typedef unsigned __int64 uint64; +#else typedef long long int64; typedef unsigned long long uint64; +#endif #else # error "no 64-bit integer type" #endif diff --git a/src/H5public.h b/src/H5public.h index a487de7..d870851 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -82,8 +82,14 @@ typedef int hbool_t; * with small address spaces these are defined to be larger. */ #if defined(HAVE_LARGE_HSIZET) && SIZEOF_SIZE_T<SIZEOF_LONG_LONG +#if defined(WIN32) +typedef unsigned __int64 hsize_t; +typedef signed __int64 hssize_t; +typedef signed int ssize_t; +#else typedef unsigned long long hsize_t; typedef signed long long hssize_t; +#endif #else typedef size_t hsize_t; typedef ssize_t hssize_t; |