This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
5df5b2646fd438dc2dfdc6aa4479d1e204baa110
[perl5.git] / ext / Thread / typemap
1 Thread          T_XSCPTR
2
3 INPUT
4 T_XSCPTR
5         STMT_START {
6             MAGIC *mg;
7             SV *sv = ($arg);
8
9             if (!sv_isobject(sv))
10                 croak(\"$var is not an object\");
11             sv = (SV*)SvRV(sv);
12             if (!SvRMAGICAL(sv) || !(mg = mg_find(sv, '~'))
13                 || mg->mg_private != ${ntype}_MAGIC_SIGNATURE)
14                 croak(\"XSUB ${func_name}: $var is a forged ${ntype} object\");
15             $var = ($type) SvPVX(mg->mg_obj);
16             DEBUG_S(PerlIO_printf(Perl_debug_log,
17                                   \"XSUB ${func_name}: %p\\n\", $var));
18         } STMT_END
19 T_IVREF
20         if (SvROK($arg))
21             $var = ($type) SvIV((SV*)SvRV($arg));
22         else
23             croak(\"$var is not a reference\")
24