dougm       01/05/05 12:24:44

  Modified:    xs/Apache/RequestIO Apache__RequestIO.h
               xs/maps  apache_functions.map modperl_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
  Added:       t/response/TestApache write.pm
  Log:
  add $r->write method (and WRITE alias)
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/response/TestApache/write.pm
  
  Index: write.pm
  ===================================================================
  package TestApache::write;
  
  use strict;
  use warnings FATAL => 'all';
  
  use constant BUFSIZ => 512; #small for testing
  
  sub handler {
      my $r = shift;
      $r->content_type('text/plain');
  
      $r->write("1..2");
      $r->write("\n", 1);
  
      my $ok = "ok 1\n";
      $r->write($ok, 2);
      $r->write($ok, -1, 2);
  
      $ok = "not ok 2\n";
      $r->write($ok, 5, 4);
  
      0;
  }
  
  1;
  
  
  
  1.10      +28 -0     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Apache__RequestIO.h       2001/05/05 18:46:14     1.9
  +++ Apache__RequestIO.h       2001/05/05 19:24:42     1.10
  @@ -53,6 +53,34 @@
       return bytes;
   }
   
  +/* alias */
  +#define mpxs_Apache__RequestRec_WRITE mpxs_Apache__RequestRec_write
  +
  +static MP_INLINE
  +apr_ssize_t mpxs_Apache__RequestRec_write(request_rec *r,
  +                                          SV *buffer, apr_ssize_t bufsiz,
  +                                          int offset)
  +{
  +    dTHX; /*XXX*/
  +    apr_ssize_t wlen = bufsiz;
  +    const char *buf;
  +    STRLEN svlen;
  +    MP_dRCFG;
  +
  +    buf = (const char *)SvPV(buffer, svlen);
  +
  +    if (bufsiz == -1) {
  +        wlen = offset ? svlen - offset : svlen;
  +    }
  +    else {
  +        wlen = bufsiz;
  +    }
  +
  +    modperl_wbucket_write(&rcfg->wbucket, buf+offset, &wlen);
  +
  +    return wlen;
  +}
  +
   static MP_INLINE long mpxs_ap_get_client_block(pTHX_ request_rec *r,
                                                  SV *buffer, int bufsiz)
   {
  
  
  
  1.24      +1 -1      modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- apache_functions.map      2001/05/05 17:40:26     1.23
  +++ apache_functions.map      2001/05/05 19:24:43     1.24
  @@ -79,7 +79,7 @@
    ap_should_client_block
    ap_rflush
   PREFIX=ap_r
  - ap_rwrite | | r, buf, nbyte
  +~ap_rwrite
   ~ap_rprintf
   !ap_rputc
   ~ap_rputs
  
  
  
  1.15      +3 -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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- modperl_functions.map     2001/05/05 18:46:15     1.14
  +++ modperl_functions.map     2001/05/05 19:24:43     1.15
  @@ -19,6 +19,9 @@
    mpxs_Apache__RequestRec_sendfile | | r, filename=r->filename, offset=0, len=0
    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
  + apr_ssize_t:DEFINE_WRITE | | \
  +             request_rec *:r, SV *:buffer, apr_ssize_t:bufsiz=-1, int:offset=0
   
   MODULE=Apache::ServerUtil   PACKAGE=guess
    mpxs_Apache__Server_push_handlers
  
  
  
  1.16      +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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FunctionTable.pm  2001/05/05 18:46:15     1.15
  +++ FunctionTable.pm  2001/05/05 19:24:44     1.16
  @@ -2,7 +2,7 @@
   
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   # ! WARNING: generated by ModPerl::ParseSource/0.01
  -# !          Sat May  5 10:40:17 2001
  +# !          Sat May  5 12:17:55 2001
   # !          do NOT edit, any changes will be lost !
   # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   
  @@ -3680,6 +3680,28 @@
         }
       ],
       'name' => 'mpxs_ap_rvputs'
  +  },
  +  {
  +    'return_type' => 'apr_ssize_t',
  +    'args' => [
  +      {
  +        'name' => 'r',
  +        'type' => 'request_rec *'
  +      },
  +      {
  +        'name' => 'buffer',
  +        'type' => 'SV *'
  +      },
  +      {
  +        'name' => 'bufsiz',
  +        'type' => 'apr_ssize_t'
  +      },
  +      {
  +        'name' => 'offset',
  +        'type' => 'int'
  +      }
  +    ],
  +    'name' => 'mpxs_Apache__RequestRec_write'
     },
     {
       'return_type' => 'long',
  
  
  

Reply via email to