Call Stack
Dave Hein
Posts: 6,347
Is there any documentation on the call stack used in Spin?· Is it the same when calling methods within the same object versus methods in other objects?
Comments
http://forums.parallax.com/showthread.php?p=878067
Thanks for your responses.· I looked at the wiki, and it contains some very useful information.· jazzed, I'll have to try SPUD sometime.· It looks very useful.
Dave
The main reason I need to know about the call stack is so that I can create methods that handle a variable number of arguments, such as printf.· I created a function printfx that gets it arguments off of a list.· The list is just a pointer to the first argument in the functions printf0, printf1 and printf2.· Spin code requires that the number of arguments used in the call match the number of arguments in the method.· However, I only need one function to do the processing, and I just need the inteface functions to match the number of agurments needed.
A partial example of the code is shown below.
Dave
PUB printf0(format)
· printfx(@format)
PUB printf1(format, arg1)
· printfx(@format)
PUB printf2(format, arg1, arg2)
· printfx(@format)
PUB printfx(arglist) | format, arg
· format := LONG[noparse][[/noparse]arglist][noparse][[/noparse]0]
· arg := LONG[noparse][[/noparse]arglist][noparse][[/noparse]1]
· arglist += 8
· ...