… | |
… | |
42 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
42 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
43 | |
43 | |
44 | PROTOTYPES: ENABLE |
44 | PROTOTYPES: ENABLE |
45 | |
45 | |
46 | SV * |
46 | SV * |
47 | ptr2ref (IV ptr) |
47 | ptr2ref (UV ptr) |
48 | CODE: |
48 | CODE: |
49 | RETVAL = newRV_inc (INT2PTR (SV *, ptr)); |
49 | RETVAL = newRV_inc (INT2PTR (SV *, ptr)); |
|
|
50 | OUTPUT: |
|
|
51 | RETVAL |
|
|
52 | |
|
|
53 | UV |
|
|
54 | ref2ptr (SV *rv) |
|
|
55 | CODE: |
|
|
56 | RETVAL = PTR2UV (SvRV (rv)); |
50 | OUTPUT: |
57 | OUTPUT: |
51 | RETVAL |
58 | RETVAL |
52 | |
59 | |
53 | void |
60 | void |
54 | find_ (SV *target) |
61 | find_ (SV *target) |
… | |
… | |
151 | { |
158 | { |
152 | AV *pad = (AV *)AvARRAY (padlist)[depth]; |
159 | AV *pad = (AV *)AvARRAY (padlist)[depth]; |
153 | |
160 | |
154 | av_push (excl, newSVuv (PTR2UV (pad))); /* exclude pads themselves from being found */ |
161 | av_push (excl, newSVuv (PTR2UV (pad))); /* exclude pads themselves from being found */ |
155 | |
162 | |
|
|
163 | /* The 0th pad slot is @_ */ |
|
|
164 | if (AvARRAY (pad)[0] == targ) |
|
|
165 | res_pair ("the argument array for"); |
|
|
166 | |
156 | for (i = AvFILLp (pad) + 1; i--; ) |
167 | for (i = AvFILLp (pad) + 1; --i; ) |
157 | if (AvARRAY (pad)[i] == targ) |
168 | if (AvARRAY (pad)[i] == targ) |
158 | { |
169 | { |
159 | /* Values from constant functions are stored in the pad without any name */ |
170 | /* Values from constant functions are stored in the pad without any name */ |
160 | SV *name_sv = AvARRAY (AvARRAY (padlist)[0])[i]; |
171 | SV *name_sv = AvARRAY (AvARRAY (padlist)[0])[i]; |
161 | |
172 | |
… | |
… | |
204 | if (rmagical) |
215 | if (rmagical) |
205 | SvRMAGICAL_on (sv); |
216 | SvRMAGICAL_on (sv); |
206 | } |
217 | } |
207 | } |
218 | } |
208 | |
219 | |
|
|
220 | if (targ == (SV*)PL_main_cv) |
|
|
221 | res_text ("the main body of the program"); |
|
|
222 | |
209 | EXTEND (SP, 2); |
223 | EXTEND (SP, 2); |
210 | PUSHs (sv_2mortal (newRV_noinc ((SV *)about))); |
224 | PUSHs (sv_2mortal (newRV_noinc ((SV *)about))); |
211 | PUSHs (sv_2mortal (newRV_noinc ((SV *)excl))); |
225 | PUSHs (sv_2mortal (newRV_noinc ((SV *)excl))); |
212 | } |
226 | } |
213 | |
227 | |