You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2002/03/07 18:44:14 UTC
returning stack manipulation with WrapXS?
I can manipulate the elements on the sp stack if I use this declaration:
void mpxs_Apache__Foo_bar(pTHX_ I32 items, SV **MARK, SV **SP)
but I cannot control the stack on the way back, since WrapXS will
render this function as:
XS(XS_Apache_Foo_bar)
{
dXSARGS;
{
mpxs_Apache__Foo_bar(aTHX_ items, MARK+1, SP);
}
XSRETURN_EMPTY;
}
This XSRETURN_EMPTY ruins everything.
Now the only way I can manipulate the returning stack with WrapXS is
using MPXS_ declaration like:
static XS(MPXS_Apache__Foo_bar)
and then I can do anything I want, since there will be no wrapper
created around this XSsub.
The problem is that source_scan won't pick up an MPXS_ function if it
doesn't start with MPXS_{apr|ap|modperl}. Any idea what's
wrong with:
static XS(MPXS_Apache__Foo_bar)
I don't like calling my functions modperl_ when they actually can be
used outside modperl.
Thanks!
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: returning stack manipulation with WrapXS?
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> I can manipulate the elements on the sp stack if I use this declaration:
>
> void mpxs_Apache__Foo_bar(pTHX_ I32 items, SV **MARK, SV **SP)
>
> but I cannot control the stack on the way back, since WrapXS will
> render this function as:
>
> XS(XS_Apache_Foo_bar)
> {
> dXSARGS;
> {
> mpxs_Apache__Foo_bar(aTHX_ items, MARK+1, SP);
> }
> XSRETURN_EMPTY;
> }
>
> This XSRETURN_EMPTY ruins everything.
>
> Now the only way I can manipulate the returning stack with WrapXS is
> using MPXS_ declaration like:
>
> static XS(MPXS_Apache__Foo_bar)
>
> and then I can do anything I want, since there will be no wrapper
> created around this XSsub.
>
> The problem is that source_scan won't pick up an MPXS_ function if it
> doesn't start with MPXS_{apr|ap|modperl}. Any idea what's
> wrong with:
>
> static XS(MPXS_Apache__Foo_bar)
Also why if I have a function
static XS(MPXS_modperl_bar)
I absolutely must have another function called:
static whatever modperl_bar(whatever)
If there is no modperl_bar, source_scan won't pick MPXS_modperl_bar
I know that MPXS_ is supposed to be a thin wrapper, but what if I don't
need
to make any calls but only play with the stack?
What do I miss, Doug?
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: returning stack manipulation with WrapXS?
Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:
> % find xs -name "*.h" | xargs grep MPXS_
> ...
> xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_dispatch)
> xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache_LOG_MARK)
> xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_log_xerror)
> xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_log_error)
>
> and see modperl_functions.map.
> source_scan doesn't put any MPXS_ functions in the xs/tables.
> the name must either map to an existing C function or be DEFINEd in the
> .map
it works :)
I was confused thinking that DEFINE is only for #define's.
I need to document all the variants.
You are da man, Doug! Thanks
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: returning stack manipulation with WrapXS?
Posted by Doug MacEachern <do...@covalent.net>.
% find xs -name "*.h" | xargs grep MPXS_
...
xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_dispatch)
xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache_LOG_MARK)
xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_log_xerror)
xs/Apache/Log/Apache__Log.h:static XS(MPXS_Apache__Log_log_error)
and see modperl_functions.map.
source_scan doesn't put any MPXS_ functions in the xs/tables.
the name must either map to an existing C function or be DEFINEd in the
.map
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org