![]() |
macro with parameters
Hi guys,
I would really appreciate your help over this issue I have. I have a macro with 2 parameters like below: PHP Code:
PHP Code:
Is there a way to avoid this kind bad macro usage, beside: PHP Code:
Isawen |
Well you could do:
Stucode: |
And a more sophisticated solution is to switch $1 to something else if one of the macro parameters is $1, i.e.
Here if the parameter is $1, you instead use $2 and leave $1 as it is. In fact, this is how some of the macros in Sections.nsh should be changed to use (those macros were written before !if).code: Edit: I should point out that neither of these solutions will work if for example "some string containing $1" is used for _PARAM1. You are stuck there. Perhaps usage of !searchparse may work but you have to match $1 and ignore $$1 somehow. Stu |
I'm somehow satisfied with the !define command to store the OUTDIR and to restore it at the end.
Thanks. |
Edit: Err, nvm, not applicable here.
|
I am probably wrong to ask but you do realise that !define is a compile time instruction. It will not be set to the value of $OUTDIR because that is not known until run time. Storing $OUTDIR in a constant will not benefit you at all except to save you from having to repeat $OUTDIR throughout the macro. Wherever you use that constant, $OUTDIR will be inserted.
Stu |
Yes, sorry my bad. Thanks for your correction.
I didn't notice that the functionality was wrong until I changed some paths that I needed inside the macro. Much appreciated. Isa |
| All times are GMT. The time now is 17:40. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.