When I thought I was starting to understand something ;-(
I am trying to implement APR::Table->do(sub { .. });
And I thought it was simply a matter of these few steps:
1. Create xs/APR/Table/APR__Table.h
2. put a prototype in there, like:
static MP_INLINE
void mpxs_APR__Table_do(apr_table_t *table, SV *sub)
{
return;
}
3. Then run make source_scan, therefore adding this to
xs/tables/current/ModPerl/FunctionTable.pm
+ {
+ 'return_type' => 'void',
+ 'name' => 'mpxs_APR__Table_do',
+ 'args' => [
+ {
+ 'type' => 'apr_table_t *',
+ 'name' => 'table'
+ },
+ {
+ 'type' => 'SV *',
+ 'name' => 'sub'
+ }
+ ]
+ },
Looks good so far...
4. Edit xs/maps/apr_functions.map
apr_table_add
-apr_table_addn
- apr_table_do
apr_table_get
apr_table_merge
-apr_table_mergen
@@ -191,6 +190,7 @@
-apr_table_setn
apr_table_unset
-apr_table_vdo
+ PREFIX=apr_table_
+ ~apr_table_do
And that should be it, right ?
My problem is that the only way I could figure out to get the code generated in
WrapXS/APR/Table/Table.xs
to include the right wrapping for my new ->do method looked more like this:
apr_table_add
-apr_table_addn
- apr_table_do
apr_table_get
apr_table_merge
-apr_table_mergen
@@ -191,6 +190,7 @@
-apr_table_setn
apr_table_unset
-apr_table_vdo
+ mpxs_APR__Table_do
What is it that I do not understand ?
Hey, Stas, don't you think there should be some document about this ? I might
consider writing it, as I might
get a better understanding of all the code autogeneration system.
Let me know, I am just confused. It works, but I am sure there is a "cleaner" way to
do it ;-)
Ciao.
--
Philippe M. Chiasson <[EMAIL PROTECTED]>
Extropia's Resident System Guru
http://www.eXtropia.com/
Tonight I just can't face the Muzak.
-- Larry Wall
perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl
Hacker!\n$/&&print||$$++&&redo}'
PGP signature