Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2d778c5e
Commit
2d778c5e
authored
Sep 12, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Change the prefix on bison-generated names to avoid the name-prefix directive.
parent
1be6e9a6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
145 deletions
+143
-145
ppl.l
libs/wpp/ppl.l
+106
-106
ppy.y
libs/wpp/ppy.y
+13
-15
preproc.c
libs/wpp/preproc.c
+8
-8
wpp.c
libs/wpp/wpp.c
+8
-8
wpp_private.h
libs/wpp/wpp_private.h
+8
-8
No files found.
libs/wpp/ppl.l
View file @
2d778c5e
...
...
@@ -127,7 +127,7 @@
%option stack
%option 8bit never-interactive
%option nounput
%option prefix="pp"
%option prefix="pp
y_
"
%x pp_pp
%x pp_eol
...
...
@@ -181,7 +181,7 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL]
/*
* Always update the current character position within a line
*/
#define YY_USER_ACTION pp_status.char_number+=ppleng;
#define YY_USER_ACTION pp_status.char_number+=pp
y_
leng;
/*
* Buffer management for includes and expansions
...
...
@@ -328,22 +328,22 @@ includelogicentry_t *pp_includelogiclist = NULL;
<pp_pp>{ws}*endif{ws}* yy_pp_state(pp_endif); return tENDIF;
<pp_pp>{ws}*line{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
<pp_pp>{ws}+ if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
<pp_pp>{ws}*[a-z]+ pp
error("Invalid preprocessor token '%s'", pp
text);
<pp_pp>{ws}*[a-z]+ pp
y_error("Invalid preprocessor token '%s'", ppy_
text);
<pp_pp>\r?\n newline(1); yy_pop_state(); return tNL; /* This could be the null-token */
<pp_pp>\\\r?\n newline(0);
<pp_pp>\\\r? pp
error("Preprocessor junk '%s'", pp
text);
<pp_pp>. return *pptext;
<pp_pp>\\\r? pp
y_error("Preprocessor junk '%s'", ppy_
text);
<pp_pp>. return *pp
y_
text;
/*
* Handle #include and #line
*/
<pp_line>[0-9]+ return make_number(10, &pp
lval, pptext, pp
leng);
<pp_inc>\< new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_iqs);
<pp_inc,pp_line>\" new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_dqs);
<pp_line>[0-9]+ return make_number(10, &pp
y_lval, ppy_text, ppy_
leng);
<pp_inc>\< new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_iqs);
<pp_inc,pp_line>\" new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_dqs);
<pp_inc,pp_line>{ws}+ ;
<pp_inc,pp_line>\n newline(1); yy_pop_state(); return tNL;
<pp_inc,pp_line>\\\r?\n newline(0);
<pp_inc,pp_line>(\\\r?)|(.) pperror(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
<pp_inc,pp_line>(\\\r?)|(.) pp
y_
error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
/*
* Ignore all input when a false clause is parsed
...
...
@@ -360,11 +360,11 @@ includelogicentry_t *pp_includelogiclist = NULL;
* Note: tIDENT is handled below.
*/
<pp_if>0[0-7]*{ul}? return make_number(8, &pp
lval, pptext, pp
leng);
<pp_if>0[0-7]*[8-9]+{ul}? pperror("Invalid octal digit");
<pp_if>[1-9][0-9]*{ul}? return make_number(10, &pp
lval, pptext, pp
leng);
<pp_if>0[xX][0-9a-fA-F]+{ul}? return make_number(16, &pp
lval, pptext, pp
leng);
<pp_if>0[xX] pperror("Invalid hex number");
<pp_if>0[0-7]*{ul}? return make_number(8, &pp
y_lval, ppy_text, ppy_
leng);
<pp_if>0[0-7]*[8-9]+{ul}? pp
y_
error("Invalid octal digit");
<pp_if>[1-9][0-9]*{ul}? return make_number(10, &pp
y_lval, ppy_text, ppy_
leng);
<pp_if>0[xX][0-9a-fA-F]+{ul}? return make_number(16, &pp
y_lval, ppy_text, ppy_
leng);
<pp_if>0[xX] pp
y_
error("Invalid hex number");
<pp_if>defined yy_push_state(pp_defined); return tDEFINED;
<pp_if>"<<" return tLSHIFT;
<pp_if>">>" return tRSHIFT;
...
...
@@ -376,21 +376,21 @@ includelogicentry_t *pp_includelogiclist = NULL;
<pp_if>">=" return tGTE;
<pp_if>\n newline(1); yy_pop_state(); return tNL;
<pp_if>\\\r?\n newline(0);
<pp_if>\\\r? pperror("Junk in conditional expression");
<pp_if>\\\r? pp
y_
error("Junk in conditional expression");
<pp_if>{ws}+ ;
<pp_if>\' new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_sqs);
<pp_if>\" pperror("String constants not allowed in conditionals");
<pp_if>. return *pptext;
<pp_if>\' new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_sqs);
<pp_if>\" pp
y_
error("String constants not allowed in conditionals");
<pp_if>. return *pp
y_
text;
/*
* Handle #ifdef, #ifndef and #undef
* to get only an untranslated/unexpanded identifier
*/
<pp_ifd>{cident} pp
lval.cptr = pp_xstrdup(pp
text); return tIDENT;
<pp_ifd>{cident} pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tIDENT;
<pp_ifd>{ws}+ ;
<pp_ifd>\n newline(1); yy_pop_state(); return tNL;
<pp_ifd>\\\r?\n newline(0);
<pp_ifd>(\\\r?)|(.) pperror("Identifier expected");
<pp_ifd>(\\\r?)|(.) pp
y_
error("Identifier expected");
/*
* Handle #else and #endif.
...
...
@@ -398,18 +398,18 @@ includelogicentry_t *pp_includelogiclist = NULL;
<pp_endif>{ws}+ ;
<pp_endif>\n newline(1); yy_pop_state(); return tNL;
<pp_endif>\\\r?\n newline(0);
<pp_endif>. pperror("Garbage after #else or #endif.");
<pp_endif>. pp
y_
error("Garbage after #else or #endif.");
/*
* Handle the special 'defined' keyword.
* This is necessary to get the identifier prior to any
* substitutions.
*/
<pp_defined>{cident} yy_pop_state(); pp
lval.cptr = pp_xstrdup(pp
text); return tIDENT;
<pp_defined>{cident} yy_pop_state(); pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tIDENT;
<pp_defined>{ws}+ ;
<pp_defined>(\()|(\)) return *pptext;
<pp_defined>(\()|(\)) return *pp
y_
text;
<pp_defined>\\\r?\n newline(0);
<pp_defined>(\\.)|(\n)|(.) pperror("Identifier expected");
<pp_defined>(\\.)|(\n)|(.) pp
y_
error("Identifier expected");
/*
* Handle #error, #warning, #pragma and #ident.
...
...
@@ -417,17 +417,17 @@ includelogicentry_t *pp_includelogiclist = NULL;
* will act appropriately.
* Comments are stripped from the literal text.
*/
<pp_eol>[^/\\\n]+ if(yy_top_state() != pp_ignore) { pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL; }
<pp_eol>\/[^/\\\n*]* if(yy_top_state() != pp_ignore) { pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL; }
<pp_eol>(\\\r?)|(\/[^/*]) if(yy_top_state() != pp_ignore) { pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL; }
<pp_eol>[^/\\\n]+ if(yy_top_state() != pp_ignore) { pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL; }
<pp_eol>\/[^/\\\n*]* if(yy_top_state() != pp_ignore) { pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL; }
<pp_eol>(\\\r?)|(\/[^/*]) if(yy_top_state() != pp_ignore) { pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL; }
<pp_eol>\n newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
<pp_eol>\\\r?\n newline(0);
/*
* Handle left side of #define
*/
<pp_def>{cident}\( pp
lval.cptr = pp_xstrdup(pptext); pplval.cptr[pp
leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
<pp_def>{cident} pp
lval.cptr = pp_xstrdup(pp
text); yy_pp_state(pp_define); return tDEFINE;
<pp_def>{cident}\( pp
y_lval.cptr = pp_xstrdup(ppy_text); ppy_lval.cptr[ppy_
leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
<pp_def>{cident} pp
y_lval.cptr = pp_xstrdup(ppy_
text); yy_pp_state(pp_define); return tDEFINE;
<pp_def>{ws}+ ;
<pp_def>\\\r?\n newline(0);
<pp_def>(\\\r?)|(\n)|(.) perror("Identifier expected");
...
...
@@ -435,39 +435,39 @@ includelogicentry_t *pp_includelogiclist = NULL;
/*
* Scan the substitution of a define
*/
<pp_define>[^'"/\\\n]+ pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL;
<pp_define>(\\\r?)|(\/[^/*]) pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL;
<pp_define>\\\r?\n{ws}+ newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
<pp_define>[^'"/\\\n]+ pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL;
<pp_define>(\\\r?)|(\/[^/*]) pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL;
<pp_define>\\\r?\n{ws}+ newline(0); pp
y_
lval.cptr = pp_xstrdup(" "); return tLITERAL;
<pp_define>\\\r?\n newline(0);
<pp_define>\n newline(1); yy_pop_state(); return tNL;
<pp_define>\' new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_sqs);
<pp_define>\" new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_dqs);
<pp_define>\' new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_sqs);
<pp_define>\" new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_dqs);
/*
* Scan the definition macro arguments
*/
<pp_macro>\){ws}* yy_pp_state(pp_mbody); return tMACROEND;
<pp_macro>{ws}+ ;
<pp_macro>{cident} pp
lval.cptr = pp_xstrdup(pp
text); return tIDENT;
<pp_macro>{cident} pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tIDENT;
<pp_macro>, return ',';
<pp_macro>"..." return tELIPSIS;
<pp_macro>(\\\r?)|(\n)|(.)|(\.\.?) pperror("Argument identifier expected");
<pp_macro>(\\\r?)|(\n)|(.)|(\.\.?) pp
y_
error("Argument identifier expected");
<pp_macro>\\\r?\n newline(0);
/*
* Scan the substitution of a macro
*/
<pp_mbody>[^a-zA-Z0-9'"#/\\\n]+ pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL;
<pp_mbody>{cident} pp
lval.cptr = pp_xstrdup(pp
text); return tIDENT;
<pp_mbody>[^a-zA-Z0-9'"#/\\\n]+ pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL;
<pp_mbody>{cident} pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tIDENT;
<pp_mbody>\#\# return tCONCAT;
<pp_mbody>\# return tSTRINGIZE;
<pp_mbody>[0-9][^'"#/\\\n]* pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL;
<pp_mbody>(\\\r?)|(\/[^/*'"#\\\n]*) pp
lval.cptr = pp_xstrdup(pp
text); return tLITERAL;
<pp_mbody>\\\r?\n{ws}+ newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
<pp_mbody>[0-9][^'"#/\\\n]* pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL;
<pp_mbody>(\\\r?)|(\/[^/*'"#\\\n]*) pp
y_lval.cptr = pp_xstrdup(ppy_
text); return tLITERAL;
<pp_mbody>\\\r?\n{ws}+ newline(0); pp
y_
lval.cptr = pp_xstrdup(" "); return tLITERAL;
<pp_mbody>\\\r?\n newline(0);
<pp_mbody>\n newline(1); yy_pop_state(); return tNL;
<pp_mbody>\' new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_sqs);
<pp_mbody>\" new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_dqs);
<pp_mbody>\' new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_sqs);
<pp_mbody>\" new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_dqs);
/*
* Macro expansion text scanning.
...
...
@@ -488,7 +488,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
macexpstackentry_t *mac = pop_macro();
yy_pop_state();
put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
put_buffer(pp
text, pp
leng);
put_buffer(pp
y_text, ppy_
leng);
free_macro(mac);
}
...
...
@@ -498,7 +498,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
*/
<pp_macscan>\( {
if(++MACROPARENTHESES() > 1)
add_text_to_macro(pp
text, pp
leng);
add_text_to_macro(pp
y_text, ppy_
leng);
}
<pp_macscan>\) {
if(--MACROPARENTHESES() == 0)
...
...
@@ -507,19 +507,19 @@ includelogicentry_t *pp_includelogiclist = NULL;
macro_add_arg(1);
}
else
add_text_to_macro(pp
text, pp
leng);
add_text_to_macro(pp
y_text, ppy_
leng);
}
<pp_macscan>, {
if(MACROPARENTHESES() > 1)
add_text_to_macro(pp
text, pp
leng);
add_text_to_macro(pp
y_text, ppy_
leng);
else
macro_add_arg(0);
}
<pp_macscan>\" new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_dqs);
<pp_macscan>\' new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_sqs);
<pp_macscan>\" new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_dqs);
<pp_macscan>\' new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_sqs);
<pp_macscan>"/*" yy_push_state(pp_comment); add_text_to_macro(" ", 1);
<pp_macscan>\n pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(pp
text, pp
leng);
<pp_macscan>([^/(),\\\n"']+)|(\/[^/*(),\\\n'"]*)|(\\\r?)|(.) add_text_to_macro(pp
text, pp
leng);
<pp_macscan>\n pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(pp
y_text, ppy_
leng);
<pp_macscan>([^/(),\\\n"']+)|(\/[^/*(),\\\n'"]*)|(\\\r?)|(.) add_text_to_macro(pp
y_text, ppy_
leng);
<pp_macscan>\\\r?\n newline(0);
/*
...
...
@@ -534,18 +534,18 @@ includelogicentry_t *pp_includelogiclist = NULL;
* Remove C++ style comment (almost all start-conditions)
*/
<INITIAL,pp_pp,pp_ignore,pp_eol,pp_inc,pp_if,pp_ifd,pp_endif,pp_defined,pp_def,pp_define,pp_macro,pp_mbody,pp_macscan,RCINCL>"//"[^\n]* {
if(pp
text[pp
leng-1] == '\\')
ppwarning("C++ style comment ends with an escaped newline (escape ignored)");
if(pp
y_text[ppy_
leng-1] == '\\')
pp
y_
warning("C++ style comment ends with an escaped newline (escape ignored)");
}
/*
* Single, double and <> quoted constants
*/
<INITIAL,pp_macexp>\" pp_incl_state.seen_junk++; new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_dqs);
<INITIAL,pp_macexp>\' pp_incl_state.seen_junk++; new_string(); add_string(pp
text, pp
leng); yy_push_state(pp_sqs);
<pp_dqs>[^"\\\n]+ add_string(pp
text, pp
leng);
<INITIAL,pp_macexp>\" pp_incl_state.seen_junk++; new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_dqs);
<INITIAL,pp_macexp>\' pp_incl_state.seen_junk++; new_string(); add_string(pp
y_text, ppy_
leng); yy_push_state(pp_sqs);
<pp_dqs>[^"\\\n]+ add_string(pp
y_text, ppy_
leng);
<pp_dqs>\" {
add_string(pp
text, pp
leng);
add_string(pp
y_text, ppy_
leng);
yy_pop_state();
switch(yy_current_state())
{
...
...
@@ -555,37 +555,37 @@ includelogicentry_t *pp_includelogiclist = NULL;
case pp_inc:
case RCINCL:
if (yy_current_state()==RCINCL) yy_pop_state();
pplval.cptr = get_string();
pp
y_
lval.cptr = get_string();
return tDQSTRING;
case pp_line:
pplval.cptr = get_string();
if (is_c_h_include(pplval.cptr, 1)) pass_data=0;
pp
y_
lval.cptr = get_string();
if (is_c_h_include(pp
y_
lval.cptr, 1)) pass_data=0;
else pass_data=1;
return tDQSTRING;
default:
put_string();
}
}
<pp_sqs>[^'\\\n]+ add_string(pp
text, pp
leng);
<pp_sqs>[^'\\\n]+ add_string(pp
y_text, ppy_
leng);
<pp_sqs>\' {
add_string(pp
text, pp
leng);
add_string(pp
y_text, ppy_
leng);
yy_pop_state();
switch(yy_current_state())
{
case pp_if:
case pp_define:
case pp_mbody:
pplval.cptr = get_string();
pp
y_
lval.cptr = get_string();
return tSQSTRING;
default:
put_string();
}
}
<pp_iqs>[^\>\\\n]+ add_string(pp
text, pp
leng);
<pp_iqs>[^\>\\\n]+ add_string(pp
y_text, ppy_
leng);
<pp_iqs>\> {
add_string(pp
text, pp
leng);
add_string(pp
y_text, ppy_
leng);
yy_pop_state();
pplval.cptr = get_string();
pp
y_
lval.cptr = get_string();
return tIQSTRING;
}
<pp_dqs>\\\r?\n {
...
...
@@ -608,15 +608,15 @@ includelogicentry_t *pp_includelogiclist = NULL;
newline(0);
break;
default:
add_string(pp
text, pp
leng);
add_string(pp
y_text, ppy_
leng);
newline(-1);
}
}
<pp_iqs,pp_dqs,pp_sqs>\\. add_string(pp
text, pp
leng);
<pp_iqs,pp_dqs,pp_sqs>\\. add_string(pp
y_text, ppy_
leng);
<pp_iqs,pp_dqs,pp_sqs>\n {
newline(1);
add_string(pp
text, pp
leng);
ppwarning("Newline in string constant encounterd (started line %d)", string_start());
add_string(pp
y_text, ppy_
leng);
pp
y_
warning("Newline in string constant encounterd (started line %d)", string_start());
}
/*
...
...
@@ -625,22 +625,22 @@ includelogicentry_t *pp_includelogiclist = NULL;
<INITIAL,pp_if,pp_inc,pp_macexp>{cident} {
pp_entry_t *ppp;
pp_incl_state.seen_junk++;
if(!(ppp = pplookup(pptext)))
if(!(ppp = pplookup(pp
y_
text)))
{
if(yy_current_state() == pp_inc)
pperror("Expected include filename");
pp
y_
error("Expected include filename");
if(yy_current_state() == pp_if)
{
pp
lval.cptr = pp_xstrdup(pp
text);
pp
y_lval.cptr = pp_xstrdup(ppy_
text);
return tIDENT;
}
else {
if((yy_current_state()==INITIAL) && (strcasecmp(pptext,"RCINCLUDE")==0)){
if((yy_current_state()==INITIAL) && (strcasecmp(pp
y_
text,"RCINCLUDE")==0)){
yy_push_state(RCINCL);
return tRCINCLUDE;
}
else put_buffer(pp
text, pp
leng);
else put_buffer(pp
y_text, ppy_
leng);
}
}
else if(!ppp->expanding)
...
...
@@ -661,27 +661,27 @@ includelogicentry_t *pp_includelogiclist = NULL;
pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type);
}
}
else put_buffer(pp
text, pp
leng);
else put_buffer(pp
y_text, ppy_
leng);
}
/*
* Everything else that needs to be passed and
* newline and continuation handling
*/
<INITIAL,pp_macexp>[^a-zA-Z_#'"/\\\n \r\t\f\v]+|(\/|\\)[^a-zA-Z_/*'"\\\n \r\t\v\f]* pp_incl_state.seen_junk++; put_buffer(pp
text, pp
leng);
<INITIAL,pp_macexp>{ws}+ put_buffer(pp
text, pp
leng);
<INITIAL,pp_macexp>[^a-zA-Z_#'"/\\\n \r\t\f\v]+|(\/|\\)[^a-zA-Z_/*'"\\\n \r\t\v\f]* pp_incl_state.seen_junk++; put_buffer(pp
y_text, ppy_
leng);
<INITIAL,pp_macexp>{ws}+ put_buffer(pp
y_text, ppy_
leng);
<INITIAL>\n newline(1);
<INITIAL>\\\r?\n newline(0);
<INITIAL>\\\r? pp_incl_state.seen_junk++; put_buffer(pp
text, pp
leng);
<INITIAL>\\\r? pp_incl_state.seen_junk++; put_buffer(pp
y_text, ppy_
leng);
/*
* Special catcher for macro argmument expansion to prevent
* newlines to propagate to the output or admin.
*/
<pp_macexp>(\n)|(.)|(\\\r?(\n|.)) put_buffer(pp
text, pp
leng);
<pp_macexp>(\n)|(.)|(\\\r?(\n|.)) put_buffer(pp
y_text, ppy_
leng);
<RCINCL>[A-Za-z0-9_\.\\/]+ {
pp
lval.cptr=pp_xstrdup(pp
text);
pp
y_lval.cptr=pp_xstrdup(ppy_
text);
yy_pop_state();
return tRCINCLUDEPATH;
}
...
...
@@ -689,26 +689,26 @@ includelogicentry_t *pp_includelogiclist = NULL;
<RCINCL>{ws}+ ;
<RCINCL>\" {
new_string(); add_string(pp
text,pp
leng);yy_push_state(pp_dqs);
new_string(); add_string(pp
y_text,ppy_
leng);yy_push_state(pp_dqs);
}
/*
* This is a 'catch-all' rule to discover errors in the scanner
* in an orderly manner.
*/
<*>. pp_incl_state.seen_junk++; pp
warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*pptext & 0xff) ? *pptext : ' ', *pp
text);
<*>. pp_incl_state.seen_junk++; pp
y_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_
text);
<<EOF>> {
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
bufferstackentry_t *bep = pop_buffer();
if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth))
ppwarning("Unmatched #if/#endif at end of file");
pp
y_
warning("Unmatched #if/#endif at end of file");
if(!bep)
{
if(YY_START != INITIAL)
pperror("Unexpected end of file during preprocessing");
pp
y_
error("Unexpected end of file during preprocessing");
yyterminate();
}
else if(bep->should_pop == 2)
...
...
@@ -717,7 +717,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
mac = pop_macro();
expand_macro(mac);
}
pp_delete_buffer(b);
pp
y_
_delete_buffer(b);
}
%%
...
...
@@ -727,8 +727,8 @@ includelogicentry_t *pp_includelogiclist = NULL;
**************************************************************************
*/
#ifndef ppwrap
int ppwrap(void)
#ifndef pp
y_
wrap
int pp
y_
wrap(void)
{
return 1;
}
...
...
@@ -798,7 +798,7 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len)
ext[0] = len > 2 ? toupper(str[len-3]) : ' ';
if(!strcmp(ext, "LUL"))
pperror("Invalid constant suffix");
pp
y_
error("Invalid constant suffix");
else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
{
is_ll++;
...
...
@@ -937,7 +937,7 @@ static void add_text(const char *str, int len)
curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0]));
if(curdef_alloc > 65536)
ppwarning("Reallocating macro-expansion buffer larger than 64kB");
pp
y_
warning("Reallocating macro-expansion buffer larger than 64kB");
}
memcpy(&curdef_text[curdef_idx], str, len);
curdef_idx += len;
...
...
@@ -1053,7 +1053,7 @@ static void expand_macro(macexpstackentry_t *mep)
assert(ppp->expanding == 0);
if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
pperror("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
pp
y_
error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
for(n = 0; n < nargs; n++)
nnl += mep->nnls[n];
...
...
@@ -1122,7 +1122,7 @@ static void new_string(void)
{
#ifdef DEBUG
if(strbuf_idx)
ppwarning("new_string: strbuf_idx != 0");
pp
y_
warning("new_string: strbuf_idx != 0");
#endif
strbuf_idx = 0;
str_startline = pp_status.line_number;
...
...
@@ -1137,7 +1137,7 @@ static void add_string(const char *str, int len)
strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0]));
if(strbuf_alloc > 65536)
ppwarning("Reallocating string buffer larger than 64kB");
pp
y_
warning("Reallocating string buffer larger than 64kB");
}
memcpy(&strbuffer[strbuf_idx], str, len);
strbuf_idx += len;
...
...
@@ -1175,7 +1175,7 @@ static int string_start(void)
*/
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
{
if(ppdebug)
if(pp
y_
debug)
printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
if(bufferstackidx >= MAXBUFFERSTACK)
pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow");
...
...
@@ -1197,7 +1197,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
ppp->expanding = 1;
else if(filename)
{
/* These will track the pperror to the correct file and line */
/* These will track the pp
y_
error to the correct file and line */
pp_status.line_number = 1;
pp_status.char_number = 1;
pp_status.input = filename;
...
...
@@ -1228,8 +1228,8 @@ static bufferstackentry_t *pop_buffer(void)
ncontinuations = bufferstack[bufferstackidx].ncontinuations;
if(!bufferstack[bufferstackidx].should_pop)
{
fclose(ppin);
fprintf(ppout, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input);
fclose(pp
y_
in);
fprintf(pp
y_
out, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input);
/* We have EOF, check the include logic */
if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp)
...
...
@@ -1260,7 +1260,7 @@ static bufferstackentry_t *pop_buffer(void)
}
}
if(ppdebug)
if(pp
y_
debug)
printf("pop_buffer(%d): %p %p (%d, %d, %d) %p %d\n",
bufferstackidx,
bufferstack[bufferstackidx].bufferstate,
...
...
@@ -1271,7 +1271,7 @@ static bufferstackentry_t *pop_buffer(void)
bufferstack[bufferstackidx].filename,
bufferstack[bufferstackidx].should_pop);
pp
_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
ppy_
_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
if(bufferstack[bufferstackidx].should_pop)
{
...
...
@@ -1294,7 +1294,7 @@ static bufferstackentry_t *pop_buffer(void)
static void push_macro(pp_entry_t *ppp)
{
if(macexpstackidx >= MAXMACEXPSTACK)
pperror("Too many nested macros");
pp
y_
error("Too many nested macros");
macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0]));
...
...
@@ -1416,7 +1416,7 @@ static void put_buffer(const char *s, int len)
add_text_to_macro(s, len);
else {
if(pass_data)
fwrite(s, 1, len, ppout);
fwrite(s, 1, len, pp
y_
out);
}
}
...
...
@@ -1457,13 +1457,13 @@ void pp_do_include(char *fname, int type)
n = strlen(fname);
if(n <= 2)
pperror("Empty include filename");
pp
y_
error("Empty include filename");
/* Undo the effect of the quotation */
fname[n-1] = '\0';
if((ppin = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL)
pperror("Unable to open include file %s", fname+1);
if((pp
y_
in = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL)
pp
y_
error("Unable to open include file %s", fname+1);
fname[n-1] = *fname; /* Redo the quotes */
push_buffer(NULL, newpath, fname, 0);
...
...
@@ -1476,9 +1476,9 @@ void pp_do_include(char *fname, int type)
if(pp_status.debug)
fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d ,pass_data=%d\n",
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth, pass_data);
pp_switch_to_buffer(pp_create_buffer(pp
in, YY_BUF_SIZE));
ppy__switch_to_buffer(ppy__create_buffer(ppy_
in, YY_BUF_SIZE));
fprintf(ppout, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
fprintf(pp
y_
out, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
}
/*
...
...
libs/wpp/ppy.y
View file @
2d778c5e
...
...
@@ -123,8 +123,6 @@ static int nmacro_args;
%}
%name-prefix="pp"
%union{
int sint;
unsigned int uint;
...
...
@@ -225,7 +223,7 @@ preprocessor
break;
case if_elsetrue:
case if_elsefalse:
pperror("#elif cannot follow #else");
pp
y_
error("#elif cannot follow #else");
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
}
...
...
@@ -248,7 +246,7 @@ preprocessor
break;
case if_elsetrue:
case if_elsefalse:
pperror("#else clause already defined");
pp
y_
error("#else clause already defined");
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
}
...
...
@@ -273,21 +271,21 @@ preprocessor
| tMACRO res_arg allmargs tMACROEND opt_mtexts tNL {
pp_add_macro($1, macro_args, nmacro_args, $5);
}
| tLINE tSINT tDQSTRING tNL { fprintf(ppout, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tNL { fprintf(ppout, "# %d %s\n", $2 , $3); free($3); }
| tLINE tSINT tDQSTRING tNL { fprintf(pp
y_
out, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tNL { fprintf(pp
y_
out, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tNL
{ fprintf(ppout, "# %d %s %d\n", $2, $3, $4); free($3); }
{ fprintf(pp
y_
out, "# %d %s %d\n", $2, $3, $4); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
{ fprintf(pp
y_
out, "# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
{ fprintf(pp
y_
out, "# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
{ fprintf(pp
y_
out, "# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
| tGCCLINE tNL /* The null-token */
| tERROR opt_text tNL { pperror("#error directive: '%s'", $2); if($2) free($2); }
| tWARNING opt_text tNL { ppwarning("#warning directive: '%s'", $2); if($2) free($2); }
| tPRAGMA opt_text tNL { fprintf(ppout, "#pragma %s\n", $2 ? $2 : ""); if ($2) free($2); }
| tPPIDENT opt_text tNL { if(pp_status.pedantic) ppwarning("#ident ignored (arg: '%s')", $2); if($2) free($2); }
| tERROR opt_text tNL { pp
y_
error("#error directive: '%s'", $2); if($2) free($2); }
| tWARNING opt_text tNL { pp
y_
warning("#warning directive: '%s'", $2); if($2) free($2); }
| tPRAGMA opt_text tNL { fprintf(pp
y_
out, "#pragma %s\n", $2 ? $2 : ""); if ($2) free($2); }
| tPPIDENT opt_text tNL { if(pp_status.pedantic) pp
y_
warning("#ident ignored (arg: '%s')", $2); if($2) free($2); }
| tRCINCLUDE tRCINCLUDEPATH {
int nl=strlen($2) +3;
char *fn=pp_xmalloc(nl);
...
...
@@ -347,7 +345,7 @@ mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); }
| tSTRINGIZE tIDENT {
int mat = marg_index($2);
if(mat < 0)
pperror("Stringification identifier must be an argument parameter");
pp
y_
error("Stringification identifier must be an argument parameter");
$$ = new_mtext(NULL, mat, exp_stringize);
}
| tIDENT {
...
...
libs/wpp/preproc.c
View file @
2d778c5e
...
...
@@ -203,7 +203,7 @@ void pp_del_define(const char *name)
if
((
ppp
=
pplookup
(
name
))
==
NULL
)
{
if
(
pp_status
.
pedantic
)
ppwarning
(
"%s was not defined"
,
name
);
pp
y_
warning
(
"%s was not defined"
,
name
);
return
;
}
...
...
@@ -223,7 +223,7 @@ pp_entry_t *pp_add_define(char *def, char *text)
if
((
ppp
=
pplookup
(
def
))
!=
NULL
)
{
if
(
pp_status
.
pedantic
)
ppwarning
(
"Redefinition of %s
\n\t
Previous definition: %s:%d"
,
def
,
ppp
->
filename
,
ppp
->
linenumber
);
pp
y_
warning
(
"Redefinition of %s
\n\t
Previous definition: %s:%d"
,
def
,
ppp
->
filename
,
ppp
->
linenumber
);
pp_del_define
(
def
);
}
ppp
=
pp_xmalloc
(
sizeof
(
pp_entry_t
));
...
...
@@ -265,7 +265,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
if
((
ppp
=
pplookup
(
id
))
!=
NULL
)
{
if
(
pp_status
.
pedantic
)
ppwarning
(
"Redefinition of %s
\n\t
Previous definition: %s:%d"
,
id
,
ppp
->
filename
,
ppp
->
linenumber
);
pp
y_
warning
(
"Redefinition of %s
\n\t
Previous definition: %s:%d"
,
id
,
ppp
->
filename
,
ppp
->
linenumber
);
pp_del_define
(
id
);
}
ppp
=
pp_xmalloc
(
sizeof
(
pp_entry_t
));
...
...
@@ -524,7 +524,7 @@ void pp_push_if(pp_if_state_t s)
pp_if_state_t
pp_pop_if
(
void
)
{
if
(
if_stack_idx
<=
0
)
pperror
(
"#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"
);
pp
y_
error
(
"#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"
);
switch
(
pp_if_state
())
{
...
...
@@ -606,21 +606,21 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
fprintf
(
stderr
,
"
\n
"
);
}
int
pperror
(
const
char
*
s
,
...)
int
pp
y_
error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Error"
,
pptext
,
ap
);
generic_msg
(
s
,
"Error"
,
pp
y_
text
,
ap
);
va_end
(
ap
);
exit
(
1
);
return
1
;
}
int
ppwarning
(
const
char
*
s
,
...)
int
pp
y_
warning
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Warning"
,
pptext
,
ap
);
generic_msg
(
s
,
"Warning"
,
pp
y_
text
,
ap
);
va_end
(
ap
);
return
0
;
}
...
...
libs/wpp/wpp.c
View file @
2d778c5e
...
...
@@ -28,7 +28,7 @@
#include "wpp_private.h"
#include "wine/wpp.h"
int
ppdebug
,
pp_flex_debug
;
int
pp
y_
debug
,
pp_flex_debug
;
struct
define
{
...
...
@@ -126,7 +126,7 @@ void wpp_add_cmdline_define( const char *value )
void
wpp_set_debug
(
int
lex_debug
,
int
parser_debug
,
int
msg_debug
)
{
pp_flex_debug
=
lex_debug
;
pp
debug
=
parser_debug
;
pp
y_debug
=
parser_debug
;
pp_status
.
debug
=
msg_debug
;
}
...
...
@@ -149,8 +149,8 @@ int wpp_parse( const char *input, FILE *output )
add_cmdline_defines
();
add_special_defines
();
if
(
!
input
)
ppin
=
stdin
;
else
if
(
!
(
ppin
=
fopen
(
input
,
"rt"
)))
if
(
!
input
)
pp
y_
in
=
stdin
;
else
if
(
!
(
pp
y_
in
=
fopen
(
input
,
"rt"
)))
{
fprintf
(
stderr
,
"Could not open %s
\n
"
,
input
);
exit
(
2
);
...
...
@@ -158,12 +158,12 @@ int wpp_parse( const char *input, FILE *output )
pp_status
.
input
=
input
;
ppout
=
output
;
fprintf
(
ppout
,
"# 1
\"
%s
\"
1
\n
"
,
input
?
input
:
""
);
pp
y_
out
=
output
;
fprintf
(
pp
y_
out
,
"# 1
\"
%s
\"
1
\n
"
,
input
?
input
:
""
);
ret
=
ppparse
();
ret
=
pp
y_
parse
();
if
(
input
)
fclose
(
ppin
);
if
(
input
)
fclose
(
pp
y_
in
);
pp_pop_define_state
();
return
ret
;
}
...
...
libs/wpp/wpp_private.h
View file @
2d778c5e
...
...
@@ -217,8 +217,8 @@ int pp_get_if_depth(void);
#define __attribute__(x)
/*nothing*/
#endif
int
pperror
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
ppwarning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
pp
y_
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
pp
y_
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
pp_internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
)));
/* current preprocessor state */
...
...
@@ -239,11 +239,11 @@ extern includelogicentry_t *pp_includelogiclist;
/*
* From ppl.l
*/
extern
FILE
*
ppin
;
extern
FILE
*
ppout
;
extern
char
*
pptext
;
extern
FILE
*
pp
y_
in
;
extern
FILE
*
pp
y_
out
;
extern
char
*
pp
y_
text
;
extern
int
pp_flex_debug
;
int
pplex
(
void
);
int
pp
y_
lex
(
void
);
void
pp_do_include
(
char
*
fname
,
int
type
);
void
pp_push_ignore_state
(
void
);
...
...
@@ -253,7 +253,7 @@ void pp_pop_ignore_state(void);
/*
* From ppy.y
*/
int
ppparse
(
void
);
extern
int
ppdebug
;
int
pp
y_
parse
(
void
);
extern
int
pp
y_
debug
;
#endif
/* __WINE_WPP_PRIVATE_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment