Afrow UK
9th January 2012 00:33 UTC
nsExpr: Small expression evaluator plug-in
nsL Assembler died when I finished my Uni degree so here is the next best thing. A small C plug-in (6KB) which extends the functionality of NSIS to support C-style expressions. They can be used in an ${If} like so:
${If} ${Expr} `(R0 == 9 || r0 == 3) && (R0 == 0 || !r2)`
...
Or they can be evaluated with their result written to a variable:
${ExprEval} `(r3 + 20) / 3 * -2` $R0
http://nsis.sourceforge.net/NsExpr_plug-in
See Readme.txt in the zip file for available operators. May need some further testing.
Stu
Afrow UK
9th January 2012 22:03 UTC
1.0.0.1 - 9th January 2012
* Reduced memory usage and improved parse efficiency.
* Fixed any operator being accepted instead of a colon for ternary comparison.
* Added additional comments.
http://nsis.sourceforge.net/NsExpr_plug-in
Stu
Afrow UK
9th January 2012 22:53 UTC
Just fixed a small typo.
1.0.1.1 - 9th January 2012
* Fixed missing '/n' for skipping whitespace.
http://nsis.sourceforge.net/NsExpr_plug-in
Stu
T.Slappy
11th January 2012 09:53 UTC
Thanks Stu for another great plug-in!
Please write a little more about usage on the wiki!
My personal opinion:
Using R0-R9 (for $R0-$R9) and r0-r9 (for $0-$9) is not too user friendly as NSIS script is case INsensitive which may lead to some hard-to-find errors during debugging the script.
Afrow UK
11th January 2012 12:24 UTC
Originally posted by T.Slappy
Thanks Stu for another great plug-in!
Please write a little more about usage on the wiki!
OK will do.
Originally posted by T.Slappy
My personal opinion:
Using R0-R9 (for $R0-$R9) and r0-r9 (for $0-$9) is not too user friendly as NSIS script is case INsensitive which may lead to some hard-to-find errors during debugging the script.
You do not have to use R0 or r0 if you don't want to (you can just superimpose $R0 and $0 into the string). The benefits of using R0/r0 though is outlined in the readme. The reason I have chose R0 and r0 is because this is what the System plug-in uses. It wouldn't be wise to invent another variable naming system. Even so, what would you suggest? You can't just put 0 for $0 can you...
Stu