| 1 | #ifndef INC_config_hpp__ | 
| 2 | #define INC_config_hpp__ | 
| 3 |  | 
| 4 | /* ANTLR Translator Generator | 
| 5 | * Project led by Terence Parr at http://www.jGuru.com | 
| 6 | * Software rights: http://www.antlr.org/license.html | 
| 7 | * | 
| 8 | * $Id: config.hpp,v 1.1 2005-12-02 15:38:02 tim Exp $ | 
| 9 | */ | 
| 10 |  | 
| 11 | /* | 
| 12 | * Just a simple configuration file to differentiate between the | 
| 13 | * various compilers used and reconfigure stuff for any oddities of the | 
| 14 | * compiler in question. | 
| 15 | * | 
| 16 | * These are the defaults. Per compiler these are amended. | 
| 17 | */ | 
| 18 | #define ANTLR_USE_NAMESPACE(_x_) _x_:: | 
| 19 | #define ANTLR_USING_NAMESPACE(_x_) using namespace _x_; | 
| 20 | #define ANTLR_CXX_SUPPORTS_NAMESPACE 1 | 
| 21 | #define ANTLR_C_USING(_x_) | 
| 22 | #define ANTLR_API | 
| 23 | #ifndef CUSTOM_API | 
| 24 | # define CUSTOM_API | 
| 25 | #endif | 
| 26 | #define ANTLR_IOS_BASE ios_base | 
| 27 | /** define if cctype functions/macros need a std:: prefix. A lot of compilers | 
| 28 | * define these as macros, in which case something barfs. | 
| 29 | */ | 
| 30 | #define ANTLR_CCTYPE_NEEDS_STD | 
| 31 |  | 
| 32 | /// Define if C++ compiler supports std::uncaught_exception | 
| 33 | #define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION | 
| 34 |  | 
| 35 | #define ANTLR_ATOI_IN_STD | 
| 36 |  | 
| 37 | /******************************************************************************/ | 
| 38 | /*{{{ Microsoft Visual C++ */ | 
| 39 | // NOTE: If you provide patches for a specific MSVC version guard them for | 
| 40 | // the specific version!!!! | 
| 41 | // _MSC_VER == 1100 for Microsoft Visual C++ 5.0 | 
| 42 | // _MSC_VER == 1200 for Microsoft Visual C++ 6.0 | 
| 43 | // _MSC_VER == 1300 for Microsoft Visual C++ 7.0 | 
| 44 | #if defined(_MSC_VER) | 
| 45 |  | 
| 46 | // This warning really gets on my nerves. | 
| 47 | // It's the one about symbol longer than 256 chars, and it happens | 
| 48 | // all the time with STL. | 
| 49 | # pragma warning( disable : 4786 4231 ) | 
| 50 | // this shuts up some DLL interface warnings for STL | 
| 51 | # pragma warning( disable : 4251 ) | 
| 52 |  | 
| 53 | # ifdef ANTLR_CXX_USE_STLPORT | 
| 54 | #       undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION | 
| 55 | # endif | 
| 56 |  | 
| 57 | # if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) ) | 
| 58 | #       error "DLL Build not supported on these MSVC versions." | 
| 59 | // see comment in lib/cpp/src/dll.cpp | 
| 60 | # endif | 
| 61 |  | 
| 62 | // For the DLL support originally contributed by Stephen Naughton | 
| 63 | // If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined | 
| 64 | // If you are building the DLL define ANTLR_EXPORTS | 
| 65 | // If you are compiling code to be used with the DLL define ANTLR_IMPORTS | 
| 66 | # ifdef ANTLR_EXPORTS | 
| 67 | #       undef ANTLR_API | 
| 68 | #       define ANTLR_API __declspec(dllexport) | 
| 69 | # endif | 
| 70 |  | 
| 71 | # ifdef ANTLR_IMPORTS | 
| 72 | #       undef ANTLR_API | 
| 73 | #       define ANTLR_API __declspec(dllimport) | 
| 74 | # endif | 
| 75 |  | 
| 76 | // VC6 | 
| 77 | # if ( _MSC_VER == 1200 ) | 
| 78 | #       undef ANTLR_ATOI_IN_STD | 
| 79 | # endif | 
| 80 |  | 
| 81 | // These should be verified for newer MSVC's | 
| 82 | // Not allowed to put 'static const int XXX=20;' in a class definition | 
| 83 | # define NO_STATIC_CONSTS | 
| 84 | // Using vector<XXX> requires operator<(X,X) to be defined | 
| 85 | # define NEEDS_OPERATOR_LESS_THAN | 
| 86 | // No strcasecmp in the C library (so use stricmp instead) | 
| 87 | // - Anyone know which is in which standard? | 
| 88 | # define NO_STRCASECMP | 
| 89 | # undef ANTLR_CCTYPE_NEEDS_STD | 
| 90 |  | 
| 91 | // needed for CharScannerLiteralsLess | 
| 92 | # define NO_TEMPLATE_PARTS | 
| 93 |  | 
| 94 | #endif  // End of Microsoft Visual C++ | 
| 95 |  | 
| 96 | /*}}}*/ | 
| 97 | /******************************************************************************/ | 
| 98 | /*{{{ SunPro Compiler (Using OBJECTSPACE STL) | 
| 99 | *****************************************************************************/ | 
| 100 | #ifdef __SUNPRO_CC | 
| 101 |  | 
| 102 | # if (__SUNPRO_CC >= 0x500) | 
| 103 |  | 
| 104 | #       define NEEDS_OPERATOR_LESS_THAN | 
| 105 | #       define NO_TEMPLATE_PARTS | 
| 106 |  | 
| 107 | # else | 
| 108 |  | 
| 109 | #       undef namespace | 
| 110 | #       define namespace | 
| 111 |  | 
| 112 | #       if (__SUNPRO_CC == 0x420) | 
| 113 |  | 
| 114 | /* This code is specif to SunWspro Compiler 4.2, and will compile with | 
| 115 | the objectspace 2.1 toolkit for Solaris2.6 */ | 
| 116 | #        define HAS_NOT_CASSERT_H | 
| 117 | #        define HAS_NOT_CSTRING_H | 
| 118 | #        define HAS_NOT_CCTYPE_H | 
| 119 | #        define HAS_NOT_CSTDIO_H | 
| 120 | #        define HAS_OSTREAM_H | 
| 121 |  | 
| 122 | /* #define OS_SOLARIS_2_6 | 
| 123 | #define OS_NO_WSTRING | 
| 124 | #define OS_NO_ALLOCATORS | 
| 125 | #define OS_MULTI_THREADED | 
| 126 | #define OS_SOLARIS_NATIVE | 
| 127 | #define OS_REALTIME | 
| 128 | #define __OSVERSION__=5 | 
| 129 | #define SVR4 | 
| 130 | */ | 
| 131 |  | 
| 132 | // ObjectSpace + some specific templates constructions with stl. | 
| 133 | /* #define OS_NO_ALLOCATOR */ | 
| 134 |  | 
| 135 | // This great compiler does not have the namespace feature. | 
| 136 | #        undef  ANTLR_USE_NAMESPACE | 
| 137 | #        define ANTLR_USE_NAMESPACE(_x_) | 
| 138 | #        undef ANTLR_USING_NAMESPACE | 
| 139 | #        define ANTLR_USING_NAMESPACE(_x_) | 
| 140 | #        undef ANTLR_CXX_SUPPORTS_NAMESPACE | 
| 141 | #       endif           // End __SUNPRO_CC == 0x420 | 
| 142 |  | 
| 143 | #       undef explicit | 
| 144 | #       define explicit | 
| 145 |  | 
| 146 | #       define exception os_exception | 
| 147 | #       define bad_exception os_bad_exception | 
| 148 |  | 
| 149 | // Not allowed to put 'static const int XXX=20;' in a class definition | 
| 150 | #       define NO_STATIC_CONSTS | 
| 151 | // Using vector<XXX> requires operator<(X,X) to be defined | 
| 152 | #       define NEEDS_OPERATOR_LESS_THAN | 
| 153 |  | 
| 154 | # endif | 
| 155 |  | 
| 156 | # undef ANTLR_CCTYPE_NEEDS_STD | 
| 157 |  | 
| 158 | #endif  // end __SUNPRO_CC | 
| 159 | /*}}}*/ | 
| 160 | /*****************************************************************************/ | 
| 161 | /*{{{ Inprise C++ Builder 3.0 | 
| 162 | *****************************************************************************/ | 
| 163 | #ifdef __BCPLUSPLUS__ | 
| 164 | # define NO_TEMPLATE_PARTS | 
| 165 | # define NO_STRCASECMP | 
| 166 | # undef ANTLR_CCTYPE_NEEDS_STD | 
| 167 | #endif  // End of C++ Builder 3.0 | 
| 168 | /*}}}*/ | 
| 169 | /*****************************************************************************/ | 
| 170 | /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) | 
| 171 | *****************************************************************************/ | 
| 172 | #ifdef __IBMCPP__ | 
| 173 |  | 
| 174 | // No strcasecmp in the C library (so use stricmp instead) | 
| 175 | // - Anyone know which is in which standard? | 
| 176 | # define NO_STRCASECMP | 
| 177 | # undef ANTLR_CCTYPE_NEEDS_STD | 
| 178 |  | 
| 179 | #endif  // end IBM VisualAge C++ | 
| 180 | /*}}}*/ | 
| 181 | /*****************************************************************************/ | 
| 182 | /*{{{ Metrowerks Codewarrior | 
| 183 | *****************************************************************************/ | 
| 184 | #ifdef __MWERKS__ | 
| 185 | # if (__MWERKS__ <= 0x2201) | 
| 186 | #       define NO_TEMPLATE_PARTS | 
| 187 | # endif | 
| 188 |  | 
| 189 | // CW 6.0 and 7.0 still do not have it. | 
| 190 | # define ANTLR_REALLY_NO_STRCASECMP | 
| 191 |  | 
| 192 | # undef ANTLR_C_USING | 
| 193 | # define ANTLR_C_USING(_x_)   using std:: ## _x_; | 
| 194 |  | 
| 195 | # define ANTLR_CCTYPE_NEEDS_STD | 
| 196 | # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION | 
| 197 |  | 
| 198 | #endif  // End of Metrowerks Codewarrior | 
| 199 | /*}}}*/ | 
| 200 | /*****************************************************************************/ | 
| 201 | /*{{{ SGI Irix 6.5.10 MIPSPro compiler | 
| 202 | *****************************************************************************/ | 
| 203 | // (contributed by Anna Winkler) | 
| 204 | // Note: you can't compile ANTLR with the MIPSPro compiler on | 
| 205 | // anything < 6.5.10 because SGI just fixed a big bug dealing with | 
| 206 | // namespaces in that release. | 
| 207 | #ifdef __sgi | 
| 208 | # define HAS_NOT_CCTYPE_H | 
| 209 | # define HAS_NOT_CSTRING_H | 
| 210 | # define HAS_NOT_CSTDIO_H | 
| 211 | # undef ANTLR_CCTYPE_NEEDS_STD | 
| 212 | #endif // End IRIX MIPSPro | 
| 213 | /*}}}*/ | 
| 214 | /*****************************************************************************/ | 
| 215 | /*{{{ G++ in various incarnations | 
| 216 | *****************************************************************************/ | 
| 217 | // With the gcc-2.95 and 3.0 being in the near future we should start handling | 
| 218 | // incompatabilities between the various libstdc++'s. | 
| 219 | #if defined(__GNUC__) || defined(__GNUG__) | 
| 220 | // gcc 2 branch.. | 
| 221 | # if (__GNUC__ == 2 ) | 
| 222 | #       if (__GNUC_MINOR__ <= 8 ) | 
| 223 | #        undef ANTLR_USE_NAMESPACE | 
| 224 | #        define ANTLR_USE_NAMESPACE(_x_) | 
| 225 | #        undef ANTLR_USING_NAMESPACE | 
| 226 | #        define ANTLR_USING_NAMESPACE(_x_) | 
| 227 | #        undef ANTLR_CXX_SUPPORTS_NAMESPACE | 
| 228 | #       endif | 
| 229 | #       if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 ) | 
| 230 | #         undef ANTLR_IOS_BASE | 
| 231 | #         define ANTLR_IOS_BASE ios | 
| 232 | #         undef ANTLR_CCTYPE_NEEDS_STD | 
| 233 | // compiling with -ansi ? | 
| 234 | #         ifdef __STRICT_ANSI__ | 
| 235 | #               undef ANTLR_REALLY_NO_STRCASECMP | 
| 236 | #               define ANTLR_REALLY_NO_STRCASECMP | 
| 237 | #         endif | 
| 238 | #       else | 
| 239 | // experimental .96 .97 branches.. | 
| 240 | #        undef ANTLR_CCTYPE_NEEDS_STD | 
| 241 | #       endif | 
| 242 | # endif | 
| 243 | #endif // ! __GNUC__ | 
| 244 | /*}}}*/ | 
| 245 | /*****************************************************************************/ | 
| 246 | /*{{{ Digital CXX (Tru64) | 
| 247 | *****************************************************************************/ | 
| 248 | #ifdef __DECCXX | 
| 249 | #define __USE_STD_IOSTREAM | 
| 250 | #endif | 
| 251 | /*}}}*/ | 
| 252 | /*****************************************************************************/ | 
| 253 | #ifdef __BORLANDC__ | 
| 254 | #if  __BORLANDC__ >= 560 | 
| 255 | #include <ctype> | 
| 256 | #include <stdlib> | 
| 257 | #define ANTLR_CCTYPE_NEEDS_STD | 
| 258 | #else | 
| 259 | #error "sorry, compiler is too old - consider an update." | 
| 260 | #endif | 
| 261 | #endif | 
| 262 |  | 
| 263 | // Redefine these for backwards compatability.. | 
| 264 | #undef ANTLR_BEGIN_NAMESPACE | 
| 265 | #undef ANTLR_END_NAMESPACE | 
| 266 |  | 
| 267 | #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 | 
| 268 | # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { | 
| 269 | # define ANTLR_END_NAMESPACE } | 
| 270 | #else | 
| 271 | # define ANTLR_BEGIN_NAMESPACE(_x_) | 
| 272 | # define ANTLR_END_NAMESPACE | 
| 273 | #endif | 
| 274 |  | 
| 275 | #endif //INC_config_hpp__ |