1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00
Commit Graph

18 Commits

Author SHA1 Message Date
Alwin
495e82fc9a WINGs: trivial fixes in text strings
Fixing typos and/or inconsistencies in error messages. Some
backports for the Dutch .po file.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2015-04-28 09:06:33 -04:00
Christophe CURIS
a3b6b62049 WINGs: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
58961dce72 WUtil: Removed unused argument in internal function 2013-10-19 18:01:36 -03:00
Christophe CURIS
5a3cab3cef Changed handling of quoted strings in the menu parser for consistency
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.
2012-11-15 12:37:16 +00:00
Rodolfo García Peñas (kix)
5fe4160025 menuparser.c code clean
This patch do this changes:

1. Change (add/remove) blank lines
2. Join some if's in only one
3. Change c++ comments to c comments (// -> /* */)
4. Add / remove curly brackets if needed
5. Change spaces (add/remove) & set correct indentation
2012-07-28 18:39:40 +01:00
Christophe CURIS
b2e7620868 Menu parser: remove d-quotes around title of entry
When a menu entry contains a space, it is necessary to enclose it
in simple or double quotes; these were not removed and so would
appear in the menu.
2012-07-19 11:23:29 +01:00
Christophe CURIS
9ad278ddf8 Menu parser: added boundary checks in the path-gen for #include file search
When generating the full path+name of file to search for a file
being #included, it was generated in a buffer that's supposedly
large enough (MAXLINE > 2*PATH_MAX). However, this limit has a few
issues (PATH_MAX seem to be able to be bigger, and worse: we can't
be sure we're given longer args).

The code was rewrote to natively include boundary checks so we're
sure we won't overflow the buffer. A few strncpy have been removed
because in this case they tend to make things harder to write.
2012-07-19 11:23:29 +01:00
Christophe CURIS
ac52d4de65 Menu parser: fix possible infinite loop when loading menu file
When a #include is used, the file is searched in many places; when
the file was searched in the ':'-separated list of path it could
led to infinite loop if the list contained more than one path and
that the file was not found in the first path, the ':' separator
was not properly passed over.
2012-07-19 11:23:29 +01:00
Rodolfo García Peñas (kix)
fae81bf518 Format string bug in WMenuParserError
There is a format string (FS) bug in the function WMenuParserError.

It is the tipical FS bug, like printf(a) instead of printf("%s", a);

See http://en.wikipedia.org/wiki/Uncontrolled_format_string for more info.
2012-07-16 22:45:25 +01:00
Christophe CURIS
4658f4f9a1 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.
2012-07-14 20:22:20 +02:00
Christophe CURIS
9b792369cb Remove dependency to CPP: added pre-defined macros
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)
2012-07-14 20:22:20 +02:00
Christophe CURIS
aaa4517df7 Remove dependency to CPP: support for #define macros
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.
2012-07-14 20:22:20 +02:00
Christophe CURIS
88a82ab8df Remove dependency to CPP: support for #include directive
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.
2012-07-14 20:22:20 +02:00
Christophe CURIS
ed9482b626 Remove dependency to CPP: new parser that handles comments
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.
2012-07-14 20:22:20 +02:00
Christophe CURIS
7d74648fc3 Remove dependency to CPP: add function to report problems while parsing
The default function used so far provides informations not so useful
to user, like wmaker's source file, line number and function; it
also cannot provide the line number from the parsed file because cpp
messes this information.

With this dedicated function we try to provide useful things which
are being tracked by the parser internally, like valid line number
and the name of the file being read (which can be convenient in the
case of #include, for which we may also be able to provide the
inclusion tree!)
2012-07-14 20:22:20 +02:00
Christophe CURIS
42cccb2313 Remove dependency to CPP: merged 'getLine' and 'separateline' into a single function call
From caller point of view, the two function have been merged into a
single function in the API. This will be needed by the advanced
parser that will have to not separate the concept of a 'line' and
the concept of 'content' (due to empty/comment lines, multi-line
comments, long lines split with '\')
2012-07-14 20:22:20 +02:00
Christophe CURIS
19f0998cd1 Remove dependency to CPP: create structure to keep info of file being parsed
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.
2012-07-14 20:22:20 +02:00
Christophe CURIS
f0e8b76c03 Remove dependency to CPP: Moving parser functions to a dedicated file
Due to the tasks to take in charge, the internal parser will grow in
size to support basic CPP feature, so it is a good idea to start by
moving the current functions into a dedicated file.
2012-07-14 20:22:20 +02:00