You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2003/06/07 21:57:43 UTC

cvs commit: httpd-apreq-2/glue/perl/xsbuilder/maps apreq_functions.map apreq_structures.map apreq_types.map

joes        2003/06/07 12:57:43

  Modified:    glue/perl/xsbuilder apreq_xs_postperl.h
               glue/perl/xsbuilder/Apache/Cookie Apache__Cookie.h Cookie_pm
               glue/perl/xsbuilder/Apache/Request Apache__Request.h
                        Request_pm
               glue/perl/xsbuilder/maps apreq_functions.map
                        apreq_structures.map apreq_types.map
  Log:
  Perl glue compiles.
  
  Revision  Changes    Path
  1.5       +190 -49   httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h
  
  Index: apreq_xs_postperl.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apreq_xs_postperl.h	31 May 2003 07:01:50 -0000	1.4
  +++ apreq_xs_postperl.h	7 Jun 2003 19:57:42 -0000	1.5
  @@ -1,14 +1,43 @@
   #ifndef APREQ_XS_POSTPERL_H
   #define APREQ_XS_POSTPERL_H
   
  +#define apreq_table_t apr_table_t
  +#define apreq_xs_class (SvROK(ST(0))  ? HvNAME(SvSTASH(ST(0))) : SvPV_nolen(ST(0)))
  +#define apreq_xs_value_class ( call_method("value_class", G_SCALAR), \
  +                                SvPV_nolen(ST(0)) )
  +#define apreq_xs_table_class ( call_method("table_class", G_SCALAR), \
  +                                SvPV_nolen(ST(0)) )
  +
  +APR_INLINE
  +static XS(apreq_xs_env)
  +{
  +    dXSARGS;
  +
  +    if (!SvROK(ST(0))) {
  +        ST(0) = newSVpv(apreq_env, 0);
  +    }
  +    else {
  +        MAGIC *mg;
  +        SV *sv = SvRV(ST(0));
  +
  +        if (SvOBJECT(sv) && (mg = mg_find(sv, PERL_MAGIC_ext))) {
  +            ST(0) = sv_2mortal(sv_setref_pv(newSV(0), 
  +                                            apreq_env, mg->mg_ptr));
  +        }
  +        else
  +            ST(0) = &PL_sv_undef;
  +    }
  +    XSRETURN(1);
  +}
   
   /* conversion function template based on modperl-2's sv2request_rec */
   
  -#define APREQ_XS_DEFINE_SV_CONVERT(type, class)                         \
  -APR_INLINE static apreq_##type##_t *apreq_xs_sv2##type(pTHX_ SV* in)    \
  +#define APREQ_XS_DEFINE_CONVERT(type)                                   \
  +APR_INLINE                                                              \
  +static apreq_##type##_t *apreq_xs_##type##_perl2c(pTHX_ SV* in)         \
   {                                                                       \
  -    while (in && SvROK(in) & sv_derived_from(in, class)) {              \
  -        SV *sv = SvRV(sv);                                              \
  +    while (in && SvROK(in)) {                                           \
  +        SV *sv = SvRV(in);                                              \
           switch (SvTYPE(sv)) {                                           \
               SV **svp;                                                   \
           case SVt_PVHV:                                                  \
  @@ -18,69 +47,181 @@
                   in = *svp;                                              \
                   break;                                                  \
               }                                                           \
  -            Perl_croak(aTHX_  class "- derived `%s' object has no `"    \
  +            Perl_croak(aTHX_  "%s object has no `"                      \
                                #type "' key!", HvNAME(SvSTASH(sv)));      \
           case SVt_PVMG:                                                  \
  -            return (apreq_##type##_t *)SvIVX(sv);                       \
  +            if (SvOBJECT(sv) && SvIOK(sv))                              \
  +                return (apreq_##type##_t *)SvIVX(sv);                   \
           default:                                                        \
  -            Perl_croak(aTHX_ "panic: unsupported apreq_" #type          \
  +             Perl_croak(aTHX_ "panic: unsupported apreq_" #type         \
                                "_t type \%d",                             \
                        SvTYPE(sv));                                       \
          }                                                                \
       }                                                                   \
       return NULL;                                                        \
   }                                                                       \
  -APR_INLINE static SV *apreq_xs_##type##2sv(apreq_##type##_t *t)         \
  +APR_INLINE                                                              \
  +static SV *apreq_xs_##type##_c2perl(pTHX_ apreq_##type##_t *t,          \
  +                                    void *env, const char *class)       \
   {                                                                       \
  -    SV *sv = newSViv(0);                                                \
  -    SvUPGRADE(sv, SVt_PVIV);                                            \
  -    SvGROW(sv, sizeof *t);                                              \
  -    SvIVX(sv) = (IV)t;                                                  \
  -    SvIOK_on(sv);                                                       \
  -    SvPOK_on(sv);                                                       \
  -    sv_magic(sv, Nullsv, PERL_MAGIC_ext, (char *)t->env, 0);            \
  -                                                                        \
  -    /* initialize sv as an object */                                    \
  -    SvSTASH(sv) = gv_stashpv(class, TRUE);                              \
  -    SvOBJECT_on(sv);                                                    \
  -    return newRV_noinc(sv);                                             \
  +    SV *rv = sv_setref_pv(newSV(0), class, t);                          \
  +    sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0);                 \
  +    return rv;                                                          \
  +}                                                                       \
  +                                                                        \
  +APR_INLINE                                                              \
  +static void *apreq_xs_##type##_perl2env(SV *sv)                         \
  +{                                                                       \
  +    MAGIC *mg = mg_find(SvROK(sv) ? SvRV(sv): sv, PERL_MAGIC_ext);      \
  +    return mg ? mg->mg_ptr : NULL;                                      \
   }
   
   
  -#define APREQ_XS_DEFINE_SV_TIE(type, class)                             \
  -static int apreq_xs_##type##_free(pTHX_ SV* sv, MAGIC *mg)              \
  +/* requires type##2sv macro */
  +
  +#define APREQ_XS_DEFINE_OBJECT(type)                                    \
  +static XS(apreq_xs_##type)                                              \
   {                                                                       \
  -    /* need to prevent perl from freeing the apreq value */             \
  -    SvPVX(sv) = NULL;                                                   \
  -    SvCUR_set(sv,0);                                                    \
  -    SvPOK_off(sv);                                                      \
  -    return 0;                                                           \
  -}                                                                       \
  -const static MGVTBL apreq_xs_##type##_magic = {0, 0, 0, 0,              \
  -                                               apreq_xs_##type##_free };\
  +    dXSARGS;                                                            \
  +    void *env;                                                          \
  +    apr_pool_t *pool;                                                   \
  +    const char *class, *data;                                           \
  +    apreq_##type##_t *obj;                                              \
  +                                                                        \
  +    if (items < 2 || SvROK(ST(0)) || !SvROK(ST(1)))                     \
  +        Perl_croak(aTHX_ "Usage: $class->" #type "($env, $data)");      \
  +                                                                        \
  +    class = SvPV_nolen(ST(0));                                          \
  +    env = (void *)SvIVX(SvRV(ST(1)));                                   \
  +    data = (items == 3)  ?  SvPV_nolen(ST(2)) :  NULL;                  \
  +    obj = apreq_##type(env, data);                                      \
                                                                           \
  -APR_INLINE static SV *apreq_xs_##type##2sv(apreq_##type##_t *t)         \
  +    ST(0) = obj ? sv_2mortal(apreq_xs_##type##2sv(obj,class)) :         \
  +                  &PL_sv_undef;                                         \
  +    XSRETURN(1);                                                        \
  +}
  +
  +
  +/* requires definition of type##2sv macro */
  +
  +#define APREQ_XS_DEFINE_MAKE(type)                                      \
  +static XS(apreq_xs_make_##type)                                         \
   {                                                                       \
  -    SV *sv = newSV(0);                                                  \
  -    SvUPGRADE(sv, SVt_PV);                                              \
  -    SvPVX(sv) = t->v.data;                                              \
  -    SvCUR_set(sv, t->v.size);                                           \
  -                                                                        \
  -    sv_magicext(sv, Nullsv, PERL_MAGIC_tiedscalar,                      \
  -                (MGVTBL *)&apreq_xs_##type##_magic, (char *)t, 0);      \
  -                                                                        \
  -    /* initialize sv as object, so "tied" will return object ref */     \
  -    SvSTASH(sv) = gv_stashpv(class, TRUE);                              \
  -    SvOBJECT_on(sv);                                                    \
  -                                                                        \
  -    SvREADONLY_on(sv);                                                  \
  -    SvTAINT(sv);                                                        \
  -    return sv;                                                          \
  +    dXSARGS;                                                            \
  +    void *env;                                                          \
  +    apr_pool_t *pool;                                                   \
  +    const char *class, *key, *val;                                      \
  +    STRLEN klen, vlen;                                                  \
  +    apreq_##type##_t *t;                                                \
  +                                                                        \
  +    if (items != 4 || SvROK(ST(0)) || !SvROK(ST(1)))                    \
  +        Perl_croak(aTHX_ "Usage: $class->make($env, $name, $val)");     \
  +                                                                        \
  +    class = SvPV_nolen(ST(0));                                          \
  +    env = (void *)SvIVX(SvRV(ST(1)));                                   \
  +    pool = apreq_env_pool(env);                                         \
  +    key = SvPV(ST(2), klen);                                            \
  +    val = SvPV(ST(3), vlen);                                            \
  +    t = apreq_make_##type(pool, key, klen, val, vlen);                  \
  +                                                                        \
  +    ST(0) = apreq_xs_##type##2sv(t, class);                             \
  +    XSRETURN(1);                                                        \
  +}  
  +
  +struct do_arg {
  +    const char      *class;
  +    void            *env;
  +    PerlInterpreter *perl;
  +};
  +
  +/* requires definition of type##2sv macro */
  +
  +#define APREQ_XS_DEFINE_GET(type, subtype)                              \
  +static int apreq_xs_##type##_table_do(void *data, const char *key,      \
  +                               const char *val)                         \
  +{                                                                       \
  +    struct do_arg *d = (struct do_arg *)data;                           \
  +    void *env = d->env;                                                 \
  +    const char *class = d->class;                                       \
  +    dTHXa(d->perl);                                                     \
  +    dSP;                                                                \
  +    if (val)                                                            \
  +        XPUSHs(sv_2mortal(apreq_xs_##subtype##2sv(                      \
  +                   apreq_value_to_##subtype(apreq_strtoval(val)),       \
  +                   class)));                                            \
  +                                                                        \
  +    else                                                                \
  +        XPUSHs(&PL_sv_undef);                                           \
  +                                                                        \
  +    PUTBACK;                                                            \
  +    return 1;                                                           \
   }                                                                       \
  -APR_INLINE                                                              \
  -static apreq_##type##_t *apreq_xs_sv2##type(pTHX_ SV *sv)               \
  +                                                                        \
  +static XS(apreq_xs_##type##_table_get)                                  \
   {                                                                       \
  -   return apreq_value_to_##type(apreq_strtoval(SvPVX(sv)));             \
  +    dXSARGS;                                                            \
  +    const char *key = NULL;                                             \
  +                                                                        \
  +    if (items == 1 || items == 2) {                                     \
  +        SV *sv = ST(0);                                                 \
  +        void *env = apreq_xs_##type##_perl2env(sv);                     \
  +        const char *class = apreq_xs_value_class;                       \
  +        struct do_arg d = { class, env, aTHX };                         \
  +        apr_table_t *t  = apreq_xs_##type##_sv2table(sv);               \
  +                                                                        \
  +        if (items == 2)                                                 \
  +            key = SvPV_nolen(ST(1));                                    \
  +                                                                        \
  +        if (t == NULL)                                                  \
  +            Perl_croak(aTHX_ "Usage: $table->get($key)");               \
  +                                                                        \
  +        switch (GIMME_V) {                                              \
  +            const char *val;                                            \
  +                                                                        \
  +        case G_ARRAY:                                                   \
  +            XSprePUSH;                                                  \
  +            PUTBACK;                                                    \
  +            apr_table_do(apreq_xs_##type##_table_do, &d, t, key, NULL); \
  +            break;                                                      \
  +                                                                        \
  +        case G_SCALAR:                                                  \
  +            val = apr_table_get(t, key);                                \
  +            if (val == NULL)                                            \
  +                XSRETURN_UNDEF;                                         \
  +            ST(0) = sv_2mortal(apreq_xs_##subtype##2sv(                 \
  +                        apreq_value_to_##subtype(                       \
  +                            apreq_strtoval(val)), class));              \
  +            XSRETURN(1);                                                \
  +                                                                        \
  +        default:                                                        \
  +            XSRETURN(0);                                                \
  +        }                                                               \
  +    }                                                                   \
  +    else                                                                \
  +	Perl_croak(aTHX_ "Usage: $table->get($key)");                   \
   }
  +
  +/* requires sv2##type, type##2env & type##2##subtype macros */
  +
  +#define APREQ_XS_DEFINE_TABLE(type, subtype)                    \
  +static XS(apreq_xs_##type##_##subtype)                          \
  +{                                                               \
  +    dXSARGS;                                                    \
  +    apreq_##type##_t *obj;                                      \
  +    void *env;                                                  \
  +    SV *sv;                                                     \
  +                                                                \
  +    if (items != 1)                                             \
  +        Perl_croak(aTHX_ "Usage: " #type "->" #subtype "()");   \
  +                                                                \
  +    sv = ST(0);                                                 \
  +    obj = apreq_xs_sv2##type(sv);                               \
  +    env = apreq_xs_##type##2env(obj);                           \
  +    ST(0) = apreq_xs_table2sv(apreq_xs_##type##2##subtype(obj), \
  +                              apreq_xs_table_class);            \
  +    XSRETURN(1);                                                \
  +}
  +
  +
   
   #endif /* APREQ_XS_POSTPERL_H */
  
  
  
  1.4       +103 -2    httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h
  
  Index: Apache__Cookie.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Apache__Cookie.h	31 May 2003 07:01:50 -0000	1.3
  +++ Apache__Cookie.h	7 Jun 2003 19:57:42 -0000	1.4
  @@ -1,2 +1,103 @@
  -APREQ_XS_DEFINE_SV_CONVERT(jar, "Apache::Cookie::Jar");
  -APREQ_XS_DEFINE_SV_TIE(cookie, "Apache::Cookie");
  +/* jar */
  +
  +APREQ_XS_DEFINE_CONVERT(jar);
  +
  +#define apreq_xs_sv2jar(sv) apreq_xs_jar_perl2c(aTHX_ sv)
  +#define apreq_xs_jar2sv(j,class) apreq_xs_jar_c2perl(aTHX_ j,j->env,class)
  +#define apreq_xs_jar_sv2table(sv) apreq_xs_sv2jar(sv)->cookies
  +#define apreq_xs_jar2env(j) j->env
  +
  +APREQ_XS_DEFINE_OBJECT(jar);
  +
  +/* cookie */
  +
  +APREQ_XS_DEFINE_CONVERT(cookie);
  +
  +#define apreq_xs_sv2cookie(sv) apreq_xs_cookie_perl2c(aTHX_ sv)
  +#define apreq_xs_cookie2sv(c,class) apreq_xs_cookie_c2perl(aTHX_ c,env,class)
  +#define apreq_xs_cookie_sv2env(sv) apreq_xs_cookie_perl2env(sv)
  +
  +APREQ_XS_DEFINE_MAKE(cookie);
  +
  +APREQ_XS_DEFINE_GET(jar,cookie);
  +
  +/* table */
  +APREQ_XS_DEFINE_CONVERT(table);
  +
  +#define apreq_xs_table2sv(t,class) apreq_xs_table_c2perl(aTHX_ t,env,class)
  +#define apreq_xs_sv2table(sv) apreq_xs_table_perl2c(aTHX_ sv)
  +#define apreq_xs_table_sv2table(sv) apreq_xs_sv2table(sv)
  +#define apreq_xs_table_sv2env(sv) apreq_xs_table_perl2env(sv)
  +
  +#define apreq_xs_jar2cookies(j) j->cookies
  +APREQ_XS_DEFINE_TABLE(jar,cookies);
  +
  +APREQ_XS_DEFINE_GET(table,cookie);
  +
  +static XS(apreq_xs_cookie_as_string)
  +{
  +    dXSARGS;
  +    apreq_cookie_t *c;
  +    SV *sv;
  +
  +    if (items != 1)
  +        Perl_croak(aTHX_ "Usage: $cookie->as_string()");
  +
  +    sv = ST(0);
  +    c = apreq_xs_sv2cookie(sv);
  +    sv = NEWSV(0, apreq_serialize_cookie(NULL, 0, c));
  +    SvCUR(sv) = apreq_serialize_cookie(SvPVX(sv), SvLEN(sv), c);
  +    SvPOK_on(sv);
  +    ST(0) = sv_2mortal(sv);
  +    XSRETURN(1);
  +}
  +
  +static XS(apreq_xs_cookie_expires)
  +{
  +    dXSARGS;
  +    apreq_cookie_t *c;
  +
  +    if (items == 0)
  +        XSRETURN_UNDEF;
  +
  +    c = apreq_xs_sv2cookie(ST(0));
  +
  +    if (items > 1) {
  +        apr_pool_t *p = apreq_env_pool(apreq_xs_cookie_sv2env(ST(0)));
  +        const char *s = SvPV_nolen(ST(1));
  +        apreq_cookie_expires(p, c, s);
  +    }
  +
  +    if (c->version == NETSCAPE)
  +        ST(0) = c->time.expires ? sv_2mortal(newSVpv(c->time.expires,0)) :
  +            &PL_sv_undef;
  +    else
  +        ST(0) = c->time.max_age >= 0 ? sv_2mortal(newSViv(c->time.max_age)) :
  +            &PL_sv_undef;
  +
  +    XSRETURN(1);
  +}
  +
  +static XS(apreq_xs_cookie_set_attr)
  +{
  +    dXSARGS;
  +    apreq_cookie_t *c;
  +    apr_pool_t *p;
  +    apr_status_t status = APR_SUCCESS;
  +    int j = 1;
  +    if (items == 0)
  +        XSRETURN_UNDEF;
  +
  +    c = apreq_value_to_cookie(apreq_xs_sv2cookie(ST(0)));
  +    p = apreq_env_pool(apreq_xs_cookie_sv2env(ST(0)));
  +
  +    for (j = 1; j + 1 < items; j += 2) {
  +        status = apreq_cookie_attr(p, c, SvPV_nolen(ST(j)), 
  +                                         SvPV_nolen(ST(j+1)));
  +        if (status != APR_SUCCESS)
  +            break;
  +    }
  +    ST(0) = sv_2mortal(newSViv(status));
  +    XSRETURN(1);
  +}
  +
  
  
  
  1.2       +8 -0      httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm
  
  Index: Cookie_pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Cookie_pm	7 Jun 2003 15:11:42 -0000	1.1
  +++ Cookie_pm	7 Jun 2003 19:57:42 -0000	1.2
  @@ -2,13 +2,21 @@
   use warnings FATAL => 'all';
   
   package Apache::Cookie::Jar;
  +push our(@ISA), __PACKAGE__ -> env;
  +
  +sub value_class { 'Apache::Cookie' }
  +sub table_class { 'Apache::Cookie::Table' }
  +
  +package Apache::Cookie::Table;
   use base 'APR::Table';
   sub value_class { 'Apache::Cookie' }
   
  +
   package Apache::Cookie;
   push our(@ISA), __PACKAGE__ -> env;
   
   use overload '"' => sub {${$_[0]}};
  +
   sub status { ${$_[0]} + 0 }
   
   sub new {
  
  
  
  1.4       +139 -2    httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h
  
  Index: Apache__Request.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Apache__Request.h	31 May 2003 07:01:51 -0000	1.3
  +++ Apache__Request.h	7 Jun 2003 19:57:42 -0000	1.4
  @@ -1,2 +1,139 @@
  -APREQ_XS_DEFINE_SV_CONVERT(request, "Apache::Request");
  -APREQ_XS_DEFINE_SV_TIE(param, "Apache::Request::Param");
  +APREQ_XS_DEFINE_CONVERT(request);
  +
  +#define apreq_xs_sv2request(sv) apreq_xs_request_perl2c(aTHX_ sv)
  +#define apreq_xs_request2sv(r,class) apreq_xs_request_c2perl(aTHX_ r, r->env, class)
  +#define apreq_xs_request_sv2env(sv) apreq_xs_sv2request(sv)->env
  +#define apreq_xs_request2env(r) r->env
  +
  +APREQ_XS_DEFINE_OBJECT(request);
  +
  +
  +APR_INLINE
  +static SV *apreq_xs_param2sv(const apreq_param_t *param, 
  +                             const char *class)
  +{
  +    SV *sv = newSVpvn(param->v.data, param->v.size);
  +    if (param->charset == UTF_8)
  +        SvUTF8_on(sv);
  +
  +    SvTAINT(sv);
  +    return sv;
  +}
  +
  +/* there is no sv2param, since param isn't an object */
  +
  +APREQ_XS_DEFINE_MAKE(param);
  +
  +APREQ_XS_DEFINE_CONVERT(table);
  +
  +#define apreq_xs_table2sv(t,class) apreq_xs_table_c2perl(aTHX_ t,env,class)
  +#define apreq_xs_sv2table(sv) apreq_xs_table_perl2c(aTHX_ sv)
  +#define apreq_xs_table_sv2table(sv) apreq_xs_sv2table(sv)
  +
  +#define apreq_xs_request2args(r) r->args
  +#define apreq_xs_request2body(r) r->body
  +#define apreq_xs_request2params(r) apreq_params(apreq_env_pool(env),r)
  +APREQ_XS_DEFINE_TABLE(request,args);
  +APREQ_XS_DEFINE_TABLE(request,body);
  +APREQ_XS_DEFINE_TABLE(request,params);
  +APREQ_XS_DEFINE_GET(table,param);
  +
  +static XS(apreq_xs_params)
  +{
  +    dXSARGS;
  +    apreq_request_t *req;
  +    void *env;
  +
  +    if (items != 1)
  +        Perl_croak(aTHX_ "Usage: $req->params()");
  +
  +    req = apreq_xs_sv2request(ST(0));
  +    env = req->env;
  +
  +    ST(0) = apreq_xs_table2sv(apreq_params(apreq_env_pool(env),req),
  +                              apreq_xs_table_class);
  +    XSRETURN(1);
  +}
  +
  +
  +
  +/* might be used for making upload objects */
  +
  +APR_INLINE
  +static SV *apreq_xs_param2rv(const apreq_param_t *param, 
  +                             const char *class)
  +{
  +    SV *rv = sv_setref_pv(newSV(0), class, (void *)param);
  +    SvTAINT(SvRV(rv));
  +    return rv;
  +}
  +
  +#define apreq_xs_rv2param(sv) ((apreq_param_t *)SvIVX(SvRV(sv)))
  +
  +
  +
  +
  +static int apreq_xs_param_table_do(void *data, const char *key,
  +                                   const char *val)
  +{
  +    struct do_arg *d = (struct do_arg *)data;
  +    void *env = d->env;
  +    const char *class = d->class;
  +    dTHXa(d->perl);
  +    dSP;
  +    if (val)
  +        XPUSHs(sv_2mortal(apreq_xs_param2sv(
  +                   apreq_value_to_param(apreq_strtoval(val)),class)));
  +
  +    else
  +        XPUSHs(&PL_sv_undef);
  +
  +    PUTBACK;
  +    return 1;
  +}
  +
  +static XS(apreq_xs_param)
  +{
  +    dXSARGS;
  +    const char *key = NULL;
  +
  +    if (items == 1 || items == 2) {
  +        SV *sv = ST(0);
  +        apreq_request_t *req = apreq_xs_sv2request(sv);
  +        void *env = req->env;
  +        const char *class = apreq_xs_value_class;
  +        struct do_arg d = { class, env, aTHX };
  +
  +        if (items == 2)
  +            key = SvPV_nolen(ST(1));
  +
  +        if (req == NULL)
  +            Perl_croak(aTHX_ "Usage: $req->param($key)");
  +
  +        switch (GIMME_V) {
  +            const apreq_param_t *param;
  +
  +        case G_ARRAY:
  +            XSprePUSH;
  +            PUTBACK;
  +            apr_table_do(apreq_xs_param_table_do, &d, req->args, key, NULL);
  +            if (req->body)
  +                apr_table_do(apreq_xs_param_table_do,&d,req->body,key,NULL);
  +
  +            break;
  +
  +        case G_SCALAR:
  +            param = apreq_param(req, key);
  +            if (param == NULL)
  +                XSRETURN_UNDEF;
  +
  +            ST(0) = sv_2mortal(apreq_xs_param2sv(param, class));
  +            XSRETURN(1);
  +
  +        default:
  +            XSRETURN(0);
  +        }
  +    }
  +    else
  +	Perl_croak(aTHX_ "Usage: $table->get($key)");
  +}
  
  
  
  1.2       +14 -7     httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pm
  
  Index: Request_pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Request_pm	30 May 2003 19:15:22 -0000	1.1
  +++ Request_pm	7 Jun 2003 19:57:42 -0000	1.2
  @@ -1,12 +1,19 @@
  -# local customizations for Apache::Request
  -package Apache::Request::Value;
  -
  +use strict;
  +use warnings FATAL => 'all';
   
  +package Apache::Request::Table;
  +use base 'APR::Table';
  +sub value_class { undef }
   
   package Apache::Request;
  -sub new
  -{
  -    my $req = Apache::Request::request(shift);
  -    # parse @_ to configure $req
  +push our(@ISA), __PACKAGE__ -> env;
  +
  +sub table_class { 'Apache::Request::Table' }
  +
  +sub new {
  +    my $class = shift;
  +    my $env = shift;
  +    my $req = $class->make($env);
  +    $req->config(@_);
       return $req;
   }
  
  
  
  1.3       +33 -33    httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map
  
  Index: apreq_functions.map
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apreq_functions.map	30 May 2003 19:15:22 -0000	1.2
  +++ apreq_functions.map	7 Jun 2003 19:57:43 -0000	1.3
  @@ -1,45 +1,45 @@
   ##########  APREQ Functions  ##########
  +
  +MODULE=Apache::Request PACKAGE=Apache::Request::Table PREFIX=apreq_
  + DEFINE_get          | apreq_xs_table_table_get |
  + DEFINE_FETCH        | apreq_xs_table_table_get |
  +
  +! apreq_make_param
  +! apreq_decode_param
  +! apreq_encode_param
  +
  +MODULE=Apache::Cookie PACKAGE=Apache::Cookie
  + SV *:DEFINE_jar        | apreq_xs_jar | const char *:class, void *:env, const char *:hdr=NULL
  + SV *:DEFINE_as_string  | apreq_xs_cookie_as_string | SV *:c
  + SV *:DEFINE_make       | apreq_xs_make_cookie(aTHX_ class, env, name, val) | const char *:class, void *:env, SV *:name, SV *:val
  +      DEFINE_expires    | apreq_xs_cookie_expires   |
  +      DEFINE_set_attr   | apreq_xs_cookie_set_attr  |
  +      DEFINE_env        | apreq_xs_env              |
  + apr_status_t:DEFINE_bake | apreq_cookie_bake (apreq_xs_sv2cookie(c), apreq_xs_cookie_perl2env(c)) | SV *:c
  + apr_status_t:DEFINE_bake2| apreq_cookie_bake2(apreq_xs_sv2cookie(c), apreq_xs_cookie_perl2env(c)) | SV *:c
  +
  +MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Jar
  + DEFINE_get        | apreq_xs_jar_table_get |
  + DEFINE_cookies    | apreq_xs_jar_cookies   |
  +
  +MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Table
  + DEFINE_get        | apreq_xs_table_table_get |
  + DEFINE_FETCH      | apreq_xs_table_table_get |
  +
  +
   MODULE=Apache::Request PACKAGE=Apache::Request PREFIX=apreq_
  - apreq_request
  + apreq_request | apreq_xs_request | const char *:class, void *:env, const char *:qs=NULL
    apreq_parse_request
  - apreq_param
    apreq_params
  -
  -MODULE=Apache::Request  PACKAGE=Apache::Request::Value PREFIX=apreq_
  - apreq_make_value
  - apreq_copy_value
  - apreq_merge_values
  -
  -MODULE=Apache::Request PACKAGE=Apache::Request::Parser PREFIX=apreq_
  - apreq_parser
  - apreq_make_parser
  -
  -MODULE=Apache::Request PACKAGE=Apache::Request::Param PREFIX=apreq_
  - apreq_make_param
  - apreq_decode_param
  - apreq_encode_param
  -
  -MODULE=Apache::Cookie PACKAGE=Apache::Cookie PREFIX=apreq_
  - apreq_make_cookie
  - apreq_cookie_as_string
  - apreq_serialize_cookie
  - apreq_bake_cookie
  - apreq_bake2_cookie
  - apreq_cookie_expires
  -
  -MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Jar PREFIX=apreq_
  - apreq_jar
  - apreq_cookie
  - apreq_add_cookie
  -
  + DEFINE_param | apreq_xs_param |
   
   MODULE=Apache::Request PACKAGE=Apache::Request::Util PREFIX=apreq_
    apreq_log
  - apreq_join
  +# apreq_join
    apreq_index
    apreq_encode
  - apreq_decode
  - apreq_expires
  +# apreq_decode
  +# apreq_expires
   
   
   
  
  
  
  1.3       +13 -13    httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_structures.map
  
  Index: apreq_structures.map
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_structures.map,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apreq_structures.map	30 May 2003 19:15:22 -0000	1.2
  +++ apreq_structures.map	7 Jun 2003 19:57:43 -0000	1.3
  @@ -23,8 +23,8 @@
   </apreq_param_t>
   
   <apreq_request_t MODULE=Apache::Request>
  -   args
  -   body
  +!   args
  +!   body
   !   parser
   !   cfg
   !  env
  @@ -43,22 +43,22 @@
   </apreq_cookie_t>
   
   <apreq_jar_t MODULE=Apache::Cookie>
  -  cookies
  -  pool
  -  env
  +! cookies
  +!  pool
  +!  env
   </apreq_jar_t>
   
   
   
  -!<apreq_hook_t MODULE=Apache::Request>
  -  hook
  -  next
  -  ctx
  +<apreq_hook_t MODULE=Apache::Request>
  +!  hook
  +!  next
  +!  ctx
   </apreq_hook_t>
   
  -!<apreq_parser_t MODULE=Apache::Request>
  -  parser
  -  content_type
  -  hook
  +<apreq_parser_t MODULE=Apache::Request>
  +!  parser
  +!  content_type
  +!  hook
   > ctx
   </apreq_parser_t>
  
  
  
  1.3       +3 -0      httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_types.map
  
  Index: apreq_types.map
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_types.map,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apreq_types.map	30 May 2003 19:15:22 -0000	1.2
  +++ apreq_types.map	7 Jun 2003 19:57:43 -0000	1.3
  @@ -1,4 +1,7 @@
   ##########  APREQ types  ##########
  +const apr_size_t | UV
  +apr_size_t | UV
  +struct SV  | SV
   
   #data structure stuff
   struct apr_pool_t           | APR::Pool