--- EV/typemap 2007/10/29 07:56:03 1.5 +++ EV/typemap 2007/10/31 10:50:05 1.7 @@ -1,33 +1,39 @@ -Base T_BASE -Event T_EVENT Signal T_SIGNAL -/* for 5.6 compatibility */ -const char * T_PV +struct ev_watcher * T_WATCHER +struct ev_io * T_WATCHER +struct ev_time * T_WATCHER +struct ev_timer * T_WATCHER +struct ev_periodic * T_WATCHER +struct ev_signal * T_WATCHER +struct ev_idle * T_WATCHER +struct ev_check * T_WATCHER -INPUT - -T_BASE - if (!(SvROK ($arg) && SvOBJECT (SvRV ($arg)) - && SvSTASH (SvRV ($arg)) == stash_base)) - croak (\"object is not of type EV::Base\"); - $var = (Base)SvIV (SvRV ($arg)); +char * T_PVbyte +const char * T_PVbyte -T_EVENT - if (!(SvROK ($arg) && SvOBJECT (SvRV ($arg)) - && SvSTASH (SvRV ($arg)) == stash_event)) - croak (\"object is not of type EV::Event\"); - $var = (Event)SvPVX (SvRV ($arg)); +INPUT T_SIGNAL if (($var = sv_signum ($arg)) <= 0) croak (\"'%s' is not a valid signal number or name\", SvPV_nolen ($arg)); +T_PVbyte + $var = ($type)SvPVbyte_nolen ($arg) + +T_WATCHER + if (!(SvROK ($arg) && SvOBJECT (SvRV ($arg)) + && (SvSTASH (SvRV ($arg)) == stash_" . ($type =~ /ev_(\S+)/, "$1") . " + || sv_derived_from ($arg, \"EV::" . ($type =~ /ev_(\S+)/, ucfirst "$1") . "\")))) + croak (\"object is not of type EV::" . ($type =~ /ev_(\S+)/, ucfirst "$1") . "\"); + $var = ($type)SvPVX (SvRV ($arg)); + OUTPUT -T_BASE - sv_setref_iv ($arg, "EV::Base", (IV)$var); +T_PVbyte + sv_setpv ((SV *)$arg, $var); + +T_WATCHER + $arg = e_bless ((struct ev_watcher *)$var, stash_${ ($type =~ /ev_(\S+)/, \"$1") }); -T_EVENT - $arg = e_self ($var);