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) { |
d3480bb4 |
221 | char* old_pvx = SvPVX(PL_linestr); |
08c39634 |
222 | SV* line_copy = sv_2mortal(newSVsv(PL_linestr)); |
923c07a8 |
223 | char* base_s = SvPVX(PL_linestr) + offset; |
224 | char* s = scan_str(base_s, FALSE, FALSE); |
d3480bb4 |
225 | if(SvPVX(PL_linestr) != old_pvx) |
226 | croak("PL_linestr reallocated during scan_str, " |
227 | "Devel::Declare can't continue"); |
78bb475d |
228 | if (s <= base_s) { |
229 | s += SvCUR(line_copy); |
86964fb3 |
230 | sv_catsv(line_copy, PL_linestr); |
231 | dd_set_linestr(aTHX_ SvPV_nolen(line_copy)); |
86964fb3 |
232 | } |
923c07a8 |
233 | return s - base_s; |
234 | } |
235 | |
236 | int dd_toke_skipspace(pTHX_ int offset) { |
e8df925b |
237 | char* old_pvx = SvPVX(PL_linestr); |
923c07a8 |
238 | char* base_s = SvPVX(PL_linestr) + offset; |
a25db2dc |
239 | char* s = skipspace_force(base_s); |
e8df925b |
240 | if(SvPVX(PL_linestr) != old_pvx) |
241 | croak("PL_linestr reallocated during skipspace, " |
242 | "Devel::Declare can't continue"); |
923c07a8 |
243 | return s - base_s; |
244 | } |
245 | |
023db2fb |
246 | static void call_done_declare(pTHX) { |
247 | dSP; |
248 | |
249 | if (DD_DEBUG_TRACE) { |
250 | printf("Deconstructing declare\n"); |
251 | printf("PL_bufptr: %s\n", PL_bufptr); |
252 | printf("bufend at: %i\n", PL_bufend - PL_bufptr); |
253 | printf("linestr: %s\n", SvPVX(PL_linestr)); |
254 | printf("linestr len: %i\n", PL_bufend - SvPVX(PL_linestr)); |
255 | } |
256 | |
257 | ENTER; |
258 | SAVETMPS; |
259 | |
260 | PUSHMARK(SP); |
261 | |
262 | call_pv("Devel::Declare::done_declare", G_VOID|G_DISCARD); |
263 | |
264 | FREETMPS; |
265 | LEAVE; |
266 | |
267 | if (DD_DEBUG_TRACE) { |
268 | printf("PL_bufptr: %s\n", PL_bufptr); |
269 | printf("bufend at: %i\n", PL_bufend - PL_bufptr); |
270 | printf("linestr: %s\n", SvPVX(PL_linestr)); |
271 | printf("linestr len: %i\n", PL_bufend - SvPVX(PL_linestr)); |
272 | printf("actual len: %i\n", strlen(PL_bufptr)); |
273 | } |
274 | } |
275 | |
276 | static int dd_handle_const(pTHX_ char *name); |
277 | |
94caac6e |
278 | /* replacement PL_check rv2cv entry */ |
279 | |
6e67754a |
280 | STATIC OP *dd_ck_rv2cv(pTHX_ OP *o, void *user_data) { |
94caac6e |
281 | OP* kid; |
0ba8c7aa |
282 | int dd_flags; |
94caac6e |
283 | |
6f5220b7 |
284 | PERL_UNUSED_VAR(user_data); |
285 | |
499109e0 |
286 | if (!DD_AM_LEXING) |
287 | return o; /* not lexing? */ |
288 | |
94caac6e |
289 | if (in_declare) { |
023db2fb |
290 | call_done_declare(aTHX); |
94caac6e |
291 | return o; |
292 | } |
293 | |
294 | kid = cUNOPo->op_first; |
295 | |
296 | if (kid->op_type != OP_GV) /* not a GV so ignore */ |
297 | return o; |
298 | |
7dd7d008 |
299 | if (DD_DEBUG_TRACE) { |
e81bee92 |
300 | printf("Checking GV %s -> %s\n", HvNAME(GvSTASH(kGVOP_gv)), GvNAME(kGVOP_gv)); |
301 | } |
840ebcbb |
302 | |
72f20f69 |
303 | dd_flags = dd_is_declarator(aTHX_ GvNAME(kGVOP_gv)); |
94caac6e |
304 | |
72f20f69 |
305 | if (dd_flags == -1) |
94caac6e |
306 | return o; |
307 | |
7dd7d008 |
308 | if (DD_DEBUG_TRACE) { |
e81bee92 |
309 | printf("dd_flags are: %i\n", dd_flags); |
310 | printf("PL_tokenbuf: %s\n", PL_tokenbuf); |
311 | } |
840ebcbb |
312 | |
023db2fb |
313 | #if DD_CONST_VIA_RV2CV |
314 | if (PL_expect != XOPERATOR) { |
315 | if (!dd_handle_const(aTHX_ GvNAME(kGVOP_gv))) |
316 | return o; |
317 | CopLINE(PL_curcop) = PL_copline; |
318 | /* The parser behaviour that we're simulating depends on what comes |
319 | after the declarator. */ |
320 | if (*skipspace(PL_bufptr + strlen(GvNAME(kGVOP_gv))) != '(') { |
321 | if (in_declare) { |
322 | call_done_declare(aTHX); |
323 | } else { |
324 | dd_linestr_callback(aTHX_ "rv2cv", GvNAME(kGVOP_gv)); |
325 | } |
326 | } |
327 | return o; |
328 | } |
329 | #endif /* DD_CONST_VIA_RV2CV */ |
330 | |
a9bd9b5e |
331 | dd_linestr_callback(aTHX_ "rv2cv", GvNAME(kGVOP_gv)); |
94caac6e |
332 | |
53e3ab32 |
333 | return o; |
334 | } |
335 | |
6ed8c948 |
336 | #if DD_GROW_VIA_BLOCKHOOK |
337 | |
338 | static void dd_block_start(pTHX_ int full) |
339 | { |
340 | PERL_UNUSED_VAR(full); |
e8df925b |
341 | if (SvLEN(PL_linestr) < DD_PREFERRED_LINESTR_SIZE) |
342 | (void) lex_grow_linestr(DD_PREFERRED_LINESTR_SIZE); |
6ed8c948 |
343 | } |
344 | |
345 | #else /* !DD_GROW_VIA_BLOCKHOOK */ |
346 | |
b7505981 |
347 | OP* dd_pp_entereval(pTHX) { |
348 | dSP; |
b7505981 |
349 | STRLEN len; |
350 | const char* s; |
c93bc23e |
351 | SV *sv; |
352 | #ifdef PERL_5_9_PLUS |
353 | SV *saved_hh; |
354 | if (PL_op->op_private & OPpEVAL_HAS_HH) { |
355 | saved_hh = POPs; |
356 | } |
357 | #endif |
358 | sv = POPs; |
b7505981 |
359 | if (SvPOK(sv)) { |
7dd7d008 |
360 | if (DD_DEBUG_TRACE) { |
e81bee92 |
361 | printf("mangling eval sv\n"); |
362 | } |
b7505981 |
363 | if (SvREADONLY(sv)) |
364 | sv = sv_2mortal(newSVsv(sv)); |
365 | s = SvPVX(sv); |
366 | len = SvCUR(sv); |
367 | if (!len || s[len-1] != ';') { |
368 | if (!(SvFLAGS(sv) & SVs_TEMP)) |
369 | sv = sv_2mortal(newSVsv(sv)); |
370 | sv_catpvn(sv, "\n;", 2); |
53e3ab32 |
371 | } |
e8df925b |
372 | SvGROW(sv, DD_PREFERRED_LINESTR_SIZE); |
53e3ab32 |
373 | } |
b7505981 |
374 | PUSHs(sv); |
c93bc23e |
375 | #ifdef PERL_5_9_PLUS |
376 | if (PL_op->op_private & OPpEVAL_HAS_HH) { |
377 | PUSHs(saved_hh); |
378 | } |
379 | #endif |
b7505981 |
380 | return PL_ppaddr[OP_ENTEREVAL](aTHX); |
381 | } |
53e3ab32 |
382 | |
6e67754a |
383 | STATIC OP *dd_ck_entereval(pTHX_ OP *o, void *user_data) { |
6f5220b7 |
384 | PERL_UNUSED_VAR(user_data); |
385 | |
d8e65fc8 |
386 | if (o->op_ppaddr == PL_ppaddr[OP_ENTEREVAL]) |
387 | o->op_ppaddr = dd_pp_entereval; |
94caac6e |
388 | return o; |
389 | } |
390 | |
12b60feb |
391 | #endif /* !DD_GROW_VIA_BLOCKHOOK */ |
392 | |
6a0bcf35 |
393 | static I32 dd_filter_realloc(pTHX_ int idx, SV *sv, int maxlen) |
394 | { |
395 | const I32 count = FILTER_READ(idx+1, sv, maxlen); |
e8df925b |
396 | SvGROW(sv, DD_PREFERRED_LINESTR_SIZE); |
6a0bcf35 |
397 | /* filter_del(dd_filter_realloc); */ |
398 | return count; |
399 | } |
400 | |
023db2fb |
401 | static int dd_handle_const(pTHX_ char *name) { |
c48ac26f |
402 | switch (PL_lex_inwhat) { |
403 | case OP_QR: |
404 | case OP_MATCH: |
405 | case OP_SUBST: |
406 | case OP_TRANS: |
f2a41aa1 |
407 | case OP_BACKTICK: |
408 | case OP_STRINGIFY: |
023db2fb |
409 | return 0; |
c48ac26f |
410 | break; |
411 | default: |
412 | break; |
8d96afb7 |
413 | } |
48ee5c99 |
414 | |
a25db2dc |
415 | if (strnEQ(PL_bufptr, "->", 2)) { |
023db2fb |
416 | return 0; |
954da332 |
417 | } |
418 | |
a25db2dc |
419 | { |
420 | char buf[256]; |
421 | STRLEN len; |
422 | char *s = PL_bufptr; |
423 | STRLEN old_offset = PL_bufptr - SvPVX(PL_linestr); |
424 | |
425 | s = scan_word(s, buf, sizeof buf, FALSE, &len); |
426 | if (strnEQ(buf, name, len)) { |
427 | char *d; |
c0439e97 |
428 | SV *inject = newSVpvn(SvPVX(PL_linestr), PL_bufptr - SvPVX(PL_linestr)); |
a25db2dc |
429 | sv_catpvn(inject, buf, len); |
430 | |
431 | d = peekspace(s); |
432 | sv_catpvn(inject, s, d - s); |
433 | |
434 | if ((PL_bufend - d) >= 2 && strnEQ(d, "=>", 2)) { |
023db2fb |
435 | return 0; |
a25db2dc |
436 | } |
437 | |
438 | sv_catpv(inject, d); |
439 | dd_set_linestr(aTHX_ SvPV_nolen(inject)); |
440 | PL_bufptr = SvPVX(PL_linestr) + old_offset; |
441 | SvREFCNT_dec (inject); |
442 | } |
443 | } |
444 | |
a9bd9b5e |
445 | dd_linestr_callback(aTHX_ "const", name); |
bedac9ff |
446 | |
023db2fb |
447 | return 1; |
448 | } |
449 | |
450 | #if !DD_CONST_VIA_RV2CV |
451 | |
452 | STATIC OP *dd_ck_const(pTHX_ OP *o, void *user_data) { |
453 | int dd_flags; |
454 | char* name; |
455 | |
456 | PERL_UNUSED_VAR(user_data); |
457 | |
458 | if (DD_HAVE_PARSER && PL_expect == XOPERATOR) { |
459 | return o; |
460 | } |
461 | |
462 | /* if this is set, we just grabbed a delimited string or something, |
463 | not a bareword, so NO TOUCHY */ |
464 | |
465 | if (DD_HAVE_LEX_STUFF) |
466 | return o; |
467 | |
468 | /* don't try and look this up if it's not a string const */ |
469 | if (!SvPOK(cSVOPo->op_sv)) |
470 | return o; |
471 | |
472 | name = SvPVX(cSVOPo->op_sv); |
473 | |
474 | dd_flags = dd_is_declarator(aTHX_ name); |
475 | |
476 | if (dd_flags == -1) |
477 | return o; |
478 | |
479 | dd_handle_const(aTHX_ name); |
480 | |
3ea50944 |
481 | return o; |
482 | } |
483 | |
023db2fb |
484 | #endif /* !DD_CONST_VIA_RV2CV */ |
485 | |
94caac6e |
486 | static int initialized = 0; |
487 | |
488 | MODULE = Devel::Declare PACKAGE = Devel::Declare |
489 | |
490 | PROTOTYPES: DISABLE |
491 | |
492 | void |
493 | setup() |
494 | CODE: |
495 | if (!initialized++) { |
6ed8c948 |
496 | #if DD_GROW_VIA_BLOCKHOOK |
497 | static BHK bhk; |
498 | #if PERL_VERSION_GE(5,13,6) |
499 | BhkENTRY_set(&bhk, bhk_start, dd_block_start); |
500 | #else /* <5.13.6 */ |
501 | BhkENTRY_set(&bhk, start, dd_block_start); |
502 | #endif /* <5.13.6 */ |
503 | Perl_blockhook_register(aTHX_ &bhk); |
504 | #else /* !DD_GROW_VIA_BLOCKHOOK */ |
6e67754a |
505 | hook_op_check(OP_ENTEREVAL, dd_ck_entereval, NULL); |
6ed8c948 |
506 | #endif /* !DD_GROW_VIA_BLOCKHOOK */ |
507 | hook_op_check(OP_RV2CV, dd_ck_rv2cv, NULL); |
023db2fb |
508 | #if !DD_CONST_VIA_RV2CV |
6e67754a |
509 | hook_op_check(OP_CONST, dd_ck_const, NULL); |
023db2fb |
510 | #endif /* !DD_CONST_VIA_RV2CV */ |
94caac6e |
511 | } |
6a0bcf35 |
512 | filter_add(dd_filter_realloc, NULL); |
569ac469 |
513 | |
514 | char* |
515 | get_linestr() |
516 | CODE: |
517 | RETVAL = dd_get_linestr(aTHX); |
518 | OUTPUT: |
519 | RETVAL |
923c07a8 |
520 | |
521 | void |
522 | set_linestr(char* new_value) |
523 | CODE: |
524 | dd_set_linestr(aTHX_ new_value); |
525 | |
04a8a223 |
526 | char* |
527 | get_lex_stuff() |
528 | CODE: |
529 | RETVAL = dd_get_lex_stuff(aTHX); |
530 | OUTPUT: |
531 | RETVAL |
532 | |
533 | void |
534 | clear_lex_stuff() |
535 | CODE: |
536 | dd_clear_lex_stuff(aTHX); |
537 | |
538 | char* |
539 | get_curstash_name() |
540 | CODE: |
541 | RETVAL = dd_get_curstash_name(aTHX); |
542 | OUTPUT: |
543 | RETVAL |
544 | |
923c07a8 |
545 | int |
022eb0cc |
546 | get_linestr_offset() |
547 | CODE: |
548 | RETVAL = dd_get_linestr_offset(aTHX); |
549 | OUTPUT: |
550 | RETVAL |
551 | |
552 | int |
923c07a8 |
553 | toke_scan_word(int offset, int handle_package) |
554 | CODE: |
555 | RETVAL = dd_toke_scan_word(aTHX_ offset, handle_package); |
556 | OUTPUT: |
557 | RETVAL |
558 | |
559 | int |
04a8a223 |
560 | toke_move_past_token(int offset); |
561 | CODE: |
562 | RETVAL = dd_toke_move_past_token(aTHX_ offset); |
563 | OUTPUT: |
564 | RETVAL |
565 | |
566 | int |
923c07a8 |
567 | toke_scan_str(int offset); |
568 | CODE: |
569 | RETVAL = dd_toke_scan_str(aTHX_ offset); |
570 | OUTPUT: |
571 | RETVAL |
572 | |
573 | int |
f11d21b2 |
574 | toke_scan_ident(int offset) |
575 | CODE: |
576 | RETVAL = dd_toke_scan_ident(aTHX_ offset); |
577 | OUTPUT: |
578 | RETVAL |
579 | |
580 | int |
923c07a8 |
581 | toke_skipspace(int offset) |
582 | CODE: |
583 | RETVAL = dd_toke_skipspace(aTHX_ offset); |
584 | OUTPUT: |
585 | RETVAL |
04a8a223 |
586 | |
587 | int |
588 | get_in_declare() |
589 | CODE: |
590 | RETVAL = in_declare; |
591 | OUTPUT: |
592 | RETVAL |
593 | |
594 | void |
595 | set_in_declare(int value) |
596 | CODE: |
597 | in_declare = value; |
e81bee92 |
598 | |
599 | BOOT: |
0a3b37d1 |
600 | { |
87195072 |
601 | char *endptr; |
602 | char *debug_str = getenv ("DD_DEBUG"); |
603 | if (debug_str) { |
604 | dd_debug = strtol (debug_str, &endptr, 10); |
605 | if (*endptr != '\0') { |
606 | dd_debug = 0; |
607 | } |
e81bee92 |
608 | } |
0a3b37d1 |
609 | } |