!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):
!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.:
!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:
!macro TEST P1
Push `${${P1}}` ;Here is the problem
!macroend
!macro TEST2 Parameter1
!insertmacro TEST Parameter1 ;TEST2's 1st parameter name
!macroend