dougm 01/04/19 18:57:26
Modified: src/modules/perl modperl_util.c modperl_util.h
t/filter/TestFilter api.pm
xs/Apache/Filter Apache__Filter.h
xs/maps modperl_functions.map
Log:
add Apache::Filter::{TIEHANDLE,PRINT} methods
Revision Changes Path
1.7 +19 -0 modperl-2.0/src/modules/perl/modperl_util.c
Index: modperl_util.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- modperl_util.c 2001/04/09 23:57:22 1.6
+++ modperl_util.c 2001/04/20 01:57:25 1.7
@@ -33,6 +33,25 @@
return r;
}
+MP_INLINE SV *modperl_newSVsv_obj(pTHX_ SV *stashsv, SV *obj)
+{
+ SV *newobj;
+
+ if (!obj) {
+ obj = stashsv;
+ stashsv = Nullsv;
+ }
+
+ newobj = newSVsv(obj);
+
+ if (stashsv) {
+ HV *stash = gv_stashsv(stashsv, TRUE);
+ return sv_bless(newobj, stash);
+ }
+
+ return newobj;
+}
+
MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr)
{
SV *sv = newSV(0);
1.8 +2 -0 modperl-2.0/src/modules/perl/modperl_util.h
Index: modperl_util.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- modperl_util.h 2001/04/09 23:57:22 1.7
+++ modperl_util.h 2001/04/20 01:57:25 1.8
@@ -16,6 +16,8 @@
MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv);
+MP_INLINE SV *modperl_newSVsv_obj(pTHX_ SV *stashsv, SV *obj);
+
MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr);
#define modperl_bless_request_rec(r) \
1.3 +0 -9 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- api.pm 2001/04/20 00:38:09 1.2
+++ api.pm 2001/04/20 01:57:26 1.3
@@ -13,15 +13,6 @@
sub init_test_pm {
my $filter = shift;
- {
- package Apache::Filter;
- #XXX: make part of standard api?
- unless (defined &PRINT) {
- *PRINT = \&print;
- *TIEHANDLE = sub { shift };
- }
- }
-
tie *STDOUT, $filter;
$Test::TESTOUT = \*STDOUT;
1.7 +5 -0 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Apache__Filter.h 2001/04/20 00:38:10 1.6
+++ Apache__Filter.h 2001/04/20 01:57:26 1.7
@@ -6,6 +6,11 @@
|| (Perl_croak(aTHX_ "argument is not a blessed reference"),0) ? \
modperl_filter_mg_get(aTHX_ sv) : NULL)
+#define mpxs_Apache__Filter_TIEHANDLE(stashsv, sv) \
+modperl_newSVsv_obj(aTHX_ stashsv, sv)
+
+#define mpxs_Apache__Filter_PRINT mpxs_Apache__Filter_print
+
static MP_INLINE apr_size_t mpxs_Apache__Filter_print(pTHX_ I32 items,
SV **MARK, SV **SP)
{
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- modperl_functions.map 2001/04/20 00:38:11 1.4
+++ modperl_functions.map 2001/04/20 01:57:26 1.5
@@ -24,3 +24,6 @@
mpxs_Apache__Filter_print | | ...
mpxs_Apache__Filter_read | | ...
+
+ SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv
+ int:DEFINE_PRINT | | ...