summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
AgeCommit message (Collapse)Author
2020-11-21Improved `Object#define_singleton_method`dearblue
Integrate the implementation with `Module#define_method`. - Introduce the internal function `mrb_mod_define_method_m()` (no static) - The `Object#define_singleton_method` method can now accept a second argument
2020-11-21Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163KOBAYASHI Shuji
| Previous Name | New Name | |------------------------------|-------------------------| | MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_SYMBOLL_ALL | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI | | MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION | | MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK | | MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING | | MRB_DISABLE_STDIO | MRB_NO_STDIO | | ENABLE_LINENOISE | MRB_USE_LINENOISE | | ENABLE_READLINE | MRB_USE_READLINE | | DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE | | DISABLE_GEMS | MRB_NO_GEMS | * `MRB_ENABLE_SYMBOLL_ALL` seems to be a typo, so it is fixed. * `MRB_` prefix is added to those without. * The previous names can also be used for compatibility.
2020-11-21Allow to mixed and specify `*.rb` and `*.mrb` in `bin/mruby`dearblue
It is not decides by the extension. In order to be recognized as a `.mrb` file, the following three points must be satisfied: - File starts with "RITE" - At least `sizeof(struct rite_binary_header)` bytes can be read - `NUL` is included in the first 64 bytes of the file If these are not met, it is judged as a text file and it is processed as a Ruby script. The `bin/mruby -b` switch is still available which treats the given file as a `.mrb` file. New `MRB_API` function: - `include/mruby/compile.h` and `mrbgems/mruby-compiler/core/parse.y` - `mrb_load_detect_file_cxt()` (remove with `MRB_DISABLE_STDIO`) NOTE: - Even script files now always open in binary mode for `bin/mruby`. The `\r\n` is handled by the `nextc()` function already, so there is no problem even on Windows. - The `nextc0()` function in `mrbgems/mruby-compiler/core/parse.y` can now specify a string buffer and a file pointer at the same time. In this case, get it from the string buffer first. This patch includes modifies by comment of https://github.com/mruby/mruby/pull/5157.
2020-11-19Allow `bintest` even if build name is not `host`KOBAYASHI Shuji
2020-11-18Fix integer overflow error in mrdb testKOBAYASHI Shuji
2020-11-18Retrieve `irep` from `proc` after `MRB_PROC_CFUNC_P` check; ref #5140Yukihiro "Matz" Matsumoto
2020-11-17Check division overflow (`MRB_INT_MIN` and `-1`).Yukihiro "Matz" Matsumoto
2020-11-17Overflown integers should not be fall back to float values.Yukihiro "Matz" Matsumoto
2020-11-14Merge pull request #5130 from ↵Yukihiro "Matz" Matsumoto
shuujii/workaround-to-build-mirb-with-Homebrews-readline-on-Mac Workaround to build `mirb` with Homebrew's readline on Mac; fix #4537
2020-11-14Workaround to build `mirb` with Homebrew's readline on Mac; fix #4537KOBAYASHI Shuji
2020-11-14Don't use private structs with `mrb_mt_foreach()`dearblue
The `MRB_API` function `mrb_mt_foreach()` previously used the private structure `struct mt_elem`. Therefore, use `mrb_method_t` instead.
2020-11-13Rename `mrb_os_memsize_of_hash_table` to `mrb_hash_memsize`KOBAYASHI Shuji
* The term `hash_table` can be misleading because the return value of this function includes memory usage of entire `Hash` object, including not only hash table part but also entry list part, etc. * This function takes a `Hash` object as a receiver and is defined in `src/hash.c`, so it is natural to have a `mrb_hash_` prefix.
2020-11-13Merge pull request #5122 from shuujii/change-name-and-usage-of-presym-macrosYukihiro "Matz" Matsumoto
Change name and usage of presym macros
2020-11-13Change name and usage of presym macrosKOBAYASHI Shuji
To be also able to build mruby without presym in the future. However, `MRB_QSYM` has been removed and changed as follows: ### Example | Type | Symbol | Previous Style | New Style | |---------------------------|--------|------------------|----------------| | Operator | & | MRB_QSYM(and) | MRB_OPSYM(and) | | Class Variable | @@foo | MRB_QSYM(00_foo) | MRB_CVSYM(foo) | | Instance Variable | @foo | MRB_QSYM(0_foo) | MRB_IVSYM(foo) | | Method with Bang | foo! | MRB_QSYM(foo_b) | MRB_SYM_B(foo) | | Method with Question mark | foo? | MRB_QSYM(foo_p) | MRB_SYM_Q(foo) | | Mmethod with Equal | foo= | MRB_QSYM(foo_e) | MRB_SYM_E(foo) | This change makes it possible to define, for example, `MRB_IVSYM(foo)` as `mrb_intern_lit(mrb, "@" "foo")`, which is useful if we support building without presym in the future.
2020-11-12Remove unused argument of `mrb_obj_iv_tbl_memsize`KOBAYASHI Shuji
2020-11-09Don't check FD for STDIN/STDOUT/STDERR; #5114Sutou Kouhei
We don't need to require valid STDIN/STDOUT/STDERR. If we require it, we can't use mruby on an environment that doesn't have valid STDIN/STDOUT/STDERR such as Windows service process. Windows service process doesn't have valid STDIN.
2020-11-05Fix `A.new([[1,2],3]).flatten` to return `Array`.Yukihiro "Matz" Matsumoto
2020-11-05Use `INT32_{MAX,MIN}` to specify integer ranges.Yukihiro "Matz" Matsumoto
2020-11-04Avoid integer overflow in comparison.Yukihiro "Matz" Matsumoto
2020-11-04Add cast to silence int conversion warnings.Yukihiro "Matz" Matsumoto
2020-11-04Fix a bug with big negative integers.Yukihiro "Matz" Matsumoto
2020-11-04Add a new instruction `OP_LOADI32`.Yukihiro "Matz" Matsumoto
That loads 32 bit integer bypassing pool access.
2020-11-03Merge pull request #5112 from shuujii/fix-dependencies-of-y.tab.oYukihiro "Matz" Matsumoto
Fix dependencies of `y.tab.o`
2020-11-03Use C99 `__func__` instead of `__FUNCTION__`; #5107Yukihiro "Matz" Matsumoto
2020-11-03Fix dependencies of `y.tab.o`KOBAYASHI Shuji
In the case of `y.tab.o`, `y.tab.d` was not read, so `y.tab.c` was not recompiled by updating header files. It seemed that the cause was overwriting the rake rule, so I deleted unnecessary settings.
2020-11-03Add new instructions to handle symbols/literals >255; fix #5109Yukihiro "Matz" Matsumoto
New instructions: * OP_LOADL16 * OP_LOADSYM16 * OP_STRING16 Size of pools, symbols are `int16_t` but offset representation in the bytecode was 8 bits. Size of child `irep` array is `int16_t`, too but this change does not address it.
2020-11-02ISO C does not allow extra ';' outside of a function; #5107Yukihiro "Matz" Matsumoto
2020-11-02Replace `R-assignment` by `single-line pattern matching`.Yukihiro "Matz" Matsumoto
Since `R-assignment` in CRuby is abandoned. Single-line pattern matching in `mruby` only matches single local variable at the moment. Currently it works as a right assignment to a local variable. It will be enhanced in the future.
2020-11-01Fix `mruby -v option` test.mimaki
2020-10-29Fix typo in `Range#last`KOBAYASHI Shuji
2020-10-29Move `build_config.rb` -> `build_config/default.rb`; ref #5098Yukihiro "Matz" Matsumoto
In addition, update the documents referring `build_config.rb` which is no longer used. The new `build_config.rb` describes the new configuration structure in the comment.
2020-10-29Add beginless/endless ranges tests.Yukihiro "Matz" Matsumoto
2020-10-29Raise exception from `Range#first` with beginless ranges.Yukihiro "Matz" Matsumoto
2020-10-29Implement `Range#last` in `mruby-range-ext` in Ruby.Yukihiro "Matz" Matsumoto
This reduce unnecessary calls of `mrb_funcall()`.
2020-10-28Fixed build with `conf.enable_cxx_exception`dearblue
The problem was manifested by commit 5069fb15e41998dffef8e0ba566b3a82be369ba3.
2020-10-24Reorganize `env_new()` as `mrb_env_new()`dearblue
The `mrb_env_new()` function is a global function, but it is still treated as an internal function.
2020-10-22Prohibit array changes by "a"/"*" specifier of `mrb_get_args()`dearblue
The "a"/"*" specifier of the `mrb_get_args()` function will now return `const mrb_value *`. This is because it is difficult for the caller to check if it is an array object and write-barrier if necessary. And it requires calling `mrb_ary_modify()` on the unmodified array object, which is also difficult (this is similar to #5087).
2020-10-16Add startless range (another part of #5085)Yukihiro "Matz" Matsumoto
Ref #5093; close #5085
2020-10-15Merge branch 'work_for_merge' of https://github.com/zubycz/mruby into ↵Yukihiro "Matz" Matsumoto
zubycz-work_for_merge
2020-10-15Fix out of bound access in `parse.y`.Yukihiro "Matz" Matsumoto
2020-10-15Merge pull request #5084 from mruby/mruby3Yukihiro "Matz" Matsumoto
Mruby3
2020-10-14Avoid using C struct dump for test Ruby code.Yukihiro "Matz" Matsumoto
Files under `test/t` and `mrbgem/*/test` are for tests, not for actual execution. So symbols in those files need not to be pre-allocated. This change slightly reduce the memory consumption.
2020-10-13Introduce endless range (a part of #5085)taiyoslime
Co-Authored-By: n4o847 <[email protected]> Co-Authored-By: smallkirby <[email protected]>
2020-10-12Revert e2e6554b56 not to use `MRB_TRY()`; close #5088Yukihiro "Matz" Matsumoto
`MRB_TRY()` does not work when compiled by C compiler with `cxx_exception`, due to the mixture of `setjmp()` used by `mirb.c` and `throw` used by the core. The original intension of e2e6554b56 is to protect code from signal interruption, but the signal interruption is not well-defined in mruby anyway.
2020-10-12Unify `mrb_str_to_str` to `mrb_obj_as_string`.Yukihiro "Matz" Matsumoto
Redirect `mrb_str_to_str` to `mrb_obj_as_string` via C macro. Inspired by #5082
2020-10-12Update `bintest` of `mruby-bin-debugger`.Yukihiro "Matz" Matsumoto
Need to support `int / int -> int` update.
2020-10-12Add `const` before `struct mrb_irep` in `mruby-bin-debugger` gem.Yukihiro "Matz" Matsumoto
2020-10-12Fix `mrb_int_mul_overflow()` to check either operand being zero.Yukihiro "Matz" Matsumoto
2020-10-12Embed debug information to resolve Windows VC's issue.Yukihiro "Matz" Matsumoto
2020-10-12Adjust backslash position in multi-line macros.Yukihiro "Matz" Matsumoto