Yukihiro "Matz" Matsumoto
bba044cfc8
test/pack.c: reorganize test suits.
2021-06-07 08:54:54 +09:00
Yukihiro "Matz" Matsumoto
cd64ddf372
pack.c: raise exception for unsupported specifiers.
2021-06-07 07:18:17 +09:00
Yukihiro "Matz" Matsumoto
e112c46281
pack.c: check overflow before calling pack_x.
2021-06-06 08:01:58 +09:00
Yukihiro "Matz" Matsumoto
d518294f20
pack.c: check overflow before reading count.
2021-06-06 08:01:01 +09:00
Yukihiro "Matz" Matsumoto
af3e0ddfc0
pack.c: failed to detect overflow when ch is zero in read_tmpl.
2021-06-06 08:00:24 +09:00
Yukihiro "Matz" Matsumoto
f01c29b0ec
pack.c: hold enum values in enum variables not int.
2021-06-05 20:04:59 +09:00
Yukihiro "Matz" Matsumoto
01a21085f6
add a few regressions test from #2313
...
The code was contributed from Carson McDonald (@carsonmcdonald)
2021-06-03 16:47:04 +09:00
Yukihiro "Matz" Matsumoto
be647acd3e
sprintf.c: avoid object allocation in integer formatting.
2021-05-30 19:57:56 +09:00
Yukihiro "Matz" Matsumoto
8a4bcc58c9
numeric.c: introduce mrb_int_to_cstr() to dump mrb_int.
...
* refactor `mrb_integer_to_str()`
* refactor `mrb_str_format()`
2021-05-30 08:15:51 +09:00
Yukihiro "Matz" Matsumoto
60aa2192a8
codegen.c: just raise the exception on broken node for assignments.
2021-05-29 15:46:30 +09:00
Yukihiro "Matz" Matsumoto
269470babc
kernel.c: avoid recursive VM call in mrb_f_caller.
2021-05-28 07:39:34 +09:00
Yukihiro "Matz" Matsumoto
4e683c20a2
kernel.c: caller should not include the frame for itself.
2021-05-28 07:38:21 +09:00
Yukihiro "Matz" Matsumoto
48b08fecba
array.c: unify mrb_ary_ref and mrb_ary_entry
...
Use only `mrb_ary_entry` hereafter.
2021-05-27 21:43:43 +09:00
Yukihiro "Matz" Matsumoto
b9bde0c918
mruby-sprintf: reduce float digits to avoid test failure.
...
Too many digits to fit in single precision float numbers, so that tests
fail when `MRB_USE_FLOAT32` defined.
2021-05-22 14:46:37 +09:00
Yukihiro "Matz" Matsumoto
5c7fe225a6
fp_fmt.c: remove mrb_float_to_cstr().
...
The function was intended to be a utility function for `mruby-sprintf`.
The functionality was integrated into `sprintf.c`.
2021-05-22 14:16:55 +09:00
Yukihiro "Matz" Matsumoto
f0e1d575f2
sprintf.c: remove specifiers %a and %A.
...
`fmt_fp.c` does not support those specifiers. In addition, I believe no
one uses hexadecimal representation of float values.
2021-05-21 08:13:37 +09:00
Yukihiro "Matz" Matsumoto
07c8470278
parse.y: allow "command" syntax in endless method definition.
...
This change allows `def hello = puts "Hello"` without parentheses.
This syntax has been introduced since Ruby3.1.
2021-05-18 16:26:36 +09:00
Yukihiro "Matz" Matsumoto
d50c83cca7
parse.y: endless singleton method definition can omit parens.
2021-05-18 16:25:53 +09:00
Yukihiro "Matz" Matsumoto
5eebbd7df2
Global renaming regarding integer and float.
...
Consistent number conversion function names:
* `mrb_value` to immediate (C) value
* `mrb_int()` -> `mrb_as_int()`
* `mrb_to_flo()` -> `mrb_as_float()`
* `mrb_value` to `mrb_value` (converted)
* `mrb_to_int()'
* `mrb_Integer()` - removed
* `mrb_Float()` -> `mrb_to_float`
Consistent function name (avoid `_flo` suffix):
* `mrb_div_flo()` -> `mrb_div_float`
2021-05-17 15:07:05 +09:00
Yukihiro "Matz" Matsumoto
ea7f1953c3
Rename mrb_fixnum_to_str to mrb_integer_to_str.
2021-05-17 13:59:01 +09:00
Yukihiro "Matz" Matsumoto
080fdbf9e8
Rename mrb_flo_to_fixnum to mrb_float_to_integer.
2021-05-17 13:58:54 +09:00
Yukihiro "Matz" Matsumoto
fbbcee835f
rational.c: update function prefixes.
...
To be consistent, functions with `rational_` prefix implements methods,
functions with `rat_` prefix are utility functions.
2021-05-17 13:39:51 +09:00
Yukihiro "Matz" Matsumoto
ae4c952d2e
mruby-array-ext/array.c: implement Array#rotate in C.
...
The Ruby version of `Array#rotate!` generated a rotated array and
replaced the receiver, but the C version rotates the receiver array
in-place. So the performance is improved a lot both in speed and memory
consumption. Look for the comments in `array.c` for the in-place rotating
algorithm, if you are interested.
2021-05-15 17:26:36 +09:00
Yukihiro "Matz" Matsumoto
9422fdbc87
mruby-array-ext/array.c: implement Array#compact in C.
2021-05-14 10:39:41 +09:00
Yukihiro "Matz" Matsumoto
bdb5d85adc
array.rb: replace can't with cannot.
...
To avoid editor coloring failures.
2021-05-14 10:34:11 +09:00
Yukihiro "Matz" Matsumoto
3a3761ec69
string.c: remove unnecessary branch in the internal method.
2021-05-13 16:08:25 +09:00
Yukihiro "Matz" Matsumoto
2bed750eb0
range.c: avoid use of mrb_fixnum_p.
...
`mrb_int` may not fit in `fixnum` (inline integer).
2021-05-13 15:35:34 +09:00
Yukihiro "Matz" Matsumoto
4d6f5be1df
mruby-test: MRB_INT_MAX etc. may not fit in Fixnum (inline int).
2021-05-13 15:34:20 +09:00
Yukihiro "Matz" Matsumoto
033aa98cf4
time.c: Windows API provides clock_gettime.
...
`gettimeofday` emulation needed no longer.
2021-05-08 10:34:38 +09:00
dearblue
6fc5dc986a
Extend the tab with 8 whitespace
...
This work was done as follows:
- check: `git grep $'\011' -- :^oss-fuzz`
- convert: `ruby -pi -e 'nil while $_.sub!(/^(.*?)\t/) { $1 + " " * (8 - $1.size % 8) }'`
The `doc/guide/{compile,mrbgems}.md` file adds and removes whitespace to make the directory tree look the same.
In `mrbgems/mruby-socket/src/socket.c`, there is a part where the indent is changed from 4 to 2 at the same time as the tab is changed.
2021-05-05 22:16:03 +09:00
Yukihiro "Matz" Matsumoto
35a6dfe905
Merge pull request #5442 from dearblue/mruby-pack
...
Fix documents for `mruby-io`
2021-05-05 09:38:45 +09:00
dearblue
8eb5a8867b
Fix documents for mruby-io
2021-05-03 23:27:40 +09:00
dearblue
eca990b2ec
Update gem spec for mruby-sleep
...
To align the spec like any other core mrbgems:
- Delete `spec.version`
- Set `spec.summary`
2021-05-03 23:17:04 +09:00
Yukihiro "Matz" Matsumoto
8f362eaf8a
io.rb,print.rb: puts to expand array arguments.
...
As CRuby behaves.
2021-05-01 00:00:14 +09:00
KOBAYASHI Shuji
a633f0f9f6
Fix typo in mrbgems/mruby-io/mrblib/io.rb; ref cb55e7eca
2021-04-29 09:27:12 +09:00
Yukihiro "Matz" Matsumoto
2ad5d4f53d
string.c: add a new method String#center.
2021-04-28 21:44:19 +09:00
Yukihiro "Matz" Matsumoto
e5e5acefaf
string.{c,rb}: fix type of return values from some methods as Ruby3.0
...
When the receiver is the instance of subclass of `String`.
- `String#each_char`
- `String#each_line`
- `String#partition`
2021-04-28 21:41:01 +09:00
Yukihiro "Matz" Matsumoto
cb55e7eca9
io.rb: reimplement IO#each_char.
...
It used to be an alias to `IO#each_byte` but those methods should have
behave differently.
2021-04-28 21:37:05 +09:00
Yukihiro "Matz" Matsumoto
aff3743c12
array.rb: Array#uniq to return always Array.
...
Even called for subclass of `Array`, according to new Ruby3.0 behavior.
Other methods of `Array` behave as Ruby3.0 from the first hand.
2021-04-28 17:45:19 +09:00
Yukihiro "Matz" Matsumoto
f22535045a
mruby.c: specify file names for libraries set by -r; fix #5427
2021-04-26 19:00:49 +09:00
Yukihiro "Matz" Matsumoto
2ead8a0520
Merge pull request #5423 from dearblue/gc-red
...
Introduce `MRB_GC_RED`
2021-04-26 07:29:08 +09:00
Yukihiro "Matz" Matsumoto
767577efb1
Merge pull request #5422 from dearblue/binding1
...
Avoid ill-advised `goto`
2021-04-25 14:36:17 +09:00
Yukihiro "Matz" Matsumoto
4d249c28d9
Skip tests that use Float inside; ref #5421
2021-04-24 12:04:08 +09:00
Yukihiro "Matz" Matsumoto
4b4622f711
time.c: fixable_time_t_p is not used with MRB_NO_FLOAT; #5421
2021-04-24 11:38:56 +09:00
Yukihiro "Matz" Matsumoto
237f3339bf
random.c: refactoring; #5421
...
- `Random.rand` with `MRB_NO_FLOAT` behaves as `Random.rand(100)`
- `Random.rand(i)` where `i<0` raises `ArgumentError`
2021-04-24 11:15:53 +09:00
dearblue
94c5c8f44c
Introduce MRB_GC_RED
...
Replaces the magic number `7` except in `src/gc.c`.
2021-04-24 10:31:21 +09:00
dearblue
b18fd23cef
Avoid ill-advised goto
...
ref #5362
2021-04-23 22:54:12 +09:00
Yukihiro "Matz" Matsumoto
dc88a87f9b
time.c: time_t may be unsigned on some platforms.
2021-04-23 07:53:17 +09:00
Yukihiro "Matz" Matsumoto
1a82bab1b0
error.h: rename mrb_protect_raw to mrb_protect_error; #5415
...
- `_raw` does not describe the nature of the function
- the function protect errors during C function execution
2021-04-22 17:01:33 +09:00
Yukihiro "Matz" Matsumoto
2268405fe6
test/math.rb: 10**30 could cause integer overflow; ref #5420
2021-04-21 22:04:20 +09:00