[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)
This commit is contained in:
Pedro Vicente Nunes 2001-07-03 09:49:03 -05:00
parent f72cb07b0a
commit f9f0de7aa0
4 changed files with 83 additions and 21 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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: