From fbc7cb8fd06628a7d412d646321001c468c53f62 Mon Sep 17 00:00:00 2001 From: anders_k Date: Fri, 11 Jun 2010 16:33:10 +0000 Subject: [PATCH] Fixed and documented !if & operator git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6099 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/defines.but | 2 +- Source/script.cpp | 1 + Source/tokens.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Docs/src/defines.but b/Docs/src/defines.but index ec9452ea..f6c97958 100644 --- a/Docs/src/defines.but +++ b/Docs/src/defines.but @@ -63,7 +63,7 @@ The opposite of !ifdef. The lines will be compiled when the gflag has not been d \c [!] value [op value2] This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If value is non-zero, or the comparison of value and value2 depending on the operator results in true, the contained lines will be compiled. Otherwise, they will be skipped. -op can be either == or != (string comparison), <=, < > or >= (float comparison), && or || (boolean comparison). +op can be either == or != (string comparison), <=, < > or >= (float comparison), & (bitwise AND comparison), && or || (boolean comparison). If [!] is set, return value will be switched from true to false and vice versa. \c !if 1 < 2 diff --git a/Source/script.cpp b/Source/script.cpp index 070fc8ee..5cd0268a 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -483,6 +483,7 @@ parse_again: case 6: istrue = line.gettoken_float(1) >= line.gettoken_float(3); break; case 7: + istrue = (line.gettoken_int(1) & line.gettoken_int(3)) != 0; break; case 8: istrue = line.gettoken_int(1) && line.gettoken_int(3); break; case 9: diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 2764dc47..7b3f7b1f 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -242,7 +242,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_P_ADDINCLUDEDIR,_T("!AddIncludeDir"),1,0,_T("dir"),TP_ALL}, {TOK_P_INCLUDE,_T("!include"),1,1,_T("[/NONFATAL] filename.nsh"),TP_ALL}, {TOK_P_CD,_T("!cd"),1,0,_T("absolute_or_relative_new_directory"),TP_ALL}, -{TOK_P_IF,_T("!if"),1,3,_T("[!] value [(==,!=,<=,<,>,>=,&&,||) value2] [...]"),TP_ALL}, +{TOK_P_IF,_T("!if"),1,3,_T("[!] value [(==,!=,<=,<,>,>=,&,&&,||) value2] [...]"),TP_ALL}, {TOK_P_IFDEF,_T("!ifdef"),1,-1,_T("symbol [| symbol2 [& symbol3 [...]]]"),TP_ALL}, {TOK_P_IFNDEF,_T("!ifndef"),1,-1,_T("symbol [| symbol2 [& symbol3 [...]]]"),TP_ALL}, {TOK_P_ENDIF,_T("!endif"),0,0,_T(""),TP_ALL},