Where are Inline_Stack_Vars, etc. defined?

Discussion in 'Perl Misc' started by kj, Jul 30, 2005.

  1. kj

    kj Guest

    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!

    kj

    --
    NOTE: In my address everything before the first period is backwards;
    and the last period, and everything after it, should be discarded.
    kj, Jul 30, 2005
    #1
    1. Advertising

  2. kj

    Sisyphus Guest

    "kj" <> wrote in message
    news:dcfalv$7l0$...
    >
    >
    >
    > 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
    Sisyphus, Jul 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robin Cull
    Replies:
    5
    Views:
    401
    Andrew Dalke
    Jul 31, 2003
  2. Daniel Joyce

    Python Audio (Alpy, Fastaudio, Etc Etc)

    Daniel Joyce, Sep 16, 2003, in forum: Python
    Replies:
    1
    Views:
    917
    Markus Wankus
    Sep 16, 2003
  3. Marco Herrn
    Replies:
    7
    Views:
    625
    Ng Pheng Siong
    Apr 9, 2004
  4. Oodini
    Replies:
    1
    Views:
    1,762
    Keith Thompson
    Sep 27, 2005
  5. Kevin Walzer

    Re: PIL (etc etc etc) on OS X

    Kevin Walzer, Aug 1, 2008, in forum: Python
    Replies:
    4
    Views:
    383
    Fredrik Lundh
    Aug 13, 2008
Loading...

Share This Page