Commit | Line | Data |
94caac6e |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
3 | #include "XSUB.h" |
b15aa864 |
4 | #include "hook_op_check.h" |
94caac6e |
5 | #undef printf |
e807ee50 |
6 | #include "stolen_chunk_of_toke.c" |
94caac6e |
7 | #include <stdio.h> |
8 | #include <string.h> |
9 | |
023db2fb |
10 | #define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
11 | #define PERL_DECIMAL_VERSION \ |
12 | PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
13 | #define PERL_VERSION_GE(r,v,s) \ |
14 | (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
15 | |
9673d7ca |
16 | #ifndef Newx |
17 | # define Newx(v,n,t) New(0,v,n,t) |
18 | #endif /* !Newx */ |
19 | |
7dd7d008 |
20 | #define DD_DEBUGf_UPDATED_LINESTR 1 |
21 | #define DD_DEBUGf_TRACE 2 |
22 | |
23 | #define DD_DEBUG_UPDATED_LINESTR (dd_debug & DD_DEBUGf_UPDATED_LINESTR) |
24 | #define DD_DEBUG_TRACE (dd_debug & DD_DEBUGf_TRACE) |
e81bee92 |
25 | static int dd_debug = 0; |
c630715a |
26 | |
023db2fb |
27 | #define DD_CONST_VIA_RV2CV PERL_VERSION_GE(5,11,2) |
28 | |
6ed8c948 |
29 | #define DD_GROW_VIA_BLOCKHOOK PERL_VERSION_GE(5,13,3) |
30 | |
94caac6e |
31 | #define LEX_NORMAL 10 |
32 | #define LEX_INTERPNORMAL 9 |
33 | |
e8df925b |
34 | /* please try not to have a line longer than this :) */ |
35 | |
36 | #define DD_PREFERRED_LINESTR_SIZE 16384 |
37 | |
94caac6e |
38 | /* flag to trigger removal of temporary declaree sub */ |
39 | |
40 | static int in_declare = 0; |
41 | |
96f12726 |
42 | /* in 5.10, PL_parser will be NULL if we aren't parsing, and PL_lex_stuff |
43 | is a lookup into it - so if anything else we can use to tell, so we |
44 | need to be a bit more careful if PL_parser exists */ |
45 | |
46 | #define DD_AM_LEXING_CHECK (PL_lex_state == LEX_NORMAL || PL_lex_state == LEX_INTERPNORMAL) |
47 | |
f19b3507 |
48 | #if defined(PL_parser) || defined(PERL_5_9_PLUS) |
96f12726 |
49 | #define DD_HAVE_PARSER PL_parser |
50 | #define DD_HAVE_LEX_STUFF (PL_parser && PL_lex_stuff) |
51 | #define DD_AM_LEXING (PL_parser && DD_AM_LEXING_CHECK) |
52 | #else |
53 | #define DD_HAVE_PARSER 1 |
54 | #define DD_HAVE_LEX_STUFF PL_lex_stuff |
55 | #define DD_AM_LEXING DD_AM_LEXING_CHECK |
56 | #endif |
57 | |
72f20f69 |
58 | /* thing that decides whether we're dealing with a declarator */ |
59 | |
60 | int dd_is_declarator(pTHX_ char* name) { |
61 | HV* is_declarator; |
62 | SV** is_declarator_pack_ref; |
63 | HV* is_declarator_pack_hash; |
64 | SV** is_declarator_flag_ref; |
65 | int dd_flags; |
66 | |
67 | is_declarator = get_hv("Devel::Declare::declarators", FALSE); |
68 | |
69 | if (!is_declarator) |
70 | return -1; |
71 | |
569ac469 |
72 | /* $declarators{$current_package_name} */ |
73 | |
9603b8dc |
74 | if (!HvNAME(PL_curstash)) |
f2a41aa1 |
75 | return -1; |
9603b8dc |
76 | |
72f20f69 |
77 | is_declarator_pack_ref = hv_fetch(is_declarator, HvNAME(PL_curstash), |
78 | strlen(HvNAME(PL_curstash)), FALSE); |
79 | |
80 | if (!is_declarator_pack_ref || !SvROK(*is_declarator_pack_ref)) |
81 | return -1; /* not a hashref */ |
82 | |
83 | is_declarator_pack_hash = (HV*) SvRV(*is_declarator_pack_ref); |
84 | |
569ac469 |
85 | /* $declarators{$current_package_name}{$name} */ |
86 | |
72f20f69 |
87 | is_declarator_flag_ref = hv_fetch( |
88 | is_declarator_pack_hash, name, |
89 | strlen(name), FALSE |
90 | ); |
91 | |
92 | /* requires SvIOK as well as TRUE since flags not being an int is useless */ |
93 | |
94 | if (!is_declarator_flag_ref |
48ee5c99 |
95 | || !SvIOK(*is_declarator_flag_ref) |
72f20f69 |
96 | || !SvTRUE(*is_declarator_flag_ref)) |
97 | return -1; |
98 | |
99 | dd_flags = SvIVX(*is_declarator_flag_ref); |
100 | |
101 | return dd_flags; |
102 | } |
103 | |
569ac469 |
104 | /* callback thingy */ |
105 | |
a9bd9b5e |
106 | void dd_linestr_callback (pTHX_ char* type, char* name) { |
569ac469 |
107 | |
108 | char* linestr = SvPVX(PL_linestr); |
a9bd9b5e |
109 | int offset = PL_bufptr - linestr; |
569ac469 |
110 | |
569ac469 |
111 | dSP; |
112 | |
113 | ENTER; |
114 | SAVETMPS; |
115 | |
116 | PUSHMARK(SP); |
117 | XPUSHs(sv_2mortal(newSVpv(type, 0))); |
118 | XPUSHs(sv_2mortal(newSVpv(name, 0))); |
119 | XPUSHs(sv_2mortal(newSViv(offset))); |
120 | PUTBACK; |
121 | |
04a8a223 |
122 | call_pv("Devel::Declare::linestr_callback", G_VOID|G_DISCARD); |
569ac469 |
123 | |
569ac469 |
124 | FREETMPS; |
125 | LEAVE; |
126 | } |
127 | |
128 | char* dd_get_linestr(pTHX) { |
5f0b59d5 |
129 | if (!DD_HAVE_PARSER) { |
130 | return NULL; |
131 | } |
569ac469 |
132 | return SvPVX(PL_linestr); |
133 | } |
134 | |
135 | void dd_set_linestr(pTHX_ char* new_value) { |
6f5220b7 |
136 | unsigned int new_len = strlen(new_value); |
569ac469 |
137 | |
ce9a252b |
138 | if (SvLEN(PL_linestr) < new_len) { |
41db92e3 |
139 | croak("PL_linestr not long enough, was Devel::Declare loaded soon enough in %s", |
140 | CopFILE(&PL_compiling) |
141 | ); |
ce9a252b |
142 | } |
143 | |
569ac469 |
144 | |
145 | memcpy(SvPVX(PL_linestr), new_value, new_len+1); |
146 | |
147 | SvCUR_set(PL_linestr, new_len); |
148 | |
149 | PL_bufend = SvPVX(PL_linestr) + new_len; |
7dd7d008 |
150 | |
87195072 |
151 | if ( DD_DEBUG_UPDATED_LINESTR && PERLDB_LINE && PL_curstash != PL_debstash) { |
7dd7d008 |
152 | // Cribbed from toke.c |
153 | SV * const sv = NEWSV(85,0); |
154 | |
155 | sv_upgrade(sv, SVt_PVMG); |
156 | sv_setpvn(sv,PL_bufptr,PL_bufend-PL_bufptr); |
157 | (void)SvIOK_on(sv); |
158 | SvIV_set(sv, 0); |
159 | av_store(CopFILEAV(&PL_compiling),(I32)CopLINE(&PL_compiling),sv); |
160 | } |
569ac469 |
161 | } |
162 | |
04a8a223 |
163 | char* dd_get_lex_stuff(pTHX) { |
96f12726 |
164 | return (DD_HAVE_LEX_STUFF ? SvPVX(PL_lex_stuff) : ""); |
04a8a223 |
165 | } |
166 | |
bd85a06e |
167 | void dd_clear_lex_stuff(pTHX) { |
96f12726 |
168 | if (DD_HAVE_PARSER) |
f05cbc90 |
169 | PL_lex_stuff = (SV*)NULL; |
04a8a223 |
170 | } |
171 | |
172 | char* dd_get_curstash_name(pTHX) { |
173 | return HvNAME(PL_curstash); |
174 | } |
175 | |
022eb0cc |
176 | int dd_get_linestr_offset(pTHX) { |
0da63271 |
177 | char* linestr; |
178 | if (!DD_HAVE_PARSER) { |
179 | return -1; |
180 | } |
181 | linestr = SvPVX(PL_linestr); |
022eb0cc |
182 | return PL_bufptr - linestr; |
183 | } |
184 | |
840ebcbb |
185 | char* dd_move_past_token (pTHX_ char* s) { |
923c07a8 |
186 | |
187 | /* |
188 | * buffer will be at the beginning of the declarator, -unless- the |
189 | * declarator is at EOL in which case it'll be the next useful line |
190 | * so we don't short-circuit out if we don't find the declarator |
191 | */ |
192 | |
193 | while (s < PL_bufend && isSPACE(*s)) s++; |
194 | if (memEQ(s, PL_tokenbuf, strlen(PL_tokenbuf))) |
195 | s += strlen(PL_tokenbuf); |
196 | return s; |
197 | } |
198 | |
840ebcbb |
199 | int dd_toke_move_past_token (pTHX_ int offset) { |
04a8a223 |
200 | char* base_s = SvPVX(PL_linestr) + offset; |
201 | char* s = dd_move_past_token(aTHX_ base_s); |
202 | return s - base_s; |
203 | } |
204 | |
923c07a8 |
205 | int dd_toke_scan_word(pTHX_ int offset, int handle_package) { |
206 | char tmpbuf[sizeof PL_tokenbuf]; |
207 | char* base_s = SvPVX(PL_linestr) + offset; |
208 | STRLEN len; |
209 | char* s = scan_word(base_s, tmpbuf, sizeof tmpbuf, handle_package, &len); |
210 | return s - base_s; |
211 | } |
212 | |
f11d21b2 |
213 | int dd_toke_scan_ident(pTHX_ int offset) { |
214 | char tmpbuf[sizeof PL_tokenbuf]; |
215 | char* base_s = SvPVX(PL_linestr) + offset; |
f11d21b2 |
216 | char* s = scan_ident(base_s, PL_bufend, tmpbuf, sizeof tmpbuf, 0); |
217 | return s - base_s; |
218 | } |
219 | |
923c07a8 |
220 | int dd_toke_scan_str(pTHX_ int offset) { |
19b277fc |
221 | STRLEN remaining = sv_len(PL_linestr) - offset; |
86964fb3 |
222 | SV* line_copy = newSVsv(PL_linestr); |
923c07a8 |
223 | char* base_s = SvPVX(PL_linestr) + offset; |
224 | char* s = scan_str(base_s, FALSE, FALSE); |
86964fb3 |
225 | if (s != base_s && sv_len(PL_lex_stuff) > remaining) { |
226 | int ret = (s - SvPVX(PL_linestr)) + remaining; |
227 | sv_catsv(line_copy, PL_linestr); |
228 | dd_set_linestr(aTHX_ SvPV_nolen(line_copy)); |
229 | SvREFCNT_dec(line_copy); |
230 | return ret; |
231 | } |
923c07a8 |
232 | return s - base_s; |
233 | } |
234 | |
235 | int dd_toke_skipspace(pTHX_ int offset) { |
e8df925b |
236 | char* old_pvx = SvPVX(PL_linestr); |
923c07a8 |
237 | char* base_s = SvPVX(PL_linestr) + offset; |
a25db2dc |
238 | char* s = skipspace_force(base_s); |
e8df925b |
239 | if(SvPVX(PL_linestr) != old_pvx) |
240 | croak("PL_linestr reallocated during skipspace, " |
241 | "Devel::Declare can't continue"); |
923c07a8 |
242 | return s - base_s; |
243 | } |
244 | |
023db2fb |
245 | static void call_done_declare(pTHX) { |
246 | dSP; |
247 | |
248 | if (DD_DEBUG_TRACE) { |
249 | printf("Deconstructing declare\n"); |
250 | printf("PL_bufptr: %s\n", PL_bufptr); |
251 | printf("bufend at: %i\n", PL_bufend - PL_bufptr); |
252 | printf("linestr: %s\n", SvPVX(PL_linestr)); |
253 | printf("linestr len: %i\n", PL_bufend - SvPVX(PL_linestr)); |
254 | } |
255 | |
256 | ENTER; |
257 | SAVETMPS; |
258 | |
259 | PUSHMARK(SP); |
260 | |
261 | call_pv("Devel::Declare::done_declare", G_VOID|G_DISCARD); |
262 | |
263 | FREETMPS; |
264 | LEAVE; |
265 | |
266 | if (DD_DEBUG_TRACE) { |
267 | printf("PL_bufptr: %s\n", PL_bufptr); |
268 | printf("bufend at: %i\n", PL_bufend - PL_bufptr); |
269 | printf("linestr: %s\n", SvPVX(PL_linestr)); |
270 | printf("linestr len: %i\n", PL_bufend - SvPVX(PL_linestr)); |
271 | printf("actual len: %i\n", strlen(PL_bufptr)); |
272 | } |
273 | } |
274 | |
275 | static int dd_handle_const(pTHX_ char *name); |
276 | |
94caac6e |
277 | /* replacement PL_check rv2cv entry */ |
278 | |
6e67754a |
279 | STATIC OP *dd_ck_rv2cv(pTHX_ OP *o, void *user_data) { |
94caac6e |
280 | OP* kid; |
0ba8c7aa |
281 | int dd_flags; |
94caac6e |
282 | |
6f5220b7 |
283 | PERL_UNUSED_VAR(user_data); |
284 | |
499109e0 |
285 | if (!DD_AM_LEXING) |
286 | return o; /* not lexing? */ |
287 | |
94caac6e |
288 | if (in_declare) { |
023db2fb |
289 | call_done_declare(aTHX); |
94caac6e |
290 | return o; |
291 | } |
292 | |
293 | kid = cUNOPo->op_first; |
294 | |
295 | if (kid->op_type != OP_GV) /* not a GV so ignore */ |
296 | return o; |
297 | |
7dd7d008 |
298 | if (DD_DEBUG_TRACE) { |
e81bee92 |
299 | printf("Checking GV %s -> %s\n", HvNAME(GvSTASH(kGVOP_gv)), GvNAME(kGVOP_gv)); |
300 | } |
840ebcbb |
301 | |
72f20f69 |
302 | dd_flags = dd_is_declarator(aTHX_ GvNAME(kGVOP_gv)); |
94caac6e |
303 | |
72f20f69 |
304 | if (dd_flags == -1) |
94caac6e |
305 | return o; |
306 | |
7dd7d008 |
307 | if (DD_DEBUG_TRACE) { |
e81bee92 |
308 | printf("dd_flags are: %i\n", dd_flags); |
309 | printf("PL_tokenbuf: %s\n", PL_tokenbuf); |
310 | } |
840ebcbb |
311 | |
023db2fb |
312 | #if DD_CONST_VIA_RV2CV |
313 | if (PL_expect != XOPERATOR) { |
314 | if (!dd_handle_const(aTHX_ GvNAME(kGVOP_gv))) |
315 | return o; |
316 | CopLINE(PL_curcop) = PL_copline; |
317 | /* The parser behaviour that we're simulating depends on what comes |
318 | after the declarator. */ |
319 | if (*skipspace(PL_bufptr + strlen(GvNAME(kGVOP_gv))) != '(') { |
320 | if (in_declare) { |
321 | call_done_declare(aTHX); |
322 | } else { |
323 | dd_linestr_callback(aTHX_ "rv2cv", GvNAME(kGVOP_gv)); |
324 | } |
325 | } |
326 | return o; |
327 | } |
328 | #endif /* DD_CONST_VIA_RV2CV */ |
329 | |
a9bd9b5e |
330 | dd_linestr_callback(aTHX_ "rv2cv", GvNAME(kGVOP_gv)); |
94caac6e |
331 | |
53e3ab32 |
332 | return o; |
333 | } |
334 | |
6ed8c948 |
335 | #if DD_GROW_VIA_BLOCKHOOK |
336 | |
337 | static void dd_block_start(pTHX_ int full) |
338 | { |
339 | PERL_UNUSED_VAR(full); |
e8df925b |
340 | if (SvLEN(PL_linestr) < DD_PREFERRED_LINESTR_SIZE) |
341 | (void) lex_grow_linestr(DD_PREFERRED_LINESTR_SIZE); |
6ed8c948 |
342 | } |
343 | |
344 | #else /* !DD_GROW_VIA_BLOCKHOOK */ |
345 | |
b7505981 |
346 | OP* dd_pp_entereval(pTHX) { |
347 | dSP; |
b7505981 |
348 | STRLEN len; |
349 | const char* s; |
c93bc23e |
350 | SV *sv; |
351 | #ifdef PERL_5_9_PLUS |
352 | SV *saved_hh; |
353 | if (PL_op->op_private & OPpEVAL_HAS_HH) { |
354 | saved_hh = POPs; |
355 | } |
356 | #endif |
357 | sv = POPs; |
b7505981 |
358 | if (SvPOK(sv)) { |
7dd7d008 |
359 | if (DD_DEBUG_TRACE) { |
e81bee92 |
360 | printf("mangling eval sv\n"); |
361 | } |
b7505981 |
362 | if (SvREADONLY(sv)) |
363 | sv = sv_2mortal(newSVsv(sv)); |
364 | s = SvPVX(sv); |
365 | len = SvCUR(sv); |
366 | if (!len || s[len-1] != ';') { |
367 | if (!(SvFLAGS(sv) & SVs_TEMP)) |
368 | sv = sv_2mortal(newSVsv(sv)); |
369 | sv_catpvn(sv, "\n;", 2); |
53e3ab32 |
370 | } |
e8df925b |
371 | SvGROW(sv, DD_PREFERRED_LINESTR_SIZE); |
53e3ab32 |
372 | } |
b7505981 |
373 | PUSHs(sv); |
c93bc23e |
374 | #ifdef PERL_5_9_PLUS |
375 | if (PL_op->op_private & OPpEVAL_HAS_HH) { |
376 | PUSHs(saved_hh); |
377 | } |
378 | #endif |
b7505981 |
379 | return PL_ppaddr[OP_ENTEREVAL](aTHX); |
380 | } |
53e3ab32 |
381 | |
6e67754a |
382 | STATIC OP *dd_ck_entereval(pTHX_ OP *o, void *user_data) { |
6f5220b7 |
383 | PERL_UNUSED_VAR(user_data); |
384 | |
d8e65fc8 |
385 | if (o->op_ppaddr == PL_ppaddr[OP_ENTEREVAL]) |
386 | o->op_ppaddr = dd_pp_entereval; |
94caac6e |
387 | return o; |
388 | } |
389 | |
12b60feb |
390 | #endif /* !DD_GROW_VIA_BLOCKHOOK */ |
391 | |
6a0bcf35 |
392 | static I32 dd_filter_realloc(pTHX_ int idx, SV *sv, int maxlen) |
393 | { |
394 | const I32 count = FILTER_READ(idx+1, sv, maxlen); |
e8df925b |
395 | SvGROW(sv, DD_PREFERRED_LINESTR_SIZE); |
6a0bcf35 |
396 | /* filter_del(dd_filter_realloc); */ |
397 | return count; |
398 | } |
399 | |
023db2fb |
400 | static int dd_handle_const(pTHX_ char *name) { |
c48ac26f |
401 | switch (PL_lex_inwhat) { |
402 | case OP_QR: |
403 | case OP_MATCH: |
404 | case OP_SUBST: |
405 | case OP_TRANS: |
f2a41aa1 |
406 | case OP_BACKTICK: |
407 | case OP_STRINGIFY: |
023db2fb |
408 | return 0; |
c48ac26f |
409 | break; |
410 | default: |
411 | break; |
8d96afb7 |
412 | } |
48ee5c99 |
413 | |
a25db2dc |
414 | if (strnEQ(PL_bufptr, "->", 2)) { |
023db2fb |
415 | return 0; |
954da332 |
416 | } |
417 | |
a25db2dc |
418 | { |
419 | char buf[256]; |
420 | STRLEN len; |
421 | char *s = PL_bufptr; |
422 | STRLEN old_offset = PL_bufptr - SvPVX(PL_linestr); |
423 | |
424 | s = scan_word(s, buf, sizeof buf, FALSE, &len); |
425 | if (strnEQ(buf, name, len)) { |
426 | char *d; |
c0439e97 |
427 | SV *inject = newSVpvn(SvPVX(PL_linestr), PL_bufptr - SvPVX(PL_linestr)); |
a25db2dc |
428 | sv_catpvn(inject, buf, len); |
429 | |
430 | d = peekspace(s); |
431 | sv_catpvn(inject, s, d - s); |
432 | |
433 | if ((PL_bufend - d) >= 2 && strnEQ(d, "=>", 2)) { |
023db2fb |
434 | return 0; |
a25db2dc |
435 | } |
436 | |
437 | sv_catpv(inject, d); |
438 | dd_set_linestr(aTHX_ SvPV_nolen(inject)); |
439 | PL_bufptr = SvPVX(PL_linestr) + old_offset; |
440 | SvREFCNT_dec (inject); |
441 | } |
442 | } |
443 | |
a9bd9b5e |
444 | dd_linestr_callback(aTHX_ "const", name); |
bedac9ff |
445 | |
023db2fb |
446 | return 1; |
447 | } |
448 | |
449 | #if !DD_CONST_VIA_RV2CV |
450 | |
451 | STATIC OP *dd_ck_const(pTHX_ OP *o, void *user_data) { |
452 | int dd_flags; |
453 | char* name; |
454 | |
455 | PERL_UNUSED_VAR(user_data); |
456 | |
457 | if (DD_HAVE_PARSER && PL_expect == XOPERATOR) { |
458 | return o; |
459 | } |
460 | |
461 | /* if this is set, we just grabbed a delimited string or something, |
462 | not a bareword, so NO TOUCHY */ |
463 | |
464 | if (DD_HAVE_LEX_STUFF) |
465 | return o; |
466 | |
467 | /* don't try and look this up if it's not a string const */ |
468 | if (!SvPOK(cSVOPo->op_sv)) |
469 | return o; |
470 | |
471 | name = SvPVX(cSVOPo->op_sv); |
472 | |
473 | dd_flags = dd_is_declarator(aTHX_ name); |
474 | |
475 | if (dd_flags == -1) |
476 | return o; |
477 | |
478 | dd_handle_const(aTHX_ name); |
479 | |
3ea50944 |
480 | return o; |
481 | } |
482 | |
023db2fb |
483 | #endif /* !DD_CONST_VIA_RV2CV */ |
484 | |
94caac6e |
485 | static int initialized = 0; |
486 | |
487 | MODULE = Devel::Declare PACKAGE = Devel::Declare |
488 | |
489 | PROTOTYPES: DISABLE |
490 | |
491 | void |
492 | setup() |
493 | CODE: |
494 | if (!initialized++) { |
6ed8c948 |
495 | #if DD_GROW_VIA_BLOCKHOOK |
496 | static BHK bhk; |
497 | #if PERL_VERSION_GE(5,13,6) |
498 | BhkENTRY_set(&bhk, bhk_start, dd_block_start); |
499 | #else /* <5.13.6 */ |
500 | BhkENTRY_set(&bhk, start, dd_block_start); |
501 | #endif /* <5.13.6 */ |
502 | Perl_blockhook_register(aTHX_ &bhk); |
503 | #else /* !DD_GROW_VIA_BLOCKHOOK */ |
6e67754a |
504 | hook_op_check(OP_ENTEREVAL, dd_ck_entereval, NULL); |
6ed8c948 |
505 | #endif /* !DD_GROW_VIA_BLOCKHOOK */ |
506 | hook_op_check(OP_RV2CV, dd_ck_rv2cv, NULL); |
023db2fb |
507 | #if !DD_CONST_VIA_RV2CV |
6e67754a |
508 | hook_op_check(OP_CONST, dd_ck_const, NULL); |
023db2fb |
509 | #endif /* !DD_CONST_VIA_RV2CV */ |
94caac6e |
510 | } |
6a0bcf35 |
511 | filter_add(dd_filter_realloc, NULL); |
569ac469 |
512 | |
513 | char* |
514 | get_linestr() |
515 | CODE: |
516 | RETVAL = dd_get_linestr(aTHX); |
517 | OUTPUT: |
518 | RETVAL |
923c07a8 |
519 | |
520 | void |
521 | set_linestr(char* new_value) |
522 | CODE: |
523 | dd_set_linestr(aTHX_ new_value); |
524 | |
04a8a223 |
525 | char* |
526 | get_lex_stuff() |
527 | CODE: |
528 | RETVAL = dd_get_lex_stuff(aTHX); |
529 | OUTPUT: |
530 | RETVAL |
531 | |
532 | void |
533 | clear_lex_stuff() |
534 | CODE: |
535 | dd_clear_lex_stuff(aTHX); |
536 | |
537 | char* |
538 | get_curstash_name() |
539 | CODE: |
540 | RETVAL = dd_get_curstash_name(aTHX); |
541 | OUTPUT: |
542 | RETVAL |
543 | |
923c07a8 |
544 | int |
022eb0cc |
545 | get_linestr_offset() |
546 | CODE: |
547 | RETVAL = dd_get_linestr_offset(aTHX); |
548 | OUTPUT: |
549 | RETVAL |
550 | |
551 | int |
923c07a8 |
552 | toke_scan_word(int offset, int handle_package) |
553 | CODE: |
554 | RETVAL = dd_toke_scan_word(aTHX_ offset, handle_package); |
555 | OUTPUT: |
556 | RETVAL |
557 | |
558 | int |
04a8a223 |
559 | toke_move_past_token(int offset); |
560 | CODE: |
561 | RETVAL = dd_toke_move_past_token(aTHX_ offset); |
562 | OUTPUT: |
563 | RETVAL |
564 | |
565 | int |
923c07a8 |
566 | toke_scan_str(int offset); |
567 | CODE: |
568 | RETVAL = dd_toke_scan_str(aTHX_ offset); |
569 | OUTPUT: |
570 | RETVAL |
571 | |
572 | int |
f11d21b2 |
573 | toke_scan_ident(int offset) |
574 | CODE: |
575 | RETVAL = dd_toke_scan_ident(aTHX_ offset); |
576 | OUTPUT: |
577 | RETVAL |
578 | |
579 | int |
923c07a8 |
580 | toke_skipspace(int offset) |
581 | CODE: |
582 | RETVAL = dd_toke_skipspace(aTHX_ offset); |
583 | OUTPUT: |
584 | RETVAL |
04a8a223 |
585 | |
586 | int |
587 | get_in_declare() |
588 | CODE: |
589 | RETVAL = in_declare; |
590 | OUTPUT: |
591 | RETVAL |
592 | |
593 | void |
594 | set_in_declare(int value) |
595 | CODE: |
596 | in_declare = value; |
e81bee92 |
597 | |
598 | BOOT: |
0a3b37d1 |
599 | { |
87195072 |
600 | char *endptr; |
601 | char *debug_str = getenv ("DD_DEBUG"); |
602 | if (debug_str) { |
603 | dd_debug = strtol (debug_str, &endptr, 10); |
604 | if (*endptr != '\0') { |
605 | dd_debug = 0; |
606 | } |
e81bee92 |
607 | } |
0a3b37d1 |
608 | } |