Merge from vendor branch AWK:
[dragonfly.git] / contrib / nvi / perl_api / typemap
1 TYPEMAP
2 # Grr can't let it end in OBJ 'cause xsubpp would
3 # s/OBJ$/REF/ that for the DESTROY function
4 VI      T_VIOBJNOMUNGE
5 VI::OPT T_VIOBJREF
6 VI::MAP T_VIOBJREF
7 VI::MARK        T_VIOBJREF
8 AVREF   T_AVREFREF
9
10 INPUT
11 T_AVREFREF
12         if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) 
13             $var = (AV *)SvRV($arg);
14         else
15             croak(\"$var is not a reference to an array\")
16 T_VIOBJNOMUNGE
17         if (sv_isa($arg, \"VI\")) {
18             IV tmp = SvIV((SV*)SvRV($arg));
19             $var = ($type) tmp;
20             if (!tmp)
21                 croak(\"screen no longer exists\");
22         }
23         else
24             croak(\"$var is not of type ${ntype}\")
25 T_VIOBJREF
26         if (sv_isa($arg, \"${ntype}\")) {
27             IV tmp = SvIV((SV*)SvRV($arg));
28             if (sv_isa((SV *)tmp, \"VI\")) {
29                 IV tmp2 = SvIV((SV*)SvRV((SV *)tmp));
30                 $var = ($type) tmp2;
31                 if (!tmp2)
32                     croak(\"screen no longer exists\");
33             }
34             else
35                 croak(\"$var is not of type ${ntype}\");
36         }
37         else
38             croak(\"$var is not of type ${ntype}\")
39
40 OUTPUT
41 T_VIOBJNOMUNGE
42         newVIrv($arg, $var);