NptConfig.h

00001 /*****************************************************************
00002 |
00003 |   Neptune - Configuration
00004 |
00005 |   (c) 2002-2006 Gilles Boccon-Gibod
00006 |   Author: Gilles Boccon-Gibod (bok@bok.net)
00007 |
00008  ****************************************************************/
00009 
00010 #ifndef _NPT_CONFIG_H_
00011 #define _NPT_CONFIG_H_
00012 
00013 /*----------------------------------------------------------------------
00014 |   defaults
00015 +---------------------------------------------------------------------*/
00016 #define NPT_CONFIG_HAVE_ASSERT_H
00017 #define NPT_CONFIG_HAVE_STD_C
00018 #define NPT_CONFIG_HAVE_STDLIB_H
00019 #define NPT_CONFIG_HAVE_STDIO_H
00020 #define NPT_CONFIG_HAVE_STDARG_H
00021 #define NPT_CONFIG_HAVE_STRING_H
00022 
00023 /*----------------------------------------------------------------------
00024 |   standard C runtime
00025 +---------------------------------------------------------------------*/
00026 #if defined(NPT_CONFIG_HAVE_STD_C)
00027 #define NPT_CONFIG_HAVE_MALLOC
00028 #define NPT_CONFIG_HAVE_CALLOC
00029 #define NPT_CONFIG_HAVE_REALLOC
00030 #define NPT_CONFIG_HAVE_FREE
00031 #define NPT_CONFIG_HAVE_MEMCPY
00032 #define NPT_CONFIG_HAVE_MEMSET
00033 #define NPT_CONFIG_HAVE_MEMCMP
00034 #define NPT_CONFIG_HAVE_GETENV
00035 #endif /* NPT_CONFIG_HAS_STD_C */
00036 
00037 #if defined(NPT_CONFIG_HAVE_STRING_H)
00038 #define NPT_CONFIG_HAVE_STRCMP
00039 #define NPT_CONFIG_HAVE_STRNCMP
00040 #define NPT_CONFIG_HAVE_STRDUP
00041 #define NPT_CONFIG_HAVE_STRLEN
00042 #define NPT_CONFIG_HAVE_STRCPY
00043 #define NPT_CONFIG_HAVE_STRNCPY
00044 #endif /* NPT_CONFIG_HAVE_STRING_H */
00045 
00046 #if defined(NPT_CONFIG_HAVE_STDIO_H)
00047 #define NPT_CONFIG_HAVE_SPRINTF
00048 #define NPT_CONFIG_HAVE_SNPRINTF
00049 #define NPT_CONFIG_HAVE_VSPRINTF
00050 #define NPT_CONFIG_HAVE_VSNPRINTF
00051 #endif /* NPT_CONFIG_HAVE_STDIO_H */
00052 
00053 /*----------------------------------------------------------------------
00054 |   standard C++ runtime
00055 +---------------------------------------------------------------------*/
00056 #define NPT_CONFIG_HAVE_NEW_H
00057 
00058 /*----------------------------------------------------------------------
00059 |   sockets
00060 +---------------------------------------------------------------------*/
00061 #define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00062 
00063 /*----------------------------------------------------------------------
00064 |   platform specifics
00065 +---------------------------------------------------------------------*/
00066 /* Windows 32 */
00067 #if defined(_WIN32) || defined(_XBOX)
00068 #if !defined(STRICT)
00069 #define STRICT
00070 #endif
00071 #define vsnprintf _vsnprintf
00072 #define snprintf  _snprintf
00073 #endif
00074 
00075 /* QNX */
00076 #if defined(__QNX__)
00077 #endif
00078 
00079 /* cygwin */
00080 #if defined(__CYGWIN__)
00081 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00082 #endif
00083 
00084 /* linux */
00085 #if defined(__linux__)
00086 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00087 #endif
00088 
00089 /* symbian */
00090 #if defined(__SYMBIAN32__)
00091 /* If defined, specify the stack size of each NPT_Thread. */
00092 #define NPT_CONFIG_THREAD_STACK_SIZE   0x14000
00093 #endif
00094 
00095 /*----------------------------------------------------------------------
00096 |   compiler specifics
00097 +---------------------------------------------------------------------*/
00098 /* GCC */
00099 #if defined(__GNUC__)
00100 #define NPT_COMPILER_UNUSED(p) (void)p
00101 #else
00102 #define NPT_COMPILER_UNUSED(p) 
00103 #endif
00104 
00105 /* TriMedia C/C++ Compiler */
00106 #if defined(__TCS__)
00107 #undef NPT_CONFIG_HAVE_ASSERT_H
00108 #undef NPT_CONFIG_HAVE_SNPRINTF
00109 #undef NPT_CONFIG_HAVE_VSNPRINTF
00110 #endif
00111 
00112 /* palmos compiler */
00113 #if defined(__PALMOS__)
00114 #if __PALMOS__ <= 0x05000000
00115 #undef NPT_CONFIG_HAVE_ASSERT_H
00116 #undef NPT_CONFIG_HAVE_SNPRINTF
00117 #undef NPT_CONFIG_HAVE_VSNPRINTF
00118 #endif
00119 #endif
00120 
00121 /* Microsoft C/C++ Compiler */
00122 #if defined(_MSC_VER)
00123 #if defined(_WIN64)
00124 typedef __int64 NPT_PointerLong;
00125 #else
00126 typedef __w64 long NPT_PointerLong;
00127 #endif
00128 #define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
00129 #if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
00130 #define NPT_CONFIG_HAVE_FOPEN_S
00131 #define NPT_CONFIG_HAVE_FSOPEN
00132 #define NPT_CONFIG_HAVE_SHARE_H
00133 #define NPT_vsnprintf(s,c,f,a)  _vsnprintf_s(s,c,_TRUNCATE,f,a)
00134 #define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
00135 #define NPT_strncpy(d,s,c)       strncpy_s(d,c,s,_TRUNCATE)
00136 #undef NPT_CONFIG_HAVE_GETENV
00137 #define NPT_CONFIG_HAVE_DUPENV_S
00138 #define dupenv_s _dupenv_s
00139 #else
00140 #define NPT_vsnprintf  _vsnprintf
00141 #define NPT_snprintf   _snprintf
00142 #endif
00143 #if defined(_DEBUG)
00144 #define _CRTDBG_MAP_ALLOC
00145 #endif
00146 #endif
00147 
00148 /* Windows CE */
00149 #if defined(_WIN32_WCE)
00150 #if defined(NPT_CONFIG_HAVE_FOPEN_S)
00151 #undef NPT_CONFIG_HAVE_FOPEN_S
00152 #endif
00153 #endif
00154 
00155 /* Symbian */
00156 #if defined(__SYMBIAN32__)
00157 #undef NPT_CONFIG_HAVE_NEW_H
00158 #include "e32std.h"
00159 #define explicit
00160 #endif
00161 
00162 /*----------------------------------------------------------------------
00163 |   defaults
00164 +---------------------------------------------------------------------*/
00165 #ifndef NPT_POINTER_TO_LONG
00166 #define NPT_POINTER_TO_LONG(_p) ((long)(_p))
00167 #endif
00168 
00169 #if !defined(NPT_snprintf)
00170 #define NPT_snprintf snprintf
00171 #endif
00172 #if !defined(NPT_strncpy)
00173 #define NPT_strncpy strncpy
00174 #endif
00175 #if !defined(NPT_vsnprintf)
00176 #define NPT_vsnprintf vsnprintf
00177 #endif
00178 
00179 /*----------------------------------------------------------------------
00180 |   includes
00181 +---------------------------------------------------------------------*/
00182 #if defined(DMALLOC)
00183 #include <dmalloc.h>
00184 #endif
00185 
00186 #endif // _NPT_CONFIG_H_