This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add a few helpers to B for INVLIST
[perl5.git] / ext / B / typemap
1 TYPEMAP
2
3 B::OP           T_OP_OBJ
4 B::UNOP         T_OP_OBJ
5 B::BINOP        T_OP_OBJ
6 B::LOGOP        T_OP_OBJ
7 B::LISTOP       T_OP_OBJ
8 B::PMOP         T_OP_OBJ
9 B::SVOP         T_OP_OBJ
10 B::PADOP        T_OP_OBJ
11 B::PVOP         T_OP_OBJ
12 B::LOOP         T_OP_OBJ
13 B::COP          T_OP_OBJ
14
15 B::SV           T_SV_OBJ
16 B::PV           T_SV_OBJ
17 B::IV           T_SV_OBJ
18 B::NV           T_SV_OBJ
19 B::PVMG         T_SV_OBJ
20 B::REGEXP       T_SV_OBJ
21 B::PVLV         T_SV_OBJ
22 B::BM           T_SV_OBJ
23 B::RV           T_SV_OBJ
24 B::GV           T_SV_OBJ
25 B::CV           T_SV_OBJ
26 B::HV           T_SV_OBJ
27 B::AV           T_SV_OBJ
28 B::IO           T_SV_OBJ
29 B::FM           T_SV_OBJ
30 B::INVLIST      T_SV_OBJ
31
32 B::MAGIC        T_MG_OBJ
33 SSize_t         T_IV
34 STRLEN          T_UV
35 PADOFFSET       T_UV
36
37 B::HE           T_HE_OBJ
38 B::RHE          T_RHE_OBJ
39
40 B::PADLIST      T_PL_OBJ
41 B::PADNAMELIST  T_PNL_OBJ
42 B::PADNAME      T_PN_OBJ
43
44 INPUT
45 T_OP_OBJ
46         if (SvROK($arg)) {
47             IV tmp = SvIV((SV*)SvRV($arg));
48             $var = INT2PTR($type,tmp);
49         }
50         else
51             croak(\"$var is not a reference\")
52
53 T_SV_OBJ
54         if (SvROK($arg)) {
55             IV tmp = SvIV((SV*)SvRV($arg));
56             $var = INT2PTR($type,tmp);
57         }
58         else
59             croak(\"$var is not a reference\")
60
61 T_MG_OBJ
62         if (SvROK($arg)) {
63             IV tmp = SvIV((SV*)SvRV($arg));
64             $var = INT2PTR($type,tmp);
65         }
66         else
67             croak(\"$var is not a reference\")
68
69 T_HE_OBJ
70         if (SvROK($arg)) {
71             IV tmp = SvIV((SV*)SvRV($arg));
72             $var = INT2PTR($type,tmp);
73         }
74         else
75             croak(\"$var is not a reference\")
76
77 T_RHE_OBJ
78         if (SvROK($arg)) {
79             IV tmp = SvIV((SV*)SvRV($arg));
80             $var = INT2PTR($type,tmp);
81         }
82         else
83             croak(\"$var is not a reference\")
84
85 T_PL_OBJ
86         if (SvROK($arg)) {
87             IV tmp = SvIV((SV*)SvRV($arg));
88             $var = INT2PTR($type,tmp);
89         }
90         else
91             croak(\"$var is not a reference\")
92
93 T_PNL_OBJ
94         if (SvROK($arg)) {
95             IV tmp = SvIV((SV*)SvRV($arg));
96             $var = INT2PTR($type,tmp);
97         }
98         else
99             croak(\"$var is not a reference\")
100
101 T_PN_OBJ
102         if (SvROK($arg)) {
103             IV tmp = SvIV((SV*)SvRV($arg));
104             $var = INT2PTR($type,tmp);
105         }
106         else
107             croak(\"$var is not a reference\")
108
109 OUTPUT
110 T_MG_OBJ
111         sv_setiv(newSVrv($arg, "B::MAGIC"), PTR2IV($var));
112
113 T_HE_OBJ
114         sv_setiv(newSVrv($arg, "B::HE"), PTR2IV($var));
115
116 T_RHE_OBJ
117         sv_setiv(newSVrv($arg, "B::RHE"), PTR2IV($var));
118
119 T_PL_OBJ
120         sv_setiv(newSVrv($arg, $var ? "B::PADLIST" : "B::NULL"),
121                  PTR2IV($var));
122
123 T_PNL_OBJ
124         sv_setiv(newSVrv($arg, $var ? "B::PADNAMELIST" : "B::NULL"),
125                  PTR2IV($var));
126
127 T_PN_OBJ
128         sv_setiv(newSVrv($arg, $var ? "B::PADNAME" : "B::SPECIAL"),
129                  PTR2IV($var));