You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ge...@apache.org on 2003/05/12 15:00:17 UTC
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
geoff 2003/05/12 06:00:16
Modified: lib/Apache ParseSource.pm
lib/ModPerl Code.pm
src/modules/perl modperl_const.c modperl_module.c
t/apache constants.t
xs/tables/current/Apache ConstantsTable.pm
xs/tables/current/ModPerl FunctionTable.pm
Log:
implement DECLINE_CMD and DIR_MAGIC_TYPE constants
Submitted by: geoff
Reviewed by: stas, gozer
Revision Changes Path
1.43 +2 -2 modperl-2.0/lib/Apache/ParseSource.pm
Index: ParseSource.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/ParseSource.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- ParseSource.pm 15 Apr 2003 02:22:41 -0000 1.42
+++ ParseSource.pm 12 May 2003 13:00:15 -0000 1.43
@@ -156,8 +156,8 @@
satisfy => [qw{SATISFY_}],
remotehost => [qw{REMOTE_}],
http => [qw{HTTP_}],
-# config => [qw{DECLINE_CMD}],
-# types => [qw{DIR_MAGIC_TYPE}],
+ config => [qw{DECLINE_CMD}],
+ types => [qw{DIR_MAGIC_TYPE}],
override => [qw{OR_ ACCESS_CONF RSRC_CONF}],
log => [qw(APLOG_)],
},
1.97 +16 -3 modperl-2.0/lib/ModPerl/Code.pm
Index: Code.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- Code.pm 24 Apr 2003 01:51:37 -0000 1.96
+++ Code.pm 12 May 2003 13:00:15 -0000 1.97
@@ -769,7 +769,7 @@
my $package_len = length $package;
my $func = canon_func(qw(constants lookup), $postfix);
- my $proto = "int $func(const char *name)";
+ my $proto = "SV \*$func(pTHX_ const char *name)";
print $h_fh "$proto;\n";
@@ -804,7 +804,20 @@
print $c_fh <<EOF;
$ifdef[0]
if (strEQ(name, "$name")) {
- return $alias{$name};
+EOF
+
+ if ($name eq 'DECLINE_CMD' || $name eq 'DIR_MAGIC_TYPE') {
+ print $c_fh <<EOF;
+ return newSVpv($alias{$name}, 0);
+EOF
+ }
+ else {
+ print $c_fh <<EOF;
+ return newSViv($alias{$name});
+EOF
+ }
+
+ print $c_fh <<EOF;
}
$ifdef[1]
EOF
@@ -815,7 +828,7 @@
print $c_fh <<EOF
};
Perl_croak_nocontext("unknown constant %s", name);
- return MP_ENOCONST;
+ return newSViv(MP_ENOCONST);
}
EOF
}
1.9 +5 -5 modperl-2.0/src/modules/perl/modperl_const.c
Index: modperl_const.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_const.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- modperl_const.c 22 Oct 2001 05:42:23 -0000 1.8
+++ modperl_const.c 12 May 2003 13:00:15 -0000 1.9
@@ -1,27 +1,27 @@
#include "mod_perl.h"
#include "modperl_const.h"
-typedef int (*constants_lookup)(const char *);
+typedef SV *(*constants_lookup)(pTHX_ const char *);
typedef const char ** (*constants_group_lookup)(const char *);
-static int new_constsub(pTHX_ constants_lookup lookup,
+static SV *new_constsub(pTHX_ constants_lookup lookup,
HV *caller_stash, HV *stash,
const char *name)
{
int name_len = strlen(name);
GV **gvp = (GV **)hv_fetch(stash, name, name_len, TRUE);
- int val;
+ SV *val;
/* dont redefine */
if (!isGV(*gvp) || !GvCV(*gvp)) {
- val = (*lookup)(name);
+ val = (*lookup)(aTHX_ name);
#if 0
fprintf(stderr, "newCONSTSUB(%s, %s, %d)\n",
HvNAME(stash), name, val);
#endif
- newCONSTSUB(stash, (char *)name, newSViv(val));
+ newCONSTSUB(stash, (char *)name, val);
#ifdef GvSHARED
GvSHARED_on(*gvp);
#endif
1.13 +2 -2 modperl-2.0/src/modules/perl/modperl_module.c
Index: modperl_module.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_module.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- modperl_module.c 14 Apr 2003 06:38:50 -0000 1.12
+++ modperl_module.c 12 May 2003 13:00:15 -0000 1.13
@@ -669,7 +669,7 @@
}
else {
cmd->args_how =
- modperl_constants_lookup_apache(SvPV(val, len));
+ SvIV(modperl_constants_lookup_apache(aTHX_ SvPV(val, len)));
}
}
@@ -695,7 +695,7 @@
}
else {
cmd->req_override =
- modperl_constants_lookup_apache(SvPV(val, len));
+ SvIV(modperl_constants_lookup_apache(aTHX_ SvPV(val, len)));
}
}
1.6 +5 -2 modperl-2.0/t/apache/constants.t
Index: constants.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apache/constants.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- constants.t 18 May 2002 02:29:44 -0000 1.5
+++ constants.t 12 May 2003 13:00:15 -0000 1.6
@@ -5,10 +5,11 @@
use Test;
use Apache2 ();
-use Apache::Const -compile => qw(DECLINED :http :common TAKE23 &OPT_EXECCGI);
+use Apache::Const -compile => qw(DECLINED :http :common TAKE23 &OPT_EXECCGI
+ DECLINE_CMD DIR_MAGIC_TYPE);
use Apache::Const; #defaults to :common
-plan tests => 13;
+plan tests => 15;
ok REDIRECT == 302;
ok AUTH_REQUIRED == 401;
@@ -17,6 +18,8 @@
ok Apache::DECLINED == -1;
ok Apache::HTTP_GONE == 410;
ok Apache::OPT_EXECCGI;
+ok Apache::DECLINE_CMD eq "\x07\x08";
+ok Apache::DIR_MAGIC_TYPE eq "httpd/unix-directory";
ok ! defined &M_GET;
Apache::Const->import('M_GET');
1.28 +6 -0 modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm
Index: ConstantsTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ConstantsTable.pm 24 Aug 2002 17:14:39 -0000 1.27
+++ ConstantsTable.pm 12 May 2003 13:00:15 -0000 1.28
@@ -143,6 +143,12 @@
'HTTP_INSUFFICIENT_STORAGE',
'HTTP_NOT_EXTENDED'
],
+ 'config' => [
+ 'DECLINE_CMD'
+ ],
+ 'types' => [
+ 'DIR_MAGIC_TYPE'
+ ],
'filter_type' => [
'AP_FTYPE_RESOURCE',
'AP_FTYPE_CONTENT_SET',
1.114 +2 -2 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
Index: FunctionTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -r1.113 -r1.114
--- FunctionTable.pm 9 May 2003 03:33:02 -0000 1.113
+++ FunctionTable.pm 12 May 2003 13:00:15 -0000 1.114
@@ -1473,7 +1473,7 @@
]
},
{
- 'return_type' => 'int',
+ 'return_type' => 'SV *',
'name' => 'modperl_constants_lookup_apache',
'args' => [
{
@@ -1483,7 +1483,7 @@
]
},
{
- 'return_type' => 'int',
+ 'return_type' => 'SV *',
'name' => 'modperl_constants_lookup_apr',
'args' => [
{