typemap
raw| 1 | TYPEMAP |
| 2 | Detector * O_OBJECT |
| 3 | |
| 4 | INPUT |
| 5 | O_OBJECT |
| 6 | if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) { |
| 7 | $var = ($type)SvIV((SV*)SvRV( $arg )); |
| 8 | } else { |
| 9 | warn(\"${Package}::$func_name() -- $var is not a blessed SV reference\"); |
| 10 | XSRETURN_UNDEF; |
| 11 | } |
| 12 | |
| 13 | OUTPUT |
| 14 | # The Perl object is blessed into 'CLASS', which should be a |
| 15 | # char * having the name of the package for the blessing. |
| 16 | O_OBJECT |
| 17 | sv_setref_pv($arg, CLASS, (void*)$var); |
| 18 |