ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Devel-FindRef/FindRef.xs
(Generate patch)

Comparing Devel-FindRef/FindRef.xs (file contents):
Revision 1.20 by root, Tue Sep 8 18:12:07 2009 UTC vs.
Revision 1.23 by root, Fri May 16 06:41:37 2014 UTC

18 18
19/* pre-5.10 perls always succeed, with 5.10, we have to check first apparently */ 19/* pre-5.10 perls always succeed, with 5.10, we have to check first apparently */
20#ifndef GvNAME_HEK 20#ifndef GvNAME_HEK
21# define GvNAME_HEK(sv) 1 21# define GvNAME_HEK(sv) 1
22#endif 22#endif
23
24#ifndef PadARRAY
25# define PadARRAY(pad) AvARRAY (pad)
26# define PadlistARRAY(pl) ((PAD **)AvARRAY (pl))
27#endif
28
23 29
24#define res_pair(text) \ 30#define res_pair(text) \
25 do { \ 31 do { \
26 AV *av = newAV (); \ 32 AV *av = newAV (); \
27 av_push (av, newSVpv (text, 0)); \ 33 av_push (av, newSVpv (text, 0)); \
143 { 149 {
144 HE *he; 150 HE *he;
145 151
146 while ((he = hv_iternext ((HV *)sv))) 152 while ((he = hv_iternext ((HV *)sv)))
147 if (HeVAL (he) == targ) 153 if (HeVAL (he) == targ)
148 res_pair (form ("the member '%.*s' of", HeKLEN (he), HeKEY (he))); 154 res_pair (form ("the hash member '%.*s' of", HeKLEN (he), HeKEY (he)));
149 } 155 }
150 156
151 break; 157 break;
152 158
153 case SVt_PVCV: 159 case SVt_PVCV:
158 if (CvANON (sv) && !depth && CvPADLIST (sv)) 164 if (CvANON (sv) && !depth && CvPADLIST (sv))
159 depth = 1; 165 depth = 1;
160 166
161 if (depth) 167 if (depth)
162 { 168 {
163 AV *padlist = CvPADLIST (sv); 169 PADLIST *padlist = CvPADLIST (sv);
164 170
165 while (depth) 171 while (depth)
166 { 172 {
167 AV *pad = (AV *)AvARRAY (padlist)[depth]; 173 PAD *pad = PadlistARRAY (padlist)[depth];
168 174
169 av_push (excl, newSVuv (PTR2UV (pad))); /* exclude pads themselves from being found */ 175 av_push (excl, newSVuv (PTR2UV (pad))); /* exclude pads themselves from being found */
170 176
171 /* The 0th pad slot is @_ */ 177 /* The 0th pad slot is @_ */
172 if (AvARRAY (pad)[0] == targ) 178 if (PadARRAY (pad)[0] == targ)
173 res_pair ("the argument array for"); 179 res_pair ("the argument array for");
174 180
175 for (i = AvFILLp (pad) + 1; --i; ) 181 for (i = AvFILLp (pad) + 1; --i; )
176 if (AvARRAY (pad)[i] == targ) 182 if (AvARRAY (pad)[i] == targ)
177 { 183 {
178 /* Values from constant functions are stored in the pad without any name */ 184 /* Values from constant functions are stored in the pad without any name */
179 SV *name_sv = AvARRAY (AvARRAY (padlist)[0])[i]; 185 SV *name_sv = PadARRAY (PadlistARRAY (padlist)[0])[i];
180 186
181 if (name_sv && SvPOK (name_sv)) 187 if (name_sv && SvPOK (name_sv))
182 res_pair (form ("the lexical '%s' in", SvPVX (name_sv))); 188 res_pair (form ("the lexical '%s' in", SvPVX (name_sv)));
183 else 189 else
184 res_pair ("an unnamed lexical in"); 190 res_pair ("an unnamed lexical in");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines