I know I've asked a similar question some 6 months ago, regarding 
aliasing dir_config. But this is a little different.

In the following XS section:

foo()

   ALIAS:
   bar = 1

during the boot XS sets XSANY.any_i32 to 0 for the real function, and 1 
for the bar alias. So inside foo() I can check which of the two function 
was called by looking at the value of ix (XSANY.any_i32).

How can I do the same with WrapXS?

I know I can use

#define bar foo

to make the physical alias. But how do I know inside foo() whether it 
was called as foo() or bar()?

I think what I'm looking for is implemented in:

static XS(MPXS_Apache__Log_dispatch)

where cv is passed to the XS function, and then we figure out by what 
"alias" the function was called by doing a switch statement on this :

     char *name = GvNAME(CvGV(cv));
     switch (*name) {
       ...
     }

Isn't the XSANY.any_i32 solution faster, considering that there could be 
cases where one needs to compare more than the first char of 'name'? 
e.g. foo, bar, baz.

I guess CvXSUBANY(cv).any_isa32 should be about the same speed as 
GvNAME(CvGV(cv)), haven't looked at the complete macros expansion.

Am I correct to say that since Perl doesn't know that the function is an 
alias, it uses somewhat more space since it points to a different C 
function/macro which in fact resolves to the same pointer. Probably not 
much of a concern when only a few aliases are used. But will add up when 
there are many.

In any case I want to verify that my understanding is correct, so I can 
properly document the equivalent of XS's ALIAS with WrapXS.

Thanks!
_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.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