cmd: Add helper for 'if' comparison operations evaluation (try 2)
frederic.delanoy at gmail.com
Mon Nov 7 07:31:43 CST 2011
On Mon, Nov 7, 2011 at 11:21, Octavian Voicu <octavian.voicu at gmail.com> wrote:
> 2011/11/7 Frédéric Delanoy <frederic.delanoy at gmail.com>:
>> + /* Note: '==' can't be returned by WCMD_parameter since '=' is a separator */
>> + p = paramEnd + 1;
>> + while (*p == ' ' || *p == '\t')
>> + p++;
>> + if (!p || *p != '=' || !(p+1) || *(p+1) != '=')
>> + goto syntax_err;
>> + strcpyW(operator, eqeqW);
>> + p += strlenW(operator);
> This doesn't look general enough, I'm not sure how you want to handle
> the other operators.
With something like http://source.winehq.org/patches/data/80647 (just submitted)
Basically, other operators can be retrieved normally using WCMD_parameter.
> Wouldn't it be better to just find next space/tab
> (skip all non-whitespace chars) then assign the part of the string
> separated by whitespace to be the operator?
I actually do what you suggest through WCMD_parameter(*) usage. Only
problem is '=' is itself a separator (ask MS why) so won't be returned
by WCMD_parameter: separators are just skipped in the current
implementation. One could add a special case in WCMD_parameter so it
returns '==' as well, but I'm not sure it's the right thing to do.
> With this approach you also don't need that syntax check there.
You do for some corner cases (lone ifs, ...)
* delimitor/separator processing is not fully complete right now.
Martin Wilck's had submitted some patches fixing some weeks ago, but
seems he lost interest in trying to got those in.
I might try to get those in at some point, but they will probably
need some modifications beforehand.
More information about the wine-devel