stas 2004/05/03 23:10:37
Modified: lib/Apache ParseSource.pm lib/ModPerl Code.pm src/modules/perl mod_perl.h modperl_const.c Log: add infrastructure for new ModPerl::Const constants Revision Changes Path 1.54 +3 -0 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.53 retrieving revision 1.54 diff -u -u -r1.53 -r1.54 --- ParseSource.pm 1 May 2004 00:15:44 -0000 1.53 +++ ParseSource.pm 4 May 2004 06:10:37 -0000 1.54 @@ -257,6 +257,9 @@ table => [qw{APR_OVERLAP_TABLES_}], uri => [qw{APR_URI_}], }, + ModPerl => { + common => [qw{MODPERL_RC_}], + } ); my %defines_wanted_re; 1.121 +4 -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.120 retrieving revision 1.121 diff -u -u -r1.120 -r1.121 --- Code.pm 26 Apr 2004 20:20:01 -0000 1.120 +++ Code.pm 4 May 2004 06:10:37 -0000 1.121 @@ -641,7 +641,7 @@ my @c_src_names = qw(interp tipool log config cmd options callback handler gtop util io io_apache filter bucket mgv pcw global env cgi perl perl_global perl_pp sys module svptr_table - const constants apache_compat); + const constants apache_compat error); my @h_src_names = qw(perl_unembed); my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit); my @c_names = ('mod_perl', (map "modperl_$_", @c_src_names)); @@ -775,7 +775,7 @@ #$self->generate_constants_pod(); } -my $constant_prefixes = join '|', qw{APR?}; +my $constant_prefixes = join '|', qw{APR? MODPERL_RC}; sub generate_constants { my($self, $h_fh, $c_fh) = @_; @@ -824,6 +824,7 @@ my $postfix = lc $class; my $package = $class . '::'; my $package_len = length $package; + my($first_let) = $class =~ /^(\w)/; my $func = canon_func(qw(constants lookup), $postfix); my $proto = "SV \*$func(pTHX_ const char *name)"; @@ -834,7 +835,7 @@ $proto { - if (*name == 'A' && strnEQ(name, "$package", $package_len)) { + if (*name == '$first_let' && strnEQ(name, "$package", $package_len)) { name += $package_len; } 1.65 +1 -0 modperl-2.0/src/modules/perl/mod_perl.h Index: mod_perl.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v retrieving revision 1.64 retrieving revision 1.65 diff -u -u -r1.64 -r1.65 --- mod_perl.h 4 Mar 2004 06:01:06 -0000 1.64 +++ mod_perl.h 4 May 2004 06:10:37 -0000 1.65 @@ -28,6 +28,7 @@ extern module AP_MODULE_DECLARE_DATA perl_module; +#include "modperl_error.h" #include "modperl_flags.h" #include "modperl_hooks.h" #include "modperl_perl_global.h" 1.12 +10 -4 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.11 retrieving revision 1.12 diff -u -u -r1.11 -r1.12 --- modperl_const.c 4 Mar 2004 06:01:07 -0000 1.11 +++ modperl_const.c 4 May 2004 06:10:37 -0000 1.12 @@ -31,8 +31,8 @@ SV *val = (*lookup)(aTHX_ name); #if 0 - fprintf(stderr, "newCONSTSUB(%s, %s, %d)\n", - HvNAME(stash), name, val); + Perl_warn(aTHX_ "newCONSTSUB(%s, %s, %s)\n", + HvNAME(stash), name, SvPV_nolen(val)); #endif newCONSTSUB(stash, (char *)name, val); @@ -67,10 +67,14 @@ lookup = modperl_constants_lookup_apr; group_lookup = modperl_constants_group_lookup_apr; } - else { + else if (strnEQ(classname, "Apache", 6)) { lookup = modperl_constants_lookup_apache; group_lookup = modperl_constants_group_lookup_apache; } + else { + lookup = modperl_constants_lookup_modperl; + group_lookup = modperl_constants_group_lookup_modperl; + } if (*arg != '-') { /* only export into callers namespace without -compile arg */ @@ -111,7 +115,9 @@ Perl_croak(aTHX_ "Usage: %s->compile(...)", stashname); } - classname = *(stashname + 1) == 'P' ? "APR" : "Apache"; + classname = *(stashname + 1) == 'P' + ? "APR" + : (*stashname == 'A' ? "Apache" : "ModPerl"); arg = SvPV(ST(1),n_a); for (i=2; i<items; i++) {