On Thu, 20 Sep 2001, Philippe M . Chiasson wrote:

> After a fun week of machines crashing all over me, here is my first attempt at
> a tied implementation of APR::Tables.
> 
> Important to note that this will most probably be partly rewritten as I don't believe
> it's "the right way" to do it.  It does work for me though.

cool.  one reason i held off on this, was because i don't think
APR::Table-s should be tied by default.  but hadn't thought of a way to
turn that on, but something along the lines of:
use APR::Table tie => 1;

or if they are tied by default:
use APR::Table tie => 0; 
would turn it off.

> The few things that I believe are not done right are:
> 
> 1.  the tie and untie functions should be macros

because of ?  speed?  you could just MP_INLINE those functions.

> 2.  the T_APRTABLEOBJ typemap stuff is just nasty.  The only thing I want to be able 
>to do
>     is to define input/output typemap for an APR::Table, and right now I had to 
>hardcode quite
>     a few things

what did you have to hard code?  APR::Table?  that is an xsubpp variable,
$Package i think.
     
> 3.  All the mp_xs_sv2_* macros are completely separate from the typemap entries, and 
>I think they
>     should be somehow tied together.  Right now I have to 
>         #define mp_xs_sv2_APR__Table(sv) \
>         _mpxs_apr_table_untie(aTHX_ sv)
>     if I want to use mpxs_usage_va_2 and friends

you should only need mpxs_usage_foo if a function has a variable list
argument (like $r->print(...)).  anything else should be taken care of by
the prototype that is generated in the .xs, like the current
APR::Table::{get,set,etc} currently are.
     
> 4.  XS aliases.  if apr_table_get and apr_table_FETCH are identical, there should be 
>a way to simply
>     alias one to the other instead of duplicating the XS glue
>         newXS("APR::Table::FETCH", XS_APR__Table_get, file);
>     is all that's required.

see Apache__RequestIO.h:
#define mpxs_Apache__RequestRec_PRINT mpxs_Apache__RequestRec_print

and modperl_functions.map:
 int:DEFINE_PRINT      | | ...

support for ALIAS would be nicer though.

> 5.  FIRSTKEY, NEXTKEY not implemented yet, as I have to figure out a place I can 
>stash the state of an iterator somwehere.  

should be able todo what 1.x does.  see APR::URI for an example of
subclassing a data structure.

one note that i mentioned in another thread, no "_private" names please,
i.e. no _ prefix.  implemention of your patch is looking good so far, but
the style is way off, please fix :-)

and check that the patch will compile with 5.6.1, i think you'll at least
need to add to modperl_perl_includes.h:
#ifndef PERL_MAGIC_tied
#   define PERL_MAGIC_tied 'P'
#endif









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

Reply via email to