summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
AgeCommit message (Collapse)Author
2019-09-11Drop test dependency from `mruby-string-ext` to `mruby-enumerator`KOBAYASHI Shuji
2019-09-09change _ variable in mirb to be enable by defaulttakkaw
2019-09-09add special local variable _ in mirbtakkaw
2019-09-05Fix `Range#max` test (`TypeError` is raised) on 32-bit mode with word boxingKOBAYASHI Shuji
2019-09-02Merge pull request #4683 from ↵Yukihiro "Matz" Matsumoto
shuujii/enumeratorChain-rewind-shouldnt-rewind-elements-arent-iterated `Enumerator::Chain#rewind` shouldn't rewind elements aren't iterated
2019-09-02`Enumerator::Chain#rewind` shouldn't rewind elements aren't iteratedKOBAYASHI Shuji
### Example: ```ruby # example.rb e = [1] def e.rewind; p :r end c = e.chain(e) c.each{break c}.rewind ``` #### Before this patch: ```terminal $ bin/mruby example.rb :r :r ``` #### After this patch (same as Ruby): ```terminal $ bin/mruby example.rb :r ```
2019-09-02Small refactoring in `fiber.c`.Yukihiro "Matz" Matsumoto
2019-09-01Merge pull request #4681 from ↵Yukihiro "Matz" Matsumoto
shuujii/array-permutation-with-a-negative-argument-should-not-yield `Array#permutation` with a negative argument should not yield
2019-09-01`Array#permutation` with a negative argument should not yieldKOBAYASHI Shuji
Before this patch: $ bin/mruby -e '[1].permutation(-1){|v| p v}' #=> [1] After this patch (same as Ruby): $ bin/mruby -e '[1].permutation(-1){|v| p v}' #=> no output
2019-08-31Skip `nil?` method call in `if` conditionals.Yukihiro "Matz" Matsumoto
Compile `if expr.nil?` to use `OP_JMPNIL` instead of calls.
2019-08-30`Array#(permutation|combination)` without block should return `self`KOBAYASHI Shuji
2019-08-27Fix build of `mruby-random` on 32-bit modeKOBAYASHI Shuji
2019-08-26Fix `Array#sample` with `MRB_INT32`KOBAYASHI Shuji
Array index became potentially negative because `uint32_t` is cast to `mrb_int`.
2019-08-26Merge pull request #4635 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-wrong-argument-for-fprintf-in-mruby-bin-mrbc Fix wrong argument for `fprintf` in `mruby-bin-mrbc`
2019-08-26Remove unused `random.h`KOBAYASHI Shuji
2019-08-25Merge pull request #4667 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-Range-max-test-TypeError-is-raised-on-32-bit-mode Fix `Range#max` test (`TypeError` is raised) on 32-bit mode
2019-08-24Fix `Range#max` test (`TypeError` is raised) on 32-bit modeKOBAYASHI Shuji
2019-08-24Create a symbolic link in the temporary directory; fix #4642dearblue
Because the linker gives a warning on FreeBSD 12.0. ``` warning: mktemp() possibly used unsafely; consider using mkstemp() ```
2019-08-21Merge pull request #4650 from take-cheeze/patch-5Yukihiro "Matz" Matsumoto
Remove deprecated iij stuffs
2019-08-20Remove deprecated iij stuffsTakeshi Watanabe
2019-08-20Fix link of mruby-ioTakeshi Watanabe
2019-08-20Fixed a bug in the `OP_JMPNOT` optimization (13eaff4); fix #4644Yukihiro "Matz" Matsumoto
2019-08-19Merge pull request #4639 from dearblue/suppress-Wstringop-truncationYukihiro "Matz" Matsumoto
Suppress warnings for `strncat()`
2019-08-19Merge pull request #4638 from dearblue/simplify-get-argsYukihiro "Matz" Matsumoto
Simplify get arguments
2019-08-19Merge pull request #4642 from dearblue/unique-symlinkYukihiro "Matz" Matsumoto
Make symbolic link names unique for test
2019-08-18Make symbolic link names unique for testdearblue
2019-08-18Suppress warnings for `strncat()`dearblue
`strncat()` also needs `'\0'`.
2019-08-18Simplify get argumentsdearblue
- `mrb_str_index_m()` and `mrb_str_rindex()` Make `mrb_get_args()` called only once from called twice. - `mrb_str_byteslice()` Replace `goto` with `if ~ else`.
2019-08-18Prohibit changes to iseq in principledearblue
2019-08-17Fix wrong argument for `fprintf` in `mruby-bin-mrbc`KOBAYASHI Shuji
2019-08-17Remove unnecessary `OP_JMPNOT` for `unless` statement.Yukihiro "Matz" Matsumoto
2019-08-16Avoid creating unnecessary empty arrays on splat.Yukihiro "Matz" Matsumoto
But this changes requires `OP_ARYCAT` and `OP_ARYPUSH` to accept `nil` as their first operand. Alternative VMs (e.g. `mruby/c`) that understand mruby bytecode need to be updated.
2019-08-12Remove unnecessary prototypes from 'keywords`; fix #4628Yukihiro "Matz" Matsumoto
2019-08-09Avoid overflow and underflow in Complex#/Ray Chason
2019-08-08Implement Complex#abs in terms of Math.hypotRay Chason
Math.hypot avoids premature overflow and underflow
2019-08-07Reorganize `mrb_string_value_cstr` and related functions.Yukihiro "Matz" Matsumoto
`mrb_string_value_cstr` and `mrb_string_value_len`: obsolete `mrb_string_cstr`: new function to retrieve NULL terminated C string `RSTRING_CSTR`: wrapper macro of `mrb_string_cstr`
2019-08-07`RUBY_PLATFORM` may not contain `mswin` or `mingw`; Add `msys`Yukihiro "Matz" Matsumoto
2019-08-06Removed an unused local variable; ref #4615Yukihiro "Matz" Matsumoto
2019-08-05Merge pull request #4615 from ↵Yukihiro "Matz" Matsumoto
shuujii/use-new-specifiers-modifiers-of-mrb_vfromat Use new specifiers/modifiers of `mrb_vfromat()`
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-08-05Merge pull request #4614 from ↵Yukihiro "Matz" Matsumoto
shuujii/use-mrb_int-instead-of-to_int-in-mruby-numeric-ext Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`
2019-08-05Merge pull request #4612 from dearblue/float-constsYukihiro "Matz" Matsumoto
Add constants for floating point number
2019-08-04Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`KOBAYASHI Shuji
2019-08-04Add constants for floating point numberdearblue
2019-08-03Change second argument to `%l` of `mrb_vformat()` to `size_t` from `mrb_int`KOBAYASHI Shuji
- `size_t` is more commonly used. - `len` argument of `mrb_str_new()` is `size_t`. NOTE: The test for `%l` is temporarily disabled because adding a new type to `mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual Studio 2017 in AppVeyor.
2019-08-03Merge pull request #4611 from shuujii/fix-mrb_vformat%f-with-MRB_USE_FLOATYukihiro "Matz" Matsumoto
Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`
2019-08-03Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`KOBAYASHI Shuji
It potentially not work when `mrb_float` is `float` because `float` variable in variable length arguments is promoted to `double`. Also I fixed build with `MRB_WITHOUT_FLOAT`.
2019-08-03Suppress compiler warnings for mruby-time; fix #4600dearblue
Warnings: - If `MRB_TIME_T_UINT` is defined, the compiler issues a warning with an integer comparison of different signs. - It is mentioned that the `usec` variable passed to the `mrb_to_time_t()` function may not be initialized
2019-08-02Change the `mrb_vformat` specifier `%d` for `int`KOBAYASHI Shuji
It potentially breaks, for example, in the case of `mrb_int` is 64-bit and more smaller type is passed by `%d`. In fact, the problem could become apparent when I used `%d` to `backtrace_location::lineno` in `src/backtrace.c:mrb_unpack_backtrace()` on AppVeyor. Therefore, change `%d` for `int` (not `mrb_int`) so that it can be used mostly without casting.
2019-08-01Add new specifiers/modifiers to format string of `mrb_vfromat()`KOBAYASHI Shuji
Format sequence syntax: %[modifier]specifier Modifiers: ----------+------------------------------------------------------------ Modifier | Meaning ----------+------------------------------------------------------------ ! | Convert to string by corresponding `inspect` instead of | corresponding `to_s`. ----------+------------------------------------------------------------ Specifiers: ----------+----------------+-------------------------------------------- Specifier | Argument Type | Note ----------+----------------+-------------------------------------------- c | char | d,i | mrb_int | f | mrb_float | l | char*, mrb_int | Arguments are string and length. n | mrb_sym | s | char* | Argument is NUL terminated string. t | mrb_value | Convert to type (class) of object. v,S | mrb_value | C | struct RClass* | T | mrb_value | Convert to real type (class) of object. Y | mrb_value | Same as `!v` if argument is `true`, `false` | | or `nil`, otherwise same as `T`. % | - | Convert to percent sign itself (no argument | | taken). ----------+----------------+-------------------------------------------- This change will increase the binary size, but replacing all format strings with new specifiers/modifiers will decrease the size because it reduces inline expansion of `mrb_obj_value()`, etc. at the caller.