[lokisetup] New feature : boolean variables and expressions

Stéphane Peter megastep at megastep.org
Fri Mar 31 17:23:37 EST 2006

On Mar 31, 2006, at 9:02 AM, Ludwig Nussel wrote:

> Stéphane Peter wrote:
>> [...]
>>> You could also just use xml to represent that expression. You don't
>>> need an additional parser then.
>> Good point, although I tend to prefer simple strings to replace the
>> existing system in place, which was already a string with a command
>> to call. We would also have to worry about children XML nodes in many
>> places where we didn't expect much more than attributes before, which
>> would complicate things further and certainly introduce more bugs. ;)
> It would be the same. If I understand your description correctly you
> do <bool name="foo">+(|(redhat,suse),x86)<bool>. If you use xml
> instead it would be something like
> <bool name="foo">
>   <and>
>     <or>
>       <distro>redhat</distro>
>       <distro>suse</distro>
>     <or>
>     <arch>x86</arch>
>   </and>
> <bool>

Well, actually you didn't understand my description correctly. ;) You  
would have something like this:

<bool name="foo" script="command.sh"/> (the return value from the  
command determines the bool  value).

You can then use expressions referencing these bools in other current  
tags, for example :

<files if="+(foo,Linux)">

So my point was that it would add a lot to the syntax of these  
existing tags to do it in XML the way you suggest. Sure we could do  
it, but I like simplicity.

> Not exactly the most compact way to define an expression but it fits
> better into the rest of the file.

We could do it, but I don't think it is really necessary, at least  
not for now. The whole parser is only a hundred lines or so.

These changes help to write much cleaner installers. I have made a  
few more changes over the past couple of days, and have greatly  
simplified a very complex installer script I am using in a shipping  
product. It also improves performance as it can be used to reduce the  
number of external scripts being called to a minimum. A lot of the  
previous conditional tags were calling commands every time they were  
being parsed.

Stéphane Peter
megastep at megastep.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/lokisetup/attachments/20060331/e334d9ee/attachment.htm>

More information about the Lokisetup mailing list