As reported by Amadeusz Sławiński, the support for (d)quoted string
in the menu file was not exactly the same as in previous versions
of WindowMaker, so we had a regression which is not acceptable.
This patch propose a consistent handling for (d)quoted text instead
of the previous on-the-title-only code; now all (d)quoted strings
are still kept as-is (as expected) but the (d)quotes are always
removed.
As a side note, it also improve the support for \escaped character
to work correctly as mentioned in the example of the default menu.
Note: This reverts b2e7620868 which
was an incomplete solution to the problem.
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.
A number of macros are pre-defined by WindowMaker for CPP in the
function 'MakeCPPArgs', they are now available in the internal
parser too. CPP also had some predefined macros, a subset of them
have been added.
The definition have been split in two parts:
- the macro that are dependant on WindowMaker parameters are
defined by WindowMaker (src/rootmenu.c)
- those that are independant, which can be defined by the parser
itself (WINGs/menuparser_macros.c)
This adds support for defining new macros, with or without parameters, which
when found afterwards in the text are replaced by their definition.
The complex analysis for arguments replacement is done at macro definition
time, so it is done only once and the macro expansion will be fast.
The macro-related functions have been placed in their own file because it is
quite a complex task and we do not want filesize to explode, it is always
better to keep things human-sized.
The parser is prepared to handle '#' directives, starting with file
inclusion. The search path for the file are taken from what was
actually given to CPP. There is an arbitrary limit to the inclusion
nesting, which is actually not a design limitation but a security
to avoid infinite include loops.
Wrote a new parsing code that is able to skip over comments.
Note that because CPP is still active, you will not see any
effect unless you disable CPP pre-processing.
All the information related to the file being parsed are stored in
a single place. The content of this structure is not visible to
caller to avoid messing the content; the parsing will be handled as
methods to this object.
Please note that all functions visible as part of the parser's API
are using the CamelCaseNotation to be consistent with the rest of
the API; however all internal functions use the non_camel_case_syntax
to follow the coding style set by Carlos for the project.