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
Show 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);
MRB_INLINE
enum
mrb_vtype
mrb_type
(
mrb_value
o
)
{
switch
(
o
.
w
)
{
case
MRB_Qfalse
:
case
MRB_Qnil
:
return
MRB_TT_FALSE
;
case
MRB_Qtrue
:
return
MRB_TT_TRUE
;
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
;
return
!
mrb_bool
(
o
)
?
MRB_TT_FALSE
:
mrb_true_p
(
o
)
?
MRB_TT_TRUE
:
mrb_fixnum_p
(
o
)
?
MRB_TT_FIXNUM
:
mrb_symbol_p
(
o
)
?
MRB_TT_SYMBOL
:
mrb_undef_p
(
o
)
?
MRB_TT_UNDEF
:
o
.
value
.
bp
->
tt
;
}
#endif
/* MRUBY_BOXING_WORD_H */
mrbgems/mruby-compiler/core/parse.y
View file @
a016d1d0
...
...
@@ -4526,6 +4526,7 @@ parse_string(parser_state *p)
case 'm': f |= 4; break;
case 'u': f |= 16; break;
case 'n': f |= 32; break;
case 'o': break;
default: tokadd(p, re_opt); break;
}
}
...
...
mrbgems/mruby-io/mrblib/io.rb
View file @
a016d1d0
...
...
@@ -123,8 +123,8 @@ class IO
def
write
(
string
)
str
=
string
.
is_a?
(
String
)
?
string
:
string
.
to_s
return
str
.
size
unless
str
.
size
>
0
if
0
<
@buf
.
length
return
0
if
str
.
empty?
unless
@buf
.
empty?
# reset real pos ignore buf
seek
(
pos
,
SEEK_SET
)
end
...
...
@@ -140,8 +140,8 @@ class IO
def
eof?
_check_readable
begin
buf
=
_read_buf
return
buf
.
size
==
0
_read_buf
return
@buf
.
empty?
rescue
EOFError
return
true
end
...
...
@@ -150,7 +150,7 @@ class IO
def
pos
raise
IOError
if
closed?
sysseek
(
0
,
SEEK_CUR
)
-
@buf
.
length
sysseek
(
0
,
SEEK_CUR
)
-
@buf
.
bytesize
end
alias_method
:tell
,
:pos
...
...
@@ -170,8 +170,13 @@ class IO
end
def
_read_buf
return
@buf
if
@buf
&&
@buf
.
size
>
0
@buf
=
sysread
(
BUF_SIZE
)
return
@buf
if
@buf
&&
@buf
.
bytesize
>=
4
# maximum UTF-8 character is 4 bytes
@buf
||=
""
begin
@buf
+=
sysread
(
BUF_SIZE
)
rescue
EOFError
=>
e
raise
e
if
@buf
.
empty?
end
end
def
ungetc
(
substr
)
...
...
@@ -253,12 +258,14 @@ class IO
break
end
if
limit
&&
limit
<=
@buf
.
bytesize
array
.
push
IO
.
_bufread
(
@buf
,
limit
)
if
limit
&&
limit
<=
@buf
.
size
array
.
push
@buf
[
0
,
limit
]
@buf
[
0
,
limit
]
=
""
break
elsif
idx
=
@buf
.
index
(
rs
)
len
=
idx
+
rs
.
bytesize
array
.
push
IO
.
_bufread
(
@buf
,
len
)
len
=
idx
+
rs
.
size
array
.
push
@buf
[
0
,
len
]
@buf
[
0
,
len
]
=
""
break
else
array
.
push
@buf
...
...
@@ -281,7 +288,9 @@ class IO
def
readchar
_read_buf
IO
.
_bufread
(
@buf
,
1
)
c
=
@buf
[
0
]
@buf
[
0
]
=
""
c
end
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