SEXP T_PTRSEXP

#############################################################################
INPUT

T_PTRSEXP
	if( $arg == &PL_sv_undef ) {
		$var = R_NilValue;
	} else if (SvROK($arg) && sv_derived_from($arg, \"Statistics::NiceR::Sexp\")) {
            IV tmp = SvIV((SV*)SvRV($arg));
            $var = INT2PTR($type,tmp);
        } else {
            Perl_croak(aTHX_ \"%s: %s is not of type %s\",
                        ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
                        \"$var\", \"Statistics::NiceR::Sexp\");
	}

#############################################################################
OUTPUT

T_PTRSEXP
	if( $var == R_NilValue ) {
		$arg = &PL_sv_undef;
	} else {
		sv_setref_pv($arg, \"Statistics::NiceR::Sexp\", (void*)$var);
	}
