sourcepawn/compiler/osdefs.h
author Fyren <fyrenmoo@gmail.com>
Wed Apr 01 05:56:51 2009 -0700 (2009-04-01)
changeset 2692 126e2d41c2b3
parent 2471 194be299b700
permissions -rw-r--r--
Disable nextmap in Synergy and Dystopia (bug 3687, bug 3741; r=liam)
     1 /* __MSDOS__    set when compiling for DOS (not Windows)
     2  * _Windows     set when compiling for any version of Microsoft Windows
     3  * __WIN32__    set when compiling for Windows95 or WindowsNT (32 bit mode)
     4  * __32BIT__    set when compiling in 32-bit "flat" mode (DOS or Windows)
     5  *
     6  * Copyright 1998-2005, ITB CompuPhase, The Netherlands.
     7  * [email protected].
     8  */
     9 
    10 #ifndef _OSDEFS_H
    11 #define _OSDEFS_H
    12 
    13 /* Every compiler uses different "default" macros to indicate the mode
    14  * it is in. Throughout the source, we use the Borland C++ macros, so
    15  * the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to
    16  * those of Borland C++.
    17  */
    18 #if defined(__WATCOMC__)
    19 #  if defined(__WINDOWS__) || defined(__NT__)
    20 #    define _Windows    1
    21 #  endif
    22 #  ifdef __386__
    23 #    define __32BIT__   1
    24 #  endif
    25 #  if defined(_Windows) && defined(__32BIT__)
    26 #    define __WIN32__   1
    27 #  endif
    28 #elif defined(_MSC_VER)
    29 #  if defined(_WINDOWS) || defined(_WIN32)
    30 #    define _Windows    1
    31 #  endif
    32 #  ifdef _WIN32
    33 #    define __WIN32__   1
    34 #    define __32BIT__   1
    35 #  endif
    36 #  if _MSC_VER >= 1400
    37 #    if !defined _CRT_SECURE_NO_DEPRECATE
    38 #      define _CRT_SECURE_NO_DEPRECATE
    39 #    endif
    40 #    define strdup		_strdup
    41 #    define stricmp		_stricmp
    42 #    define access		_access
    43 #    define chdir		_chdir
    44 #    define strdup		_strdup
    45 #    define unlink		_unlink
    46 #  endif
    47 #endif
    48 
    49 #if defined __FreeBSD__
    50    #include <sys/endian.h>
    51 #elif defined __APPLE__
    52    #include <machine/endian.h>
    53 #elif defined LINUX
    54    #include <endian.h>
    55 #endif
    56 
    57 /* Linux NOW has these */
    58 #if !defined BIG_ENDIAN
    59   #define BIG_ENDIAN    4321
    60 #endif
    61 #if !defined LITTLE_ENDIAN
    62   #define LITTLE_ENDIAN 1234
    63 #endif
    64 
    65 /* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
    66 #if !defined BYTE_ORDER
    67   #if defined UCLINUX
    68     #define BYTE_ORDER BIG_ENDIAN
    69   #else
    70     #define BYTE_ORDER LITTLE_ENDIAN
    71   #endif
    72 #endif
    73 
    74 #if defined __MSDOS__ || defined __WIN32__ || defined _Windows
    75   #define DIRSEP_CHAR '\\'
    76 #elif defined macintosh
    77   #define DIRSEP_CHAR ':'
    78 #else
    79   #define DIRSEP_CHAR '/'   /* directory separator character */
    80 #endif
    81 
    82 /* _MAX_PATH is sometimes called differently and it may be in limits.h or
    83  * stdlib.h instead of stdio.h.
    84  */
    85 #if !defined _MAX_PATH
    86   /* not defined, perhaps stdio.h was not included */
    87   #if !defined PATH_MAX
    88     #include <stdio.h>
    89   #endif
    90   #if !defined _MAX_PATH && !defined PATH_MAX
    91     /* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
    92     #include <limits.h>
    93   #endif
    94   #if !defined _MAX_PATH && !defined PATH_MAX
    95     /* no _MAX_PATH and no MAX_PATH, perhaps it is in stdlib.h */
    96     #include <stdlib.h>
    97   #endif
    98   /* if _MAX_PATH is undefined, try common alternative names */
    99   #if !defined _MAX_PATH
   100     #if defined MAX_PATH
   101       #define _MAX_PATH    MAX_PATH
   102     #elif defined _POSIX_PATH_MAX
   103       #define _MAX_PATH  _POSIX_PATH_MAX
   104     #else
   105       /* everything failed, actually we have a problem here... */
   106       #define _MAX_PATH  1024
   107     #endif
   108   #endif
   109 #endif
   110 
   111 #endif  /* _OSDEFS_H */