dougm 01/11/06 10:41:46 Modified: todo api.txt xs/Apache/RequestIO Apache__RequestIO.h xs/maps apache_functions.map modperl_functions.map Log: add Apache::RequestIO::{printf,PRINTF} methods Revision Changes Path 1.13 +1 -1 modperl-2.0/todo/api.txt Index: api.txt =================================================================== RCS file: /home/cvs/modperl-2.0/todo/api.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- api.txt 2001/10/29 01:19:16 1.12 +++ api.txt 2001/11/06 18:41:46 1.13 @@ -3,7 +3,7 @@ ------------------------------------------ tied filehandle interface: - -CLOSE, GETC, PRINTF, READLINE + -CLOSE, GETC, READLINE $r->finfo: need apr_finfo_t <-> struct stat conversion (might already be there, 1.18 +30 -1 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.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Apache__RequestIO.h 2001/11/06 17:50:56 1.17 +++ Apache__RequestIO.h 2001/11/06 18:41:46 1.18 @@ -1,7 +1,8 @@ #define mpxs_Apache__RequestRec_TIEHANDLE(stashsv, sv) \ modperl_newSVsv_obj(aTHX_ stashsv, sv) -#define mpxs_Apache__RequestRec_PRINT mpxs_Apache__RequestRec_print +#define mpxs_Apache__RequestRec_PRINT mpxs_Apache__RequestRec_print +#define mpxs_Apache__RequestRec_PRINTF mpxs_ap_rprintf #define mpxs_output_flush(r, rcfg) \ /* if ($|) */ \ @@ -55,6 +56,34 @@ mpxs_output_flush(r, rcfg); + return bytes; +} + +static MP_INLINE +apr_size_t mpxs_ap_rprintf(pTHX_ I32 items, SV **MARK, SV **SP) +{ + modperl_config_req_t *rcfg; + request_rec *r; + apr_size_t bytes = 0; + SV *sv; + + mpxs_usage_va(2, r, "$r->printf($fmt, ...)"); + + rcfg = modperl_config_req_get(r); + + /* XXX: we could have an rcfg->sprintf_buffer to reuse this SV + * across requests + */ + sv = newSV(0); + modperl_perl_do_sprintf(aTHX_ sv, items, MARK); + bytes = SvCUR(sv); + + modperl_wbucket_write(&rcfg->wbucket, SvPVX(sv), &bytes); + + mpxs_output_flush(r, rcfg); + + SvREFCNT_dec(sv); + return bytes; } 1.35 +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.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- apache_functions.map 2001/10/22 02:46:55 1.34 +++ apache_functions.map 2001/11/06 18:41:46 1.35 @@ -92,7 +92,7 @@ ap_rflush PREFIX=ap_r ~ap_rwrite -~ap_rprintf + ap_rprintf | mpxs_ | ... !ap_rputc ~ap_rputs ap_rvputs | mpxs_ | ... | puts 1.26 +3 -2 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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- modperl_functions.map 2001/10/29 01:19:16 1.25 +++ modperl_functions.map 2001/11/06 18:41:46 1.26 @@ -25,8 +25,9 @@ mpxs_Apache_request | | classname, svr=Nullsv MODULE=Apache::RequestIO PACKAGE=Apache::RequestRec - SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv - apr_size_t:DEFINE_PRINT | | ... + SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv + apr_size_t:DEFINE_PRINT | | ... + apr_size_t:DEFINE_PRINTF | | ... 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