|
|
#1 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
I'm just trying to clean up my code a bit. I like to wrap my own functions in an NSH file that I can !include when I need them using macros and return varaibles. (I find this much more convenient than using stack commands within a section or function.)
My list of functions (and NSH files) keeps growing. I'd like to take the ones I use most often and put then into a single NSH file. However, I might not use every single function declared in an NSH file. I'd like to know if anyone has any tricks of defining a function "on demand". In other words, I want to automatically create a function only when needed. I thought perhaps I could encapsulate the function within "!ifdef" statements, but I'm not sure if that's the right way to go. Here's an example of a basic NSH file layout that I currently use. Any advice would be appreciated. Thanks! ______________________________________________________ !macro MyFunc Return_var Input_var push ${Input_var} Call MyFunc Pop ${Return_var} !macroend !define CoolFunction "!insertmacro MyFunc" Function MyFunc Exch $0 push $1 ; do stuff with $0 ; store result in $1 exch $1 exch pop $0 FunctionEnd |
|
|
|
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|