Old 16th September 2004, 22:05   #1
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
!macro Suggestions

I do have some suggestions for the compile time command "!macro":

- Introduce nesting of !macro's inside themselves so you can record them when they are inserted. This would really cut a lot of space in a file. Like this code below (w/ the suggestion below also):

code:
!macro STRFUNC_DEFFUNC Name
!define `${Name}` `!insertmacro FUNCTION_STRING_${Name}`
!define `Un${Name}` `!insertmacro FUNCTION_STRING_Un${Name}`

!macro `FUNCTION_STRING_Un${Name}`
!define `Un${Name}` `!insertmacro FUNCTION_STRING_${Name}`
!macroend
!macroend

!insertmacro STRFUNC_DEFFUNC StrCase
!insertmacro STRFUNC_DEFFUNC StrClb
!insertmacro STRFUNC_DEFFUNC StrIOToNSIS
!insertmacro STRFUNC_DEFFUNC StrLoc
!insertmacro STRFUNC_DEFFUNC StrNSISToIO
!insertmacro STRFUNC_DEFFUNC StrRep
!insertmacro STRFUNC_DEFFUNC StrSort
!insertmacro STRFUNC_DEFFUNC StrStr
!insertmacro STRFUNC_DEFFUNC StrStrAdv
!insertmacro STRFUNC_DEFFUNC StrTok
!insertmacro STRFUNC_DEFFUNC StrTrimNewLines

(I was so excited with the size I could cut down with this, that I made StrFunc.nsh 1.07 first version based on the code above. Now that I discovered it is not that way, I saved it somewhere else so I can remember about this )

(This code is the initial definition of the header file commands for install and uninstall for the user to use)

- Enable !macro's to have defined values (with !define) for the parameters. Like the code above suggests.

- A character on the parameter name to make that parameter optional. This should be only for the last parameters of the macro. I.e.:

code:
!macro FUNCTION_STRING_StrStrAdv OutVar String StrToSearch *SearchDirection
- A message is appearing when ${} is used. I know, it appears like a define but it cannot be one as you can't define "" or create an user variable with brackets "{}".

- Everytime a macro (macro #1) is called with an !insertmacro(macro #2) and this macro (macro #2) tries to get a parameter value of the main macro (macro #1) and push that value for use with functions, it pushes nothing. You can't know what is causing it because MessageBox ever gives the correct value, and dumpstate says that happened only empty pushes. An example of this:

code:
!macro TEST P1
Push `${${P1}}` ;Here is the problem
!macroend

!macro TEST2 Parameter1
!insertmacro TEST Parameter1 ;TEST2's 1st parameter name
!macroend


My Wiki Pages

Working now on:
New projects. (language: any)

Last edited by deguix; 16th September 2004 at 22:22.
deguix is offline   Reply With Quote
Old 17th September 2004, 10:46   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Macro names with defines in them already work.

What message appears when using ${}?

Your last example works fine. Look for that push line in the compiler output.

As for the rest, add a feature request. There are currently more important things to do, so it'll have to wait.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th September 2004, 22:08   #3
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Quote:
What message appears when using ${}?
"unknown variable/constant "{}" detected, ignoring"

How can it be a variable/constant if you can't !define or create a custom variable with that? I know, it's nothing really important...

Quote:
Your last example works fine. Look for that push line in the compiler output.
Maybe I could test this after, as I fixed this using a different approach already on StrFunc.nsh.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 17th September 2004, 22:40   #4
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Oh, the real problem was that !include was including the wrong file! I done it like this:

!include "StrFunc.nsh"

But on the current folder of the script there had this file with the same name (I was using it for backup). I can see now why some of your statements are true:

Quote:
Macro names with defines in them already work.
Quote:
Your last example works fine. Look for that push line in the compiler output.
[EDIT]Posted feature requests.[/EDIT]

My Wiki Pages

Working now on:
New projects. (language: any)

Last edited by deguix; 17th September 2004 at 22:56.
deguix 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