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
85bdd634
Commit
85bdd634
authored
Jan 15, 2013
by
Masaki Muranaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/mruby/cdump.h: Add new error codes.
src/cdump.h: Use error codes defined in mruby/cdump.h.
parent
58305530
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
include/mruby/cdump.h
include/mruby/cdump.h
+3
-0
src/cdump.c
src/cdump.c
+12
-9
No files found.
include/mruby/cdump.h
View file @
85bdd634
...
...
@@ -23,6 +23,9 @@ int mrb_cdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname);
/* error code */
#define MRB_CDUMP_OK 0
#define MRB_CDUMP_GENERAL_FAILURE -1
#define MRB_CDUMP_WRITE_FAULT -2
#define MRB_CDUMP_INVALID_IREP -6
#define MRB_CDUMP_INVALID_ARGUMENT -7
#if defined(__cplusplus)
}
/* extern "C" { */
...
...
src/cdump.c
View file @
85bdd634
...
...
@@ -23,7 +23,7 @@ make_cdump_isec(mrb_state *mrb, int irep_no, FILE *f)
mrb_irep
*
irep
=
mrb
->
irep
[
irep_no
];
if
(
irep
==
NULL
)
return
-
1
;
return
MRB_CDUMP_INVALID_IREP
;
/* dump isec struct*/
if
(
irep
->
ilen
>
0
)
{
...
...
@@ -34,7 +34,7 @@ make_cdump_isec(mrb_state *mrb, int irep_no, FILE *f)
SOURCE_CODE0
(
""
);
}
return
0
;
return
MRB_CDUMP_OK
;
}
static
size_t
...
...
@@ -104,7 +104,7 @@ make_cdump_irep(mrb_state *mrb, int irep_no, FILE *f)
size_t
buf_len
,
str_len
;
if
(
irep
==
NULL
)
return
-
1
;
return
MRB_CDUMP_INVALID_IREP
;
buf_len
=
MRB_CDUMP_LINE_LEN
;
if
((
buf
=
(
char
*
)
mrb_malloc
(
mrb
,
buf_len
))
==
NULL
)
{
...
...
@@ -176,9 +176,10 @@ int
mrb_cdump_irep
(
mrb_state
*
mrb
,
int
n
,
FILE
*
f
,
const
char
*
initname
)
{
int
irep_no
;
int
error
;
if
(
mrb
==
NULL
||
n
<
0
||
n
>=
mrb
->
irep_len
||
f
==
NULL
||
initname
==
NULL
)
return
-
1
;
return
MRB_CDUMP_INVALID_ARGUMENT
;
SOURCE_CODE0
(
"#include
\"
mruby.h
\"
"
);
SOURCE_CODE0
(
"#include
\"
mruby/irep.h
\"
"
);
...
...
@@ -187,8 +188,9 @@ mrb_cdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname)
SOURCE_CODE0
(
""
);
for
(
irep_no
=
n
;
irep_no
<
mrb
->
irep_len
;
irep_no
++
)
{
if
(
make_cdump_isec
(
mrb
,
irep_no
,
f
)
!=
0
)
return
-
1
;
error
=
make_cdump_isec
(
mrb
,
irep_no
,
f
);
if
(
error
!=
MRB_CDUMP_OK
)
return
error
;
}
SOURCE_CODE0
(
"void"
);
...
...
@@ -200,12 +202,13 @@ mrb_cdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname)
SOURCE_CODE0
(
" mrb_irep *irep;"
);
SOURCE_CODE0
(
""
);
for
(
irep_no
=
n
;
irep_no
<
mrb
->
irep_len
;
irep_no
++
)
{
if
(
make_cdump_irep
(
mrb
,
irep_no
,
f
)
!=
0
)
return
-
1
;
error
=
make_cdump_irep
(
mrb
,
irep_no
,
f
);
if
(
error
!=
MRB_CDUMP_OK
)
return
error
;
}
SOURCE_CODE0
(
" mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));"
);
SOURCE_CODE0
(
"}"
);
return
0
;
return
MRB_CDUMP_OK
;
}
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