Skip to content
Snippets Groups Projects
Commit a172a8fc authored by rswindell's avatar rswindell
Browse files

Switched from #ifdef to #if defined.

parent 5d9d2135
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <string.h> /* strrchr */ #include <string.h> /* strrchr */
#ifdef _WIN32 #if defined(_WIN32)
#include <windows.h> /* WINAPI, etc */ #include <windows.h> /* WINAPI, etc */
#include <io.h> /* _findfirst */ #include <io.h> /* _findfirst */
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include <fcntl.h> /* O_NOCCTY */ #include <fcntl.h> /* O_NOCCTY */
#include <ctype.h> /* toupper */ #include <ctype.h> /* toupper */
#ifdef __FreeBSD__ #if defined(__FreeBSD__)
#include <sys/param.h> #include <sys/param.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/kbio.h> #include <sys/kbio.h>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include <sys/ioctl.h> /* ioctl */ #include <sys/ioctl.h> /* ioctl */
#ifdef __GLIBC__ /* actually, BSD, but will work for now */ #if defined(__GLIBC__) /* actually, BSD, but will work for now */
#include <sys/vfs.h> /* statfs() */ #include <sys/vfs.h> /* statfs() */
#endif #endif
...@@ -99,7 +99,7 @@ static int glob_compare( const void *arg1, const void *arg2 ) ...@@ -99,7 +99,7 @@ static int glob_compare( const void *arg1, const void *arg2 )
return stricmp( * ( char** ) arg1, * ( char** ) arg2 ); return stricmp( * ( char** ) arg1, * ( char** ) arg2 );
} }
#ifdef __BORLANDC__ #if defined(__BORLANDC__)
#pragma argsused #pragma argsused
#endif #endif
...@@ -256,7 +256,7 @@ time_t DLLCALL fdate(char *filename) ...@@ -256,7 +256,7 @@ time_t DLLCALL fdate(char *filename)
/****************************************************************************/ /****************************************************************************/
long DLLCALL flength(char *filename) long DLLCALL flength(char *filename)
{ {
#ifdef __BORLANDC__ /* stat() doesn't work right */ #if defined(__BORLANDC__) /* stat() doesn't work right */
long handle; long handle;
struct _finddata_t f; struct _finddata_t f;
...@@ -293,7 +293,7 @@ long DLLCALL flength(char *filename) ...@@ -293,7 +293,7 @@ long DLLCALL flength(char *filename)
/****************************************************************************/ /****************************************************************************/
BOOL DLLCALL fexist(char *filespec) BOOL DLLCALL fexist(char *filespec)
{ {
#ifdef _WIN32 #if defined(_WIN32)
long handle; long handle;
struct _finddata_t f; struct _finddata_t f;
...@@ -369,7 +369,7 @@ BOOL DLLCALL isdir(char *filename) ...@@ -369,7 +369,7 @@ BOOL DLLCALL isdir(char *filename)
/****************************************************************************/ /****************************************************************************/
int DLLCALL getfattr(char* filename) int DLLCALL getfattr(char* filename)
{ {
#ifdef _WIN32 #if defined(_WIN32)
long handle; long handle;
struct _finddata_t finddata; struct _finddata_t finddata;
...@@ -394,14 +394,14 @@ int DLLCALL getfattr(char* filename) ...@@ -394,14 +394,14 @@ int DLLCALL getfattr(char* filename)
/****************************************************************************/ /****************************************************************************/
/* Return free disk space in bytes (up to a maximum of 4GB) */ /* Return free disk space in bytes (up to a maximum of 4GB) */
/****************************************************************************/ /****************************************************************************/
#ifdef _WIN32 #if defined(_WIN32)
typedef BOOL(WINAPI * GetDiskFreeSpaceEx_t) typedef BOOL(WINAPI * GetDiskFreeSpaceEx_t)
(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER); (LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
#endif #endif
ulong DLLCALL getfreediskspace(char* path) ulong DLLCALL getfreediskspace(char* path)
{ {
#ifdef _WIN32 #if defined(_WIN32)
char root[16]; char root[16];
DWORD TotalNumberOfClusters; DWORD TotalNumberOfClusters;
DWORD NumberOfFreeClusters; DWORD NumberOfFreeClusters;
...@@ -424,14 +424,14 @@ ulong DLLCALL getfreediskspace(char* path) ...@@ -424,14 +424,14 @@ ulong DLLCALL getfreediskspace(char* path)
&size, // receives the number of bytes on disk &size, // receives the number of bytes on disk
NULL)) // receives the free bytes on disk NULL)) // receives the free bytes on disk
return(0); return(0);
#ifdef _ANONYMOUS_STRUCT #if defined(_ANONYMOUS_STRUCT)
if(avail.HighPart) if(avail.HighPart)
#else #else
if(avail.u.HighPart) if(avail.u.HighPart)
#endif #endif
return(0xffffffff); /* 4GB max */ return(0xffffffff); /* 4GB max */
#ifdef _ANONYMOUS_STRUCT #if defined(_ANONYMOUS_STRUCT)
return(avail.LowPart); return(avail.LowPart);
#else #else
return(avail.u.LowPart); return(avail.u.LowPart);
......
...@@ -40,20 +40,20 @@ ...@@ -40,20 +40,20 @@
#include "gen_defs.h" /* ulong */ #include "gen_defs.h" /* ulong */
#ifdef DLLEXPORT #if defined(DLLEXPORT)
#undef DLLEXPORT #undef DLLEXPORT
#endif #endif
#ifdef DLLCALL #if defined(DLLCALL)
#undef DLLCALL #undef DLLCALL
#endif #endif
#ifdef _WIN32 #if defined(_WIN32)
#ifdef WRAPPER_DLL #if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#else #else
#define DLLEXPORT __declspec(dllimport) #define DLLEXPORT __declspec(dllimport)
#endif #endif
#ifdef __BORLANDC__ #if defined(__BORLANDC__)
#define DLLCALL __stdcall #define DLLCALL __stdcall
#else #else
#define DLLCALL #define DLLCALL
...@@ -63,21 +63,15 @@ ...@@ -63,21 +63,15 @@
#define DLLCALL #define DLLCALL
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
#ifdef _MSC_VER
#include "msdirent.h"
#else
#include <dirent.h> /* POSIX directory functions */
#endif
/****************/ /****************/
/* RTL-specific */ /* RTL-specific */
/****************/ /****************/
#ifdef __unix__ #if defined(__unix__)
#define ALLFILES "*" /* matches all files in a directory */ #define ALLFILES "*" /* matches all files in a directory */
#include <glob.h> /* POSIX.2 directory pattern matching function */ #include <glob.h> /* POSIX.2 directory pattern matching function */
...@@ -159,8 +153,11 @@ extern "C" { ...@@ -159,8 +153,11 @@ extern "C" {
struct dirent * readdir (DIR *__dir); struct dirent * readdir (DIR *__dir);
int closedir (DIR *__dir); int closedir (DIR *__dir);
void rewinddir(DIR *__dir); void rewinddir(DIR *__dir);
#else
#include <dirent.h> /* POSIX directory functions */
#endif #endif
/**********/ /**********/
/* Macros */ /* Macros */
/**********/ /**********/
...@@ -205,7 +202,7 @@ DLLEXPORT char* DLLCALL getfname(char* path); ...@@ -205,7 +202,7 @@ DLLEXPORT char* DLLCALL getfname(char* path);
DLLEXPORT int DLLCALL getfattr(char* filename); DLLEXPORT int DLLCALL getfattr(char* filename);
DLLEXPORT ulong DLLCALL getfreediskspace(char* path); DLLEXPORT ulong DLLCALL getfreediskspace(char* path);
#ifdef __cplusplus #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -82,20 +82,20 @@ ...@@ -82,20 +82,20 @@
/* Prototypes */ /* Prototypes */
/**************/ /**************/
#ifdef DLLEXPORT #if defined(DLLEXPORT)
#undef DLLEXPORT #undef DLLEXPORT
#endif #endif
#ifdef DLLCALL #if defined(DLLCALL)
#undef DLLCALL #undef DLLCALL
#endif #endif
#ifdef _WIN32 #if defined(_WIN32)
#ifdef WRAPPER_DLL #if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#else #else
#define DLLEXPORT __declspec(dllimport) #define DLLEXPORT __declspec(dllimport)
#endif #endif
#ifdef __BORLANDC__ #if defined(__BORLANDC__)
#define DLLCALL __stdcall #define DLLCALL __stdcall
#else #else
#define DLLCALL #define DLLCALL
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
#define DLLCALL #define DLLCALL
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
...@@ -121,7 +121,7 @@ extern "C" { ...@@ -121,7 +121,7 @@ extern "C" {
DLLEXPORT time_t DLLCALL filetime(int fd); DLLEXPORT time_t DLLCALL filetime(int fd);
#ifdef __cplusplus #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#ifndef _GEN_DEFS_H #ifndef _GEN_DEFS_H
#define _GEN_DEFS_H #define _GEN_DEFS_H
#ifdef _WIN32 #if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN /* Don't bring in excess baggage */ #define WIN32_LEAN_AND_MEAN /* Don't bring in excess baggage */
#include <windows.h> #include <windows.h>
#endif #endif
...@@ -88,7 +88,7 @@ enum { ...@@ -88,7 +88,7 @@ enum {
}; };
#ifndef MAX_PATH #ifndef MAX_PATH
#ifdef MAXPATHLEN #if defined MAXPATHLEN
#define MAX_PATH MAXPATHLEN /* clib.h */ #define MAX_PATH MAXPATHLEN /* clib.h */
#elif defined PATH_MAX #elif defined PATH_MAX
#define MAX_PATH PATH_MAX #define MAX_PATH PATH_MAX
......
...@@ -39,13 +39,12 @@ ...@@ -39,13 +39,12 @@
#include <stdlib.h> /* RAND_MAX */ #include <stdlib.h> /* RAND_MAX */
#include <fcntl.h> /* O_NOCTTY */ #include <fcntl.h> /* O_NOCTTY */
#ifdef __unix__ #if defined(__unix__)
#ifndef __FreeBSD__ /* KIOCSOUND */
#include <sys/kd.h> /* KIOCSOUND */ #if defined(__FreeBSD__)
#endif
#ifdef __FreeBSD__
#include <sys/kbio.h> #include <sys/kbio.h>
#endif #else
#include <sys/kd.h>
#endif /* __unix__ */ #endif /* __unix__ */
#include "genwrap.h" /* Verify prototypes */ #include "genwrap.h" /* Verify prototypes */
...@@ -53,7 +52,7 @@ ...@@ -53,7 +52,7 @@
/****************************************************************************/ /****************************************************************************/
/* Convert ASCIIZ string to upper case */ /* Convert ASCIIZ string to upper case */
/****************************************************************************/ /****************************************************************************/
#ifdef __unix__ #if defined(__unix__)
char* DLLCALL strupr(char* str) char* DLLCALL strupr(char* str)
{ {
char* p=str; char* p=str;
...@@ -95,7 +94,7 @@ char* strrev(char* str) ...@@ -95,7 +94,7 @@ char* strrev(char* str)
/* Generate a tone at specified frequency for specified milliseconds */ /* Generate a tone at specified frequency for specified milliseconds */
/* Thanks to Casey Martin for this code */ /* Thanks to Casey Martin for this code */
/****************************************************************************/ /****************************************************************************/
#ifdef __unix__ #if defined(__unix__)
void DLLCALL unix_beep(int freq, int dur) void DLLCALL unix_beep(int freq, int dur)
{ {
static int console_fd=-1; static int console_fd=-1;
...@@ -114,7 +113,7 @@ void DLLCALL unix_beep(int freq, int dur) ...@@ -114,7 +113,7 @@ void DLLCALL unix_beep(int freq, int dur)
/****************************************************************************/ /****************************************************************************/
/* Return random number between 0 and n-1 */ /* Return random number between 0 and n-1 */
/****************************************************************************/ /****************************************************************************/
#ifndef __BORLANDC__ #if !defined(__BORLANDC__j)
int DLLCALL xp_random(int n) int DLLCALL xp_random(int n)
{ {
float f; float f;
......
...@@ -41,20 +41,20 @@ ...@@ -41,20 +41,20 @@
#include <stdio.h> /* sprintf */ #include <stdio.h> /* sprintf */
#include "gen_defs.h" /* ulong */ #include "gen_defs.h" /* ulong */
#ifdef DLLEXPORT #if defined(DLLEXPORT)
#undef DLLEXPORT #undef DLLEXPORT
#endif #endif
#ifdef DLLCALL #if defined(DLLCALL)
#undef DLLCALL #undef DLLCALL
#endif #endif
#ifdef _WIN32 #if defined(_WIN32)
#ifdef WRAPPER_DLL #if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#else #else
#define DLLEXPORT __declspec(dllimport) #define DLLEXPORT __declspec(dllimport)
#endif #endif
#ifdef __BORLANDC__ #if defined(__BORLANDC__)
#define DLLCALL __stdcall #define DLLCALL __stdcall
#else #else
#define DLLCALL #define DLLCALL
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#define DLLCALL #define DLLCALL
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
...@@ -167,11 +167,11 @@ extern "C" { ...@@ -167,11 +167,11 @@ extern "C" {
#endif #endif
#ifdef __BORLANDC__ #if defined(__BORLANDC__)
#define xp_random random #define xp_random random
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
/**********************************/ /**********************************/
/* Socket Implementation-specific */ /* Socket Implementation-specific */
/**********************************/ /**********************************/
#ifdef _WINSOCKAPI_ #if defined(_WINSOCKAPI_)
#undef EINTR #undef EINTR
#define EINTR (WSAEINTR-WSABASEERR) #define EINTR (WSAEINTR-WSABASEERR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment