On Tue, Nov 15, 2016 at 01:28:15PM -0800, Dominik Vogt wrote:
>   Branch: refs/heads/dv/new-parser-2
>   Home:   https://github.com/fvwmorg/fvwm
>   Commit: 3443ade4c10cef5e0d2b6f3a30b30b6731a9ec60
>       
> https://github.com/fvwmorg/fvwm/commit/3443ade4c10cef5e0d2b6f3a30b30b6731a9ec60
>   Author: Dominik Vogt <dominik.v...@gmx.de>
>   Date:   2016-11-15 (Tue, 15 Nov 2016)
> 
>   Changed paths:
>     M fvwm/cmdparser_old.c
> 
>   Log Message:
>   -----------
>   Fix crash in new parser.
> 
> Because dest_c->call_depth was not properly set, set_repeat_data was called
> during nested function execution and deleted the original command line before
> the function completed.  Triggered for example with "all windowshade off".

This patch completes the first shot of pluggable parser support
with a plugin that does what the old parser always has done.
There are some places with open questions (marked with '!!!'), but
I cannot remember right now what they are about.  There's also
tons of debug fprintfs.

Basically, all parsing is now done through callbacks from the
structure "old_parser_hooks" in cmdparser_old.c.  To write a new
parser duplicate the file, e.g. call it cmdparser_new.c, place the
replacement functions in the new structure and make
cmdparser_..._get_hooks return the structure, then put the new
parser's get_hook-function in functions.c:functions_init().

The parser should theoretically be switchable on the fly, even at
per function basis, with some extra work to make sure that the
structure is not switched while the old structure is being used
(i.e. only after the command that triggers the switch has
finished).  Possibly the parser hooks structure could be passed
around with the context instead of storing it in a static global.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt

Reply via email to