dougm       01/09/15 10:57:25

  Modified:    lib/Apache compat.pm
               t/response/TestAPI request_rec.pm
               todo     api.txt
               xs/Apache/RequestIO Apache__RequestIO.h
               xs/maps  modperl_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  implement $r->print
  Submitted by: Philippe M . Chiasson <[EMAIL PROTECTED]>
  Reviewed by:  dougm
  
  Revision  Changes    Path
  1.12      +0 -2      modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- compat.pm 2001/09/13 04:41:44     1.11
  +++ compat.pm 2001/09/15 17:57:25     1.12
  @@ -111,8 +111,6 @@
       #XXX resolve '.' in @INC to basename $r->filename
   }
   
  -*print = \&puts;
  -
   sub finfo {
       my $r = shift;
       stat $r->filename;
  
  
  
  1.6       +10 -1     modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- request_rec.pm    2001/09/08 18:26:46     1.5
  +++ request_rec.pm    2001/09/15 17:57:25     1.6
  @@ -8,7 +8,7 @@
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 37;
  +    plan $r, tests => 40;
   
       #Apache->request($r); #PerlOptions +GlobalRequest takes care
       my $gr = Apache->request;
  @@ -88,6 +88,15 @@
   
       #no_cache
       ok $r->no_cache || 1;
  +    
  +    {
  +    local $| = 0;
  +    ok 9  == $r->print("buffered\n");
  +    ok 0  == $r->print();
  +    local $| = 1;
  +    ok 13 == $r->print('n','o','t',' ','b','u','f','f','e','r','e','d',"\n");
  +    }
  +    
   
       #no_local_copy
   
  
  
  
  1.3       +0 -3      modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- api.txt   2001/09/08 18:26:46     1.2
  +++ api.txt   2001/09/15 17:57:25     1.3
  @@ -68,9 +68,6 @@
   however, $r->sendfile is a new function that opens the file for you
   and calls ap_send_fd() underneath.
   
  -$r->print:
  -does not yet honor $|
  -
   $r->{hard,reset,soft,kill}_timeout:
   do not exist in 2.0.  should be deprecated.  consider adding noops in
   Apache::compat
  
  
  
  1.13      +29 -16    modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Apache__RequestIO.h       2001/06/20 23:59:37     1.12
  +++ Apache__RequestIO.h       2001/09/15 17:57:25     1.13
  @@ -1,17 +1,8 @@
   #define mpxs_Apache__RequestRec_TIEHANDLE(stashsv, sv) \
   modperl_newSVsv_obj(aTHX_ stashsv, sv)
   
  -#define mpxs_Apache__RequestRec_PRINT mpxs_ap_rvputs
  +#define mpxs_Apache__RequestRec_PRINT mpxs_Apache__RequestRec_print
   
  -#if 0
  -#define MP_USE_AP_RWRITE
  -#endif
  -
  -#ifdef MP_USE_AP_RWRITE
  -
  -#define mpxs_call_rwrite(r,buf,len) \
  -ap_rwrite(buf, len, r)
  -
   #define mpxs_rwrite_loop(func,obj) \
       while (MARK <= SP) { \
           STRLEN len; \
  @@ -21,8 +12,6 @@
           MARK++; \
       }
   
  -#endif
  -
   static MP_INLINE apr_size_t mpxs_ap_rvputs(pTHX_ I32 items,
                                              SV **MARK, SV **SP)
   {
  @@ -39,11 +28,7 @@
   
       MP_START_TIMES();
   
  -#ifdef MP_USE_AP_RWRITE
  -    mpxs_rwrite_loop(mpxs_call_rwrite, r);
  -#else
       mpxs_write_loop(modperl_wbucket_write, &rcfg->wbucket);
  -#endif
   
       MP_END_TIMES();
       MP_PRINT_TIMES("r->puts");
  @@ -52,6 +37,34 @@
   
       return bytes;
   }
  +
  +static MP_INLINE
  +apr_size_t mpxs_Apache__RequestRec_print(pTHX_ I32 items,
  +                                         SV **MARK, SV **SP)
  +{
  +    modperl_config_srv_t *scfg;
  +    modperl_config_req_t *rcfg;
  +    request_rec *r;
  +    
  +    /* bytes must be called bytes */
  +    apr_size_t bytes = 0;
  +    
  +    /* this also magically assings to r ;-) */
  +    mpxs_usage_va_1(r, "$r->print(...)");
  +    
  +    rcfg = modperl_config_req_get(r);
  +    scfg = modperl_config_srv_get(r->server);
  +    
  +    mpxs_write_loop(modperl_wbucket_write, &rcfg->wbucket);
  +    
  +    /* if ($|) */
  +    if (IoFLUSH(PL_defoutgv)){
  +        modperl_wbucket_flush(&rcfg->wbucket);
  +        ap_rflush(r);
  +    }
  +    
  +    return bytes;
  +}  
   
   /* alias */
   #define mpxs_Apache__RequestRec_WRITE mpxs_Apache__RequestRec_write
  
  
  
  1.19      +1 -0      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- modperl_functions.map     2001/09/13 04:41:44     1.18
  +++ modperl_functions.map     2001/09/15 17:57:25     1.19
  @@ -21,6 +21,7 @@
    mpxs_Apache__RequestRec_read | | r, buffer, bufsiz, offset=0
    long:DEFINE_READ | | request_rec *:r, SV *:buffer, int:bufsiz, int:offset=0
    mpxs_Apache__RequestRec_write | | r, buffer, bufsiz=-1, offset=0
  + mpxs_Apache__RequestRec_print | | ...
    apr_ssize_t:DEFINE_WRITE | | \
                request_rec *:r, SV *:buffer, apr_ssize_t:bufsiz=-1, int:offset=0
   
  
  
  
  1.25      +23 -1     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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- FunctionTable.pm  2001/09/13 04:41:44     1.24
  +++ FunctionTable.pm  2001/09/15 17:57:25     1.25
  @@ -2,7 +2,7 @@
   
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   # ! WARNING: generated by ModPerl::ParseSource/0.01
  -# !          Wed Sep 12 21:41:47 2001
  +# !          Sat Sep 15 10:58:15 2001
   # !          do NOT edit, any changes will be lost !
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   
  @@ -3396,6 +3396,28 @@
         {
           'type' => 'request_rec *',
           'name' => 'r'
  +      }
  +    ]
  +  },
  +  {
  +    'return_type' => 'apr_size_t',
  +    'name' => 'mpxs_Apache__RequestRec_print',
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'I32',
  +        'name' => 'items'
  +      },
  +      {
  +        'type' => 'SV **',
  +        'name' => 'mark'
  +      },
  +      {
  +        'type' => 'SV **',
  +        'name' => 'sp'
         }
       ]
     },
  
  
  

Reply via email to