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
19a08b84
Commit
19a08b84
authored
Feb 09, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1674 from cremno/mrb_bool-FALSE-TRUE
use mrb_bool, FALSE and TRUE more
parents
d8a5f120
4507985c
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
49 additions
and
49 deletions
+49
-49
include/mruby/compile.h
include/mruby/compile.h
+3
-2
include/mruby/range.h
include/mruby/range.h
+1
-1
include/mruby/string.h
include/mruby/string.h
+2
-2
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+4
-4
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+7
-7
src/codegen.c
src/codegen.c
+4
-4
src/error.c
src/error.c
+1
-1
src/gc.c
src/gc.c
+2
-2
src/hash.c
src/hash.c
+1
-1
src/numeric.c
src/numeric.c
+1
-1
src/object.c
src/object.c
+1
-1
src/parse.y
src/parse.y
+10
-11
src/range.c
src/range.c
+1
-1
src/string.c
src/string.c
+3
-3
src/symbol.c
src/symbol.c
+1
-1
tools/mrbc/mrbc.c
tools/mrbc/mrbc.c
+7
-7
No files found.
include/mruby/compile.h
View file @
19a08b84
...
...
@@ -119,7 +119,8 @@ struct mrb_parser_state {
unsigned
int
cmdarg_stack
;
int
paren_nest
;
int
lpar_beg
;
int
in_def
,
in_single
,
cmd_start
;
int
in_def
,
in_single
;
mrb_bool
cmd_start
:
1
;
mrb_ast_node
*
locals
;
mrb_ast_node
*
pb
;
...
...
@@ -138,7 +139,7 @@ struct mrb_parser_state {
size_t
nwarn
;
mrb_ast_node
*
tree
;
int
capture_errors
;
mrb_bool
capture_errors
:
1
;
struct
mrb_parser_message
error_buffer
[
10
];
struct
mrb_parser_message
warn_buffer
[
10
];
...
...
include/mruby/range.h
View file @
19a08b84
...
...
@@ -26,7 +26,7 @@ struct RRange {
#define mrb_range_value(p) mrb_obj_value((void*)(p))
mrb_value
mrb_range_new
(
mrb_state
*
,
mrb_value
,
mrb_value
,
int
);
mrb_
int
mrb_range_beg_len
(
mrb_state
*
mrb
,
mrb_value
range
,
mrb_int
*
begp
,
mrb_int
*
lenp
,
mrb_int
len
);
mrb_
bool
mrb_range_beg_len
(
mrb_state
*
mrb
,
mrb_value
range
,
mrb_int
*
begp
,
mrb_int
*
lenp
,
mrb_int
len
);
#if defined(__cplusplus)
}
/* extern "C" { */
...
...
include/mruby/string.h
View file @
19a08b84
...
...
@@ -55,8 +55,8 @@ int mrb_str_offset(mrb_state *mrb, mrb_value str, int pos);
mrb_value
mrb_str_dup
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_intern
(
mrb_state
*
mrb
,
mrb_value
self
);
mrb_value
mrb_str_cat_cstr
(
mrb_state
*
,
mrb_value
,
const
char
*
);
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
int
badcheck
);
double
mrb_str_to_dbl
(
mrb_state
*
mrb
,
mrb_value
str
,
int
badcheck
);
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
mrb_bool
badcheck
);
double
mrb_str_to_dbl
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_bool
badcheck
);
mrb_value
mrb_str_to_str
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_int
mrb_str_hash
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_buf_append
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_value
str2
);
...
...
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
View file @
19a08b84
...
...
@@ -45,7 +45,7 @@ p(mrb_state *mrb, mrb_value obj, int prompt)
static
mrb_bool
is_code_block_open
(
struct
mrb_parser_state
*
parser
)
{
int
code_block_open
=
FALSE
;
mrb_bool
code_block_open
=
FALSE
;
/* check for heredoc */
if
(
parser
->
parsing_heredoc
!=
NULL
)
return
TRUE
;
...
...
@@ -249,9 +249,9 @@ main(int argc, char **argv)
mrb_value
result
;
struct
_args
args
;
int
n
;
int
code_block_open
=
FALSE
;
mrb_bool
code_block_open
=
FALSE
;
int
ai
;
int
first_command
=
1
;
mrb_bool
first_command
=
TRUE
;
unsigned
int
nregs
;
/* new interpreter instance */
...
...
@@ -390,7 +390,7 @@ main(int argc, char **argv)
}
mrb_parser_free
(
parser
);
cxt
->
lineno
++
;
first_command
=
0
;
first_command
=
FALSE
;
}
mrbc_context_free
(
mrb
,
cxt
);
mrb_close
(
mrb
);
...
...
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
View file @
19a08b84
...
...
@@ -75,10 +75,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
item
=
argv
[
0
]
+
1
;
switch
(
*
item
++
)
{
case
'b'
:
args
->
mrbfile
=
1
;
args
->
mrbfile
=
TRUE
;
break
;
case
'c'
:
args
->
check_syntax
=
1
;
args
->
check_syntax
=
TRUE
;
break
;
case
'e'
:
if
(
item
[
0
])
{
...
...
@@ -116,7 +116,7 @@ append_cmdline:
break
;
case
'v'
:
if
(
!
args
->
verbose
)
mrb_show_version
(
mrb
);
args
->
verbose
=
1
;
args
->
verbose
=
TRUE
;
break
;
case
'-'
:
if
(
strcmp
((
*
argv
)
+
2
,
"version"
)
==
0
)
{
...
...
@@ -124,7 +124,7 @@ append_cmdline:
exit
(
EXIT_SUCCESS
);
}
else
if
(
strcmp
((
*
argv
)
+
2
,
"verbose"
)
==
0
)
{
args
->
verbose
=
1
;
args
->
verbose
=
TRUE
;
break
;
}
else
if
(
strcmp
((
*
argv
)
+
2
,
"copyright"
)
==
0
)
{
...
...
@@ -144,7 +144,7 @@ append_cmdline:
printf
(
"%s: Cannot open program file. (%s)
\n
"
,
*
origargv
,
*
argv
);
return
0
;
}
args
->
fname
=
1
;
args
->
fname
=
TRUE
;
args
->
cmdline
=
argv
[
0
];
argc
--
;
argv
++
;
}
...
...
@@ -199,9 +199,9 @@ main(int argc, char **argv)
c
=
mrbc_context_new
(
mrb
);
if
(
args
.
verbose
)
c
->
dump_result
=
1
;
c
->
dump_result
=
TRUE
;
if
(
args
.
check_syntax
)
c
->
no_exec
=
1
;
c
->
no_exec
=
FALSE
;
if
(
args
.
mrbfile
)
{
v
=
mrb_load_irep_file_cxt
(
mrb
,
args
.
rfp
,
c
);
}
...
...
src/codegen.c
View file @
19a08b84
...
...
@@ -981,7 +981,7 @@ gen_send_intern(codegen_scope *s)
push
();
}
static
void
gen_literal_array
(
codegen_scope
*
s
,
node
*
tree
,
int
sym
,
int
val
)
gen_literal_array
(
codegen_scope
*
s
,
node
*
tree
,
mrb_bool
sym
,
int
val
)
{
if
(
val
)
{
int
i
=
0
,
j
=
0
;
...
...
@@ -1069,7 +1069,7 @@ readint_float(codegen_scope *s, const char *p, int base)
}
static
mrb_int
readint_mrb_int
(
codegen_scope
*
s
,
const
char
*
p
,
int
base
,
int
neg
,
int
*
overflow
)
readint_mrb_int
(
codegen_scope
*
s
,
const
char
*
p
,
int
base
,
mrb_bool
neg
,
mrb_bool
*
overflow
)
{
const
char
*
e
=
p
+
strlen
(
p
);
mrb_int
result
=
0
;
...
...
@@ -1926,7 +1926,7 @@ codegen(codegen_scope *s, node *tree, int val)
int
base
=
(
intptr_t
)
tree
->
cdr
->
car
;
mrb_int
i
;
mrb_code
co
;
int
overflow
;
mrb_bool
overflow
;
i
=
readint_mrb_int
(
s
,
p
,
base
,
FALSE
,
&
overflow
);
if
(
overflow
)
{
...
...
@@ -1982,7 +1982,7 @@ codegen(codegen_scope *s, node *tree, int val)
int
base
=
(
intptr_t
)
tree
->
cdr
->
car
;
mrb_int
i
;
mrb_code
co
;
int
overflow
;
mrb_bool
overflow
;
i
=
readint_mrb_int
(
s
,
p
,
base
,
TRUE
,
&
overflow
);
if
(
overflow
)
{
...
...
src/error.c
View file @
19a08b84
...
...
@@ -352,7 +352,7 @@ set_backtrace(mrb_state *mrb, mrb_value info, mrb_value bt)
}
static
mrb_value
make_exception
(
mrb_state
*
mrb
,
int
argc
,
mrb_value
*
argv
,
int
isstr
)
make_exception
(
mrb_state
*
mrb
,
int
argc
,
mrb_value
*
argv
,
mrb_bool
isstr
)
{
mrb_value
mesg
;
int
n
;
...
...
src/gc.c
View file @
19a08b84
...
...
@@ -834,13 +834,13 @@ incremental_sweep_phase(mrb_state *mrb, size_t limit)
RVALUE
*
p
=
page
->
objects
;
RVALUE
*
e
=
p
+
MRB_HEAP_PAGE_SIZE
;
size_t
freed
=
0
;
int
dead_slot
=
1
;
mrb_bool
dead_slot
=
TRUE
;
int
full
=
(
page
->
freelist
==
NULL
);
if
(
is_minor_gc
(
mrb
)
&&
page
->
old
)
{
/* skip a slot which doesn't contain any young object */
p
=
e
;
dead_slot
=
0
;
dead_slot
=
FALSE
;
}
while
(
p
<
e
)
{
if
(
is_dead
(
mrb
,
&
p
->
as
.
basic
))
{
...
...
src/hash.c
View file @
19a08b84
...
...
@@ -998,7 +998,7 @@ mrb_hash_has_value(mrb_state *mrb, mrb_value hash)
}
static
mrb_value
hash_equal
(
mrb_state
*
mrb
,
mrb_value
hash1
,
mrb_value
hash2
,
int
eql
)
hash_equal
(
mrb_state
*
mrb
,
mrb_value
hash1
,
mrb_value
hash2
,
mrb_bool
eql
)
{
khash_t
(
ht
)
*
h1
,
*
h2
;
...
...
src/numeric.c
View file @
19a08b84
...
...
@@ -48,7 +48,7 @@ static mrb_value
num_pow
(
mrb_state
*
mrb
,
mrb_value
x
)
{
mrb_value
y
;
int
both_int
=
FALSE
;
mrb_bool
both_int
=
FALSE
;
mrb_float
d
;
mrb_get_args
(
mrb
,
"o"
,
&
y
);
...
...
src/object.c
View file @
19a08b84
...
...
@@ -302,7 +302,7 @@ inspect_type(mrb_state *mrb, mrb_value val)
}
static
mrb_value
convert_type
(
mrb_state
*
mrb
,
mrb_value
val
,
const
char
*
tname
,
const
char
*
method
,
int
raise
)
convert_type
(
mrb_state
*
mrb
,
mrb_value
val
,
const
char
*
tname
,
const
char
*
method
,
mrb_bool
raise
)
{
mrb_sym
m
=
0
;
...
...
src/parse.y
View file @
19a08b84
...
...
@@ -3319,8 +3319,8 @@ backref_error(parser_state *p, node *n)
}
}
static
int
peeks(parser_state *p, const char *s);
static
int
skips(parser_state *p, const char *s);
static
mrb_bool
peeks(parser_state *p, const char *s);
static
mrb_bool
skips(parser_state *p, const char *s);
static inline int
nextc(parser_state *p)
...
...
@@ -3383,7 +3383,7 @@ skip(parser_state *p, char term)
}
}
static
int
static
mrb_bool
peek_n(parser_state *p, int c, int n)
{
node *list = 0;
...
...
@@ -3405,7 +3405,7 @@ peek_n(parser_state *p, int c, int n)
}
#define peek(p,c) peek_n((p), (c), 0)
static
int
static
mrb_bool
peeks(parser_state *p, const char *s)
{
int len = strlen(s);
...
...
@@ -3426,7 +3426,7 @@ peeks(parser_state *p, const char *s)
return FALSE;
}
static
int
static
mrb_bool
skips(parser_state *p, const char *s)
{
int c;
...
...
@@ -3855,8 +3855,8 @@ heredoc_identifier(parser_state *p)
{
int c;
int type = str_heredoc;
int
indent = FALSE;
int
quote = FALSE;
mrb_bool
indent = FALSE;
mrb_bool
quote = FALSE;
node *newnode;
parser_heredoc_info *info;
...
...
@@ -5197,7 +5197,7 @@ mrb_parser_parse(parser_state *p, mrbc_context *c)
}
p->cmd_start = TRUE;
p->in_def = p->in_single =
FALSE
;
p->in_def = p->in_single =
0
;
p->nerr = p->nwarn = 0;
p->lex_strterm = NULL;
...
...
@@ -5227,7 +5227,6 @@ mrb_parser_new(mrb_state *mrb)
*p = parser_state_zero;
p->mrb = mrb;
p->pool = pool;
p->in_def = p->in_single = 0;
p->s = p->send = NULL;
#ifdef ENABLE_STDIO
...
...
@@ -5235,9 +5234,9 @@ mrb_parser_new(mrb_state *mrb)
#endif
p->cmd_start = TRUE;
p->in_def = p->in_single =
FALSE
;
p->in_def = p->in_single =
0
;
p->capture_errors =
0
;
p->capture_errors =
FALSE
;
p->lineno = 1;
p->column = 0;
#if defined(PARSER_TEST) || defined(PARSER_DEBUG)
...
...
src/range.c
View file @
19a08b84
...
...
@@ -257,7 +257,7 @@ mrb_range_each(mrb_state *mrb, mrb_value range)
return
range
;
}
mrb_
int
mrb_
bool
mrb_range_beg_len
(
mrb_state
*
mrb
,
mrb_value
range
,
mrb_int
*
begp
,
mrb_int
*
lenp
,
mrb_int
len
)
{
mrb_int
beg
,
end
,
b
,
e
;
...
...
src/string.c
View file @
19a08b84
...
...
@@ -2005,7 +2005,7 @@ mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
}
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
int
badcheck
)
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
int
base
,
mrb_bool
badcheck
)
{
char
*
s
;
int
len
;
...
...
@@ -2068,7 +2068,7 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
}
double
mrb_cstr_to_dbl
(
mrb_state
*
mrb
,
const
char
*
p
,
int
badcheck
)
mrb_cstr_to_dbl
(
mrb_state
*
mrb
,
const
char
*
p
,
mrb_bool
badcheck
)
{
char
*
end
;
double
d
;
...
...
@@ -2137,7 +2137,7 @@ bad:
}
double
mrb_str_to_dbl
(
mrb_state
*
mrb
,
mrb_value
str
,
int
badcheck
)
mrb_str_to_dbl
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_bool
badcheck
)
{
char
*
s
;
int
len
;
...
...
src/symbol.c
View file @
19a08b84
...
...
@@ -308,7 +308,7 @@ static mrb_bool
symname_p
(
const
char
*
name
)
{
const
char
*
m
=
name
;
int
localid
=
FALSE
;
mrb_bool
localid
=
FALSE
;
if
(
!
m
)
return
FALSE
;
switch
(
*
m
)
{
...
...
tools/mrbc/mrbc.c
View file @
19a08b84
...
...
@@ -110,14 +110,14 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
}
break
;
case
'c'
:
args
->
check_syntax
=
1
;
args
->
check_syntax
=
TRUE
;
break
;
case
'v'
:
if
(
!
args
->
verbose
)
mrb_show_version
(
mrb
);
args
->
verbose
=
1
;
args
->
verbose
=
TRUE
;
break
;
case
'g'
:
args
->
debug_info
=
1
;
args
->
debug_info
=
TRUE
;
break
;
case
'h'
:
return
-
1
;
...
...
@@ -130,7 +130,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
exit
(
EXIT_SUCCESS
);
}
else
if
(
strcmp
(
argv
[
i
]
+
2
,
"verbose"
)
==
0
)
{
args
->
verbose
=
1
;
args
->
verbose
=
TRUE
;
break
;
}
else
if
(
strcmp
(
argv
[
i
]
+
2
,
"copyright"
)
==
0
)
{
...
...
@@ -186,12 +186,12 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
mrb_value
result
;
char
*
input
=
args
->
argv
[
args
->
idx
];
FILE
*
infile
;
int
need_close
=
FALSE
;
mrb_bool
need_close
=
FALSE
;
c
=
mrbc_context_new
(
mrb
);
if
(
args
->
verbose
)
c
->
dump_result
=
1
;
c
->
no_exec
=
1
;
c
->
dump_result
=
TRUE
;
c
->
no_exec
=
TRUE
;
if
(
input
[
0
]
==
'-'
&&
input
[
1
]
==
'\0'
)
{
infile
=
stdin
;
}
...
...
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