Enumerating and abstracting function names.....function_Ptr anyone?
Based on insufficient solutions for resolving a string to its function name during runtime, ( see posts
Post on Rollbacks.
And the apparent lack of abstracted functionality during runtime of the GetFunctionAddress GetFunctionAddress Limitations
I'm trying to create a script/macro that would perform the following:
Step 1. Define a macro named ResStr ( Short for ResolveString )
-> hard part for me...
Step 1. Rip the NSIS script and Enumerate ALL the names of EVERY function defined in the script. Not necessary for a manual version... but would be really good for a global coding style performance enhancement.
Step 2. Build a case statement for an input variable that would resolve to each of those names as a string literal in order to survive compile reduction to memory space.
See, without it being truely abstracted....using GetFunctionAddress is meaningless for runtime solutions. i.e. Yes... we can pass a function pointer to a macro and the macro doesn't need to know what specific one its calling... But only if the setup is built at compile time.
GetFunctionAddress NEEDS to receive a variable that contains a string.... but to do that we need to be able to hash the "stringnames" to the memory spaces... like this code might....???
USAGE:
; Reading a string from a file into this var...
${GetBetween} "<callback>" "</callback>" $fileHandle $myFunction_PtrString
${ResStr} $myFunction_PtrString
And the manually built version would be someting like this:
!macro ResStr _FunctionNameLiteral
push ${FunctionNameLiteral}
call func_ResStr
!macroend
Function func_ResStr
push $1 ; save reg1
Exch
pop $1 ; get function name as string literal.
${Switch} $1
${Case} "fileBusyCondition" ; this would work because its runtime comparisons...
; a result call back from trying to rollback.
Call fileBusyCondition ; this would work because its precompile time linking.....
${Case} "mailTheMoney"
; When I hack the lotto successfully perform
; this callback.
Call mailTheMoney
; Blah Blah Blah every function that a user might care
; to call back....
${EndSwitch}
pop $1
FunctionEnd
So if we could enumerate all function names like this, then we could have an Resolve String function......
Easiest way to enumerate all function names in a NSIS project?
[ Hollow sound. ] Helloooooooooo? ;-)