![]() |
"!if cond || cond" conditional compilation
I'd like to be able to do:
!if ((${A} == ${B}) || (${A} == ${C})) ...(code)... !endif How do I do that?? |
If you really want to create such a compile-time condition, you have two hackish solutions I can think of.
code: |
I may be [relatively] new to NSIS kichik, but I'm definitely NOT new to programming (having been one for for over 30 years). I *do* know the difference between compile-time and run-time checking, and I'm here to tell you this is most definitely *NOT* a run-time need. :)
Thus your closing suggestion is unfortunately completely out of the question. And your first "hackish" suggestion is also rejected for being too, .. well, .. (forgive me) F'ing UGLY. ;) (Besides, IMO simply calling a function instead (which I had already considered and rejected BTW) would be much cleaner/clearer than invoking a macro) Your second hackish suggestion however, looks somewhat intriguing and MIGHT be a possibility -- if only I actually understood what you were suggesting that is! (which I don't!) :( Could you do me a favor and explain it a bit more please? Thanks. Thanks for the quick reply and thanks for NSIS itself too. Much appreciated. :) |
David,
Let me offer a suggestion: code: It's a crappy temp define name, but you see the idea. Don |
For the 2nd example that kichik has posted, let's say A (99) is equal to B (99):
Edit: You should probably wrap the two !defines in !ifdefs in case B==C (you will get a compiler error)!code: Stu |
Quote:
'Tis a shame though that NSIS doesn't (yet?) support the format/style I originally posted. Any chance of that perhaps sometime changing in the [hopefully] near future?? <hint! hint!> ;) |
Quote:
Unfortunately however, this technique, while slick, doesn't exactly help uncomplicate my code any. :( I mean, in order to use it the way I want to use it, I'd have to do something like: As you can see, using this particular technique doesn't exactly make the code neat and clean, does it?code: Thanks anyway Stu and kichik, but I think I'm going to stick with Don's suggestion (which I had already figured out on my own) until such time as NSIS can be fixed. At least with his technique I can hide all my needed !defines in a !included header somewhere and then just use a simple, SINGLE, !ifdef whereever I need to, thereby preserving the simplicity/readability (and thus maintainability) of my code. Thanks for everyone's help folks. Much appreciated. |
Hi David
Depending on how your bitwise logical operator skills are, you could also use an approach similar to this (which is based on using bitmasks in C) by getting creative with the /math option for !define: code: and so on. I don't know how this would work out for you, but it could be worth trying out, particularly if work through some of the other combinations of the bitmasks to reflect your desired logic. Duncan |
Maybe I am making this all too simple but have you tried the OrIf in the LogicLib?
${If} "${A}" == "${B}" ;; ${OrIf} "${A}" == "${C}" ;; ${EndIf} It was just a thought, like I said probably making the problem too simple |
Quote:
Please read the complete thread before posting. Thank you. |
Quote:
Quote:
------------------------- <hint> Try changing your "InstallerType" to just "Standard" (it will NEVER be more than one value at the same time!!) and then show the code necessary to test whether the passed "InstallerType" is EITHER "Standard" -OR- "Development". Do that and I think you'll see your technique is actually worse than Don's since it takes more code to setup the combination-value tests. |
| All times are GMT. The time now is 17:55. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.