summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2019-08-02Merge pull request #4609 from ↵Yukihiro "Matz" Matsumoto
shuujii/change-the-mrb_vformat-specifier-%d-for-int Change the `mrb_vformat` specifier `%d` for `int`
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-01Merge pull request #4608 from ↵Yukihiro "Matz" Matsumoto
shuujii/add-new-specifiers-modifiers-to-format-string-of-mrb_vfromat Add new specifiers/modifiers to format string of `mrb_vfromat()`
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.
2019-07-31Merge pull request #4607 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-UTC-offset-representation-in-Time-to_s-on-some-environments Fix UTC offset representation in `Time#to_s` on some environments; ref #4604
2019-07-31Fix UTC offset representation in `Time#to_s` on some environments; ref #4604KOBAYASHI Shuji
Use own implementation to calculate UTC offset on Visual Studio 2015 or earlier or MinGW because `strftime("%z")` on these environments does not conform C99.
2019-07-31Avoid `MRB_INT_MIN` to apply `fixdivmod`.Yukihiro "Matz" Matsumoto
`MRB_INT_MIN` is the only integer value that has no corresponding positive integer value (i.e. `-MRB_INT_MIN` = `MRB_INT_MIN`).
2019-07-31Normalize floating point negative zero to positive zero in `flodivmod'.Yukihiro "Matz" Matsumoto
2019-07-31Should return +/- infinity for float division by zero.Yukihiro "Matz" Matsumoto
2019-07-31Use `NULL` instead of `0` for null pointers.Yukihiro "Matz" Matsumoto
2019-07-30Fixed integer overflow in `lshift`.Yukihiro "Matz" Matsumoto
2019-07-30Merge pull request #4606 from shuujii/refine-message-to-skip-in-nested-assertYukihiro "Matz" Matsumoto
Refine message to `skip` in nested `assert`
2019-07-30Refine message to `skip` in nested `assert`KOBAYASHI Shuji
- I think "Info" is used only to `skip`, so change to "Skip". - Changed the default value of `assert` and specify the argument explicitly at the caller of `assert` because it is unnatural "Assertion failed" is output even though the assertion doesn't fail. == Example: def assert_foo(exp, act) assert do assert_equal exp[0], act[0] assert_equal exp[1], act[1] end end def assert_bar(exp, act) assert do skip end end def assert_baz(exp, act) assert do assert_equal exp, act assert_bar exp, act end end assert 'test#skip_in_nested_assert' do assert_baz 1, 1 end === Before this patch: ?.. Info: test#skip_in_nested_assert (core) - Assertion[1] Info: Assertion failed (core) - Assertion[1-2] Skip: Assertion failed (core) Total: 3 OK: 2 KO: 0 Crash: 0 Warning: 0 Skip: 1 === After this patch: ??? Skip: test#skip_in_nested_assert (core) - Assertion[1] Skip: assert (core) - Assertion[1-2] Skip: assert (core) Total: 3 OK: 0 KO: 0 Crash: 0 Warning: 0 Skip: 3
2019-07-29Merge pull request #4605 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-Warn-if-assertion-is-missing-inside-assert Fix "Warn if assertion is missing inside `assert`"; ref ff43b2b9
2019-07-29Fix "Warn if assertion is missing inside `assert`"; ref ff43b2b9KOBAYASHI Shuji
2019-07-29Merge pull request #4604 from kou/time-to-s-utf8Yukihiro "Matz" Matsumoto
Fix Time#to_s encoding on Windows
2019-07-29Fix Time#to_s encoding on WindowsSutou Kouhei
strftime() on Windows returns locale encoding time zone for "%z" even if MSDN says "%z" is "The offset from UTC in ISO 8601 format; no characters if time zone is unknown" in MSDN: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019 So we need to convert encoding of string from strftime().
2019-07-29Fixed a conflict between #4407 and #4540Yukihiro "Matz" Matsumoto
2019-07-29Merge pull request #4407 from ↵Yukihiro "Matz" Matsumoto
shuujii/add-assert_raise_with_message-and-assert_raise_with_message_pattern Add `assert_raise_with_message` and `assert_raise_with_message_pattern`
2019-07-29Resolved conflicts in #4320Yukihiro "Matz" Matsumoto
2019-07-28Merge pull request #4602 from shuujii/remove-EnumeratorChain-initialize_copyYukihiro "Matz" Matsumoto
Remove `Enumerator::Chain#initialize_copy`
2019-07-28Merge pull request #4603 from ↵Yukihiro "Matz" Matsumoto
shuujii/define-plus-to-Enumerator-and-Enumerator-Chain-instead-of-Enumerable Define `#+` to `Enumerator` and `Enumerator#Chain` instead of `Enumerable`
2019-07-28Define `#+` to `Enumerator` and `Enumerator#Chain` instead of `Enumerable`KOBAYASHI Shuji
2019-07-28Remove `Enumerator::Chain#initialize_copy`KOBAYASHI Shuji
I think `Enumerator::Chain#initialize_copy` is unnecessary because CRuby doesn't clone elements.
2019-07-28Merge pull request #4601 from ↵Yukihiro "Matz" Matsumoto
shuujii/drop-dependency-from-mruby-enumerator-to-mruby-enum-ext Drop dependency from `mruby-enumerator` to `mruby-enum-ext`
2019-07-28Drop dependency from `mruby-enumerator` to `mruby-enum-ext`KOBAYASHI Shuji
2019-07-28Merge pull request #4600 from dearblue/time-precisionYukihiro "Matz" Matsumoto
Fix the lack of precision for `Time`; ref d74355061
2019-07-27Merge pull request #4599 from ↵Yukihiro "Matz" Matsumoto
shuujii/drop-dependency-from-mruby-enum-chain-to-mruby-enum-ext Drop dependency from `mruby-enum-chain` to `mruby-enum-ext`
2019-07-27Fix the lack of precision for `Time`; ref d74355061dearblue
- `Time.local` and `Time.utc` are able to use with `MRB_INT16 + MRB_WITHOUT_FLOAT`. - `time_t` is converted directly from the Ruby object. - `time + sec` and` time - sec` are not affected by the precision of `mrb_float`. Similarly, calculations are possible with `MRB_INT16 + MRB_WITHOUT_FLOAT`.
2019-07-27Drop dependency from `mruby-enum-chain` to `mruby-enum-ext`KOBAYASHI Shuji
2019-07-27Merge pull request #4598 from dearblue/time-without-floatYukihiro "Matz" Matsumoto
Fix mruby-time with `MRB_WITHOUT_FLOAT`; ref d74355061
2019-07-27Fix line number bug; fix #4513Yukihiro "Matz" Matsumoto
Also fix the misfeature introduced in 23783a4, that ignores newlines between method chains.
2019-07-27Fix mruby-time with `MRB_WITHOUT_FLOAT`; ref d74355061dearblue
2019-07-27Merge pull request #4597 from ↵Yukihiro "Matz" Matsumoto
shuujii/drop-dependency-from-mruby-array-ext-to-mruby-enum-ext Drop dependency from `mruby-array-ext` to `mruby-enum-ext`
2019-07-27Merge pull request #4594 from ↵Yukihiro "Matz" Matsumoto
shuujii/move-NilClass-to_h-to-mruby-object-ext-from-mruby-enum-ext Move `NilClass#to_h` to `mruby-object-ext` from `mruby-enum-ext`
2019-07-26Drop dependency from `mruby-array-ext` to `mruby-enum-ext`KOBAYASHI Shuji
2019-07-26Merge pull request #4595 from shuujii/refine-Array-permutation-combination-testYukihiro "Matz" Matsumoto
Refine `Array#(permutation|combination) test`
2019-07-25Refine `Array#(permutation|combination) test`KOBAYASHI Shuji
- No guarantees about the order in which the permutations/combinations are yielded. - Drop dependency on `Enumerator`.
2019-07-24Move `NilClass#to_h` to `mruby-object-ext` from `mruby-enum-ext`KOBAYASHI Shuji
2019-07-24Add `return` to silence a warning; ref #4593Yukihiro "Matz" Matsumoto
2019-07-24Use `MRB_TT_ISTRUCT` for `Random` to reduce memory.Yukihiro "Matz" Matsumoto
When the size of Xorshift128 seed (`sizeof(uint32)*4`) is bigger than ISTRUCT_DATA_SIZE, `Random` uses Xorshift96 instead.
2019-07-24Call `MRB_SET_INSTANCE_TT` for `Complex` and `Rational`.Yukihiro "Matz" Matsumoto
2019-07-23Merge pull request #4593 from shuujii/add-encoding-argument-to-Integral-chrYukihiro "Matz" Matsumoto
Add encoding argument to `Integral#chr`
2019-07-23Add encoding argument to `Integral#chr`KOBAYASHI Shuji
Currently, `Integral#chr` in mruby changes behavior by `MRB_UTF8_STRING` setting. before this patch: $ bin/mruby -e 'p 171.chr' #=> "\xab" (`MRB_UTF8_STRING` is disabled) $ bin/mruby -e 'p 171.chr' #=> "«" (`MRB_UTF8_STRING` is enabled) This behavior is incompatible with Ruby, and a little inconvenient because it can't be interpreted as ASCII-8BIT with `MRB_UTF8_STRING`, I think. So add encoding argument according to Ruby. after this patch: $ bin/mruby -e 'p 171.chr' #=> "\xab" $ bin/mruby -e 'p 171.chr("ASCII-8BIT")' #=> "\xab" $ bin/mruby -e 'p 171.chr("UTF-8")' #=> "«" Allow only `String` for encoding because mruby doesn't have `Encoding` class, and `"ASCII-8BIT"` (`"BINARY"`) and `"UTF-8"` (only with `MRB_UTF8_STRING`) are valid value (default is `"ASCII-8BIT"`).
2019-07-22Merge pull request #4591 from ↵Yukihiro "Matz" Matsumoto
shuujii/integrate-Integral-chr-Fixnum-chr-to-mruby-string-ext Integrate `Integral#chr` (`Fixnum#chr`) to `mruby-string-ext`
2019-07-22Merge pull request #4590 from shuujii/fix-Module-dup-to-frozen-moduleYukihiro "Matz" Matsumoto
Fix `Module#dup` to frozen module
2019-07-22Merge pull request #4592 from shuujii/set-MRB_STR_ASCII-flag-in-String-inspectYukihiro "Matz" Matsumoto
Set `MRB_STR_ASCII` flag in `String#inspect`
2019-07-22Fix `mruby-time` to work with `MRB_WITHOUT_FLOAT`; ref #4576Yukihiro "Matz" Matsumoto
As a side effect, `mrb_time_at()` now takes `mrb_int` instead of `double` as time arguments.
2019-07-22Improve conflict error message of `Time` and `Math`; ref #4576Yukihiro "Matz" Matsumoto
2019-07-22Check conflicts with `Complex` and `MRB_WITHOUT_FLOAT`; ref #4576Yukihiro "Matz" Matsumoto
The Complex class needs `mrb_float` so that it does not work with `MRB_WITHOUT_FLOAT` anyway.