summaryrefslogtreecommitdiffstats
path: root/contrib/nvi/perl_api/typemap
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/nvi/perl_api/typemap')
-rw-r--r--contrib/nvi/perl_api/typemap42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/nvi/perl_api/typemap b/contrib/nvi/perl_api/typemap
new file mode 100644
index 0000000..0e38a9c
--- /dev/null
+++ b/contrib/nvi/perl_api/typemap
@@ -0,0 +1,42 @@
+TYPEMAP
+# Grr can't let it end in OBJ 'cause xsubpp would
+# s/OBJ$/REF/ that for the DESTROY function
+VI T_VIOBJNOMUNGE
+VI::OPT T_VIOBJREF
+VI::MAP T_VIOBJREF
+VI::MARK T_VIOBJREF
+AVREF T_AVREFREF
+
+INPUT
+T_AVREFREF
+ if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV)
+ $var = (AV *)SvRV($arg);
+ else
+ croak(\"$var is not a reference to an array\")
+T_VIOBJNOMUNGE
+ if (sv_isa($arg, \"VI\")) {
+ IV tmp = SvIV((SV*)SvRV($arg));
+ $var = ($type) tmp;
+ if (!tmp)
+ croak(\"screen no longer exists\");
+ }
+ else
+ croak(\"$var is not of type ${ntype}\")
+T_VIOBJREF
+ if (sv_isa($arg, \"${ntype}\")) {
+ IV tmp = SvIV((SV*)SvRV($arg));
+ if (sv_isa((SV *)tmp, \"VI\")) {
+ IV tmp2 = SvIV((SV*)SvRV((SV *)tmp));
+ $var = ($type) tmp2;
+ if (!tmp2)
+ croak(\"screen no longer exists\");
+ }
+ else
+ croak(\"$var is not of type ${ntype}\");
+ }
+ else
+ croak(\"$var is not of type ${ntype}\")
+
+OUTPUT
+T_VIOBJNOMUNGE
+ newVIrv($arg, $var);
OpenPOWER on IntegriCloud