compiler-init/osdefs.h
branchdvander
changeset 1 bf68e1639dba
child 17 9c9a85736197
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/compiler-init/osdefs.h	Thu Jul 13 20:03:46 2006 +0000
     1.3 @@ -0,0 +1,108 @@
     1.4 +/* __MSDOS__    set when compiling for DOS (not Windows)
     1.5 + * _Windows     set when compiling for any version of Microsoft Windows
     1.6 + * __WIN32__    set when compiling for Windows95 or WindowsNT (32 bit mode)
     1.7 + * __32BIT__    set when compiling in 32-bit "flat" mode (DOS or Windows)
     1.8 + *
     1.9 + * Copyright 1998-2005, ITB CompuPhase, The Netherlands.
    1.10 + * [email protected].
    1.11 + */
    1.12 +
    1.13 +#ifndef _OSDEFS_H
    1.14 +#define _OSDEFS_H
    1.15 +
    1.16 +/* Every compiler uses different "default" macros to indicate the mode
    1.17 + * it is in. Throughout the source, we use the Borland C++ macros, so
    1.18 + * the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to
    1.19 + * those of Borland C++.
    1.20 + */
    1.21 +#if defined(__WATCOMC__)
    1.22 +#  if defined(__WINDOWS__) || defined(__NT__)
    1.23 +#    define _Windows    1
    1.24 +#  endif
    1.25 +#  ifdef __386__
    1.26 +#    define __32BIT__   1
    1.27 +#  endif
    1.28 +#  if defined(_Windows) && defined(__32BIT__)
    1.29 +#    define __WIN32__   1
    1.30 +#  endif
    1.31 +#elif defined(_MSC_VER)
    1.32 +#  if defined(_WINDOWS) || defined(_WIN32)
    1.33 +#    define _Windows    1
    1.34 +#  endif
    1.35 +#  ifdef _WIN32
    1.36 +#    define __WIN32__   1
    1.37 +#    define __32BIT__   1
    1.38 +#  endif
    1.39 +#  if _MSC_VER >= 1400
    1.40 +#    if !defined _CRT_SECURE_NO_DEPRECATE
    1.41 +#      define _CRT_SECURE_NO_DEPRECATE
    1.42 +#    endif
    1.43 +#    define strdup		_strdup
    1.44 +#    define stricmp		_stricmp
    1.45 +#    define access		_access
    1.46 +#    define chdir		_chdir
    1.47 +#    define strdup		_strdup
    1.48 +#  endif
    1.49 +#endif
    1.50 +
    1.51 +#if defined __FreeBSD__
    1.52 +   #include <sys/endian.h>
    1.53 +#elif defined LINUX
    1.54 +   #include <endian.h>
    1.55 +#endif
    1.56 +
    1.57 +/* Linux NOW has these */
    1.58 +#if !defined BIG_ENDIAN
    1.59 +  #define BIG_ENDIAN    4321
    1.60 +#endif
    1.61 +#if !defined LITTLE_ENDIAN
    1.62 +  #define LITTLE_ENDIAN 1234
    1.63 +#endif
    1.64 +
    1.65 +/* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
    1.66 +#if !defined BYTE_ORDER
    1.67 +  #if defined UCLINUX
    1.68 +    #define BYTE_ORDER BIG_ENDIAN
    1.69 +  #else
    1.70 +    #define BYTE_ORDER LITTLE_ENDIAN
    1.71 +  #endif
    1.72 +#endif
    1.73 +
    1.74 +#if defined __MSDOS__ || defined __WIN32__ || defined _Windows
    1.75 +  #define DIRSEP_CHAR '\\'
    1.76 +#elif defined macintosh
    1.77 +  #define DIRSEP_CHAR ':'
    1.78 +#else
    1.79 +  #define DIRSEP_CHAR '/'   /* directory separator character */
    1.80 +#endif
    1.81 +
    1.82 +/* _MAX_PATH is sometimes called differently and it may be in limits.h or
    1.83 + * stdlib.h instead of stdio.h.
    1.84 + */
    1.85 +#if !defined _MAX_PATH
    1.86 +  /* not defined, perhaps stdio.h was not included */
    1.87 +  #if !defined PATH_MAX
    1.88 +    #include <stdio.h>
    1.89 +  #endif
    1.90 +  #if !defined _MAX_PATH && !defined PATH_MAX
    1.91 +    /* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
    1.92 +    #include <limits.h>
    1.93 +  #endif
    1.94 +  #if !defined _MAX_PATH && !defined PATH_MAX
    1.95 +    /* no _MAX_PATH and no MAX_PATH, perhaps it is in stdlib.h */
    1.96 +    #include <stdlib.h>
    1.97 +  #endif
    1.98 +  /* if _MAX_PATH is undefined, try common alternative names */
    1.99 +  #if !defined _MAX_PATH
   1.100 +    #if defined MAX_PATH
   1.101 +      #define _MAX_PATH    MAX_PATH
   1.102 +    #elif defined _POSIX_PATH_MAX
   1.103 +      #define _MAX_PATH  _POSIX_PATH_MAX
   1.104 +    #else
   1.105 +      /* everything failed, actually we have a problem here... */
   1.106 +      #define _MAX_PATH  1024
   1.107 +    #endif
   1.108 +  #endif
   1.109 +#endif
   1.110 +
   1.111 +#endif  /* _OSDEFS_H */