kj said:
I'm trying to translate fragments snatched from pp.c into Inline::C
functions. These fragments use stack-manipulation macros such as
PUTBACK and SPAGAIN. I'm having a hard time figuring out how to
translate these macros into code that will play well with Inline's
stack manipulation macros. It would be very helpful for me to see
how the Inline::C macros are defined, but I can't find these
definitions.
Thanks!
It's all done in Inline.h which gets created whenever you run an Inline::C
script. If you run your Inline::C script with the Config option
CLEAN_AFTER_BUILD => 0 then you'll be able to go into the build directory
and find Inline.h. (Without that option the build directory gets cleaned up
after the script has successfully compiled.)
Anyway, to save you the trouble, here's what Inline.h looks like:
#define Inline_Stack_Vars dXSARGS
#define Inline_Stack_Items items
#define Inline_Stack_Item(x) ST(x)
#define Inline_Stack_Reset sp = mark
#define Inline_Stack_Push(x) XPUSHs(x)
#define Inline_Stack_Done PUTBACK
#define Inline_Stack_Return(x) XSRETURN(x)
#define Inline_Stack_Void XSRETURN(0)
#define INLINE_STACK_VARS Inline_Stack_Vars
#define INLINE_STACK_ITEMS Inline_Stack_Items
#define INLINE_STACK_ITEM(x) Inline_Stack_Item(x)
#define INLINE_STACK_RESET Inline_Stack_Reset
#define INLINE_STACK_PUSH(x) Inline_Stack_Push(x)
#define INLINE_STACK_DONE Inline_Stack_Done
#define INLINE_STACK_RETURN(x) Inline_Stack_Return(x)
#define INLINE_STACK_VOID Inline_Stack_Void
#define inline_stack_vars Inline_Stack_Vars
#define inline_stack_items Inline_Stack_Items
#define inline_stack_item(x) Inline_Stack_Item(x)
#define inline_stack_reset Inline_Stack_Reset
#define inline_stack_push(x) Inline_Stack_Push(x)
#define inline_stack_done Inline_Stack_Done
#define inline_stack_return(x) Inline_Stack_Return(x)
#define inline_stack_void Inline_Stack_Void
I don't exactly know why those macros were created. Seems to me that one
might just as well use 'dXSARGS', 'items', 'ST(x)', 'sp = mark',
'xPUSHs(x)', 'PUTBACK', 'XSRETURN(x), and 'XSRETURN(0)' instead of the
synonyms provided by Inline.h.
Cheers,
Rob