On Fri, 8 Mar 2002, Stas Bekman wrote:

> Doug,
> 
> This kind of construct:
> 
>    int mpxs_Apache__Foo_bar(pTHX_ I32 items, SV **MARK, SV **SP)
> 
> is special to WrapXS, isn't it?

dunno if i'd call it special.  usage is derived from PP() functions in the 
perl core.
 
> you cannot really use ST() macros inside of it to access arguments on 
> the stack. I see that 'ax' + PL_stack_base don't point to the first 
> argument, but to the second one. Though MARK does point to the first 
> argument, so what I get is:
> 
> first arg:   *MARK
> second arg:  *(MARK+1) == ST(0)
> ...
> 
> I've read through the sources and it seems that you manipulate the stack 
> only via MARK in this kind of mpxs_ functions.

right.
 
> Is this because of the second non-XSUB call from within the XS wrapper? 
> And ST() macros are designed only to be used inside the XSUB calls?

ST() could be used anywhere, the MARK/SP usage is just a little less 
overhead.  and this is only used for variable number of args, like 
print(...):
while (MARK <= SP) {
    char *buf = SvPV(*MARK, wlen);
    ...
    MARK++;
}

if you know the number of arguments you shouldn't be using this construct.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to