perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
Date Fri, 20 Apr 2001 00:38:11 GMT
dougm       01/04/19 17:38:11

  Modified:    src/modules/perl modperl_filter.c modperl_filter.h
               t/filter/TestFilter api.pm buckets.pm input_body.pm
                        input_msg.pm
               xs/Apache/Filter Apache__Filter.h
               xs/maps  modperl_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  get rid of Apache::{Input,Output}Filter subclasses
  first argument to filter handlers is now a ap_filter_t, just like C handlers
  difference is the Apache::Filter object has a modperl_filter_t attached to it,
  for access to the read/print stream-like interface
  
  Revision  Changes    Path
  1.15      +15 -6     modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- modperl_filter.c	2001/04/19 21:26:35	1.14
  +++ modperl_filter.c	2001/04/20 00:38:08	1.15
  @@ -51,11 +51,6 @@
   
   /* generic filter routines */
   
  -static char *filter_classes[] = {
  -    "Apache::InputFilter",
  -    "Apache::OutputFilter",
  -};
  -
   modperl_filter_t *modperl_filter_new(ap_filter_t *f,
                                        apr_bucket_brigade *bb,
                                        modperl_filter_mode_e mode)
  @@ -79,6 +74,18 @@
       return filter;
   }
   
  +static void modperl_filter_mg_set(pTHX_ SV *obj, modperl_filter_t *filter)
  +{
  +    sv_magic(SvRV(obj), obj, '~', NULL, 0);
  +    SvMAGIC(SvRV(obj))->mg_ptr = (char *)filter;
  +}
  +
  +modperl_filter_t *modperl_filter_mg_get(pTHX_ SV *obj)
  +{
  +    MAGIC *mg = mg_find(SvRV(obj), '~');
  +    return mg ? (modperl_filter_t *)mg->mg_ptr : NULL;
  +}
  +
   int modperl_run_filter(modperl_filter_t *filter, ap_input_mode_t mode)
   {
       AV *args = Nullav;
  @@ -94,9 +101,11 @@
       MP_dINTERP_SELECT(r, c, s);
   
       modperl_handler_make_args(aTHX_ &args,
  -                              filter_classes[filter->mode], filter,
  +                              "Apache::Filter", filter->f,
                                 "APR::Brigade", filter->bb,
                                 NULL);
  +
  +    modperl_filter_mg_set(aTHX_ AvARRAY(args)[0], filter);
   
       if (filter->mode == MP_INPUT_FILTER_MODE) {
           av_push(args, newSViv(mode));
  
  
  
  1.4       +2 -0      modperl-2.0/src/modules/perl/modperl_filter.h
  
  Index: modperl_filter.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_filter.h	2001/04/19 17:44:17	1.3
  +++ modperl_filter.h	2001/04/20 00:38:08	1.4
  @@ -23,6 +23,8 @@
                                        apr_bucket_brigade *bb,
                                        modperl_filter_mode_e mode);
   
  +modperl_filter_t *modperl_filter_mg_get(pTHX_ SV *obj);
  +
   int modperl_run_filter(modperl_filter_t *filter, ap_input_mode_t mode);
   
   MP_INLINE modperl_filter_t *modperl_sv2filter(pTHX_ SV *sv);
  
  
  
  1.2       +4 -6      modperl-2.0/t/filter/TestFilter/api.pm
  
  Index: api.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/api.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- api.pm	2001/04/13 07:17:06	1.1
  +++ api.pm	2001/04/20 00:38:09	1.2
  @@ -14,7 +14,7 @@
       my $filter = shift;
   
       {
  -        package Apache::OutputFilter;
  +        package Apache::Filter;
           #XXX: make part of standard api?
           unless (defined &PRINT) {
               *PRINT = \&print;
  @@ -40,17 +40,15 @@
   
       ok $buffer eq $response_data;
   
  -    my $f = $filter->f;
  +    ok $filter->isa('Apache::Filter');
   
  -    ok $f->isa('Apache::Filter');
  +    my $frec = $filter->frec;
   
  -    my $frec = $f->frec;
  -
       ok $frec->isa('Apache::FilterRec');
   
       ok $frec->name;
   
  -    my $r = $f->r;
  +    my $r = $filter->r;
   
       ok $r->isa('Apache::RequestRec');
   
  
  
  
  1.3       +2 -2      modperl-2.0/t/filter/TestFilter/buckets.pm
  
  Index: buckets.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/buckets.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- buckets.pm	2001/04/19 17:31:06	1.2
  +++ buckets.pm	2001/04/20 00:38:09	1.3
  @@ -26,7 +26,7 @@
   
       my $tests = Apache::TestToString->finish;
   
  -    my $brigade = APR::Brigade->new($filter->f->r->pool);
  +    my $brigade = APR::Brigade->new($filter->r->pool);
       my $bucket = APR::Bucket->new($tests);
   
       $brigade->insert_tail($bucket);
  @@ -34,7 +34,7 @@
       my $ok = $brigade->first->type->name =~ /mod_perl/ ? 4 : 0;
       $brigade->insert_tail(APR::Bucket->new("ok $ok\n"));
   
  -    $filter->f->next->pass_brigade($brigade);
  +    $filter->next->pass_brigade($brigade);
   
       Apache::OK;
   }
  
  
  
  1.2       +1 -1      modperl-2.0/t/filter/TestFilter/input_body.pm
  
  Index: input_body.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/input_body.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- input_body.pm	2001/04/19 17:46:36	1.1
  +++ input_body.pm	2001/04/20 00:38:09	1.2
  @@ -19,7 +19,7 @@
       my($filter, $bb, $mode) = @_;
   
       if ($bb->empty) {
  -        my $rv = $filter->f->next->get_brigade($bb, $mode);
  +        my $rv = $filter->next->get_brigade($bb, $mode);
   
           if ($rv != APR::SUCCESS) {
               return $rv;
  
  
  
  1.2       +1 -1      modperl-2.0/t/filter/TestFilter/input_msg.pm
  
  Index: input_msg.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/input_msg.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- input_msg.pm	2001/04/19 21:28:03	1.1
  +++ input_msg.pm	2001/04/20 00:38:09	1.2
  @@ -20,7 +20,7 @@
       my($filter, $bb, $mode) = @_;
   
       if ($bb->empty) {
  -        my $rv = $filter->f->next->get_brigade($bb, $mode);
  +        my $rv = $filter->next->get_brigade($bb, $mode);
   
           if ($rv != APR::SUCCESS) {
               return $rv;
  
  
  
  1.6       +5 -8      modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Apache__Filter.h	2001/04/19 21:26:42	1.5
  +++ Apache__Filter.h	2001/04/20 00:38:10	1.6
  @@ -1,16 +1,13 @@
  -#define mpxs_Apache__OutputFilter_f(filter) filter->f
  -
   #define mpxs_Apache__RequestRec_add_output_filter(r, name, ctx) \
   ap_add_output_filter(name, ctx, r, NULL)
   
  -/* XXX: this should be generated like the others in modperl_xs_sv_convert.h */
   #define mp_xs_sv2_modperl_filter(sv) \
   ((SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG)) \
   || (Perl_croak(aTHX_ "argument is not a blessed reference"),0) ? \
  -(modperl_filter_t *)SvIV((SV*)SvRV(sv)) : (modperl_filter_t *)NULL)
  +modperl_filter_mg_get(aTHX_ sv) : NULL)
   
  -static MP_INLINE apr_size_t mpxs_Apache__OutputFilter_print(pTHX_ I32 items,
  -                                                            SV **MARK, SV **SP)
  +static MP_INLINE apr_size_t mpxs_Apache__Filter_print(pTHX_ I32 items,
  +                                                      SV **MARK, SV **SP)
   {
       modperl_filter_t *modperl_filter;
       apr_size_t bytes = 0;
  @@ -30,8 +27,8 @@
       return bytes;
   }
   
  -static MP_INLINE apr_size_t mpxs_Apache__OutputFilter_read(pTHX_ I32 items,
  -                                                           SV **MARK, SV **SP)
  +static MP_INLINE apr_size_t mpxs_Apache__Filter_read(pTHX_ I32 items,
  +                                                     SV **MARK, SV **SP)
   {
       modperl_filter_t *modperl_filter;
       apr_size_t wanted, len=0;
  
  
  
  1.4       +3 -5      modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_functions.map	2001/04/19 17:41:41	1.3
  +++ modperl_functions.map	2001/04/20 00:38:11	1.4
  @@ -20,9 +20,7 @@
    mpxs_Apache__Server_get_handlers
   
   MODULE=Apache::Filter
  -modperl_filter_attributes | MPXS_ | ... | MODIFY_CODE_ATTRIBUTES
  + modperl_filter_attributes | MPXS_ | ... | MODIFY_CODE_ATTRIBUTES
   
  -PACKAGE=Apache::OutputFilter
  - mpxs_Apache__OutputFilter_print | | ...
  - mpxs_Apache__OutputFilter_read  | | ...
  - ap_filter_t *:DEFINE_f | | modperl_filter_t *:filter
  + mpxs_Apache__Filter_print | | ...
  + mpxs_Apache__Filter_read  | | ...
  
  
  
  1.6       +17 -3     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionTable.pm	2001/04/19 21:26:46	1.5
  +++ FunctionTable.pm	2001/04/20 00:38:11	1.6
  @@ -2,7 +2,7 @@
   
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   # ! WARNING: generated by ModPerl::ParseSource/0.01
  -# !          Thu Apr 19 12:55:37 2001
  +# !          Thu Apr 19 17:22:38 2001
   # !          do NOT edit, any changes will be lost !
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   
  @@ -1895,6 +1895,20 @@
       'name' => 'modperl_filter_new'
     },
     {
  +    'return_type' => 'modperl_filter_t *',
  +    'args' => [
  +      {
  +        'name' => 'my_perl',
  +        'type' => 'PerlInterpreter *'
  +      },
  +      {
  +        'name' => 'obj',
  +        'type' => 'SV *'
  +      }
  +    ],
  +    'name' => 'modperl_filter_mg_get'
  +  },
  +  {
       'return_type' => 'int',
       'args' => [
         {
  @@ -3038,7 +3052,7 @@
           'type' => 'SV **'
         }
       ],
  -    'name' => 'mpxs_Apache__OutputFilter_print'
  +    'name' => 'mpxs_Apache__Filter_print'
     },
     {
       'return_type' => 'apr_size_t',
  @@ -3060,7 +3074,7 @@
           'type' => 'SV **'
         }
       ],
  -    'name' => 'mpxs_Apache__OutputFilter_read'
  +    'name' => 'mpxs_Apache__Filter_read'
     },
     {
       'return_type' => 'U32 *',
  
  
  

Mime
View raw message