mrubyを超漢字で動作させる
修訂 | 4440566b9522ae5ff6b2bce7b3d8ecd232304eea (tree) |
---|---|
時間 | 2015-11-17 07:30:34 |
作者 | Yukihiro "Matz" Matsumoto <matz@ruby...> |
Commiter | Yukihiro "Matz" Matsumoto |
DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014
changes:
@@ -98,7 +98,7 @@ MRuby::Build.new('host-debug') do |conf| | ||
98 | 98 | conf.gembox 'default' |
99 | 99 | |
100 | 100 | # C compiler settings |
101 | - conf.cc.defines = %w(ENABLE_DEBUG) | |
101 | + conf.cc.defines = %w(MRB_ENABLE_DEBUG) | |
102 | 102 | |
103 | 103 | # Generate mruby debugger command (require mruby-eval) |
104 | 104 | conf.gem :core => "mruby-bin-debugger" |
@@ -463,7 +463,7 @@ can't be disabled for the main build. | ||
463 | 463 | MRuby::CrossBuild.new('Minimal') do |conf| |
464 | 464 | toolchain :gcc |
465 | 465 | |
466 | - conf.cc.defines = %w(DISABLE_STDIO) | |
466 | + conf.cc.defines = %w(MRB_DISABLE_STDIO) | |
467 | 467 | conf.bins = [] |
468 | 468 | end |
469 | 469 | ``` |
@@ -11,11 +11,7 @@ You can use mrbconfs with following ways: | ||
11 | 11 | changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed. |
12 | 12 | |
13 | 13 | ## stdio setting. |
14 | -`ENABLE_STDIO` | |
15 | -* Will be defined automatically if `DISABLE_STDIO` isn't defined. | |
16 | -* Uses `<stdio.h>` functions. | |
17 | - | |
18 | -`DISABLE_STDIO` | |
14 | +`MRB_DISABLE_STDIO` | |
19 | 15 | * When defined `<stdio.h>` functions won't be used. |
20 | 16 | * Some features will be disabled when this is enabled: |
21 | 17 | * `mrb_irep` load/dump from/to file. |
@@ -23,15 +19,12 @@ You can use mrbconfs with following ways: | ||
23 | 19 | * Printing features in **src/print.c**. |
24 | 20 | |
25 | 21 | ## Debug macros. |
26 | -`ENABLE_DEBUG` | |
22 | +`MRB_ENABLE_DEBUG_HOOK` | |
27 | 23 | * When defined code fetch hook and debug OP hook will be enabled. |
28 | 24 | * When using any of the hook set function pointer `code_fetch_hook` and/or `debug_op_hook` of `mrb_state`. |
29 | 25 | * Fetch hook will be called before any OP. |
30 | 26 | * Debug OP hook will be called when dispatching `OP_DEBUG`. |
31 | 27 | |
32 | -`DISABLE_DEBUG` | |
33 | -* Will be define automatically if `ENABLE_DEBUG` isn't defined. | |
34 | - | |
35 | 28 | `MRB_DEBUG` |
36 | 29 | * When defined `mrb_assert*` macro will be defined with macros from `<assert.h>`. |
37 | 30 | * Could be enabled via `enable_debug` method of `MRuby::Build`. |
@@ -50,7 +50,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf| | ||
50 | 50 | cc.defines << %w(KHASH_DEFAULT_SIZE=8) |
51 | 51 | cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) |
52 | 52 | cc.defines << %w(MRB_GC_STRESS) |
53 | - #cc.defines << %w(DISABLE_STDIO) #if you dont need stdio. | |
53 | + #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. | |
54 | 54 | #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval |
55 | 55 | end |
56 | 56 |
@@ -47,7 +47,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf| | ||
47 | 47 | cc.defines << %w(KHASH_DEFAULT_SIZE=8) |
48 | 48 | cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) |
49 | 49 | cc.defines << %w(MRB_GC_STRESS) |
50 | - #cc.defines << %w(DISABLE_STDIO) #if you dont need stdio. | |
50 | + #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. | |
51 | 51 | #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval |
52 | 52 | end |
53 | 53 |
@@ -75,23 +75,25 @@ | ||
75 | 75 | /* fixed size state atexit stack */ |
76 | 76 | //#define MRB_FIXED_STATE_ATEXIT_STACK |
77 | 77 | |
78 | -/* -DDISABLE_XXXX to drop following features */ | |
79 | -//#define DISABLE_STDIO /* use of stdio */ | |
78 | +/* -DMRB_DISABLE_XXXX to drop following features */ | |
79 | +//#define MRB_DISABLE_STDIO /* use of stdio */ | |
80 | 80 | |
81 | -/* -DENABLE_XXXX to enable following features */ | |
82 | -//#define ENABLE_DEBUG /* hooks for debugger */ | |
81 | +/* -DMRB_ENABLE_XXXX to enable following features */ | |
82 | +//#define MRB_ENABLE_DEBUG_HOOK /* hooks for debugger */ | |
83 | 83 | |
84 | 84 | /* end of configuration */ |
85 | 85 | |
86 | -/* define ENABLE_XXXX from DISABLE_XXX */ | |
87 | -#ifndef DISABLE_STDIO | |
88 | -#define ENABLE_STDIO | |
86 | +/* define MRB_DISABLE_XXXX from DISABLE_XXX (for compatibility) */ | |
87 | +#ifdef DISABLE_STDIO | |
88 | +#define MRB_DIABLE_STDIO | |
89 | 89 | #endif |
90 | -#ifndef ENABLE_DEBUG | |
91 | -#define DISABLE_DEBUG | |
90 | + | |
91 | +/* define MRB_ENABLE_XXXX from ENABLE_XXX (for compatibility) */ | |
92 | +#ifdef ENABLE_DEBUG | |
93 | +#define MRB_ENABLE_DEBUG_HOOK | |
92 | 94 | #endif |
93 | 95 | |
94 | -#ifdef ENABLE_STDIO | |
96 | +#ifndef MRB_DISABLE_STDIO | |
95 | 97 | # include <stdio.h> |
96 | 98 | #endif |
97 | 99 |
@@ -152,7 +152,7 @@ typedef struct mrb_state { | ||
152 | 152 | struct symbol_name *symtbl; /* symbol table */ |
153 | 153 | size_t symcapa; |
154 | 154 | |
155 | -#ifdef ENABLE_DEBUG | |
155 | +#ifdef MRB_ENABLE_DEBUG_HOOK | |
156 | 156 | void (*code_fetch_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs); |
157 | 157 | void (*debug_op_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs); |
158 | 158 | #endif |
@@ -112,7 +112,7 @@ struct mrb_parser_state { | ||
112 | 112 | struct mrb_pool *pool; |
113 | 113 | mrb_ast_node *cells; |
114 | 114 | const char *s, *send; |
115 | -#ifdef ENABLE_STDIO | |
115 | +#ifndef MRB_DIABLE_STDIO | |
116 | 116 | FILE *f; |
117 | 117 | #endif |
118 | 118 | mrbc_context *cxt; |
@@ -167,7 +167,7 @@ MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*); | ||
167 | 167 | MRB_API char const* mrb_parser_get_filename(struct mrb_parser_state*, uint16_t idx); |
168 | 168 | |
169 | 169 | /* utility functions */ |
170 | -#ifdef ENABLE_STDIO | |
170 | +#ifndef MRB_DISABLE_STDIO | |
171 | 171 | MRB_API struct mrb_parser_state* mrb_parse_file(mrb_state*,FILE*,mrbc_context*); |
172 | 172 | #endif |
173 | 173 | MRB_API struct mrb_parser_state* mrb_parse_string(mrb_state*,const char*,mrbc_context*); |
@@ -175,14 +175,12 @@ MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,int,mr | ||
175 | 175 | MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*); |
176 | 176 | |
177 | 177 | /* program load functions */ |
178 | -#ifdef ENABLE_STDIO | |
178 | +#ifndef MRB_DISABLE_STDIO | |
179 | 179 | MRB_API mrb_value mrb_load_file(mrb_state*,FILE*); |
180 | +MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt); | |
180 | 181 | #endif |
181 | 182 | MRB_API mrb_value mrb_load_string(mrb_state *mrb, const char *s); |
182 | 183 | MRB_API mrb_value mrb_load_nstring(mrb_state *mrb, const char *s, int len); |
183 | -#ifdef ENABLE_STDIO | |
184 | -MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt); | |
185 | -#endif | |
186 | 184 | MRB_API mrb_value mrb_load_string_cxt(mrb_state *mrb, const char *s, mrbc_context *cxt); |
187 | 185 | MRB_API mrb_value mrb_load_nstring_cxt(mrb_state *mrb, const char *s, int len, mrbc_context *cxt); |
188 | 186 |
@@ -23,7 +23,7 @@ MRB_BEGIN_DECL | ||
23 | 23 | #define DUMP_ENDIAN_MASK 6 |
24 | 24 | |
25 | 25 | int mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size); |
26 | -#ifdef ENABLE_STDIO | |
26 | +#ifndef MRB_DISABLE_STDIO | |
27 | 27 | int mrb_dump_irep_binary(mrb_state*, mrb_irep*, uint8_t, FILE*); |
28 | 28 | int mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep*, uint8_t flags, FILE *f, const char *initname); |
29 | 29 | mrb_irep *mrb_read_irep_file(mrb_state*, FILE*); |
@@ -7,7 +7,7 @@ | ||
7 | 7 | #include "mruby/dump.h" |
8 | 8 | #include "mruby/variable.h" |
9 | 9 | |
10 | -#ifndef ENABLE_STDIO | |
10 | +#ifdef MRB_DISABLE_STDIO | |
11 | 11 | static void |
12 | 12 | p(mrb_state *mrb, mrb_value obj) |
13 | 13 | { |
@@ -96,7 +96,7 @@ codegen_error(codegen_scope *s, const char *message) | ||
96 | 96 | mrb_pool_close(s->mpool); |
97 | 97 | s = tmp; |
98 | 98 | } |
99 | -#ifdef ENABLE_STDIO | |
99 | +#ifndef MBB_DISABLE_STDIO | |
100 | 100 | if (s->filename && s->lineno) { |
101 | 101 | fprintf(stderr, "codegen error:%s:%d: %s\n", s->filename, s->lineno, message); |
102 | 102 | } |
@@ -375,7 +375,7 @@ dispatch(codegen_scope *s, int pc) | ||
375 | 375 | case OP_ONERR: |
376 | 376 | break; |
377 | 377 | default: |
378 | -#ifdef ENABLE_STDIO | |
378 | +#ifndef MRB_DISABLE_STDIO | |
379 | 379 | fprintf(stderr, "bug: dispatch on non JMP op\n"); |
380 | 380 | #endif |
381 | 381 | scope_error(s); |
@@ -978,7 +978,7 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val) | ||
978 | 978 | break; |
979 | 979 | |
980 | 980 | default: |
981 | -#ifdef ENABLE_STDIO | |
981 | +#ifndef MRB_DISABLE_STDIO | |
982 | 982 | printf("unknown lhs %d\n", type); |
983 | 983 | #endif |
984 | 984 | break; |
@@ -3294,7 +3294,7 @@ yyerror(parser_state *p, const char *s) | ||
3294 | 3294 | int n; |
3295 | 3295 | |
3296 | 3296 | if (! p->capture_errors) { |
3297 | -#ifdef ENABLE_STDIO | |
3297 | +#ifndef MRB_DISABLE_STDIO | |
3298 | 3298 | if (p->filename) { |
3299 | 3299 | fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s); |
3300 | 3300 | } |
@@ -3330,7 +3330,7 @@ yywarn(parser_state *p, const char *s) | ||
3330 | 3330 | int n; |
3331 | 3331 | |
3332 | 3332 | if (! p->capture_errors) { |
3333 | -#ifdef ENABLE_STDIO | |
3333 | +#ifndef MRB_DISABLE_STDIO | |
3334 | 3334 | if (p->filename) { |
3335 | 3335 | fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s); |
3336 | 3336 | } |
@@ -3401,7 +3401,7 @@ nextc(parser_state *p) | ||
3401 | 3401 | cons_free(tmp); |
3402 | 3402 | } |
3403 | 3403 | else { |
3404 | -#ifdef ENABLE_STDIO | |
3404 | +#ifndef MRB_DISABLE_STDIO | |
3405 | 3405 | if (p->f) { |
3406 | 3406 | if (feof(p->f)) goto eof; |
3407 | 3407 | c = fgetc(p->f); |
@@ -3491,7 +3491,7 @@ peeks(parser_state *p, const char *s) | ||
3491 | 3491 | { |
3492 | 3492 | int len = strlen(s); |
3493 | 3493 | |
3494 | -#ifdef ENABLE_STDIO | |
3494 | +#ifndef MRB_DISABLE_STDIO | |
3495 | 3495 | if (p->f) { |
3496 | 3496 | int n = 0; |
3497 | 3497 | while (*s) { |
@@ -5442,7 +5442,7 @@ mrb_parser_new(mrb_state *mrb) | ||
5442 | 5442 | p->pool = pool; |
5443 | 5443 | |
5444 | 5444 | p->s = p->send = NULL; |
5445 | -#ifdef ENABLE_STDIO | |
5445 | +#ifndef MRB_DISBLE_STDIO | |
5446 | 5446 | p->f = NULL; |
5447 | 5447 | #endif |
5448 | 5448 |
@@ -5541,7 +5541,7 @@ mrb_parser_get_filename(struct mrb_parser_state* p, uint16_t idx) { | ||
5541 | 5541 | } |
5542 | 5542 | } |
5543 | 5543 | |
5544 | -#ifdef ENABLE_STDIO | |
5544 | +#ifndef MRB_DISABLE_STDIO | |
5545 | 5545 | MRB_API parser_state* |
5546 | 5546 | mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c) |
5547 | 5547 | { |
@@ -5633,7 +5633,7 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c) | ||
5633 | 5633 | return v; |
5634 | 5634 | } |
5635 | 5635 | |
5636 | -#ifdef ENABLE_STDIO | |
5636 | +#ifndef MRB_DISABLE_STDIO | |
5637 | 5637 | MRB_API mrb_value |
5638 | 5638 | mrb_load_file_cxt(mrb_state *mrb, FILE *f, mrbc_context *c) |
5639 | 5639 | { |
@@ -5671,7 +5671,7 @@ mrb_load_string(mrb_state *mrb, const char *s) | ||
5671 | 5671 | return mrb_load_string_cxt(mrb, s, NULL); |
5672 | 5672 | } |
5673 | 5673 | |
5674 | -#ifdef ENABLE_STDIO | |
5674 | +#ifndef MRB_DISABLE_STDIO | |
5675 | 5675 | |
5676 | 5676 | static void |
5677 | 5677 | dump_prefix(node *tree, int offset) |
@@ -5697,7 +5697,7 @@ dump_recur(mrb_state *mrb, node *tree, int offset) | ||
5697 | 5697 | void |
5698 | 5698 | mrb_parser_dump(mrb_state *mrb, node *tree, int offset) |
5699 | 5699 | { |
5700 | -#ifdef ENABLE_STDIO | |
5700 | +#ifndef MRB_DISABLE_STDIO | |
5701 | 5701 | int nodetype; |
5702 | 5702 | |
5703 | 5703 | if (!tree) return; |
@@ -25,7 +25,7 @@ struct backtrace_location { | ||
25 | 25 | |
26 | 26 | typedef void (*output_stream_func)(mrb_state*, struct backtrace_location*, void*); |
27 | 27 | |
28 | -#ifdef ENABLE_STDIO | |
28 | +#ifndef MRB_DISABLE_STDIO | |
29 | 29 | |
30 | 30 | struct print_backtrace_args { |
31 | 31 | FILE *stream; |
@@ -165,7 +165,7 @@ exc_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun | ||
165 | 165 | overwritten. So invoke these functions just after detecting exceptions. |
166 | 166 | */ |
167 | 167 | |
168 | -#ifdef ENABLE_STDIO | |
168 | +#ifndef MRB_DISABLE_STDIO | |
169 | 169 | |
170 | 170 | MRB_API void |
171 | 171 | mrb_print_backtrace(mrb_state *mrb) |
@@ -5,7 +5,7 @@ | ||
5 | 5 | #include "mruby/string.h" |
6 | 6 | #include "mruby/proc.h" |
7 | 7 | |
8 | -#ifdef ENABLE_STDIO | |
8 | +#ifndef MRB_DISABLE_STDIO | |
9 | 9 | static int |
10 | 10 | print_r(mrb_state *mrb, mrb_irep *irep, size_t n, int pre) |
11 | 11 | { |
@@ -53,7 +53,7 @@ print_lv(mrb_state *mrb, mrb_irep *irep, mrb_code c, int r) | ||
53 | 53 | static void |
54 | 54 | codedump(mrb_state *mrb, mrb_irep *irep) |
55 | 55 | { |
56 | -#ifdef ENABLE_STDIO | |
56 | +#ifndef MRB_DISABLE_STDIO | |
57 | 57 | int i; |
58 | 58 | int ai; |
59 | 59 | mrb_code c; |
@@ -989,7 +989,7 @@ mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size | ||
989 | 989 | return dump_irep(mrb, irep, dump_flags(flags, FLAG_BYTEORDER_NONATIVE), bin, bin_size); |
990 | 990 | } |
991 | 991 | |
992 | -#ifdef ENABLE_STDIO | |
992 | +#ifndef MRB_DISABLE_STDIO | |
993 | 993 | |
994 | 994 | int |
995 | 995 | mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE* fp) |
@@ -1092,4 +1092,4 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con | ||
1092 | 1092 | return result; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | -#endif /* ENABLE_STDIO */ | |
1095 | +#endif /* MRB_DISABLE_STDIO */ |
@@ -309,7 +309,7 @@ mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...) | ||
309 | 309 | MRB_API void |
310 | 310 | mrb_warn(mrb_state *mrb, const char *fmt, ...) |
311 | 311 | { |
312 | -#ifdef ENABLE_STDIO | |
312 | +#ifndef MRB_DISABLE_STDIO | |
313 | 313 | va_list ap; |
314 | 314 | mrb_value str; |
315 | 315 |
@@ -324,7 +324,7 @@ mrb_warn(mrb_state *mrb, const char *fmt, ...) | ||
324 | 324 | MRB_API mrb_noreturn void |
325 | 325 | mrb_bug(mrb_state *mrb, const char *fmt, ...) |
326 | 326 | { |
327 | -#ifdef ENABLE_STDIO | |
327 | +#ifndef MRB_DISABLE_STDIO | |
328 | 328 | va_list ap; |
329 | 329 | mrb_value str; |
330 | 330 |
@@ -642,7 +642,7 @@ mrb_load_irep(mrb_state *mrb, const uint8_t *bin) | ||
642 | 642 | return mrb_load_irep_cxt(mrb, bin, NULL); |
643 | 643 | } |
644 | 644 | |
645 | -#ifdef ENABLE_STDIO | |
645 | +#ifndef MRB_DISABLE_STDIO | |
646 | 646 | |
647 | 647 | MRB_API mrb_irep* |
648 | 648 | mrb_read_irep_file(mrb_state *mrb, FILE* fp) |
@@ -704,4 +704,4 @@ mrb_load_irep_file(mrb_state *mrb, FILE* fp) | ||
704 | 704 | { |
705 | 705 | return mrb_load_irep_file_cxt(mrb, fp, NULL); |
706 | 706 | } |
707 | -#endif /* ENABLE_STDIO */ | |
707 | +#endif /* MRB_DISABLE_STDIO */ |
@@ -8,7 +8,7 @@ | ||
8 | 8 | #include "mruby/string.h" |
9 | 9 | #include "mruby/variable.h" |
10 | 10 | |
11 | -#ifdef ENABLE_STDIO | |
11 | +#ifndef MRB_DISABLE_STDIO | |
12 | 12 | static void |
13 | 13 | printstr(mrb_value obj, FILE *stream) |
14 | 14 | { |
@@ -24,35 +24,24 @@ printstr(mrb_value obj, FILE *stream) | ||
24 | 24 | MRB_API void |
25 | 25 | mrb_p(mrb_state *mrb, mrb_value obj) |
26 | 26 | { |
27 | - mrb_value val = mrb_inspect(mrb, obj); | |
28 | - | |
29 | - printstr(val, stdout); | |
27 | + printstr(mrb_inspect(mrb, obj), stdout); | |
30 | 28 | } |
31 | 29 | |
32 | 30 | MRB_API void |
33 | 31 | mrb_print_error(mrb_state *mrb) |
34 | 32 | { |
35 | - mrb_value s; | |
36 | - | |
37 | 33 | mrb_print_backtrace(mrb); |
38 | - s = mrb_funcall(mrb, mrb_obj_value(mrb->exc), "inspect", 0); | |
39 | - printstr(s, stderr); | |
34 | + printstr(mrb_funcall(mrb, mrb_obj_value(mrb->exc), "inspect", 0), stderr); | |
40 | 35 | } |
41 | 36 | |
42 | 37 | MRB_API void |
43 | 38 | mrb_show_version(mrb_state *mrb) |
44 | 39 | { |
45 | - mrb_value msg; | |
46 | - | |
47 | - msg = mrb_const_get(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_DESCRIPTION")); | |
48 | - printstr(msg, stdout); | |
40 | + printstr(mrb_const_get(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_DESCRIPTION")), stdout); | |
49 | 41 | } |
50 | 42 | |
51 | 43 | MRB_API void |
52 | 44 | mrb_show_copyright(mrb_state *mrb) |
53 | 45 | { |
54 | - mrb_value msg; | |
55 | - | |
56 | - msg = mrb_const_get(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_COPYRIGHT")); | |
57 | - printstr(msg, stdout); | |
46 | + printstr(mrb_const_get(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_COPYRIGHT")), stdout); | |
58 | 47 | } |
@@ -22,7 +22,7 @@ | ||
22 | 22 | #include "value_array.h" |
23 | 23 | #include "mruby/throw.h" |
24 | 24 | |
25 | -#ifndef ENABLE_STDIO | |
25 | +#ifndef MRB_DISABLE_STDIO | |
26 | 26 | #if defined(__cplusplus) |
27 | 27 | extern "C" { |
28 | 28 | #endif |
@@ -693,7 +693,7 @@ argnum_error(mrb_state *mrb, mrb_int num) | ||
693 | 693 | |
694 | 694 | #define ERR_PC_SET(mrb, pc) mrb->c->ci->err = pc; |
695 | 695 | #define ERR_PC_CLR(mrb) mrb->c->ci->err = 0; |
696 | -#ifdef ENABLE_DEBUG | |
696 | +#ifdef MRB_ENABLE_DEBUG_HOOK | |
697 | 697 | #define CODE_FETCH_HOOK(mrb, irep, pc, regs) if ((mrb)->code_fetch_hook) (mrb)->code_fetch_hook((mrb), (irep), (pc), (regs)); |
698 | 698 | #else |
699 | 699 | #define CODE_FETCH_HOOK(mrb, irep, pc, regs) |
@@ -2340,10 +2340,10 @@ RETRY_TRY_BLOCK: | ||
2340 | 2340 | |
2341 | 2341 | CASE(OP_DEBUG) { |
2342 | 2342 | /* A B C debug print R(A),R(B),R(C) */ |
2343 | -#ifdef ENABLE_DEBUG | |
2343 | +#ifdef MRB_ENABLE_DEBUG_HOOK | |
2344 | 2344 | mrb->debug_op_hook(mrb, irep, pc, regs); |
2345 | 2345 | #else |
2346 | -#ifdef ENABLE_STDIO | |
2346 | +#ifndef MRB_DISABLE_STDIO | |
2347 | 2347 | printf("OP_DEBUG %d %d %d\n", GETARG_A(i), GETARG_B(i), GETARG_C(i)); |
2348 | 2348 | #else |
2349 | 2349 | abort(); |