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
VI::LINE	T_VIOBJREF
VI::TAGQ	T_VITAGQ
VI::TAGQ2	T_VITAGQ2
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}\")
T_VITAGQ
	if (sv_isa($arg, \"VI::TAGQ\")) {
	    $var = ($type) SvIV((SV*)SvRV($arg));
	    if ($var->tqp == 0)
		croak(\"Tag queue invalidated\");
	} else
	    croak(\"$var is not of type ${ntype}\")
T_VITAGQ2
	if (sv_isa($arg, \"VI::TAGQ\")) {
	    $var = ($type) SvIV((SV*)SvRV($arg));
	} else
	    croak(\"$var is not of type ${ntype}\")

OUTPUT
T_VIOBJNOMUNGE
	newVIrv($arg, $var);
