Commit | Line | Data |
---|---|---|
8ba9a35a VM |
1 | From 078b46c69d063aef1715b11348a2871d6036f253 Mon Sep 17 00:00:00 2001 |
2 | From: Christos Zoulas <christos@zoulas.com> | |
3 | Date: Sun, 22 Jan 2017 18:34:30 +0100 | |
4 | Subject: [PATCH] Add more defines in the non-reentrant part. | |
5 | ||
6 | Fix the reentrant part; don't "#define yyfoo yyfoo" because it breaks | |
7 | code that does #ifndef yywrap .. | |
8 | --- | |
9 | src/flex.skl | 16 ++++++++++++++-- | |
10 | 1 file changed, 14 insertions(+), 2 deletions(-) | |
11 | ||
12 | diff --git a/src/flex.skl b/src/flex.skl | |
13 | index 190700f..6a7cde4 100644 | |
14 | --- a/src/flex.skl | |
15 | +++ b/src/flex.skl | |
16 | @@ -61,11 +61,17 @@ m4_changequote([[, ]]) | |
17 | m4_ifelse(M4_YY_PREFIX,yy,, | |
18 | #define yy_create_buffer M4_YY_PREFIX[[_create_buffer]] | |
19 | #define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]] | |
20 | -#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]] | |
21 | +#define yy_scan_buffer M4_YY_PREFIX[[_scan_buffer]] | |
22 | +#define yy_scan_string M4_YY_PREFIX[[_scan_string]] | |
23 | +#define yy_scan_bytes M4_YY_PREFIX[[_scan_bytes]] | |
24 | #define yy_init_buffer M4_YY_PREFIX[[_init_buffer]] | |
25 | #define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]] | |
26 | #define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]] | |
27 | #define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]] | |
28 | +#define yypush_buffer_state M4_YY_PREFIX[[push_buffer_state]] | |
29 | +#define yypop_buffer_state M4_YY_PREFIX[[pop_buffer_state]] | |
30 | +#define yyensure_buffer_stack M4_YY_PREFIX[[ensure_buffer_stack]] | |
31 | +#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]] | |
32 | #define yyin M4_YY_PREFIX[[in]] | |
33 | #define yyleng M4_YY_PREFIX[[leng]] | |
34 | #define yylex M4_YY_PREFIX[[lex]] | |
35 | @@ -107,7 +113,7 @@ m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]]) | |
36 | ||
37 | m4preproc_define(`M4_GEN_PREFIX', | |
38 | ``[[#define yy$1 ]]M4_YY_PREFIX[[$1]] | |
39 | -m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') | |
40 | +%# m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') | |
41 | ||
42 | %if-c++-only | |
43 | /* The c++ scanner is a mess. The FlexLexer.h header file relies on the | |
44 | @@ -120,6 +126,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') | |
45 | %endif | |
46 | ||
47 | %if-c-only | |
48 | +m4_ifelse(M4_YY_PREFIX,yy,, | |
49 | M4_GEN_PREFIX(`_create_buffer') | |
50 | M4_GEN_PREFIX(`_delete_buffer') | |
51 | M4_GEN_PREFIX(`_scan_buffer') | |
52 | @@ -155,6 +162,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') | |
53 | M4_GEN_PREFIX(`set_column') | |
54 | ]]) | |
55 | M4_GEN_PREFIX(`wrap') | |
56 | +) | |
57 | %endif | |
58 | ||
59 | m4_ifdef( [[M4_YY_BISON_LVAL]], | |
60 | @@ -170,11 +178,14 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], | |
61 | ]]) | |
62 | ||
63 | ||
64 | +m4_ifelse(M4_YY_PREFIX,yy,, | |
65 | M4_GEN_PREFIX(`alloc') | |
66 | M4_GEN_PREFIX(`realloc') | |
67 | M4_GEN_PREFIX(`free') | |
68 | +) | |
69 | ||
70 | %if-c-only | |
71 | +m4_ifelse(M4_YY_PREFIX,yy,, | |
72 | m4_ifdef( [[M4_YY_NOT_REENTRANT]], | |
73 | [[ | |
74 | M4_GEN_PREFIX(`text') | |
75 | @@ -184,6 +195,7 @@ m4_ifdef( [[M4_YY_NOT_REENTRANT]], | |
76 | M4_GEN_PREFIX(`_flex_debug') | |
77 | M4_GEN_PREFIX(`lineno') | |
78 | ]]) | |
79 | +) | |
80 | %endif | |
81 | ||
82 |