[prev in list] [next in list] [prev in thread] [next in thread]
List: apreq-cvs
Subject: svn commit: r164889 - in /httpd/apreq/trunk/glue/perl/xsbuilder:
From: joes () apache ! org
Date: 2005-04-26 21:35:09
Message-ID: 20050426213510.56873.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: joes
Date: Tue Apr 26 14:35:06 2005
New Revision: 164889
URL: http://svn.apache.org/viewcvs?rev=164889&view=rev
Log:
Promote param() to APR::Request; start laying foundation
for APR::Request docs.
Added:
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/Apache2.pod
Removed:
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/CGI/APR__Request__CGI.h
Modified:
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/APR__Request.h
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/APR__Request__Param.h
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs
httpd/apreq/trunk/glue/perl/xsbuilder/maps/apreq_functions.map
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/APR__Request.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/APR__Request.h?rev=164889&r1=164888&r2=164889&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/APR__Request.h (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/APR__Request.h Tue Apr 26 \
14:35:06 2005 @@ -1,3 +1,5 @@
+
+
static XS(apreq_xs_parse)
{
dXSARGS;
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h?rev=164889&r1=164888&r2=164889&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h \
(original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h \
Tue Apr 26 14:35:06 2005 @@ -1,191 +1 @@
#include "mod_perl.h"
-#include "apreq_xs_tables.h"
-#define TABLE_CLASS "APR::Request::Param::Table"
-
-
-
-#if (PERL_VERSION >= 8) /* MAGIC ITERATOR REQUIRES 5.8 */
-
-/* Requires perl 5.8 or better.
- * A custom MGVTBL with its "copy" slot filled allows
- * us to FETCH a table entry immediately during iteration.
- * For multivalued keys this is essential in order to get
- * the value corresponding to the current key, otherwise
- * values() will always report the first value repeatedly.
- * With this MGVTBL the keys() list always matches up with
- * the values() list, even in the multivalued case.
- * We only prefetch the value during iteration, because the
- * prefetch adds overhead to EXISTS and STORE operations.
- * They are only "penalized" when the perl program is iterating
- * via each(), which seems to be a reasonable tradeoff.
- */
-
-static int apreq_xs_table_magic_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv,
- const char *name, int namelen)
-{
- /* Prefetch the value whenever the table iterator is > 0 */
- MAGIC *tie_magic = mg_find(nsv, PERL_MAGIC_tiedelem);
- SV *obj = SvRV(tie_magic->mg_obj);
- IV idx = SvIVX(obj);
- const apr_table_t *t = INT2PTR(apr_table_t *, idx);
- const apr_array_header_t *arr = apr_table_elts(t);
-
- idx = SvCUR(obj);
-
- if (idx > 0 && idx <= arr->nelts) {
- const apr_table_entry_t *te = (const apr_table_entry_t *)arr->elts;
- const char *param_class = mg_find(obj, PERL_MAGIC_ext)->mg_ptr;
- apreq_param_t *p = apreq_value_to_param(te[idx-1].val);
-
- SvMAGICAL_off(nsv);
- sv_setsv(nsv, sv_2mortal(apreq_xs_param2sv(aTHX_ p, param_class, obj)));
- }
-
- return 0;
-}
-
-static const MGVTBL apreq_xs_table_magic = {0, 0, 0, 0, 0,
- apreq_xs_table_magic_copy};
-
-#endif
-
-static APR_INLINE
-SV *apreq_xs_table2sv(pTHX_ const apr_table_t *t, const char *class, SV *parent,
- const char *value_class, I32 vclen)
-{
- SV *sv = (SV *)newHV();
- SV *rv = sv_setref_pv(newSV(0), class, (void *)t);
- sv_magic(SvRV(rv), parent, PERL_MAGIC_ext, value_class, vclen);
-
-#if (PERL_VERSION >= 8) /* MAGIC ITERATOR requires 5.8 */
-
- sv_magic(sv, NULL, PERL_MAGIC_ext, Nullch, -1);
- SvMAGIC(sv)->mg_virtual = (MGVTBL *)&apreq_xs_table_magic;
- SvMAGIC(sv)->mg_flags |= MGf_COPY;
-
-#endif
-
- sv_magic(sv, rv, PERL_MAGIC_tied, Nullch, 0);
- SvREFCNT_dec(rv); /* corrects SvREFCNT_inc(rv) implicit in sv_magic */
-
- return sv_bless(newRV_noinc(sv), SvSTASH(SvRV(rv)));
-}
-
-
-
-
-
-
-static int apreq_xs_table_keys(void *data, const char *key, const char *val)
-{
-#ifdef USE_ITHREADS
- struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
- dTHXa(d->perl);
-#endif
- dSP;
- apreq_param_t *p = apreq_value_to_param(val);
- SV *sv = newSVpvn(key, p->v.nlen);
-
-#ifndef USE_ITHREADS
- (void)data;
-#endif
-
- if (apreq_param_is_tainted(p))
- SvTAINTED_on(sv);
-
- XPUSHs(sv_2mortal(sv));
- PUTBACK;
- return 1;
-}
-
-static int apreq_xs_table_values(void *data, const char *key, const char *val)
-{
- struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
- dTHXa(d->perl);
- dSP;
- apreq_param_t *p = apreq_value_to_param(val);
- SV *sv = apreq_xs_param2sv(aTHX_ p, d->pkg, d->parent);
-
- XPUSHs(sv_2mortal(sv));
- PUTBACK;
- return 1;
-}
-
-static XS(apreq_xs_apache2_param)
-{
- dXSARGS;
- apreq_handle_t *req;
- SV *sv, *obj;
- IV iv;
-
- if (items == 0 || items > 2 || !SvROK(ST(0))
- || !sv_derived_from(ST(0), "APR::Request::Apache2"))
- Perl_croak(aTHX_ "Usage: APR::Request::Apache2::param($req [,$name])");
-
- sv = ST(0);
- obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
- iv = SvIVX(obj);
- req = INT2PTR(apreq_handle_t *, iv);
-
- if (items == 2 && GIMME_V == G_SCALAR) {
- apreq_param_t *p = apreq_param(req, SvPV_nolen(ST(1)));
-
- if (p != NULL) {
- ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
- sv_2mortal(ST(0));
- XSRETURN(1);
- }
- else {
- XSRETURN_UNDEF;
- }
- }
- else {
- struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
- request_rec *r;
- const apr_table_t *t;
-
- r = modperl_xs_sv2request_rec(aTHX_ sv, "Apache2::RequestRec", cv);
-
- d.pkg = NULL;
- d.parent = obj;
-
- switch (GIMME_V) {
-
- case G_ARRAY:
- XSprePUSH;
- PUTBACK;
- if (items == 1) {
- apreq_args(req, &t);
- if (t != NULL)
- apr_table_do(apreq_xs_table_keys, &d, t, NULL);
- apreq_body(req, &t);
- if (t != NULL)
- apr_table_do(apreq_xs_table_keys, &d, t, NULL);
-
- }
- else {
- char *val = SvPV_nolen(ST(1));
- apreq_args(req, &t);
- if (t != NULL)
- apr_table_do(apreq_xs_table_values, &d, t, val, NULL);
- apreq_body(req, &t);
- if (t != NULL)
- apr_table_do(apreq_xs_table_values, &d, t, val, NULL);
- }
- return;
-
- case G_SCALAR:
- t = apreq_params(req, r->pool);
- if (t == NULL)
- XSRETURN_UNDEF;
-
- ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj,
- NULL, 0);
- sv_2mortal(ST(0));
- XSRETURN(1);
-
- default:
- XSRETURN(0);
- }
- }
-}
Added: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/Apache2.pod
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/Apache2.pod?rev=164889&view=auto
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/Apache2.pod (added)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Apache2/Apache2.pod Tue Apr 26 \
14:35:06 2005 @@ -0,0 +1,33 @@
+=head1 NAME
+
+ APR::Request::Apache2
+
+=head1 SYNOPSIS
+
+ use APR::Request::Apache2;
+ my $req = APR::Request::Apache2->new($r);
+
+ my $body = $req->param("foo");
+
+=head1 DESCRIPTION
+
+=head1 APR::Request::Apache2
+
+=head1 SEE ALSO
+
+=head1 COPYRIGHT
+
+ Copyright 2003-2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/APR__Request__Param.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/APR__Request__Param.h?rev=164889&r1=164888&r2=164889&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/APR__Request__Param.h \
(original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/APR__Request__Param.h Tue \
Apr 26 14:35:06 2005 @@ -1,4 +1,5 @@
#include "apreq_xs_tables.h"
+#define TABLE_CLASS "APR::Request::Param::Table"
#if (PERL_VERSION >= 8) /* MAGIC ITERATOR REQUIRES 5.8 */
@@ -68,7 +69,268 @@
return sv_bless(newRV_noinc(sv), SvSTASH(SvRV(rv)));
}
+static int apreq_xs_table_keys(void *data, const char *key, const char *val)
+{
+#ifdef USE_ITHREADS
+ struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
+ dTHXa(d->perl);
+#endif
+ dSP;
+ apreq_param_t *p = apreq_value_to_param(val);
+ SV *sv = newSVpvn(key, p->v.nlen);
+
+#ifndef USE_ITHREADS
+ (void)data;
+#endif
+
+ if (apreq_param_is_tainted(p))
+ SvTAINTED_on(sv);
+
+ XPUSHs(sv_2mortal(sv));
+ PUTBACK;
+ return 1;
+}
+
+static int apreq_xs_table_values(void *data, const char *key, const char *val)
+{
+ struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
+ dTHXa(d->perl);
+ dSP;
+ apreq_param_t *p = apreq_value_to_param(val);
+ SV *sv = apreq_xs_param2sv(aTHX_ p, d->pkg, d->parent);
+
+ XPUSHs(sv_2mortal(sv));
+ PUTBACK;
+ return 1;
+}
+
+
+static XS(apreq_xs_args)
+{
+ dXSARGS;
+ apreq_handle_t *req;
+ SV *sv, *obj;
+ IV iv;
+
+ if (items == 0 || items > 2 || !SvROK(ST(0))
+ || !sv_derived_from(ST(0), HANDLE_CLASS))
+ Perl_croak(aTHX_ "Usage: APR::Request::args($req [,$name])");
+
+ sv = ST(0);
+ obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
+ iv = SvIVX(obj);
+ req = INT2PTR(apreq_handle_t *, iv);
+
+
+ if (items == 2 && GIMME_V == G_SCALAR) {
+ apreq_param_t *p = apreq_args_get(req, SvPV_nolen(ST(1)));
+
+ if (p != NULL) {
+ ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+ }
+ else {
+ const apr_table_t *t;
+ apr_status_t s;
+ s = apreq_args(req, &t);
+
+ if (apreq_module_status_is_error(s))
+ APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", ERROR_CLASS);
+
+ XSRETURN_UNDEF;
+ }
+ }
+ else {
+ struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
+ const apr_table_t *t;
+ apr_status_t s;
+
+ s = apreq_args(req, &t);
+
+ if (apreq_module_status_is_error(s))
+ APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", ERROR_CLASS);
+
+ if (t == NULL)
+ XSRETURN_EMPTY;
+
+ d.pkg = NULL;
+ d.parent = obj;
+
+ switch (GIMME_V) {
+
+ case G_ARRAY:
+ XSprePUSH;
+ PUTBACK;
+ if (items == 1)
+ apr_table_do(apreq_xs_table_keys, &d, t, NULL);
+ else
+ apr_table_do(apreq_xs_table_values, &d, t,
+ SvPV_nolen(ST(1)), NULL);
+ return;
+
+ case G_SCALAR:
+ ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj, NULL, 0);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+
+ default:
+ XSRETURN(0);
+ }
+ }
+}
+
+static XS(apreq_xs_body)
+{
+ dXSARGS;
+ apreq_handle_t *req;
+ SV *sv, *obj;
+ IV iv;
+
+ if (items == 0 || items > 2 || !SvROK(ST(0))
+ || !sv_derived_from(ST(0),HANDLE_CLASS))
+ Perl_croak(aTHX_ "Usage: APR::Request::body($req [,$name])");
+
+ sv = ST(0);
+ obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
+ iv = SvIVX(obj);
+ req = INT2PTR(apreq_handle_t *, iv);
+
+
+ if (items == 2 && GIMME_V == G_SCALAR) {
+ apreq_param_t *p = apreq_body_get(req, SvPV_nolen(ST(1)));
+
+ if (p != NULL) {
+ ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+ }
+ else {
+ const apr_table_t *t;
+ apr_status_t s;
+ s = apreq_body(req, &t);
+
+ if (apreq_module_status_is_error(s))
+ APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", ERROR_CLASS);
+ XSRETURN_UNDEF;
+ }
+ }
+ else {
+ struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
+ const apr_table_t *t;
+ apr_status_t s;
+
+ s = apreq_body(req, &t);
+
+ if (apreq_module_status_is_error(s))
+ APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", ERROR_CLASS);
+
+ if (t == NULL)
+ XSRETURN_EMPTY;
+
+ d.pkg = NULL;
+ d.parent = obj;
+
+ switch (GIMME_V) {
+
+ case G_ARRAY:
+ XSprePUSH;
+ PUTBACK;
+ if (items == 1)
+ apr_table_do(apreq_xs_table_keys, &d, t, NULL);
+ else
+ apr_table_do(apreq_xs_table_values, &d, t,
+ SvPV_nolen(ST(1)), NULL);
+ return;
+
+ case G_SCALAR:
+ ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj, NULL, 0);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+
+ default:
+ XSRETURN(0);
+ }
+ }
+}
+
+
+static XS(apreq_xs_param)
+{
+ dXSARGS;
+ apreq_handle_t *req;
+ SV *sv, *obj;
+ IV iv;
+
+ if (items == 0 || items > 2 || !SvROK(ST(0))
+ || !sv_derived_from(ST(0), "APR::Request"))
+ Perl_croak(aTHX_ "Usage: APR::Request::param($req [,$name])");
+
+ sv = ST(0);
+ obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
+ iv = SvIVX(obj);
+ req = INT2PTR(apreq_handle_t *, iv);
+
+ if (items == 2 && GIMME_V == G_SCALAR) {
+ apreq_param_t *p = apreq_param(req, SvPV_nolen(ST(1)));
+
+ if (p != NULL) {
+ ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+ }
+ else {
+ XSRETURN_UNDEF;
+ }
+ }
+ else {
+ struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
+ const apr_table_t *t;
+
+ d.pkg = NULL;
+ d.parent = obj;
+
+ switch (GIMME_V) {
+
+ case G_ARRAY:
+ XSprePUSH;
+ PUTBACK;
+ if (items == 1) {
+ apreq_args(req, &t);
+ if (t != NULL)
+ apr_table_do(apreq_xs_table_keys, &d, t, NULL);
+ apreq_body(req, &t);
+ if (t != NULL)
+ apr_table_do(apreq_xs_table_keys, &d, t, NULL);
+
+ }
+ else {
+ char *val = SvPV_nolen(ST(1));
+ apreq_args(req, &t);
+ if (t != NULL)
+ apr_table_do(apreq_xs_table_values, &d, t, val, NULL);
+ apreq_body(req, &t);
+ if (t != NULL)
+ apr_table_do(apreq_xs_table_values, &d, t, val, NULL);
+ }
+ return;
+
+ case G_SCALAR:
+ t = apreq_params(req, req->pool);
+ if (t == NULL)
+ XSRETURN_UNDEF;
+
+ ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj,
+ NULL, 0);
+ sv_2mortal(ST(0));
+ XSRETURN(1);
+
+ default:
+ XSRETURN(0);
+ }
+ }
+}
APR_INLINE
static SV *apreq_xs_find_bb_obj(pTHX_ SV *in)
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs?rev=164889&r1=164888&r2=164889&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs Tue Apr 26 \
14:35:06 2005 @@ -1,4 +1,3 @@
-#define TABLE_CLASS "APR::Request::Param::Table"
#ifdef AP_DEBUG
/* Undo httpd.h's strchr override. */
@@ -71,190 +70,6 @@
XSRETURN_IV(rv);
}
-static int apreq_xs_table_keys(void *data, const char *key, const char *val)
-{
-#ifdef USE_ITHREADS
- struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
- dTHXa(d->perl);
-#endif
- dSP;
- apreq_param_t *p = apreq_value_to_param(val);
- SV *sv = newSVpvn(key, p->v.nlen);
- if (apreq_param_is_tainted(p))
- SvTAINTED_on(sv);
-
-#ifndef USE_ITHREADS
- (void)data;
-#endif
- XPUSHs(sv_2mortal(sv));
- PUTBACK;
- return 1;
-}
-
-static int apreq_xs_table_values(void *data, const char *key, const char *val)
-{
- struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
- dTHXa(d->perl);
- dSP;
- apreq_param_t *p = apreq_value_to_param(val);
- SV *sv = apreq_xs_param2sv(aTHX_ p, d->pkg, d->parent);
-
- XPUSHs(sv_2mortal(sv));
- PUTBACK;
- return 1;
-}
-
-static XS(apreq_xs_args)
-{
- dXSARGS;
- apreq_handle_t *req;
- SV *sv, *obj;
- IV iv;
-
- if (items == 0 || items > 2 || !SvROK(ST(0))
- || !sv_derived_from(ST(0), HANDLE_CLASS))
- Perl_croak(aTHX_ "Usage: APR::Request::args($req [,$name])");
-
- sv = ST(0);
- obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
- iv = SvIVX(obj);
- req = INT2PTR(apreq_handle_t *, iv);
-
-
- if (items == 2 && GIMME_V == G_SCALAR) {
- apreq_param_t *p = apreq_args_get(req, SvPV_nolen(ST(1)));
-
- if (p != NULL) {
- ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
- sv_2mortal(ST(0));
- XSRETURN(1);
- }
- else {
- const apr_table_t *t;
- apr_status_t s;
- s = apreq_args(req, &t);
-
- if (apreq_module_status_is_error(s))
- APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", ERROR_CLASS);
-
- XSRETURN_UNDEF;
- }
- }
- else {
- struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
- const apr_table_t *t;
- apr_status_t s;
-
- s = apreq_args(req, &t);
-
- if (apreq_module_status_is_error(s))
- APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", ERROR_CLASS);
-
- if (t == NULL)
- XSRETURN_EMPTY;
-
- d.pkg = NULL;
- d.parent = obj;
-
- switch (GIMME_V) {
-
- case G_ARRAY:
- XSprePUSH;
- PUTBACK;
- if (items == 1)
- apr_table_do(apreq_xs_table_keys, &d, t, NULL);
- else
- apr_table_do(apreq_xs_table_values, &d, t,
- SvPV_nolen(ST(1)), NULL);
- return;
-
- case G_SCALAR:
- ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj, NULL, 0);
- sv_2mortal(ST(0));
- XSRETURN(1);
-
- default:
- XSRETURN(0);
- }
- }
-}
-
-static XS(apreq_xs_body)
-{
- dXSARGS;
- apreq_handle_t *req;
- SV *sv, *obj;
- IV iv;
-
- if (items == 0 || items > 2 || !SvROK(ST(0))
- || !sv_derived_from(ST(0),HANDLE_CLASS))
- Perl_croak(aTHX_ "Usage: APR::Request::body($req [,$name])");
-
- sv = ST(0);
- obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
- iv = SvIVX(obj);
- req = INT2PTR(apreq_handle_t *, iv);
-
-
- if (items == 2 && GIMME_V == G_SCALAR) {
- apreq_param_t *p = apreq_body_get(req, SvPV_nolen(ST(1)));
-
- if (p != NULL) {
- ST(0) = apreq_xs_param2sv(aTHX_ p, NULL, obj);
- sv_2mortal(ST(0));
- XSRETURN(1);
- }
- else {
- const apr_table_t *t;
- apr_status_t s;
- s = apreq_body(req, &t);
-
- if (apreq_module_status_is_error(s))
- APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", ERROR_CLASS);
-
- XSRETURN_UNDEF;
- }
- }
- else {
- struct apreq_xs_do_arg d = {NULL, NULL, NULL, aTHX};
- const apr_table_t *t;
- apr_status_t s;
-
- s = apreq_body(req, &t);
-
- if (apreq_module_status_is_error(s))
- APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", ERROR_CLASS);
-
- if (t == NULL)
- XSRETURN_EMPTY;
-
- d.pkg = NULL;
- d.parent = obj;
-
- switch (GIMME_V) {
-
- case G_ARRAY:
- XSprePUSH;
- PUTBACK;
- if (items == 1)
- apr_table_do(apreq_xs_table_keys, &d, t, NULL);
- else
- apr_table_do(apreq_xs_table_values, &d, t,
- SvPV_nolen(ST(1)), NULL);
- return;
-
- case G_SCALAR:
- ST(0) = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj, NULL, 0);
- sv_2mortal(ST(0));
- XSRETURN(1);
-
- default:
- XSRETURN(0);
- }
- }
-}
-
-
static XS(apreq_xs_table_FETCH)
{
dXSARGS;
@@ -518,54 +333,6 @@
OUTPUT:
RETVAL
-
-MODULE = APR::Request::Param PACKAGE = APR::Request
-
-SV*
-param(handle, key)
- SV *handle
- char *key
- PREINIT:
- SV *obj;
- IV iv;
- apreq_handle_t *req;
- apreq_param_t *param;
-
- CODE:
- obj = apreq_xs_sv2object(aTHX_ handle, HANDLE_CLASS, 'r');
- iv = SvIVX(obj);
- req = INT2PTR(apreq_handle_t *, iv);
- param = apreq_param(req, key);
-
- if (param == NULL)
- RETVAL = &PL_sv_undef;
- else
- RETVAL = apreq_xs_param2sv(aTHX_ param, NULL, obj);
-
-
- OUTPUT:
- RETVAL
-
-SV *
-params(handle, pool)
- SV *handle
- APR::Pool pool
- PREINIT:
- SV *obj;
- IV iv;
- apreq_handle_t *req;
- apr_table_t *t;
-
- CODE:
- obj = apreq_xs_sv2object(aTHX_ handle, HANDLE_CLASS, 'r');
- iv = SvIVX(obj);
- req = INT2PTR(apreq_handle_t *, iv);
- t = apreq_params(req, pool);
- RETVAL = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj, NULL, 0);
-
- OUTPUT:
- RETVAL
-
MODULE = APR::Request::Param PACKAGE = APR::Request::Param
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/maps/apreq_functions.map
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/maps/apreq_functions.map?rev=164889&r1=164888&r2=164889&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/maps/apreq_functions.map (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/maps/apreq_functions.map Tue Apr 26 \
14:35:06 2005 @@ -114,11 +114,9 @@
MODULE=APR::Request::Apache2 PACKAGE=APR::Request::Apache2 \
PREFIX=APR__Request__Apache2_ apreq_xs_handle_apache2_t *:DEFINE_new | \
apreq_handle_apache2 (r) | const char *:class, request_rec *:r
-DEFINE_param | apreq_xs_apache2_param |
MODULE=APR::Request::CGI PACKAGE=APR::Request::CGI PREFIX=APR__Request__CGI_
apreq_xs_handle_cgi_t *:DEFINE_new | apreq_handle_cgi (p) | const char *:class, \
apr_pool_t *:p
-DEFINE_param | apreq_xs_cgi_param |
#################### APR::Request::Cookie stuff ####################
@@ -140,8 +138,9 @@
#################### APR::Request::Param stuff ####################
MODULE=APR::Request::Param PACKAGE=APR::Request PREFIX=APR__Request_
-DEFINE_args | apreq_xs_args |
-DEFINE_body | apreq_xs_body |
+DEFINE_args | apreq_xs_args |
+DEFINE_body | apreq_xs_body |
+DEFINE_param | apreq_xs_param |
MODULE=APR::Request::Param PACKAGE=APR::Request::Param::Table \
PREFIX=APR__Request__Param__Table_ DEFINE_get | apreq_xs_table_FETCH |
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic