1 # "perlobject.map" Dean Roehrich, version 19960302
5 # HV * -> unblessed Perl HV object.
6 # AV * -> unblessed Perl AV object.
10 # O_* -> opaque blessed objects
11 # T_* -> opaque blessed or unblessed objects
13 # O_OBJECT -> link an opaque C or C++ object to a blessed Perl object.
14 # T_OBJECT -> link an opaque C or C++ object to an unblessed Perl object.
15 # O_HvRV -> a blessed Perl HV object.
16 # T_HvRV -> an unblessed Perl HV object.
17 # O_AvRV -> a blessed Perl AV object.
18 # T_AvRV -> an unblessed Perl AV object.
26 ######################################################################
29 # The Perl object is blessed into 'CLASS', which should be a
30 # char* having the name of the package for the blessing.
32 sv_setref_pv( $arg, CLASS, (void*)$var );
35 sv_setref_pv( $arg, Nullch, (void*)$var );
37 # Cannot use sv_setref_pv() because that will destroy
38 # the HV-ness of the object. Remember that newRV() will increment
41 $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) );
44 $arg = newRV((SV*)$var);
46 # Cannot use sv_setref_pv() because that will destroy
47 # the AV-ness of the object. Remember that newRV() will increment
50 $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) );
53 $arg = newRV((SV*)$var);
56 ######################################################################
60 if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
61 $var = ($type)SvIV((SV*)SvRV( $arg ));
63 warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
69 $var = ($type)SvIV((SV*)SvRV( $arg ));
71 warn( \"${Package}::$func_name() -- $var is not an SV reference\" );
76 if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) )
77 $var = (HV*)SvRV( $arg );
79 warn( \"${Package}::$func_name() -- $var is not a blessed HV reference\" );
84 if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) )
85 $var = (HV*)SvRV( $arg );
87 warn( \"${Package}::$func_name() -- $var is not an HV reference\" );
92 if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) )
93 $var = (AV*)SvRV( $arg );
95 warn( \"${Package}::$func_name() -- $var is not a blessed AV reference\" );
100 if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) )
101 $var = (AV*)SvRV( $arg );
103 warn( \"${Package}::$func_name() -- $var is not an AV reference\" );