|
39 | 39 | /* |
40 | 40 | * DATA DECLARATIONS |
41 | 41 | */ |
| 42 | +enum eCppCharacters { |
| 43 | + /* white space characters */ |
| 44 | + SPACE = ' ', |
| 45 | + NEWLINE = '\n', |
| 46 | + CRETURN = '\r', |
| 47 | + FORMFEED = '\f', |
| 48 | + TAB = '\t', |
| 49 | + VTAB = '\v', |
| 50 | + |
| 51 | + /* some hard to read characters */ |
| 52 | + DOUBLE_QUOTE = '"', |
| 53 | + SINGLE_QUOTE = '\'', |
| 54 | + BACKSLASH = '\\', |
| 55 | + |
| 56 | + /* symbolic representations, above 0xFF not to conflict with any byte */ |
| 57 | + STRING_SYMBOL = CPP_STRING_SYMBOL, |
| 58 | + CHAR_SYMBOL = CPP_CHAR_SYMBOL |
| 59 | +}; |
| 60 | + |
42 | 61 | typedef enum { COMMENT_NONE, COMMENT_C, COMMENT_CPLUS, COMMENT_D } Comment; |
43 | 62 |
|
44 | 63 | enum eCppLimits { |
@@ -1533,7 +1552,7 @@ static void conditionMayPut (vString *condition, int c) |
1533 | 1552 | vStringPut(condition, c); |
1534 | 1553 | } |
1535 | 1554 |
|
1536 | | -extern void cStringPut (vString* string, const int c) |
| 1555 | +extern void cppVStringPut (vString* string, const int c) |
1537 | 1556 | { |
1538 | 1557 | if (c <= 0xff) |
1539 | 1558 | vStringPut (string, c); |
@@ -1953,7 +1972,7 @@ extern int cppGetc (void) |
1953 | 1972 | if (condition) |
1954 | 1973 | vStringDelete (condition); |
1955 | 1974 |
|
1956 | | - DebugStatement ( debugPutc (DEBUG_CPP, c); ) |
| 1975 | + DebugStatement ( cppDebugPutc (DEBUG_CPP, c); ) |
1957 | 1976 | DebugStatement ( if (c == NEWLINE) |
1958 | 1977 | debugPrintf (DEBUG_CPP, "%6ld: ", getInputLineNumber () + 1); ) |
1959 | 1978 |
|
@@ -2635,3 +2654,17 @@ extern parserDefinition* CPreProParser (void) |
2635 | 2654 | def->useCork = CORK_QUEUE | CORK_SYMTAB; |
2636 | 2655 | return def; |
2637 | 2656 | } |
| 2657 | + |
| 2658 | +#ifdef DEBUG |
| 2659 | +extern void cppDebugPutc (const int level, const int c) |
| 2660 | +{ |
| 2661 | + if (debug (level) && c != EOF) |
| 2662 | + { |
| 2663 | + if (c == STRING_SYMBOL) printf ("\"string\""); |
| 2664 | + else if (c == CHAR_SYMBOL) printf ("'c'"); |
| 2665 | + else putchar (c); |
| 2666 | + |
| 2667 | + fflush (stdout); |
| 2668 | + } |
| 2669 | +} |
| 2670 | +#endif |
0 commit comments