sheepy

build system (sheepy) and package manager (spm) for C
git clone https://spartatek.se/git/sheepy.git
Log | Files | Refs | README | LICENSE

definitions (21229B)


      1 /* -*- C++ -*- vim: set syntax=cpp: 
      2  * (C) 2005-2010 Frank-Rene Schaefer
      3  * ABSOLUTELY NO WARRANTY                
      4  *
      5  * NOTE: '__VA_ARGS__' in macros is avoided because at the time of
      6  *       this writing, even some prominent compilers choke on it. */
      7 #ifndef __QUEX_INCLUDE_GUARD__DEFINITIONS
      8 #define __QUEX_INCLUDE_GUARD__DEFINITIONS
      9 
     10 #include"asserts"
     11 #include"compatStdint.h"
     12 #include"compatStdbool-pseudo.h"
     13 
     14 #ifndef    QUEX_NAMESPACE_QUEX 
     15 #   define QUEX_NAMESPACE_QUEX         quex
     16 #endif
     17 #if ! defined(__QUEX_OPTION_PLAIN_C)
     18 #   define QUEX_NAMESPACE_QUEX_OPEN   namespace QUEX_NAMESPACE_QUEX {
     19 #   define QUEX_NAMESPACE_QUEX_CLOSE  }
     20 #   define QUEXED_AUX2(NSP, X)        ::NSP::X
     21 #   define QUEXED_AUX(NSP, X)         QUEXED_AUX2(NSP,X)
     22 #   define QUEXED(X)                  QUEXED_AUX(QUEX_NAMESPACE_QUEX,X)
     23 #   define QUEXED_DEF(X)              X
     24 #else
     25 #   define QUEX_NAMESPACE_QUEX_OPEN
     26 #   define QUEX_NAMESPACE_QUEX_CLOSE
     27 #   define QUEXED_AUX2(NSP, X)        NSP ## _ ## X
     28 #   define QUEXED_AUX(NSP, X)         QUEXED_AUX2(NSP, X)
     29 #   define QUEXED(X)                  QUEXED_AUX(QUEX_NAMESPACE_QUEX, X)
     30 #   define QUEXED_DEF(X)              QUEXED_AUX(QUEX_NAMESPACE_QUEX, X)
     31 #endif
     32 #if defined( __cplusplus) && ! defined(__QUEX_OPTION_PLAIN_C)
     33 #   define QUEX_MAP_THIS_TO_ME(CLASS)   CLASS* me = this; (void)me;
     34 #else
     35 #   define QUEX_MAP_THIS_TO_ME(CLASS)   /* 'me' already plays the role of 'this'.   */
     36 #endif
     37 
     38 #ifndef    QUEX_SETTING_DEBUG_OUTPUT_CHANNEL
     39 #   define QUEX_SETTING_DEBUG_OUTPUT_CHANNEL __QUEX_STD_STDERR
     40 #endif
     41 
     42 #if defined(_MSC_VER) && _MSC_VER >= 1600
     43     /* Microsoft VisualStudio(tm) 2010, i.e. Version 1600:
     44      * Forget about the 'CRT security enhancements' for sprintf, fopen, and setbuf. */
     45 #   pragma warning(disable: 4996)
     46 #endif
     47 
     48 #if ! defined(__QUEX_OPTION_PLAIN_C)
     49 #   include <cstddef>  /* gets: size_t, ptrdiff_t */
     50 #   include <cstring>  /* gets: memmove, memcpy   */
     51 #   include <cstdio>   /* gets: fprintf           */
     52 #   include <cstdlib>
     53 #   include <stdexcept>
     54 #   define __QUEX_STD_FILE     std::FILE
     55 #   define __QUEX_STD_STDIN    stdin
     56 #   define __QUEX_STD_STDERR   stderr
     57 #   define __QUEX_STD_fopen    std::fopen
     58 #   define __QUEX_STD_fclose   std::fclose
     59 #   define __QUEX_STD_fprintf  std::fprintf
     60 #   define __QUEX_STD_fread    std::fread 
     61 #   define __QUEX_STD_fseek    std::fseek 
     62 #   define __QUEX_STD_ftell    std::ftell 
     63 #   define __QUEX_STD_memcpy   std::memcpy
     64 #   define __QUEX_STD_memmove  std::memmove
     65 #   define __QUEX_STD_memset   std::memset
     66 #   define __QUEX_STD_printf   std::printf
     67 #   define __QUEX_STD_sprintf  std::sprintf
     68 #   define __QUEX_STD_strcmp   std::strcmp
     69 #   define __QUEX_STD_strcpy   std::strcpy
     70 #   define __QUEX_STD_strlen   std::strlen
     71 #   define __QUEX_STD_strncat  std::strncat
     72 #   define __QUEX_STD_malloc   std::malloc
     73 #   define __QUEX_STD_free     std::free  
     74 
     75 #   define QUEX_INLINE     inline
     76     /* Input handle type is determined automagically via templates */
     77 #else
     78 #   include <stddef.h>
     79 #   include <string.h>  /* gets: memmove, memcpy     */
     80 #   include <stdio.h>   /* gets: fprintf             */
     81 #   include <stdlib.h>
     82 #   define __QUEX_STD_FILE     FILE
     83 #   define __QUEX_STD_STDIN    stdin
     84 #   define __QUEX_STD_STDERR   stderr
     85 #   define __QUEX_STD_fopen    fopen
     86 #   define __QUEX_STD_fclose   fclose
     87 #   define __QUEX_STD_fprintf  fprintf
     88 #   define __QUEX_STD_fread    fread 
     89 #   define __QUEX_STD_fseek    fseek 
     90 #   define __QUEX_STD_ftell    ftell 
     91 #   define __QUEX_STD_memcpy   memcpy
     92 #   define __QUEX_STD_memmove  memmove
     93 #   define __QUEX_STD_memset   memset
     94 #   define __QUEX_STD_printf   printf
     95 #   define __QUEX_STD_strcmp   strcmp
     96 #   define __QUEX_STD_strcpy   strcpy
     97 #   define __QUEX_STD_strlen   strlen
     98 #   define __QUEX_STD_sprintf  sprintf
     99 #   define __QUEX_STD_strncat  strncat
    100 #   define __QUEX_STD_malloc   malloc
    101 #   define __QUEX_STD_free     free  
    102 
    103 #   define QUEX_INLINE             /* static */
    104 #   define QUEX_INPUT_HANDLE_TYPE  /* stdio.h's */ FILE 
    105 #endif
    106 
    107 #ifndef QUEX_TYPE_DEFINITIONS_E_LOAD_RESULT
    108 #define QUEX_TYPE_DEFINITIONS_E_LOAD_RESULT
    109 typedef enum {
    110     E_LoadResult_DONE,              /* Complete or incomplete, load happened. */
    111     E_LoadResult_COMPLETE,          /* Load filled drain completely.          */
    112     E_LoadResult_INCOMPLETE,        /* Drain not filled completely.           */
    113     E_LoadResult_BAD_LEXATOM,       /* Encoding error in stream.              */
    114     E_LoadResult_NO_MORE_DATA,      /* No more data to fill drain.            */
    115     E_LoadResult_NO_SPACE_FOR_LOAD, /* No space to load content into.         */
    116     E_LoadResult_FAILURE,           /* General low-level load failure.        */ 
    117     E_LoadResult_VOID               /* General low-level load failure.        */ 
    118 } E_LoadResult;
    119 #endif
    120 
    121 #define E_LoadResult_NAME(LR) \
    122             (  (LR) == E_LoadResult_DONE              ? "DONE"              \
    123              : (LR) == E_LoadResult_COMPLETE          ? "COMPLETE"          \
    124              : (LR) == E_LoadResult_INCOMPLETE        ? "INCOMPLETE"        \
    125              : (LR) == E_LoadResult_BAD_LEXATOM       ? "BAD LEXATOM"       \
    126              : (LR) == E_LoadResult_NO_MORE_DATA      ? "NO MORE DATA"      \
    127              : (LR) == E_LoadResult_NO_SPACE_FOR_LOAD ? "NO SPACE FOR LOAD" \
    128              : (LR) == E_LoadResult_FAILURE           ? "FAILURE"           \
    129              : (LR) == E_LoadResult_VOID              ? "VOID"              \
    130              :                                          "<error>")
    131 
    132 /* Define the QUEX_TYPE_STREAM_POSITION at a central place, so that it is the
    133  * same when it is used in multiple analyzers compiled into one binary.      */
    134 #ifndef    QUEX_TYPE_STREAM_POSITION
    135 #   define QUEX_TYPE_STREAM_POSITION intmax_t
    136 #endif
    137 
    138 #define QUEX_MIN(X, Y)  ((X) < (Y) ? (X) : (Y))
    139 #define QUEX_MAX(X, Y)  ((X) > (Y) ? (X) : (Y))
    140 
    141 /* In cases, such as DLL compilation for some dedicated compilers, 
    142  * the classes need some epilog. If the user does not specify such
    143  * a thing, it must be empty.                                                */
    144 #ifndef    QUEX_SETTING_USER_CLASS_DECLARATION_EPILOG
    145 #   define QUEX_SETTING_USER_CLASS_DECLARATION_EPILOG
    146 #endif
    147 
    148 /* Hash Function:
    149  *
    150  * Using Dan Bernstein's 'dbj2' (published in comp.lang.c) which is extremely
    151  * fast but still behaves well. See Linear Congruential Generators for further
    152  * reading.                                                                  */
    153 #define QUEX_HASH_INIT_VALUE  5381
    154 #define QUEX_HASH_NEXT(H, C)  ((((H) << 5) + (H)) + (C))
    155 
    156 /* Support of computed goto */
    157 #ifdef QUEX_OPTION_COMPUTED_GOTOS
    158     typedef  void*     QUEX_TYPE_GOTO_LABEL;
    159 #   define QUEX_GOTO_LABEL_VOID                       (QUEX_TYPE_GOTO_LABEL)(0x0)
    160 #   define QUEX_LABEL(StateIndex)                     &&_##StateIndex 
    161 
    162 #   define QUEX_GOTO_TERMINAL(LABEL)                  do { goto *LABEL; } while(0)
    163 
    164     /* If no computed gotos are used, then there are two state routers, one for forward
    165      * state routing and another for backward state routing. Thus, two macros for the same
    166      * thing are required.                                                                 */
    167 #   define QUEX_GOTO_STATE(LABEL)                     do { goto *LABEL; } while(0)
    168 
    169 
    170 #else
    171     typedef  int32_t  QUEX_TYPE_GOTO_LABEL;          /* > 0: State index
    172                                                       * < 0: Drop Out of a state abs(Label). */
    173 #   define QUEX_GOTO_LABEL_VOID                      (QUEX_TYPE_GOTO_LABEL)(-1)
    174 #   define QUEX_LABEL(StateIndex)                    StateIndex 
    175 
    176 #   define QUEX_GOTO_TERMINAL(LABEL)      \
    177            do {                           \
    178                last_acceptance = LABEL;   \
    179                goto QUEX_TERMINAL_ROUTER; \
    180            } while(0)
    181 
    182 #   define QUEX_GOTO_STATE(LABEL)           \
    183            do {                             \
    184               target_state_index = LABEL;   \
    185               goto QUEX_LABEL_STATE_ROUTER; \
    186            } while(0)
    187 #endif
    188 
    189 /* DELETE QUEX_GOTO_RELOAD' when safe */
    190 #define QUEX_GOTO_RELOAD(RELOAD_LABEL, ON_SUCCESS, ON_FAIL)  \
    191            do { \
    192            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%s:%i:\tUSE of QUEX_GOTO_RELOAD -- SUPPOSED TO BE SUPERFLUOUS", __FILE__, __LINE__); \
    193            target_state_index      = QUEX_LABEL(ON_SUCCESS); \
    194            target_state_else_index = QUEX_LABEL(ON_FAIL);    \
    195            goto RELOAD_LABEL; } while (0)
    196 
    197 #define __QUEX_PRINT_SOURCE_POSITION()                             \
    198         __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%s:%i:\t", __FILE__, (int)__LINE__) 
    199 
    200 #if ! defined(__QUEX_OPTION_PLAIN_C)
    201 #   define QUEX_ERROR_EXIT(Msg) \
    202            do { \
    203                __QUEX_PRINT_SOURCE_POSITION(); \
    204                throw std::runtime_error(Msg); \
    205            } while(0)
    206 #else
    207 #   define QUEX_ERROR_EXIT(Msg) \
    208            do { \
    209                __QUEX_PRINT_SOURCE_POSITION(); \
    210                __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%s", Msg); exit(-1); \
    211            } while(0)
    212 #endif
    213 
    214 #if defined(QUEX_OPTION_DEBUG_SHOW)
    215 
    216 #   define __quex_debug(Str)                                        \
    217            __QUEX_PRINT_SOURCE_POSITION();                          \
    218            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%s", (Str)) 
    219 #   define __quex_debug1(Str)                                       \
    220            __QUEX_PRINT_SOURCE_POSITION();                          \
    221            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%s\n", (Str)) 
    222 #   define __quex_debug2(FormatStr, Arg)                            \
    223            __QUEX_PRINT_SOURCE_POSITION();                          \
    224            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, FormatStr "\n", Arg)
    225 #   define __quex_debug3(FormatStr, Arg0, Arg1)                     \
    226            __QUEX_PRINT_SOURCE_POSITION();                          \
    227            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, FormatStr "\n", Arg0, Arg1)
    228 #   define __quex_debug4(FormatStr, Arg0, Arg1, Arg2)               \
    229            __QUEX_PRINT_SOURCE_POSITION();                          \
    230            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, FormatStr "\n", Arg0, Arg1, Arg2)
    231 
    232 #   define __QUEX_PRINT_CHAR(C)                             \
    233              (C) == '\n' ? __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '\\n'\n", (int)(C)) \
    234            : (C) == '\t' ? __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '\\t'\n", (int)(C)) \
    235            : (C) == '\r' ? __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '\\r'\n", (int)(C)) \
    236            : (C) == '\a' ? __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '\\a'\n", (int)(C)) \
    237            : (C) == '\v' ? __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '\\v'\n", (int)(C)) \
    238            :               __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "%02X '%c'\n",  (int)(C), (C) < 0xFF ? (char)(C) : '?')
    239 
    240 #   define __quex_debug_core(StateIdx, Message)                \
    241            __quex_debug3("state %i ____%s", (int)(StateIdx), (Message)) 
    242 
    243 #   define __quex_debug_input(StateIdx)                                            \
    244            __quex_debug("input:           ");                                      \
    245            __QUEX_PRINT_CHAR(*(me->buffer._read_p));                              \
    246            __quex_debug2("input position:  %i",                                    \
    247                          (int)(me->buffer._read_p - me->buffer._memory._front));  \
    248            __quex_optional_statistics((StateIdx))
    249 
    250 #   define __quex_debug_path_walker_core(PathWalkerIdx, PathBase, PathIterator, Message)             \
    251            __quex_debug_core(__QUEX_DEBUG_MAP_STATE_KEY_TO_STATE(PathIterator-PathBase), (Message)); \
    252            __quex_assert(PathIterator <  &PathBase[sizeof(PathBase)/sizeof(QUEX_TYPE_LEXATOM)]);   \
    253            __quex_assert(PathIterator >= &PathBase[0]);                                              \
    254            __quex_debug4("(path walker: %i, path: %i, offset: %i)",                                  \
    255                          (int)PathWalkerIdx,                                                         \
    256                          (int)__QUEX_DEBUG_MAP_PATH_BASE_TO_PATH_ID(PathBase),                       \
    257                          (int)(PathIterator-PathBase)); 
    258 
    259 #   define __quex_debug_template_core(TemplateIdx, StateKey, Message)                     \
    260            __quex_debug_core(__QUEX_DEBUG_MAP_STATE_KEY_TO_STATE(StateKey), (Message));   \
    261            __quex_assert(__QUEX_DEBUG_MAP_STATE_KEY_TO_STATE(StateKey) != 0);             \
    262            __quex_debug3("(template: %i, state key=%i)", (int)TemplateIdx, (int)StateKey)
    263 
    264 #   define __quex_debug_state(StateIdx)                \
    265            __quex_debug_core(StateIdx, "__________");  \
    266            __quex_debug_input(StateIdx)
    267 
    268 #   define __quex_debug_path_walker_state(PathWalkerIdx, PathBase, PathIterator)               \
    269            __quex_debug_path_walker_core(PathWalkerIdx, PathBase, PathIterator, "__________"); \
    270            __quex_debug_input(__QUEX_DEBUG_MAP_STATE_KEY_TO_STATE(PathIterator-PathBase))
    271 
    272 #   define __quex_debug_template_state(TemplateIdx, StateKey)                      \
    273            __quex_debug_template_core(TemplateIdx, StateKey, "__________");        \
    274            __quex_debug_input(__QUEX_DEBUG_MAP_STATE_KEY_TO_STATE(StateIdx))
    275 
    276 #   define __quex_debug_drop_out(StateIdx)            \
    277            __quex_debug_core(StateIdx, "<DROP OUT>");  
    278 
    279 #   define __quex_debug_path_walker_drop_out(PathWalkerIdx, PathBase, PathIterator) \
    280            __quex_debug_path_walker_core(PathWalkerIdx, PathBase, PathIterator, "<DROP OUT>")        
    281 
    282 #   define __quex_debug_template_drop_out(TemplateIdx, StateKey)            \
    283            __quex_debug_template_core(TemplateIdx, StateKey, "<DROP OUT>")           
    284 
    285 #   define __quex_debug_buffer_info(B)                                         \
    286            __quex_debug2("input position:  %i",                                \
    287                          (int)((B)._read_p        - (B)._memory._front + 1)); \
    288            __quex_debug2("lexeme start:    %i",                                \
    289                          (int)((B)._lexeme_start_p - (B)._memory._front + 1)); \
    290            __quex_debug2("buffer size:     %i",                                \
    291                          (int)((B)._memory._back   - (B)._memory._front)); 
    292 
    293 #   define __quex_debug_reload_before()                              \
    294            __quex_debug1("reload ________________");                 \
    295            __quex_debug2("fallback bytes:  %i",                      \
    296                          (int)(QUEX_SETTING_BUFFER_MIN_FALLBACK_N)); \
    297            __quex_debug1("(before)\n");                              \
    298            __quex_debug_buffer_info(me->buffer);
    299            
    300 #   define __quex_debug_reload_after(LR)                        \
    301            __quex_debug2("(after): %s", E_LoadResult_NAME(LR)); \
    302            __quex_debug_buffer_info(me->buffer);                \
    303            __quex_debug1("reload terminated _____"); 
    304 
    305 #   define __quex_debug_counter()                        \
    306            QUEX_NAME(Counter_print_this)(&self.counter)
    307 
    308 
    309 #else /* not defined(QUEX_OPTION_DEBUG_SHOW) */
    310 
    311 #   define __quex_debug(FormatStr)                /* empty */
    312 #   define __quex_debug1(Str)                     /* empty */
    313 #   define __quex_debug2(FormatStr, Arg)          /* empty */
    314 #   define __quex_debug3(FormatStr, Arg0, Arg1)   /* empty */
    315 
    316 #   define __quex_debug_state(StateIdx)           \
    317            __quex_optional_statistics(StateIdx)
    318 #   define __quex_debug_path_walker_state(PathWalkerIdx, PathBase, PathIterator) \
    319            __quex_optional_statistics(StateIdx)
    320 #   define __quex_debug_template_state(TemplateID, StateKey) \
    321            __quex_optional_statistics(StateIdx)
    322 
    323 #   define __quex_debug_drop_out(StateIdx)                                          /* empty */
    324 #   define __quex_debug_path_walker_drop_out(PathWalkerIdx, PathBase, PathIterator) /* empty */
    325 #   define __quex_debug_template_drop_out(TemplateID, StateKey)                     /* empty */ 
    326 
    327 #   define __quex_debug_reload_before()           /* empty */
    328 #   define __quex_debug_reload_after(LR)          /* empty */
    329 #   define __quex_debug_counter()                 /* empty */
    330 
    331 #endif /* ! QUEX_OPTION_DEBUG_SHOW */
    332 
    333 #define QUEX_ASSERT_MEMORY(BEGIN, SIZE, EOF_P) \
    334     __quex_assert((! (BEGIN)) || (SIZE) > 2);                                              \
    335     __quex_assert((! (BEGIN)) || ((EOF_P) > (BEGIN) && (EOF_P) <= &(BEGIN)[(SIZE)-1]));    \
    336     __quex_assert((  (BEGIN)) || ((SIZE) == 0       && (EOF_P) == (QUEX_TYPE_LEXATOM*)0)); \
    337     /* (BEGIN) MUST contain the limitting elements set to BUFFER LIMIT CODE   */           \
    338     __quex_assert(! (BEGIN)   || (BEGIN)[0]        == QUEX_SETTING_BUFFER_LIMIT_CODE);     \
    339     __quex_assert(! (BEGIN)   || (BEGIN)[(SIZE)-1] == QUEX_SETTING_BUFFER_LIMIT_CODE);     \
    340     __quex_assert(! (EOF_P)   || (EOF_P)[0]        == QUEX_SETTING_BUFFER_LIMIT_CODE)
    341 
    342 #if  defined(QUEX_OPTION_DEBUG_SHOW_LOADS)
    343 
    344 #   include <quex/code_base/buffer/Buffer_debug>
    345 #   define __quex_debug_buffer_load(BUFFER, Msg)         \
    346            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, Msg);              \
    347            QUEX_NAME(Buffer_show_debug_content)(BUFFER); \
    348            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "\n");
    349 
    350 #elif  defined(__QUEX_OPTION_UNIT_TEST_QUEX_BUFFER_LOADS) 
    351 
    352 #   include <quex/code_base/buffer/Buffer_debug>
    353 #   define __quex_debug_buffer_load(BUFFER, Msg)         \
    354            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, Msg);              \
    355            QUEX_NAME(Buffer_show_content)(BUFFER);       \
    356            __QUEX_STD_fprintf(QUEX_SETTING_DEBUG_OUTPUT_CHANNEL, "\n");
    357 #else
    358 
    359 #   define __quex_debug_buffer_load(BUFFER, Msg) /* empty */
    360 
    361 #endif /* __QUEX_OPTION_UNIT_TEST_QUEX_BUFFER_LOADS */
    362 
    363 #ifdef QUEX_OPTION_STATISTICS
    364 #    define __quex_optional_statistics(StateIdx) \
    365             QUEX_NAME(statistics_state_count)(QUEX_NAME(statistics_state_ ## StateIdx), \
    366                                               *(me->buffer._read_p));
    367 #else
    368 #    define __quex_optional_statistics(StateIdx) /* empty */
    369 #endif
    370 
    371 #define __QUEX_MESSAGE_CHARACTER_ENCODING_SPECIFIED_WITHOUT_CONVERTER \
    372         "A character encoding name '%s' has been specified while the analyzer is not\n" \
    373         "setup to run with a converter (icu or iconv).\n" 
    374 
    375 #define __QUEX_MESSAGE_ASSERTS_INFO \
    376         "## Disable this message by compile option\n"                               \
    377         "##        '-DQUEX_OPTION_ASSERTS_WARNING_MESSAGE_DISABLED'\n"              \
    378         "##\n"                                                                      \
    379         "## Asserts activated! Lexical analyzer is 'paranoid'!\n"                   \
    380         "## => Even smallest misbehavior causes program exit.\n"                    \
    381         "##    This helps to find subtile errors.\n"                                \
    382         "##\n"                                                                      \
    383         "## Note however: the paranoia is a heavy load on performance!\n"           \
    384         "##\n"                                                                      \
    385         "## Disable asserts by '-DQUEX_OPTION_ASSERTS_DISABLED'\n"                  \
    386         "##\n"                                                                      \
    387         "## Report any bug at\n"                                                    \
    388         "##        http://sourceforge.net/tracker/?group_id=168259&atid=846112\n" 
    389 
    390 #define __QUEX_MESSAGE_MODE_STACK_OVERFLOW \
    391         "Error: Mode stack overflow. Adapt size of mode stack via the macro\n"      \
    392         "Error: QUEX_SETTING_MODE_STACK_SIZE, or review mode transitions.\n"        \
    393         "Error: I.e. check that for every GOSUB (push), there is a correspondent\n" \
    394         "Error: GOUP (pop)."
    395 
    396 #define QUEX_ERROR_DEPRECATED(NAME, REPLACEMENT) \
    397         QUEX_ERROR_EXIT(NAME " has been deprecated\n"   \
    398                         "Please, use " REPLACEMENT ".")
    399 
    400 #define ____QUEX_APPEND(X, Y)  X ## Y
    401 #define __QUEX_APPEND(X, Y)    ____QUEX_APPEND(X, Y)
    402 
    403 #define QUEX_STRING(X)            #X
    404 #define QUEX_NUMBER_TO_STRING(x)  QUEX_STRING(x)
    405 #define QUEX_SOURCE_POS()         __FILE__ ":" QUEX_NUMBER_TO_STRING(__LINE__) ": "
    406 
    407 #if ! defined(QUEX_OPTION_TERMINATION_ZERO_DISABLED)
    408 
    409 #   define QUEX_LEXEME_TERMINATING_ZERO_SET(BUFFER)        \
    410         (BUFFER)->_lexatom_at_lexeme_start = *((BUFFER)->_read_p); \
    411         *((BUFFER)->_read_p) = '\0';
    412 
    413 #   define QUEX_LEXEME_TERMINATING_ZERO_UNDO(BUFFER)                   \
    414         /* only need to reset, in case that the terminating zero was set*/        \
    415         if( (BUFFER)->_lexatom_at_lexeme_start != (QUEX_TYPE_LEXATOM)'\0' ) { \
    416             *((BUFFER)->_read_p) = (BUFFER)->_lexatom_at_lexeme_start;         \
    417             (BUFFER)->_lexatom_at_lexeme_start = (QUEX_TYPE_LEXATOM)'\0';     \
    418         }
    419 #else
    420 
    421 #   define QUEX_LEXEME_TERMINATING_ZERO_SET(BUFFER)   /* empty */
    422 #   define QUEX_LEXEME_TERMINATING_ZERO_UNDO(BUFFER)  /* empty */
    423 
    424 #endif
    425 
    426 #endif /* __QUEX_INCLUDE_GUARD__DEFINITIONS */