Fixed and documented !if & operator

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6099 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2010-06-11 16:33:10 +00:00
parent f0fb5aafea
commit fbc7cb8fd0
3 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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:

View file

@ -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},