sourcepawn/compiler/osdefs.h
author Borja Ferrer <faluco@alliedmods.net>
Mon Aug 28 15:22:02 2006 +0000 (2006-08-28)
changeset 62 7c24f0801ae1
parent 27 764c6dd3dc25
child 2471 194be299b700
permissions -rw-r--r--
updated compiler to 3.2.3636
     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 LINUX
    52    #include <endian.h>
    53 #endif
    54 
    55 /* Linux NOW has these */
    56 #if !defined BIG_ENDIAN
    57   #define BIG_ENDIAN    4321
    58 #endif
    59 #if !defined LITTLE_ENDIAN
    60   #define LITTLE_ENDIAN 1234
    61 #endif
    62 
    63 /* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
    64 #if !defined BYTE_ORDER
    65   #if defined UCLINUX
    66     #define BYTE_ORDER BIG_ENDIAN
    67   #else
    68     #define BYTE_ORDER LITTLE_ENDIAN
    69   #endif
    70 #endif
    71 
    72 #if defined __MSDOS__ || defined __WIN32__ || defined _Windows
    73   #define DIRSEP_CHAR '\\'
    74 #elif defined macintosh
    75   #define DIRSEP_CHAR ':'
    76 #else
    77   #define DIRSEP_CHAR '/'   /* directory separator character */
    78 #endif
    79 
    80 /* _MAX_PATH is sometimes called differently and it may be in limits.h or
    81  * stdlib.h instead of stdio.h.
    82  */
    83 #if !defined _MAX_PATH
    84   /* not defined, perhaps stdio.h was not included */
    85   #if !defined PATH_MAX
    86     #include <stdio.h>
    87   #endif
    88   #if !defined _MAX_PATH && !defined PATH_MAX
    89     /* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
    90     #include <limits.h>
    91   #endif
    92   #if !defined _MAX_PATH && !defined PATH_MAX
    93     /* no _MAX_PATH and no MAX_PATH, perhaps it is in stdlib.h */
    94     #include <stdlib.h>
    95   #endif
    96   /* if _MAX_PATH is undefined, try common alternative names */
    97   #if !defined _MAX_PATH
    98     #if defined MAX_PATH
    99       #define _MAX_PATH    MAX_PATH
   100     #elif defined _POSIX_PATH_MAX
   101       #define _MAX_PATH  _POSIX_PATH_MAX
   102     #else
   103       /* everything failed, actually we have a problem here... */
   104       #define _MAX_PATH  1024
   105     #endif
   106   #endif
   107 #endif
   108 
   109 #endif  /* _OSDEFS_H */