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/Apache/RequestIO Apache__RequestIO.h
Date Mon, 05 Mar 2001 03:54:18 GMT
dougm       01/03/04 19:54:18

  Added:       xs/Apache/Filter Apache__Filter.h
               xs/Apache/RequestIO Apache__RequestIO.h
  Log:
  start of the wrapper functions for Apache
  
  Revision  Changes    Path
  1.1                  modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===================================================================
  #define mpxs_Apache__RequestRec_add_output_filter(r, name, ctx) \
  ap_add_output_filter(name, ctx, r, NULL)
  
  
  
  1.1                  modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===================================================================
  #define mpxs_write_loop(func,obj) \
      while (MARK <= SP) { \
          apr_ssize_t wlen; \
          char *buf = SvPV(*MARK, wlen); \
          apr_status_t rv = func(obj, buf, &wlen); \
          if (rv != APR_SUCCESS) { \
              croak(modperl_apr_strerror(rv)); \
          } \
          bytes += wlen; \
          MARK++; \
      }
  
  #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; \
          char *buf = SvPV(*MARK, len); \
          int wlen = func(obj, buf, len); \
          bytes += wlen; \
          MARK++; \
      }
  
  #endif
  
  static MP_INLINE apr_size_t mpxs_ap_rvputs(pTHX_ I32 items,
                                             SV **MARK, SV **SP)
  {
      modperl_srv_config_t *scfg;
      modperl_request_config_t *rcfg;
      apr_size_t bytes = 0;
      request_rec *r;
      dMP_TIMES;
  
      mpxs_usage_va_1(r, "$r->puts(...)");
  
      rcfg = modperl_request_config_get(r);
      scfg = modperl_srv_config_get(r->server);
  
      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");
  
      /* XXX: flush if $| */
  
      return bytes;
  }
  
  static MP_INLINE long mpxs_ap_get_client_block(pTHX_ request_rec *r,
                                                 SV *buffer, int bufsiz)
  {
      long nrd = 0;
  
      mpxs_sv_grow(buffer, bufsiz);
  
      nrd = ap_get_client_block(r, SvPVX(buffer), bufsiz);
  
      if (nrd > 0) {
          mpxs_sv_cur_set(buffer, nrd);
          SvTAINTED_on(buffer);
      }
      else {
          sv_setsv(buffer, &PL_sv_undef); /* XXX */
      }
  
      return nrd;
  }
  
  static MP_INLINE SV *mpxs_Apache__RequestRec_TIEHANDLE(SV *classname,
                                                         SV *obj)
  {
      return obj;
  }
  
  
  

Mime
View raw message