mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-23 03:49:26 +01:00
209 lines
3.8 KiB
C
209 lines
3.8 KiB
C
|
/*
|
||
|
* sysdeps.h - Try to include the right system headers and get other
|
||
|
* system-specific stuff right
|
||
|
*
|
||
|
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
*/
|
||
|
|
||
|
#include "sysconfig.h"
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <assert.h>
|
||
|
#include <ctype.h>
|
||
|
#include <errno.h>
|
||
|
#include <signal.h>
|
||
|
|
||
|
#include <vector>
|
||
|
using std::vector;
|
||
|
|
||
|
#ifdef HAVE_SYS_TYPES_H
|
||
|
#include <sys/types.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_VALUES_H
|
||
|
#include <values.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_STRINGS_H
|
||
|
#include <strings.h>
|
||
|
#endif
|
||
|
#ifdef HAVE_STRING_H
|
||
|
#include <string.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_UNISTD_H
|
||
|
#include <unistd.h>
|
||
|
#endif
|
||
|
#ifdef HAVE_FCNTL_H
|
||
|
#include <fcntl.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_UTIME_H
|
||
|
#include <utime.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_PARAM_H
|
||
|
#include <sys/param.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_SELECT_H
|
||
|
#include <sys/select.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_VFS_H
|
||
|
#include <sys/vfs.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_STAT_H
|
||
|
#include <sys/stat.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_MOUNT_H
|
||
|
#include <sys/mount.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_STATFS_H
|
||
|
#include <sys/statfs.h>
|
||
|
#endif
|
||
|
|
||
|
#ifdef HAVE_SYS_STATVFS_H
|
||
|
#include <sys/statvfs.h>
|
||
|
#endif
|
||
|
|
||
|
#if TIME_WITH_SYS_TIME
|
||
|
# include <sys/time.h>
|
||
|
# include <time.h>
|
||
|
#else
|
||
|
# if HAVE_SYS_TIME_H
|
||
|
# include <sys/time.h>
|
||
|
# else
|
||
|
# include <time.h>
|
||
|
# endif
|
||
|
#endif
|
||
|
|
||
|
#if HAVE_DIRENT_H
|
||
|
# include <dirent.h>
|
||
|
#else
|
||
|
# define dirent direct
|
||
|
# if HAVE_SYS_NDIR_H
|
||
|
# include <sys/ndir.h>
|
||
|
# endif
|
||
|
# if HAVE_SYS_DIR_H
|
||
|
# include <sys/dir.h>
|
||
|
# endif
|
||
|
# if HAVE_NDIR_H
|
||
|
# include <ndir.h>
|
||
|
# endif
|
||
|
#endif
|
||
|
|
||
|
#include <assert.h>
|
||
|
|
||
|
#if EEXIST == ENOTEMPTY
|
||
|
#define BROKEN_OS_PROBABLY_AIX
|
||
|
#endif
|
||
|
|
||
|
#ifdef __NeXT__
|
||
|
#define S_IRUSR S_IREAD
|
||
|
#define S_IWUSR S_IWRITE
|
||
|
#define S_IXUSR S_IEXEC
|
||
|
#define S_ISDIR(val) (S_IFDIR & val)
|
||
|
struct utimbuf
|
||
|
{
|
||
|
time_t actime;
|
||
|
time_t modtime;
|
||
|
};
|
||
|
#endif
|
||
|
|
||
|
#ifdef __DOS__
|
||
|
#include <pc.h>
|
||
|
#include <io.h>
|
||
|
#else
|
||
|
#undef O_BINARY
|
||
|
#define O_BINARY 0
|
||
|
#endif
|
||
|
|
||
|
#ifdef __mac__
|
||
|
#define bool Boolean
|
||
|
#endif
|
||
|
|
||
|
#ifdef __riscos
|
||
|
#define bool int
|
||
|
#endif
|
||
|
|
||
|
#ifdef WIN32
|
||
|
#include <windows.h>
|
||
|
#include <direct.h>
|
||
|
#if !defined(M_PI)
|
||
|
#define M_PI 3.14159265358979323846
|
||
|
#endif
|
||
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||
|
#if _MSC_VER < 1100
|
||
|
#define bool char
|
||
|
#endif
|
||
|
#define LITTLE_ENDIAN_UNALIGNED 1
|
||
|
#endif
|
||
|
|
||
|
/* If char has more then 8 bits, good night. */
|
||
|
#ifndef __BEOS__
|
||
|
typedef unsigned char uint8;
|
||
|
typedef signed char int8;
|
||
|
|
||
|
#if SIZEOF_SHORT == 2
|
||
|
typedef unsigned short uint16;
|
||
|
typedef short int16;
|
||
|
#elif SIZEOF_INT == 2
|
||
|
typedef unsigned int uint16;
|
||
|
typedef int int16;
|
||
|
#else
|
||
|
#error No 2 byte type, you lose.
|
||
|
#endif
|
||
|
|
||
|
#if SIZEOF_INT == 4
|
||
|
typedef unsigned int uint32;
|
||
|
typedef int int32;
|
||
|
#elif SIZEOF_LONG == 4
|
||
|
typedef unsigned long uint32;
|
||
|
typedef long int32;
|
||
|
#else
|
||
|
#error No 4 byte type, you lose.
|
||
|
#endif
|
||
|
|
||
|
#if SIZEOF_LONG == 8
|
||
|
typedef unsigned long uint64;
|
||
|
typedef long int64;
|
||
|
#elif SIZEOF_LONG_LONG == 8
|
||
|
typedef unsigned long long uint64;
|
||
|
typedef long long int64;
|
||
|
#else
|
||
|
#error No 8 byte type, you lose.
|
||
|
#endif
|
||
|
|
||
|
#if SIZEOF_VOID_P == 4
|
||
|
typedef uint32 uintptr;
|
||
|
typedef int32 intptr;
|
||
|
#elif SIZEOF_VOID_P == 8
|
||
|
typedef uint64 uintptr;
|
||
|
typedef int64 intptr;
|
||
|
#else
|
||
|
#error Unsupported size of pointer
|
||
|
#endif
|
||
|
|
||
|
#else
|
||
|
#include <support/SupportDefs.h>
|
||
|
#endif // __BEOS__
|