Skip to content

Commit

Permalink
Merge 6786f7b into f212efc
Browse files Browse the repository at this point in the history
  • Loading branch information
FGasper committed May 15, 2021
2 parents f212efc + 6786f7b commit aa3110e
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions lib/ExtUtils/typemap
Expand Up @@ -217,38 +217,54 @@ T_REF_IV_REF
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type *, tmp);
}
else
Perl_croak_nocontext(\"%s: %s is not of type %s\",
else {
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\")
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_REF_IV_PTR
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
Perl_croak_nocontext(\"%s: %s is not of type %s\",
else {
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\")
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_PTROBJ
if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak_nocontext(\"%s: %s is not of type %s\",
else {
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\")
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_PTRDESC
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
${type}_desc = (\U${type}_DESC\E*) tmp;
$var = ${type}_desc->ptr;
}
else
Perl_croak_nocontext(\"%s: %s is not of type %s\",
else {
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\")
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_REFREF
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
Expand All @@ -263,10 +279,14 @@ T_REFOBJ
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type,tmp);
}
else
Perl_croak_nocontext(\"%s: %s is not of type %s\",
else {
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\")
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_OPAQUE
$var = *($type *)SvPV_nolen($arg)
T_OPAQUEPTR
Expand Down

0 comments on commit aa3110e

Please sign in to comment.