Doug MacEachern wrote:

> On Thu, 27 Sep 2001, Stas Bekman wrote:
> 
> 
>>why the following pseudo-code screws everything. I think it messes up 
>>the SP, but I cannot tell since I cannot run the debugger :( I guess I 
>>could test it outside of mod_perl env.
>>
> 
> perldoc perlapi
> =item dSP
> 
> Declares a local copy of perl's stack pointer for the XSUB, ...
> 
> so SP is not the same in foo() as it is in the calling function.

that's it.

 
>>My point is that it's not easy to call the code that messes up with 
>>items and SP from C functions which are wrapped in XS wrapper.
>>
> 
> you shouldn't be calling function that mess with items and SP.
> there are two forms of xsubs in modperl-2.0 that do not have a fix
> prototype.  those with '...' in the .map file are passed items, MARK and
> SP.  and those prefixed MPXS_ which are hooked directly into newXS().
> any messing with items and SP should happen at the level of those
> functions.
 

ok, that explains everything. Use XS if you want to mess with SP and stuff.

 
>>So is it OK that I protory functions that use TABLE_GET_SET not to work 
>>with SP and items but instead be prototyped with object, key=NULL, 
>>val=NULL?

Sorry

In 1.x there is TABLE_GET_SET macro that is used by many functions to 
return a table if key==NULL, gets the value if key!=NULL but sets the 
value if items==3. And all the functions are prototyped in C as
(table, key=NULL, ...)

So in mod_perl 2.0 I have two ways to do this:

1. keep it as it was in 1.x => have to use MPXS_
2. use normal C and prototype the functions as (table, key=NULL, 
val=NULL) instead of table, key=NULL, ...)

my point is that if you look at TABLE_GET_SET, it uses two arguments 
from the prototype as is, and then heads for items to figure out if it 
has a 'val' argument. So why not to declare 'val' arg in the prototype?

Anyway, I've implemented it in both ways and not sure which is the best 
way to do.


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



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

Reply via email to