|
|
|
|
#1 |
|
Junior Member
Join Date: Jan 2010
Posts: 39
|
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
|
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Well you could do:
Stucode: |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jan 2010
Posts: 39
|
I'm somehow satisfied with the !define command to store the OUTDIR and to restore it at the end.
Thanks.
|
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Edit: Err, nvm, not applicable here.
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2010
Posts: 39
|
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
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|