Archive: boolean comparison


boolean comparison
Hellow !


Please I need help because I don't know how to do a boolean comparison in a !if.

In C code I do it like this:
if ((a == b) || (b == c) || (c == d) || (d == e))

But in Nsis I really don"t know how to do this, I read the doc but... 0_o

I've tried everything in my code but it's don't work.

Please heeeeelp ! =)

Thanks !


Yep I have include it but... 0_o


Are you doing run time or compile time comparisons?

Stu


I think it's runtime comparisons.

I explain you, the comparison is done according to the settings in a customized window


All the LogicLib syntax is explained in the header file itself (Include\LogicLib.nsh).

${If} ...
${OrIf} ...
...
${EndIf}

Stu


=) =) =) (I said that's runtime ! =( snif...)

ok I will read the header file.

I'll be back after eating and reading the file :)

Thanks !


Originally posted by Noude
=) =) =) (I said that's runtime ! =( snif...)
LogicLib is used for runtime functionality: The commands are evaluated when the installer is being run (so, at runtime). The LogicLib defines however are of course evaluated at compiletime (when the installer is being compiled), just like all other defines are evaluated at compiletime.

So while the ${defines} of LogicLib are compiletime magic, the actual functionality deals with runtime. Otherwise, you could never do this:
${If} $Variable == "test"
...because, $Variable is only given a value at runtime. The compiler won't have a clue what its value will end up being, so it cannot be a compiletime command.

Reeee !

So I have to use the LogicLib but how can I do with my variables ? 0_o

I have to compare variables at a moment !


I just read the LogicLib.nsh and .nsi

But there're just examples to do if a <= b or if a != b...
No example with || or && :/

Really I don't know how to do ...


if ((a == b) || (b == c) || (c == d) || (d == e))


${If} $a == $b
${OrIf} $b == $c
${OrIf} $c == $d
etc
etc

How can that be too difficult? o_O


because I do not always understand how to do with compiltimne and runtime... arf, sorry.

Yes, it's not difficult at all but... 0_o

Thank you a lot ^^


But I can't do :

${If} ((toto == Yes) && (toto == No) && (toto == No) && (toto == No)&& (toto == No))

???

I can only give 4 parameters to the ${If} ??


because if I do:

${If} $a == $b
${OrIf} $b == $c
${OrIf} $c == $d

I'm dead :/


Originally posted by Noude
because I do not always understand how to do with compiltimne and runtime...
It is quite easy.

Everything starting with a "!" is compiletime and
everything starting with "$" is runtime.

BTW: You should have a look at the helpfile (NSIS.chm) in your ${NSISDIR}.

Gunther

Yep I've just read it 2 seconds ago =) thanks :)