#499 Add 'PreservePreDefVars' and 'RestorePreDefVars'

2.0 Series
open
Scripting (152)
5
2010-09-30
2010-09-30
Netsurfer24
No

When I first had a look at some more complex scripts with lots of separate functions to call I noticed these "orgies" of
Push $0
Push $1
Push $2
Push $..
at the beginning of each function and at the end the same the other way round
Pop $..
Pop $2
Pop $1
Pop $0

I propose to add two new commands like 'PreservePreDefVars' and 'RestorePreDefVars' which simply saves the values of the predefined variables ($0 - $9, $R0 - $R9) and restore them when called.

The advantage is that one could use any of these variables within a function without running into trouble because of using a variable and forgot to push it to the stack before.

Another possibility would be to add the optional possibility to add the variables name as parameter like
PreservePreDefVars $0 $1 $8 $9 $R5

In an ideal world the RestorePreDefVars command automatically knows which variables were preserved before and restores only those.

Thanks,

Gunther

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks