summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2001-07-03 14:49:03 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2001-07-03 14:49:03 (GMT)
commitf9f0de7aa0529a0467e79b4521013328fab1e3e7 (patch)
tree83e73aec2d76e64e158ae3de0fbfc138a0dcef08
parentf72cb07b0ac15e511de8c735f02713fb815079e9 (diff)
downloadhdf5-f9f0de7aa0529a0467e79b4521013328fab1e3e7.zip
hdf5-f9f0de7aa0529a0467e79b4521013328fab1e3e7.tar.gz
hdf5-f9f0de7aa0529a0467e79b4521013328fab1e3e7.tar.bz2
[svn-r4099]
Purpose: Code Cleanup Description: Updating CodeWarrior Port Solution: Move around some Windows and Metroworks ifdefs, etc. Platforms tested: Solaris 2.7 (arabica) Linux 2.2 (eirene)
-rw-r--r--src/H5FDstdio.c15
-rw-r--r--src/H5Ppublic.h8
-rw-r--r--src/H5private.h49
-rw-r--r--test/overhead.c32
4 files changed, 83 insertions, 21 deletions
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index c852208..0aa6fe7 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -16,16 +16,23 @@
#include "hdf5.h"
+#ifdef H5_HAVE_STDIO_H
+#include <stdio.h>
+#endif
#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef WIN32
-#include <windows.h>
+#if !defined(_68K_) && !defined(_MPPC_) && !defined(_PPC_) && !defined(_ALPHA_) && !defined(_MIPS_) && !defined(_X86_) && defined(_M_IX86)
+#define _X86_
+#endif
+#include <windef.h>
+#include <winbase.h>
+
#include <io.h>
-#endif /*kent yang 6/21/2001, must be added for defination of open,write....
- also the defination of longlong is valid, will investigate this to
- make sure int64 can replace longlong. Otherwise, keep windows.h*/
+
+#endif
#ifdef MAX
#undef MAX
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 74efab1..6c49956 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -28,6 +28,14 @@
#include "H5MMpublic.h"
#include "H5Zpublic.h"
+/* Metroworks <sys/types.h> doesn't define off_t. */
+#ifdef __MWERKS__
+typedef long off_t;
+/* Metroworks does not define EINTR in <errno.h> */
+# define EINTR 4
+#endif
+/*__MWERKS__*/
+
/* Property list classes */
typedef enum H5P_class_t {
H5P_NO_CLASS = -1, /*error return value */
diff --git a/src/H5private.h b/src/H5private.h
index b001d86..415c919 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -168,15 +168,38 @@ MS doesn't recognize it yet (as of April 2001)
# define H5_inline
#endif
-/* Metroworks <sys/types.h> doesn't define off_t. */
-#ifdef __MWERKS__
-typedef long off_t;
-/* Metroworks does not define EINTR in <errno.h> */
-# define EINTR 4
-#endif /*__MWERKS__*/
-
#endif /*WIN32*/
+/*
+ * This driver supports systems that have the lseek64() function by defining
+ * some macros here so we don't have to have conditional compilations later
+ * throughout the code.
+ *
+ * file_offset_t: The datatype for file offsets, the second argument of
+ * the lseek() or lseek64() call.
+ *
+ * file_seek: The function which adjusts the current file position,
+ * either lseek() or lseek64().
+ *
+ * adding for windows NT file system support.
+ */
+
+#ifdef H5_HAVE_LSEEK64
+# define file_offset_t off64_t
+# define file_seek lseek64
+#elif defined (WIN32)
+# ifdef __MWERKS__
+# define file_offset_t off_t
+# define file_seek lseek
+# else /*MSVC*/
+# define file_offset_t __int64
+# define file_seek _lseeki64
+# endif
+#else
+# define file_offset_t off_t
+# define file_seek lseek
+#endif
+
#ifndef F_OK
# define F_OK 00
# define W_OK 02
@@ -760,7 +783,19 @@ __DLL__ int64_t HDstrtoll (const char *s, const char **rest, int base);
#define HDwaitpid(P,W,O) waitpid(P,W,O)
#define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
#define HDwctomb(S,C) wctomb(S,C)
+
+
+
+
+#if defined (__MWERKS__)
+/* workaround for a bug in the Metrowerks header file for write
+ which is not defined as const void*
+ pvn
+ */
+#define HDwrite(F,M,Z) write(F,(void*)M,Z)
+#else
#define HDwrite(F,M,Z) write(F,M,Z)
+#endif
/*
* And now for a couple non-Posix functions... Watch out for systems that
diff --git a/test/overhead.c b/test/overhead.c
index 0480a73..60a5e90 100644
--- a/test/overhead.c
+++ b/test/overhead.c
@@ -208,7 +208,12 @@ test(fill_t fill_style, const double splits[],
if ((dset=H5Dcreate(file, "chunked", H5T_NATIVE_INT,
fspace, dcpl))<0) goto error;
-#if !defined( __MWERKS__)
+#if !defined( __MWERKS__)
+
+ /*
+ workaround for a bug in the Metrowerks open function
+ pvn
+ */
if ((fd=open(FILE_NAME_1, O_RDONLY))<0) goto error;
#endif
@@ -245,9 +250,8 @@ test(fill_t fill_style, const double splits[],
goto error;
}
-#if defined( __MWERKS__)
- if ((fd=open(FILE_NAME_1, O_RDONLY))<0) goto error;
-#endif
+
+#if !defined( __MWERKS__)
/* Determine overhead */
if (verbose) {
@@ -262,6 +266,9 @@ test(fill_t fill_style, const double splits[],
(unsigned long)i,
(double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i);
}
+#endif
+
+
}
H5Dclose(dset);
@@ -290,17 +297,22 @@ test(fill_t fill_style, const double splits[],
case FILL_ALL:
abort();
}
+
+#if !defined( __MWERKS__)
+
if (fstat(fd, &sb)<0) goto error;
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- printf("%-7s %8.3f\n", sname,
+ printf("%-7s %8.3f\n", sname,
(double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/
(hssize_t)cur_size[0]);
+#endif
+
}
+
+
+#if !defined( __MWERKS__)
close(fd);
+#endif
+
return 0;
error: