Skip to content

Commit fb10e84

Browse files
committed
Squashed 'mruby_test/' changes from 8bad195..fb2e0b7
fb2e0b7 fixed a problem with upvar access from instance_eval; ref #3072 0000192 Merge pull request #3077 from sgnr/output-backtrace-segfault 146a9ee Fix segfault on mrb_exc_backtrace. f3cce24 replace mrb_toplevel_run() by mrb_top_run() 258cb20 mruby-eval: fixed receiver value in eval context; close #3072 f7afe1d change mrb_run related API names; compatibility macros provided 725b3ca move KHASH_DECLARE(ht..) to mruby/hash.h; close #3073 7c82bfa mruby-sprintf to use mrb_int formatting macros; ref #3076 3cf5af6 Merge pull request #3074 from syohex/precision-parameter-type 931cc03 printf precision parameter must be 'int' type ec71191 Merge pull request #3071 from ksss/symbol 20ebe9c Merge pull request #3070 from kazuho/kazuho/printf-specifiers cd131d1 define `MRB_PRI?` that map to `PRI?NN` depending on the size of `mrb_int` af21b36 symname_p support `!~` 9145aed bytes2chars() conversion to fail if target byte offset is not on the character boundary; ref #3067 aec825a stack_extend before eval_under() aa1f668 instance_eval should pass the receiver as a block parameter; close #3029 879e27d mirb: enlarge code buffer size to 4KB bd462c5 mruby-fiber: fiber_switch() to use nesting VM when it's called from C API or mrb_funcall(); close #3056 4683b89 Merge pull request #3068 from kazuho/kazuho/osx-_setjmp 121c6e3 use _setjmp/_longjmp on other BSD flavors f4bb329 use _setjmp/_longjmp on OS X 38b9c2d mruby-fiber: add Fiber.yield description; close #3066 31b8469 Merge pull request #3067 from ksss/use-memchr 6c1b6ef Use memchr for performance 1d7d706 __t_printstr__ may not be available for tests 3531fe1 GC must scan env from fibers even when it's not yet copied to heap; fix #3063 4fdec33 simpler t_print ee3fa1b Merge pull request #3065 from kou/support-backtrace-after-method-calls 0ebac02 Skip backtrace related tests when backtrace isn't available a561bdb Support backtrace after method calls e132de9 Merge pull request #3064 from kou/fix-indent 1eeeecb Fix indent d3c6faf Merge pull request #2331 from take-cheeze/struct_test 825ced1 remove duplicated local variable declaration d10e304 Merge pull request #3062 from suzukaze/refactor-array-each 6218b2e Merge pull request #3061 from mattn/fix-ctrl-c 8807690 Refactor Array#each 1e34b12 mirb: Don't exit on Ctrl-C 76d44b1 remove execute bit from mrbgems/mruby-bin-debugger files 6e09abc Merge pull request #3058 from mattn/fix-include-blocker f0205e1 rename include blocker a060bd5 Merge pull request #3057 from yuuu/add_next_command 887a56b fix bug that doesn't stop program when execute next command. a08439a fixed next command's comment. e1cc814 add next command to mrdb. 7e4a7ab Merge pull request #3055 from mattn/fix-msvc-warnings 7cc33af fix build on VS2012 d0727be Merge pull request #3054 from kazuho/kazuho/adjust-column-offset-in-peekc_n adadbf5 in `peekc_n`, adjust column number after calling `nextc` 2ca825a Merge pull request #3051 from zzak/ambiguous-first-argument 3f228c1 Fix "ambiguous first argument" warning 0720aac Merge pull request #3050 from remore/fix-minor-bug-about-objectspace d69b5c3 Add case statement of MRB_TT_SCLASS in mrb_obj_is_kind_of() f54a98f mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #3048 d18c55f mrb_str_len_to_inum(): fixed a bug with underscores in digits; fix #3049 80c1c60 Merge pull request #3047 from csouls/rafactor_array_ruby_extension d3f59db Remove redundant conditions of Array#each in ruby extension 2a234a9 mrb_str_len_to_inum(): string may not be NUL terminated; ref #3043 19c744e mrb_str_len_to_inum(): fixed a bug with separating _ in the digits; ref #3043 4a6a114 Merge pull request #3045 from Mav7/master af33394 Undid newline and whitespace on YARD doc e279854 One space indentation. 26a25e1 mrb_str_len_to_inum: should not raise "string contains null byte" error on "0x"; fix #3043 ad333cd mrb_str_len_to_inum: converting may not be terminated by NUL; fix #3044 4e267d7 Added YARD docs in new mruby.h b9e5be6 Merge pull request #3041 from zzak/travis-osx 95edcc8 Test against latest xcode 9a21aa2 preserve original string for error message ca417da mrb_str_len_to_inum(): inspect string in error message 36fabe1 new API function mrb_string_value_len() 0701236 mrb_str_to_inum(): should treat null byte in strings properly; fix #3040 d3a56a6 mrb_cstr_to_inum(): should ignore trailing white spaces even when badcheck set dbb8cf6 mrb_str_to_inum(): should raise error when string contains null byte 9f2fca6 mrb_str_to_inum(): no need to call mrb_string_value_cstr() here; ref 05411ee 05411ee mrb_string_value_cstr() should not raise error for frozen strings 85bd997 avoid comparison between signed and unsigned 1636ad4 C++ compiler does not like cast from pointer to enum; ref #3039 c299651 should ignore block to next, break, etc. fix #3039 81a7b40 Merge pull request #3038 from zzak/gc-arena-docs dce3005 GC Arena docs pass for fixups 065966d common.h are supposed to be included from other header, so call it with quotes; ref #3032 6f831ef Merge pull request #3037 from pbosetti/mruby-time 67e3cdf Implemented round(double) function within mruby-time gem, for it is missing on VisualStudio compilers where _MSC_ver < 1800 9a41db6 Merge pull request #2950 from mattn/mirb-file-args 5c405de include changed from by quotes ("") to by brackets (<>); close #3032 2e0519d Merge pull request #3036 from zzak/remove-mrbtest_irep 6dbc314 Merge pull request #3035 from iij/pr-yard-mrb_str_to_cstr 2fb12bd Merge pull request #3034 from takahashim/try_convert 1ef2faf Remove unnecessary dependencies for assert_rb codegen and test_rbireps e7a3018 Remove mrbtest_irep from mrbtest 90b7ec8 YARD doc for mrb_str_to_cstr. 621487a add {Array|Hash|String}.try_convert 625a3fe Merge pull request #3033 from sgnr/compiler-fix-mrb-disable-stdio-typo 058ffcb Fix MRB_DISABLE_STDIO typo. 18190fa Merge pull request #3030 from takahashim/nonzero 40a9700 support Numeric#zero? and Numeric#nonzero? 0e721ef Merge pull request #3028 from sgnr/fix-mrb-disable-stdio-typo 40f237e Fix typo on MRB_DISABLE_STDIO. 2aca5ab Merge pull request #3027 from pbosetti/master abc7248 formatting buffer should be bigger for negative dots; ref #3025 f974880 binary format no longer need to preserve org_v 996417c integer range check was moved to mrb_flo_to_fixnum(); ref #3025 09abdcb negative binary format should not be masked by 10bits; ref #3025 1a9b607 binary sprintf should not be restricted by mrb_int size; fix #3025 8229f34 Merge pull request #3026 from murasesyuka/bugfix/check_minus_signedint_bitshift_overflow 470fce5 Fix check for VisualStudio Version in mruby-math gem ef95dcd Bugfix nagative-number lshift() bit overflow 557ab34 Merge pull request #3024 from yoshiori/fix_readme_link 6c181fa Update README.md a4d5588 Bugfix lshift() bit overflow; close #3023 22464fe mruby-1.2.0 547a29d Merge pull request #3022 from zzak/enable-full-debug-travis-build 41c3d2f Merge pull request #3021 from zzak/fix-enable-debug-define 8454e90 Enable full-debug build on travis using `MRB_ENABLE_DEBUG_HOOK` acdfcfe Fix MRB_ENABLE_DEBUG_HOOK config typo left from 4440566 acf2fb2 Merge pull request #2752 from cremno/add-ruby_engine_version 27ee7cf Merge pull request #3020 from cremno/document-mrb_utf8_string e8d8796 document MRB_UTF8_STRING config macro fd5e341 Merge pull request #3019 from cremno/fix-mrb_disable_stdio-typos e2e23c6 add RUBY_ENGINE_VERSION ad21e5e fix MRB_DISABLE_STDIO typos dd57cb7 update TODO entries; close #2831 4440566 DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014 1dfe38b Merge pull request #3018 from zzak/add-mruby-cli-authors 6ce31f3 Merge pull request #3017 from Mav7/master 6f43e95 Added type annotation to YARD. ed6f3a0 Merge pull request #3015 from murasesyuka/fix/fix_lshift_and_fix_rshift_doc cd1a566 fix comment 31a8743 Add contributors from mruby-cli project to AUTHORS file 916630b Merge pull request #3013 from zzak/dont-pull-gems-by-default 98285e6 This patch changes git gem behavior to never pull gems unless specified. 85b5af6 Merge branch 'nobu-feature/hash-cmp' fa86026 move Hash comparison methods to mruby-hash-ext gem 1fc9074 Merge branch 'feature/hash-cmp' of https://github.com/nobu/mruby into nobu-feature/hash-cmp 4e63ea9 Merge pull request #3011 from Mav7/master 66a839e Added more YARD docs to mruby.h bf5f83f Add comparison methods to Hash 9c10800 Merge pull request #3008 from Mav7/master 27146dc Added YARD documentation in mruby.h 0c4218b Merge pull request #3007 from mruby-debian/fix/fail_to_package_build 1238739 fail to debuild 7090b5f Merge pull request #3006 from cremno/remove-ifdef-mrb_fixnum_shift b65bd37 Merge pull request #3005 from cremno/fix-ambiguous-first-argument-warning d6e1762 Merge pull request #3004 from cremno/remove-return d3b323c PR #2521 did not work for singleton classes for non-class objects; fix #3003 d109e5b remove ifdef as MRB_FIXNUM_SHIFT is always defined bb141e5 fix ambiguous first argument warning e18e2a4 remove return e20c2d7 mirb should take filename and arguments. e6a263a Raise `NameError` as defined in specification when `Struct` member isn't found. a2f5840 Add tests to `Struct#[]` and `Struct#[]=`. 3d94022 Replace return value result passing with `assert_*` in `Struct` test. git-subtree-dir: mruby_test git-subtree-split: fb2e0b721fdcf5a65b907ee69ad8e09763632db2
1 parent 76d2e1a commit fb10e84

