|
|
#1 |
|
Junior Member
Join Date: Feb 2007
Location: Grenoble / FRANCE
Posts: 5
|
Use of conditional compilation !if with &&
Hello,
I'm trying to use the conditional compilation !if with boolean comparison && but it seems not working well. My code : !define SECTIONDEF 0x0001 !insertmacro CreateSection SECTIONDEF "SECTIONNAME" "SECIDX" !macro CreateSection SecDef SecText SecIdx !echo "secname = ${${SecDef}}" !if ${${SecDef}} && 0x0008 Section "!${SecText}" ${SecIdx} ; comparison true !else Section "${SecText}" ${SecIdx} ; comparison false !endif SectionIn RO 1 2 !macroend I change the value of SECTIONDEF, but it always pass thru the true section code. Do you have any idea ? Thank you and sorry for my bad english |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
What exactly are you trying to do? Double ampersand is a boolean operator not a binary operator. Your test only tells if both defines are not empty.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2007
Location: Grenoble / FRANCE
Posts: 5
|
Yes, thank you.
I saw after posting this thread that it was only a boolean operator. ![]() I have submitted a feature request on Sourceforge for a binary operator "&", in order to test only a bit on a define value. |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Thought that was you... You already have !define /math for that. It doesn't have bitwise AND, OR and XOR operators but I've added that for the next version.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2007
Location: Grenoble / FRANCE
Posts: 5
|
Just a precision : for !define with /math option, the value of define is the result of the operation ?
In my case, I'd like to check if some bits are present on a define value to create the section. For example, if bit 1 and 4 of SECTIONDEF(=9) are set, I will declare my section like this : Section "!SECTEXT" SectionIn 1 This is in order to make different packages with only one common file with NSIS code and different headers file to define the behavior of sections (including the common file). I hope you understand what I mean. Thank you |
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Then do:
code: NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Feb 2007
Location: Grenoble / FRANCE
Posts: 5
|
But I can't define two time "result", and I'd like to check different bit on different case.
I can use different define name, but if I use it in macro, it will create a lot of define. The code I'd like to do : code: |
|
|
|
|
|
#8 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Then !undef result right after you use it.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Feb 2007
Location: Grenoble / FRANCE
Posts: 5
|
I forgot it.
Thanks |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|