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