I need function pointers!!!
Kye
Posts: 2,200
SPIN, you're letting me down. I like need some function pointers for indirecting RTC access for my file system driver.
I look forward to C on the Prop 2 - Or atleast some type of C -> SPIN bytecode translator.
I look forward to C on the Prop 2 - Or atleast some type of C -> SPIN bytecode translator.
Comments
Bill
http://forums.parallax.com/showthread.php?127057-DEMO-Self-Modify-Spin-Code-Example&highlight=pointers
I posted a MethodPointer object to the OBEX earlier this month. It is located at http://obex.parallax.com/objects/697/ .
It was discussed in the thread at http://forums.parallax.com/showthread.php?128397-Callbacks-and-Method-Pointers-in-Spin&highlight=pointer . The technique I use doesn't modify the method tables or the Spn bytecodes (except for a small amount done at initialization). It just requires a 4-word buffer for each method pointer that is used.
Dave
Call method by object index. This has risks of course like if Parallax updates the compiler to do object array bounds checks - one would hope that our list of desirable enhancements might get addressed first. YMMV.
Very cute! I had forgotten all about object arrays - thank goodness for languages that do not do any bounds checking!
Ross.