summaryrefslogtreecommitdiffstats
path: root/contrib/nvi/perl_api/typemap
blob: 0e38a9c07bc7c6036eb66dfc7169db28299f3348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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