File tree

138 files changed

+2121
-1002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2121
-1002
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ matrix:
77
- os: linux
88
sudo: 9000
99
- os: osx
10-
osx_image: xcod6.4
10+
osx_image: xcode7.1
1111

1212
addons:
1313
apt:

AUTHORS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Original Authors "mruby developers" are:
22
Yukihiro Matsumoto
3-
FUKUOKA CSK CORPORATION
3+
SCSK KYUSHU CORPORATION
44
Kyushu Institute of Technology
55
Network Applied Communication Laboratory, Inc.
66
Daniel Bovensiepen
@@ -32,3 +32,5 @@ Original Authors "mruby developers" are:
3232
Manycolors, Inc.
3333
Shota Nakano
3434
Yuichi Osawa
35+
Terence Lee
36+
Zachary Scott

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ of the Ministry of Economy, Trade and Industry of Japan.
1717

1818
## How to get mruby
1919

20-
The stable version 1.1.0 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/1.1.0.zip](https://github.com/mruby/mruby/archive/1.1.0.zip)
20+
The stable version 1.2.0 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/1.2.0.zip](https://github.com/mruby/mruby/archive/1.2.0.zip)
2121

2222
The latest development version of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/zipball/master](https://github.com/mruby/mruby/zipball/master)
2323

@@ -52,7 +52,7 @@ Or
5252

5353
mruby contains a package manager called *mrbgems*. To create extensions
5454
in C and/or Ruby you should create a *GEM*. For a documentation of how to
55-
use mrbgems consult the file [doc/mrbgems/README.md](doc/mrbgems/README.md). For example code of
55+
use mrbgems consult the file [doc/guides/mrbgems.md](doc/guides/mrbgems.md). For example code of
5656
how to use mrbgems look into the folder *examples/mrbgems/*.
5757

5858
## License

TODO

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
Things to do (Things that are not done yet)
22

3-
* Special variables ($1,$2..)
3+
* special variables ($1,$2..)
44
* super in aliased methods
5+
* multi-assignment decomposing
6+
* keyword arguments in def statement
57

68
Things to improve (Done but things to fix)
79

8-
* Hash (Reduce size. Use khash or save the order)
9-
* stringEx (Delete encoding、delete CODERANGE、delete everything except UTF-8 or ASCII)
1010
* Make additions as they are noticed.
11-

build_config.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
# include the default GEMs
2323
conf.gembox 'default'
24-
2524
# C compiler settings
2625
# conf.cc do |cc|
2726
# cc.command = ENV['CC'] || 'gcc'
@@ -99,7 +98,7 @@
9998
conf.gembox 'default'
10099

101100
# C compiler settings
102-
conf.cc.defines = %w(ENABLE_DEBUG)
101+
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)
103102

104103
# Generate mruby debugger command (require mruby-eval)
105104
conf.gem :core => "mruby-bin-debugger"

doc/guides/compile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ can't be disabled for the main build.
463463
MRuby::CrossBuild.new('Minimal') do |conf|
464464
toolchain :gcc
465465
466-
conf.cc.defines = %w(DISABLE_STDIO)
466+
conf.cc.defines = %w(MRB_DISABLE_STDIO)
467467
conf.bins = []
468468
end
469469
```

doc/guides/debugger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To confirm mrdb was installed properly, run mrdb with the `--version` option:
3838

3939
```bash
4040
$ mrdb --version
41-
mruby 1.1.0 (2014-11-19)
41+
mruby 1.2.0 (2014-11-17)
4242
```
4343

4444
## 2.2 Basic Operation

doc/guides/gc-arena-howto.md

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# How to use `mrb_gc_arena_save()`/`mrb_gc_arena_restore()`
1+
# How to use `mrb_gc_arena_save()`/`mrb_gc_arena_restore()`/`mrb_gc_protect()`
22

3-
This is basically English translation of [Matz's blog post](http://www.rubyist.net/~matz/20130731.html) written in Japanese.
4-
Some parts are updated to reflect recent changes.
3+
_This is an English translation of [Matz's blog post][matz blog post]
4+
written in Japanese._
5+
_Some parts are updated to reflect recent changes._
6+
[matz blog post]: http://www.rubyist.net/~matz/20130731.html
57

68
When you are extending mruby using C language, you may encounter
79
mysterious "arena overflow error" or memory leak or very slow
@@ -10,7 +12,7 @@ implementing "conservative GC".
1012

1113
GC (garbage collector) must ensure that object is "alive", in other
1214
words, that it is referenced by somewhere from program. This can be
13-
determined by checking that that object can be directly or indirectly
15+
determined by checking if the object can be directly or indirectly
1416
referenced by root. The local variables, global variables and
1517
constants etc are root.
1618

@@ -22,7 +24,7 @@ by C variable is also "alive", but mruby GC cannot aware of this, so
2224
it might mistakenly recognize the objects referenced by only C
2325
variables as dead.
2426

25-
It is a fatal bug for GC to collect live objects.
27+
This can be a fatal bug if the GC tries to collect a live object.
2628

2729
In CRuby, we scan C stack area, and use C variable as root to check
2830
whether object is alive or not. Of course, because we are accessing C
@@ -32,60 +34,64 @@ pointer, then assume it as a pointer. We call it "conservative".
3234

3335
By the way, CRuby's "conservative GC" has some problems.
3436

35-
Its biggest problem is we have no way to access to the stack area in
37+
The biggest problem is we have no way to access to the stack area in
3638
portable way. Therefore, we cannot use this method if we'd like to
3739
implement highly portable runtime, like mruby.
3840

39-
So we came up an another plan to implement "conservative GC" in mruby.
41+
So we came up with an another plan to implement "conservative GC" in mruby.
4042

41-
Again, the problem is that there is an object which was created in C
42-
function, and is not referenced by Ruby world, and cannot be treated
43-
as garbage.
43+
Again, the problem is when an object which was created in C function, becomes
44+
no longer referenced in the Ruby world, and cannot be treated as garbage.
4445

4546
In mruby, we recognize all objects created in C function are alive.
46-
Then we have no problem such as recognizing live object as dead.
47+
Then we have no problem such as confusing a live object as dead.
4748

4849
This means that because we cannot collect truly dead object, we may
49-
get a little bit less efficiency, but GC itself is highly portable.
50+
lose efficiency, but as a trade-off the GC itself is highly portable.
5051
We can say goodbye to the problem that GC deletes live objects due to
5152
optimization which sometimes occurs in CRuby.
5253

5354
According to this idea, we have a table, called "GC arena", which
54-
remembers objects created in C function. The arena is stack
55-
structure, when C function execution is returned to mruby VM, all
56-
objects registered in the arena are popped.
55+
remembers objects created in C function.
5756

58-
This works very well, but GC arena causes another problem. "arena
59-
overflow error" or memory leak.
57+
The arena is stack structure, when C function execution is returned to mruby
58+
VM, all objects registered in the arena are popped.
59+
60+
This works very well, but can cause another problem: "arena overflow error" or
61+
memory leak.
6062

6163
As of this writing, mruby automatically extend arena to remember
6264
objects (See `MRB_GC_FIXED_ARENA` and `MRB_GC_ARENA_SIZE` in
63-
doc/mrbconf/README.md). If you keep creating objects in C functions,
64-
it increases memory usage, since GC never kick in. This memory usage
65-
may look like memory leak, and also makes execution slower.
65+
doc/guides/mrbconf.md).
66+
67+
If you create many objects in C functions, memory usage will increase, since
68+
GC never kick in. This memory usage may look like memory leak, but will also
69+
make execution slower as more memory will need to be allocated.
6670

6771
With the build time configuration, you can limit the maximum size of
6872
arena (e.g., 100). Then if you create many objects, arena overflows,
69-
thus you will get "arena overflow error".
73+
thus you will get an "arena overflow error".
7074

7175
To workaround these problems, we have `mrb_gc_arena_save()` and
7276
`mrb_gc_arena_restore()` functions.
7377

7478
`int mrb_gc_arena_save(mrb)` returns the current position of the stack
7579
top of GC arena, and `void mrb_gc_arena_restore(mrb, idx)` sets the
76-
stack top position to back to given idx. We uses them like so:
80+
stack top position to back to given `idx`.
81+
82+
We can use them like this:
7783

7884
```c
7985
int arena_idx = mrb_gc_arena_save(mrb);
8086

81-
...create objects...
87+
// ...create objects...
8288
mrb_gc_arena_restore(mrb, arena_idx);
8389

8490
```
8591
86-
In mruby, C function call are surrounded by this save/restore, but we
92+
In mruby, C function calls are surrounded by this save/restore, but we
8793
can further optimize memory usage by surrounding save/restore, and can
88-
avoid arena overflow.
94+
avoid creating arena overflow bugs.
8995
9096
Let's take a real example. Here is the source code of `Array#inspect`:
9197
@@ -134,38 +140,38 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
134140
}
135141
```
136142

137-
This is a real example, so a little bit complicated, so bear with me.
143+
This is a real example, so a little bit complicated, but bear with me.
138144
The essence of `Array#inspect` is that after stringifying each element
139145
of array using `inspect` method, we join them together so that we can
140-
get `inspect` representation of entire array.
146+
get `inspect` representation of the entire array.
141147

142-
After the `inspect` representation of entire array is created, we no
143-
longer require the individual string representation. That means that
144-
we don't have to register these temporal objects into GC arena.
148+
After the `inspect` representation is created, we no longer require the
149+
individual string representation. This means that we don't have to register
150+
these temporal objects into GC arena.
145151

146-
Therefore, in `ary_inspect()` function, we do:
152+
Therefore, in order to keep the arena size small; the `ary_inspect()` function
153+
will do the following:
147154

148155
* save the position of the stack top using `mrb_gc_arena_save()`.
149156
* get `inspect` representation of each element.
150157
* append it to the constructing entire `inspect` representation of array.
151158
* restore stack top position using `mrb_gc_arena_restore()`.
152159

153-
to keep the arena size small.
154-
155160
Please note that the final `inspect` representation of entire array
156161
was created before the call of `mrb_gc_arena_restore()`. Otherwise,
157162
required temporal object may be deleted by GC.
158163

159-
We may have a usecase that after creating many temporal objects, we'd
164+
We may have a usecase where after creating many temporal objects, we'd
160165
like to keep some of them. In this case, we cannot use the same idea
161-
in `ary_inspect()` like appending objects to existing one. Instead,
162-
after `mrb_gc_arena_restore()`, we register back the objects we'd like
163-
to keep to the arena using `mrb_gc_protect(mrb, obj)`. Use
164-
`mrb_gc_protect()` with caution because its usage could lead to arena
165-
overflow error.
166-
167-
We also have to mention that when `mrb_funcall` is called in top
168-
level, its return value is also registered to GC arena, so calling
169-
them repeatedly eventually lead to arena overflow error. Use
170-
`mrb_gc_arena_save()` and `mrb_gc_arena_restore()` or possible use of
166+
in `ary_inspect()` like appending objects to existing one.
167+
Instead, after `mrb_gc_arena_restore()`, we must re-register the objects we
168+
want to keep in the arena using `mrb_gc_protect(mrb, obj)`.
169+
Use `mrb_gc_protect()` with caution because it could also lead to an "arena
170+
overflow error".
171+
172+
We must also mention that when `mrb_funcall` is called in top level, the return
173+
value is also registered to GC arena, so repeated use of `mrb_funcall` may
174+
eventually lead to an "arena overflow error".
175+
176+
Use `mrb_gc_arena_save()` and `mrb_gc_arena_restore()` or possible use of
171177
`mrb_gc_protect()` to workaround this.

doc/guides/mrbconf.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,20 @@ You can use mrbconfs with following ways:
1111
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
1212

1313
## 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`
1915
* When defined `<stdio.h>` functions won't be used.
2016
* Some features will be disabled when this is enabled:
2117
* `mrb_irep` load/dump from/to file.
2218
* Compiling mruby script from file.
2319
* Printing features in **src/print.c**.
2420

2521
## Debug macros.
26-
`ENABLE_DEBUG`
22+
`MRB_ENABLE_DEBUG_HOOK`
2723
* When defined code fetch hook and debug OP hook will be enabled.
2824
* When using any of the hook set function pointer `code_fetch_hook` and/or `debug_op_hook` of `mrb_state`.
2925
* Fetch hook will be called before any OP.
3026
* Debug OP hook will be called when dispatching `OP_DEBUG`.
3127

32-
`DISABLE_DEBUG`
33-
* Will be define automatically if `ENABLE_DEBUG` isn't defined.
34-
3528
`MRB_DEBUG`
3629
* When defined `mrb_assert*` macro will be defined with macros from `<assert.h>`.
3730
* Could be enabled via `enable_debug` method of `MRuby::Build`.
@@ -145,6 +138,10 @@ largest value of required alignment.
145138
* Ignored when `MRB_USE_IV_SEGLIST` is defined.
146139

147140
## Other configuration.
141+
`MRB_UTF8_STRING`
142+
* Adds UTF-8 encoding support to character-oriented String instance methods.
143+
* If it isn't defined, they only support the US-ASCII encoding.
144+
148145
`MRB_FUNCALL_ARGC_MAX`
149146
* Default value is `16`.
150147
* Specifies 4th argument(`argc`) max value of `mrb_funcall`.

examples/targets/build_config_ArduinoDue.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
5151
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
5252
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.
5454
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
5555
end
5656

examples/targets/build_config_chipKITMax32.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
4848
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
4949
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.
5151
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
5252
end
5353

include/mrbconf.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,25 @@
7575
/* fixed size state atexit stack */
7676
//#define MRB_FIXED_STATE_ATEXIT_STACK
7777

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 */
8080

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 */
8383

8484
/* end of configuration */
8585

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_DISABLE_STDIO
8989
#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
9294
#endif
9395

94-
#ifdef ENABLE_STDIO
96+
#ifndef MRB_DISABLE_STDIO
9597
# include <stdio.h>
9698
#endif
9799

0 commit comments

Comments
 (0)