1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-22 18:15:49 +01:00

Remove dependency to CPP: add support for conditional directives

It is now possible to use #ifdef/#ifndef to exclude some part of the
file. The implementation uses a stack to track conditionals so it is
possible to use nested constructs.
This commit is contained in:
Christophe CURIS
2012-06-23 18:18:31 +02:00
committed by Carlos R. Mafra
parent 9b792369cb
commit 4658f4f9a1
3 changed files with 119 additions and 0 deletions

View File

@@ -229,6 +229,14 @@ void menu_parser_define_macro(WMenuParser parser)
} else
macro->arg_count = -1; // Means no parenthesis at all to expect
/* If we're inside a #if sequence, we abort now, but not sooner in
order to keep the syntax check */
if (parser->cond.stack[0].skip) {
wfree(macro);
*parser->rd = '\0'; // Ignore macro content
return;
}
/* Get the macro's definition */
menu_parser_skip_spaces_and_comments(parser);
if (!menu_parser_read_macro_def(parser, macro, arg_name)) {