Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
a016d1d0
Commit
a016d1d0
authored
Sep 16, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dearblue-mruby-io'
parents
76355dee
6de1c64a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
include/mruby/boxing_word.h
include/mruby/boxing_word.h
+6
-16
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
+1
-0
mrbgems/mruby-io/mrblib/io.rb
mrbgems/mruby-io/mrblib/io.rb
+21
-12
No files found.
include/mruby/boxing_word.h
View file @
a016d1d0
...
@@ -144,22 +144,12 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float);
...
@@ -144,22 +144,12 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float);
MRB_INLINE
enum
mrb_vtype
MRB_INLINE
enum
mrb_vtype
mrb_type
(
mrb_value
o
)
mrb_type
(
mrb_value
o
)
{
{
switch
(
o
.
w
)
{
return
!
mrb_bool
(
o
)
?
MRB_TT_FALSE
:
case
MRB_Qfalse
:
mrb_true_p
(
o
)
?
MRB_TT_TRUE
:
case
MRB_Qnil
:
mrb_fixnum_p
(
o
)
?
MRB_TT_FIXNUM
:
return
MRB_TT_FALSE
;
mrb_symbol_p
(
o
)
?
MRB_TT_SYMBOL
:
case
MRB_Qtrue
:
mrb_undef_p
(
o
)
?
MRB_TT_UNDEF
:
return
MRB_TT_TRUE
;
o
.
value
.
bp
->
tt
;
case
MRB_Qundef
:
return
MRB_TT_UNDEF
;
}
if
(
mrb_fixnum_p
(
o
))
{
return
MRB_TT_FIXNUM
;
}
if
(
mrb_symbol_p
(
o
))
{
return
MRB_TT_SYMBOL
;
}
return
o
.
value
.
bp
->
tt
;
}
}
#endif
/* MRUBY_BOXING_WORD_H */
#endif
/* MRUBY_BOXING_WORD_H */
mrbgems/mruby-compiler/core/parse.y
View file @
a016d1d0
...
@@ -4526,6 +4526,7 @@ parse_string(parser_state *p)
...
@@ -4526,6 +4526,7 @@ parse_string(parser_state *p)
case 'm': f |= 4; break;
case 'm': f |= 4; break;
case 'u': f |= 16; break;
case 'u': f |= 16; break;
case 'n': f |= 32; break;
case 'n': f |= 32; break;
case 'o': break;
default: tokadd(p, re_opt); break;
default: tokadd(p, re_opt); break;
}
}
}
}
...
...
mrbgems/mruby-io/mrblib/io.rb
View file @
a016d1d0
...
@@ -123,8 +123,8 @@ class IO
...
@@ -123,8 +123,8 @@ class IO
def
write
(
string
)
def
write
(
string
)
str
=
string
.
is_a?
(
String
)
?
string
:
string
.
to_s
str
=
string
.
is_a?
(
String
)
?
string
:
string
.
to_s
return
str
.
size
unless
str
.
size
>
0
return
0
if
str
.
empty?
if
0
<
@buf
.
length
unless
@buf
.
empty?
# reset real pos ignore buf
# reset real pos ignore buf
seek
(
pos
,
SEEK_SET
)
seek
(
pos
,
SEEK_SET
)
end
end
...
@@ -140,8 +140,8 @@ class IO
...
@@ -140,8 +140,8 @@ class IO
def
eof?
def
eof?
_check_readable
_check_readable
begin
begin
buf
=
_read_buf
_read_buf
return
buf
.
size
==
0
return
@buf
.
empty?
rescue
EOFError
rescue
EOFError
return
true
return
true
end
end
...
@@ -150,7 +150,7 @@ class IO
...
@@ -150,7 +150,7 @@ class IO
def
pos
def
pos
raise
IOError
if
closed?
raise
IOError
if
closed?
sysseek
(
0
,
SEEK_CUR
)
-
@buf
.
length
sysseek
(
0
,
SEEK_CUR
)
-
@buf
.
bytesize
end
end
alias_method
:tell
,
:pos
alias_method
:tell
,
:pos
...
@@ -170,8 +170,13 @@ class IO
...
@@ -170,8 +170,13 @@ class IO
end
end
def
_read_buf
def
_read_buf
return
@buf
if
@buf
&&
@buf
.
size
>
0
return
@buf
if
@buf
&&
@buf
.
bytesize
>=
4
# maximum UTF-8 character is 4 bytes
@buf
=
sysread
(
BUF_SIZE
)
@buf
||=
""
begin
@buf
+=
sysread
(
BUF_SIZE
)
rescue
EOFError
=>
e
raise
e
if
@buf
.
empty?
end
end
end
def
ungetc
(
substr
)
def
ungetc
(
substr
)
...
@@ -253,12 +258,14 @@ class IO
...
@@ -253,12 +258,14 @@ class IO
break
break
end
end
if
limit
&&
limit
<=
@buf
.
bytesize
if
limit
&&
limit
<=
@buf
.
size
array
.
push
IO
.
_bufread
(
@buf
,
limit
)
array
.
push
@buf
[
0
,
limit
]
@buf
[
0
,
limit
]
=
""
break
break
elsif
idx
=
@buf
.
index
(
rs
)
elsif
idx
=
@buf
.
index
(
rs
)
len
=
idx
+
rs
.
bytesize
len
=
idx
+
rs
.
size
array
.
push
IO
.
_bufread
(
@buf
,
len
)
array
.
push
@buf
[
0
,
len
]
@buf
[
0
,
len
]
=
""
break
break
else
else
array
.
push
@buf
array
.
push
@buf
...
@@ -281,7 +288,9 @@ class IO
...
@@ -281,7 +288,9 @@ class IO
def
readchar
def
readchar
_read_buf
_read_buf
IO
.
_bufread
(
@buf
,
1
)
c
=
@buf
[
0
]
@buf
[
0
]
=
""
c
end
end
def
getc
def
getc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment