1 #ifndef bool 2 #include <iostream.h> 3 #endif 4 extern "C" { 5 #include "EXTERN.h" 6 #include "perl.h" 7 #include "XSUB.h" 8 #include "INLINE.h" 9 } 10 #ifdef bool 11 #undef bool 12 #include <iostream.h> 13 #endif 14 15 class Foo { 16 public: Foo()17 Foo() { 18 secret=0; 19 } 20 ~Foo()21 ~Foo() { } 22 get_secret()23 int get_secret() { return secret; } set_secret(int s)24 void set_secret(int s) { 25 Inline_Stack_Vars; 26 secret = s; 27 } 28 29 protected: 30 int secret; 31 }; 32 33 class Bar : public Foo { 34 public: Bar(int s)35 Bar(int s) { secret = s; } ~Bar()36 ~Bar() { } 37 set_secret(int s)38 void set_secret(int s) { secret = s * 2; } 39 }; 40 41 MODULE = Math::Geometry::Planar::GPC::Inherit PACKAGE = main::Foo 42 43 PROTOTYPES: DISABLE 44 45 Foo * 46 Foo::new() 47 48 void 49 Foo::DESTROY() 50 51 int 52 Foo::get_secret() 53 54 void 55 Foo::set_secret(s) 56 int s 57 PREINIT: 58 I32 * __temp_markstack_ptr; 59 PPCODE: 60 __temp_markstack_ptr = PL_markstack_ptr++; 61 THIS->set_secret(s); 62 if (PL_markstack_ptr != __temp_markstack_ptr) { 63 /* truly void, because dXSARGS not invoked */ 64 PL_markstack_ptr = __temp_markstack_ptr; 65 XSRETURN_EMPTY; /* return empty stack */ 66 } 67 /* must have used dXSARGS; list context implied */ 68 return; /* assume stack size is correct */ 69 70 71 MODULE = Math::Geometry::Planar::GPC::Inherit PACKAGE = main::Bar 72 73 PROTOTYPES: DISABLE 74 75 Bar * 76 Bar::new(s) 77 int s 78 79 void 80 Bar::DESTROY() 81 82 void 83 Bar::set_secret(s) 84 int s 85 PREINIT: 86 I32 * __temp_markstack_ptr; 87 PPCODE: 88 __temp_markstack_ptr = PL_markstack_ptr++; 89 THIS->set_secret(s); 90 if (PL_markstack_ptr != __temp_markstack_ptr) { 91 /* truly void, because dXSARGS not invoked */ 92 PL_markstack_ptr = __temp_markstack_ptr; 93 XSRETURN_EMPTY; /* return empty stack */ 94 } 95 /* must have used dXSARGS; list context implied */ 96 return; /* assume stack size is correct */ 97 98 MODULE = Math::Geometry::Planar::GPC::Inherit PACKAGE = main 99 100 PROTOTYPES: DISABLE 101 102 BOOT: 103 { 104 #ifndef get_av 105 AV *isa = perl_get_av("main::Bar::ISA", 1); 106 #else 107 AV *isa = get_av("main::Bar::ISA", 1); 108 #endif 109 av_push(isa, newSVpv("main::Foo", 0)); 110 } 111 112