1. 01 Sep, 2021 2 commits
  2. 31 Aug, 2021 12 commits
  3. 29 Aug, 2021 1 commit
  4. 28 Aug, 2021 4 commits
  5. 27 Aug, 2021 1 commit
    • dearblue's avatar
      Refactor the `mrb_get_args()` function · 6ac8d14b
      dearblue authored
      - Removed the `ARGV` macro.
        The current path doesn't go into the mruby VM and there's also no need to separate variables.
      - Use common functions to check object types.
        - Use `mrb_ensure_string_type()` to check the string instead of `mrb_to_str()`.
          This is for consistency with array and hash.
        - Use `mrb_ensure_array_type()` to check the array instead of `to_ary()`.
        - Use `mrb_ensure_hash_type()` to check the hash instead of `to_hash()`.
        - Add and use `ensure_class_type()` to check class and module.
      - Changed the argument index type from `mrb_int` to `int`.
        Even if it is `int16_t`, it is enough.
        `mrb_int` is overkill, especially if `MRB_32BIT` and `MRB_INT64` are defined.
      6ac8d14b
  6. 26 Aug, 2021 8 commits
  7. 25 Aug, 2021 1 commit
  8. 24 Aug, 2021 1 commit
  9. 23 Aug, 2021 3 commits
    • dearblue's avatar
      Checks the frozen object with `mrb_get_args()` · 66aa184a
      dearblue authored
      This now works with the `+` modifier that can be added after each specifier.
      
      - `nil` is bypassed.
      - The `s` and `z` specifiers are received in C as a `const char *`, so adding a `+` modifier will raise an exception.
      - The `a` specifier is received in C as `const mrb_value *`, so adding a `+` modifier will raise an exception.
      - The `|`, `*`, `&`, `?` and `:` specifiers with `+` modifier raises an exception.
      
      If `!`/`+` exceeds one for each specifier, an exception will occur in the subsequent processing.
      This is the same behavior as before.
      66aa184a
    • dearblue's avatar
      Integrate each element expansion process of the argument · 6415faab
      dearblue authored
      The previously used `given` variable will be merged into the `pickarg` pointer variable, which points to the argument currently being processed for each loop.
      6415faab
    • Yukihiro "Matz" Matsumoto's avatar
      6f46f888
  10. 22 Aug, 2021 2 commits
  11. 21 Aug, 2021 5 commits
    • dearblue's avatar
      Organize the include of header files · 5a576028
      dearblue authored
      - `#include <math.h>` is done in `mruby.h`.
        Eliminate the need to worry about the `MRB_NO_FLOAT` macro.
      
      - Include mruby header files before standard header files.
        If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`.
      
      This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
      5a576028
    • dearblue's avatar
      Stirs internal state when `seed` is set in `Random` · 2121b6e6
      dearblue authored
      This is to avoid the approximation of `Random#rand` when `seed`s are close together.
      
      For example, the first `#rand` values after doing `Random#srand(0)` and `Random#srand(1)` are very similar.
      
      Below is the sequence of mruby before this patch was given a `seed` of `0...20`:
      
      ```console
      % bin/mruby -e 'r = Random.new; 20.times { |i| r.srand(i); puts "seed=%2d  %s" % [i, 10.times.map { "%0.3f" % r.rand }.join(" ")] }'
      seed= 0  0.643 0.585 0.198 0.732 0.087 0.605 0.548 0.468 0.573 0.966
      seed= 1  0.643 0.585 0.198 0.607 0.370 0.605 0.633 0.593 0.395 0.439
      seed= 2  0.643 0.585 0.197 0.981 0.652 0.730 0.875 0.713 0.529 0.269
      seed= 3  0.643 0.585 0.198 0.857 0.934 0.730 0.960 0.216 0.286 0.523
      seed= 4  0.643 0.585 0.197 0.231 0.217 0.605 0.959 0.958 0.478 0.482
      seed= 5  0.643 0.585 0.197 0.106 0.249 0.605 0.044 0.330 0.925 0.047
      seed= 6  0.643 0.585 0.197 0.481 0.781 0.731 0.285 0.960 0.804 0.725
      seed= 7  0.643 0.585 0.197 0.356 0.813 0.731 0.370 0.711 0.937 0.448
      seed= 8  0.643 0.585 0.198 0.732 0.329 0.108 0.243 0.974 0.766 0.936
      seed= 9  0.643 0.585 0.198 0.607 0.611 0.108 0.827 0.102 0.962 0.597
      seed=10  0.643 0.585 0.198 0.981 0.393 0.233 0.569 0.723 0.472 0.805
      seed=11  0.643 0.585 0.198 0.857 0.676 0.233 0.154 0.222 0.603 0.371
      seed=12  0.643 0.585 0.198 0.231 0.458 0.108 0.654 0.979 0.928 0.577
      seed=13  0.643 0.585 0.198 0.106 0.490 0.108 0.239 0.355 0.749 0.831
      seed=14  0.643 0.585 0.198 0.481 0.523 0.233 0.981 0.486 0.505 0.131
      seed=15  0.643 0.585 0.198 0.356 0.555 0.234 0.565 0.233 0.011 0.666
      seed=16  0.643 0.585 0.197 0.730 0.573 0.611 0.904 0.512 0.971 0.153
      seed=17  0.643 0.585 0.197 0.605 0.855 0.611 0.240 0.636 0.041 0.509
      seed=18  0.643 0.585 0.196 0.979 0.137 0.736 0.229 0.765 0.674 0.832
      seed=19  0.643 0.585 0.197 0.855 0.420 0.736 0.566 0.268 0.183 0.219
      ```
      2121b6e6
    • Yukihiro "Matz" Matsumoto's avatar
    • Yukihiro "Matz" Matsumoto's avatar
    • Yukihiro "Matz" Matsumoto's avatar