mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
[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.
This commit is contained in:
parent
3a7c54b06f
commit
ca5f819b46
25
src/H5.c
25
src/H5.c
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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))); \
|
||||
|
@ -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');
|
||||
@ -957,11 +961,15 @@ 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++;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user