masahino
ad318e55c0
fix typo MRB_NO_IO_POEPN -> MRB_NO_IO_POPEN
2023-05-02 07:34:30 +09:00
Yukihiro "Matz" Matsumoto
68d67aee0e
mruby-io/io.c: need to adjust buffer limit before searching; fix #5991
2023-04-26 09:09:05 +09:00
Yukihiro "Matz" Matsumoto
01e5f2a3c8
mruby-io/io.c: fix indent
2023-04-25 23:27:59 +09:00
Yukihiro "Matz" Matsumoto
2f0265d078
mruby-io/io.c (check_file_descriptor): stop "unused label" warning
2023-03-10 08:52:05 +09:00
Yukihiro "Matz" Matsumoto
9a3199cadd
mruby-io/file.c: atime, ctime, mtime to return Bigint if possible
2023-03-10 08:52:05 +09:00
Yukihiro "Matz" Matsumoto
011edf6e99
mruby-io/file.c: hide internal methods in backtraces
2023-03-03 14:23:10 +09:00
Yukihiro "Matz" Matsumoto
5237b2cccc
mruby-io/file.c: atime, ctime, mtime check mrb_int overflow
...
When `sizeof(time_t)` is different from `mrb_int`, overflow may happen.
2023-03-03 14:21:05 +09:00
Yukihiro "Matz" Matsumoto
0e51da81bb
mruby-io/file.rb (inspect): include path in the #inspect output
2023-03-03 13:33:30 +09:00
Yukihiro "Matz" Matsumoto
a956ef35a4
mruby-io/file.c: atime, ctime, mtime should raise error
...
For fstat(3) failure.
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
9c6848a594
mruby-io/io.c (check_file_descriptor): only check EBADF
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
0529f5fc31
mruby-io/test/file.rb: add tests for File#atime, File#ctime
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
321cfe9760
mruby-io/file.c: add File#atime and File#ctime
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
31c1b7bc78
mruby-file: File#mtime has been available for long time
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
84a4d340a6
mruby-io/file.c (_mtime): return nil instead of false
...
As a Ruby convention, a method should return nil (not false) for the
exceptional value, e.g. String#index. File#_mtime should follow the
convention too.
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
d86c4a795d
mruby-io does not provide to_path method for implicit conversion
...
mruby does not use implicit type conversion by `to_xxx` (e.g. to_int,
to_str, etc.)
2023-03-03 13:33:29 +09:00
Yukihiro "Matz" Matsumoto
aefc5befbd
mruby-io/io.c: fix issues with gets; fix #5913
...
- gets with RS multiple times
- gets with RS with limit
- gets with limit bigger than buffer size
2023-01-23 07:30:40 +09:00
Yukihiro "Matz" Matsumoto
be5266fbe6
mruby-io/test: test gets with RS multiple times; ref #5913
2023-01-23 07:26:40 +09:00
dearblue
b0e537c05c
Replaced NO_IO_POPEN with MRB_NO_IO_POPEN
...
ref. commit 9deb52c7b2
2023-01-22 09:20:10 +09:00
Yukihiro "Matz" Matsumoto
9deb52c7b2
mruby-io/io.c: allow disabling popen
...
When `MRB_NO_IO_POPEN` is defined (or iPhone is target), `IO#popen`
will be disabled.
2023-01-17 18:25:23 +09:00
Yukihiro "Matz" Matsumoto
e2ffcbab6e
mruby-io/io.c: cast return pointer from malloc/realloc for C++
2023-01-09 19:58:30 +09:00
Yukihiro "Matz" Matsumoto
8b7e240e67
mruby-io/io.c: improve code around io_cloexec_open()
2023-01-09 19:43:37 +09:00
Yukihiro "Matz" Matsumoto
91727f38de
mruby-io/io.c: change the implementation of read buffers
...
The original implementations used plain Ruby strings referenced from
instance variable (`@buf`) as buffers. We replaced those buffers by C
structure (`struct mrb_io_buf`) referenced directly from `fptr`.
The result is significant improvement of both performance and memory
consumption. Our simple benchmarks (reading `README.md` 10,000 times)
runs 5+ times faster, and `mrbtest` test suites consumes 85% less
memory.
Recent changes on `mruby-io` is preparation for this improvement.
2023-01-09 10:18:35 +09:00
Yukihiro "Matz" Matsumoto
e45e57fe22
mruby-io: update ISO section numbers
2023-01-07 16:39:59 +09:00
Yukihiro "Matz" Matsumoto
fadb39a096
mruby-io/io.c: remove unused method _bufread
2023-01-06 08:52:02 +09:00
Yukihiro "Matz" Matsumoto
412b1f0fb3
mruby-io/io.c: implement IO#readlines in C
2023-01-06 08:51:21 +09:00
Yukihiro "Matz" Matsumoto
7827808d3b
mruby-io/io.c: remove Ruby implementation of IO#gets
2023-01-05 23:54:46 +09:00
Yukihiro "Matz" Matsumoto
9797138aca
mruby-io/io.c: rename io_read_buf_noraise to io_read_buf
2023-01-05 19:50:17 +09:00
Yukihiro "Matz" Matsumoto
714cc254c0
mruby-io/io.c: remove unused function io_read_buf()
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
cd01f1173a
mruby-io/io.c: implement IO#gets in C
...
In addition, reimplement `IO#readline` using `IO#gets`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
b7147bbd8d
mruby-io/io.c: implement IO#getbyte in C
...
In addition, reimplement `IO#readbyte` using `IO#getbyte`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
eec546a9cf
mruby-io/io.c: implement IO#getc in C
...
In addition, reimplement `IO#readchar` using `IO#getc`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
6e7322a3fe
mruby-io/io.c (eof_error): a new function to raise EOFError exception
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
40039d93ab
mruby-io/io.c: implement IO#getline in C
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
a9c98ab855
mruby-io/io.c: implement IO#read in C
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
99dffb6daf
mruby-io/io.c: use RSTR_SET_LEN() instead of mrb_str_resize()
...
since the latter may shrink allocated buffer, and may cause repeated
allocations.
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
1bc0be3e43
mruby-io/io.c: implement IO#eof? in C
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
9e808512d5
mruby-io/io.c: remove duplicated initializations after io_alloc()
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
2b90937a2e
mruby-io/io.c: add ISO section comments
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
d57540118b
mruby-io/io.c: rename _common functions
2023-01-05 19:50:13 +09:00
Yukihiro "Matz" Matsumoto
51dca6eda8
mruby-io/io.c: rename receiver names from self to io in this file
2023-01-02 10:01:09 +09:00
Yukihiro "Matz" Matsumoto
0e25448a20
mruby-io/io.c (io_check_readable): hide internal method in backtraces
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
7cc6a720f3
mruby-io/io.c: implement IO#readchar in C
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
10a5edd978
mruby-io/io.c: implement IO#getbyte in C
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
0c9798373a
mruby-io/io.c (fptr_finalize): close stdin/out/err as well
...
if not during the termination process.
2022-12-31 17:53:20 +09:00
Yukihiro "Matz" Matsumoto
965997d91b
mruby-io/io.c: implement IO#flush in C
2022-12-31 10:39:05 +09:00
Yukihiro "Matz" Matsumoto
b79563af60
mruby-io/test: remove test for internal IO#_read_buf
2022-12-30 13:59:21 +09:00
Yukihiro "Matz" Matsumoto
a68b1200c2
mruby-io/test: test IO#ungetc
2022-12-30 13:59:01 +09:00
Yukihiro "Matz" Matsumoto
26f458baab
mruby-io/io.c: implement IO#ungetc in C
2022-12-30 13:59:01 +09:00
Yukihiro "Matz" Matsumoto
99a4c1f703
mruby-io/io.c (io_buf): protect @buf from modification
...
Users may re-assign `@buf` using `instance_variable_set` for example.
2022-12-30 13:59:00 +09:00
Yukihiro "Matz" Matsumoto
9a6a251460
mruby-io/io.c (io_bufread_m): remove unnecessary checks
2022-12-30 13:59:00 +09:00