summaryrefslogtreecommitdiff
path: root/typemap
diff options
context:
space:
mode:
Diffstat (limited to 'typemap')
-rw-r--r--typemap123
1 files changed, 26 insertions, 97 deletions
diff --git a/typemap b/typemap
index feb91b3..5011c4f 100644
--- a/typemap
+++ b/typemap
@@ -1,107 +1,36 @@
-# "perlobject.map" Dean Roehrich, version 19960302
-#
-# TYPEMAPs
-#
-# HV * -> unblessed Perl HV object.
-# AV * -> unblessed Perl AV object.
-#
-# INPUT/OUTPUT maps
-#
-# O_* -> opaque blessed objects
-# T_* -> opaque blessed or unblessed objects
-#
-# O_OBJECT -> link an opaque C or C++ object to a blessed Perl object.
-# T_OBJECT -> link an opaque C or C++ object to an unblessed Perl object.
-# O_HvRV -> a blessed Perl HV object.
-# T_HvRV -> an unblessed Perl HV object.
-# O_AvRV -> a blessed Perl AV object.
-# T_AvRV -> an unblessed Perl AV object.
-
TYPEMAP
-HV * T_HvRV
-AV * T_AvRV
-
-QRcode * O_OBJECT
-
-######################################################################
-OUTPUT
-
-# The Perl object is blessed into 'CLASS', which should be a
-# char* having the name of the package for the blessing.
-O_OBJECT
- sv_setref_pv( $arg, CLASS, (void*)$var );
-
-T_OBJECT
- sv_setref_pv( $arg, Nullch, (void*)$var );
-
-# Cannot use sv_setref_pv() because that will destroy
-# the HV-ness of the object. Remember that newRV() will increment
-# the refcount.
-O_HvRV
- $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) );
-
-T_HvRV
- $arg = newRV((SV*)$var);
-
-# Cannot use sv_setref_pv() because that will destroy
-# the AV-ness of the object. Remember that newRV() will increment
-# the refcount.
-O_AvRV
- $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) );
-
-T_AvRV
- $arg = newRV((SV*)$var);
+QRcode * T_QRCODE
+QRinput * T_QRINPUT
+QRencodeMode T_ENUM
+QRecLevel T_ENUM
-######################################################################
INPUT
-O_OBJECT
- if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
- $var = ($type)SvIV((SV*)SvRV( $arg ));
- else{
- warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
- XSRETURN_UNDEF;
+T_QRCODE
+ if (SvROK($arg) && sv_derived_from($arg, \"Data::QRCode\")) {
+ IV tmp = SvIV((SV*)SvRV($arg));
+ $var = INT2PTR($type,tmp);
}
-
-T_OBJECT
- if( SvROK($arg) )
- $var = ($type)SvIV((SV*)SvRV( $arg ));
- else{
- warn( \"${Package}::$func_name() -- $var is not an SV reference\" );
- XSRETURN_UNDEF;
- }
-
-O_HvRV
- if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) )
- $var = (HV*)SvRV( $arg );
- else {
- warn( \"${Package}::$func_name() -- $var is not a blessed HV reference\" );
- XSRETURN_UNDEF;
- }
-
-T_HvRV
- if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) )
- $var = (HV*)SvRV( $arg );
- else {
- warn( \"${Package}::$func_name() -- $var is not an HV reference\" );
- XSRETURN_UNDEF;
+ else
+ Perl_croak_nocontext(\"%s: %s is not of type %s\",
+ ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
+ \"$var\", \"Data::QRCode\")
+
+T_QRINPUT
+ if (SvROK($arg) && sv_derived_from($arg, \"Data::QRCode::Input\")) {
+ IV tmp = SvIV((SV*)SvRV($arg));
+ $var = INT2PTR($type,tmp);
}
+ else
+ Perl_croak_nocontext(\"%s: %s is not of type %s\",
+ ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
+ \"$var\", \"Data::QRCode::Input\")
-O_AvRV
- if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) )
- $var = (AV*)SvRV( $arg );
- else {
- warn( \"${Package}::$func_name() -- $var is not a blessed AV reference\" );
- XSRETURN_UNDEF;
- }
-
-T_AvRV
- if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) )
- $var = (AV*)SvRV( $arg );
- else {
- warn( \"${Package}::$func_name() -- $var is not an AV reference\" );
- XSRETURN_UNDEF;
- }
+OUTPUT
+T_QRCODE
+ sv_setref_pv($arg, \"Data::QRCode\", (void*)$var);
+T_QRINPUT
+ sv_setref_pv($arg, \"Data::QRCode::Input\", (void*)$var);