Lite/Util/typemap
raw| 1 | # |
| 2 | # Map C types to Perl types |
| 3 | # |
| 4 | |
| 5 | struct in_addr * T_PTROBJ |
| 6 | |
| 7 | # |
| 8 | # Input conversions |
| 9 | # |
| 10 | |
| 11 | INPUT |
| 12 | |
| 13 | T_PTROBJ |
| 14 | if (sv_derived_from($arg, \"${ntype}\")) { |
| 15 | IV tmp = SvIV((SV*)SvRV($arg)); |
| 16 | $var = ($type) tmp; |
| 17 | } |
| 18 | else |
| 19 | croak(\"$var is not of type ${ntype}\") |
| 20 | |
| 21 | # |
| 22 | # Output conversions |
| 23 | # |
| 24 | |
| 25 | OUTPUT |
| 26 | |
| 27 | T_PTROBJ |
| 28 | sv_setref_pv($arg, \"${ntype}\", (void*)$var); |