Old 8th January 2012, 23:33   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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:
code:
${If} ${Expr} `(R0 == 9 || r0 == 3) && (R0 == 0 || !r2)`
...

Or they can be evaluated with their result written to a variable:
code:
${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 is offline   Reply With Quote
Old 9th January 2012, 21:03   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
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 is offline   Reply With Quote
Old 9th January 2012, 21:53   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Just fixed a small typo.
Quote:
1.0.1.1 - 9th January 2012
* Fixed missing '/n' for skipping whitespace.
http://nsis.sourceforge.net/NsExpr_plug-in

Stu
Afrow UK is offline   Reply With Quote
Old 11th January 2012, 08:53   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 530
Send a message via ICQ to T.Slappy
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.

Cool looking installer with custom design: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned.sk
Develop NSIS projects in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 11th January 2012, 11:24   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by T.Slappy View Post
Thanks Stu for another great plug-in!
Please write a little more about usage on the wiki!
OK will do.
Quote:
Originally Posted by T.Slappy View Post
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
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump