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
7103e032
Commit
7103e032
authored
Mar 13, 2013
by
Tomoyuki Sahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mrb_sys_fail raises SystemCallError if we have it.
parent
46d8c517
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
include/mruby.h
include/mruby.h
+1
-0
src/class.c
src/class.c
+6
-0
src/error.c
src/error.c
+15
-1
No files found.
include/mruby.h
View file @
7103e032
...
...
@@ -156,6 +156,7 @@ void mrb_undef_class_method(mrb_state*, struct RClass*, const char*);
mrb_value
mrb_instance_new
(
mrb_state
*
mrb
,
mrb_value
cv
);
struct
RClass
*
mrb_class_new
(
mrb_state
*
mrb
,
struct
RClass
*
super
);
struct
RClass
*
mrb_module_new
(
mrb_state
*
mrb
);
int
mrb_class_defined
(
mrb_state
*
mrb
,
const
char
*
name
);
struct
RClass
*
mrb_class_get
(
mrb_state
*
mrb
,
const
char
*
name
);
struct
RClass
*
mrb_class_obj_get
(
mrb_state
*
mrb
,
const
char
*
name
);
...
...
src/class.c
View file @
7103e032
...
...
@@ -203,6 +203,12 @@ mrb_vm_define_class(mrb_state *mrb, mrb_value outer, mrb_value super, mrb_sym id
return
c
;
}
int
mrb_class_defined
(
mrb_state
*
mrb
,
const
char
*
name
)
{
return
mrb_const_defined
(
mrb
,
mrb_obj_value
(
mrb
->
object_class
),
mrb_intern
(
mrb
,
name
));
}
static
struct
RClass
*
class_from_sym
(
mrb_state
*
mrb
,
struct
RClass
*
klass
,
mrb_sym
id
)
{
...
...
src/error.c
View file @
7103e032
...
...
@@ -5,6 +5,7 @@
*/
#include "mruby.h"
#include <errno.h>
#include <stdarg.h>
#include <setjmp.h>
#include <string.h>
...
...
@@ -401,7 +402,20 @@ mrb_make_exception(mrb_state *mrb, int argc, mrb_value *argv)
void
mrb_sys_fail
(
mrb_state
*
mrb
,
const
char
*
mesg
)
{
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
mesg
);
struct
RClass
*
sce
;
mrb_int
no
;
no
=
(
mrb_int
)
errno
;
if
(
mrb_class_defined
(
mrb
,
"SystemCallError"
))
{
sce
=
mrb_class_get
(
mrb
,
"SystemCallError"
);
if
(
mesg
!=
NULL
)
{
mrb_funcall
(
mrb
,
mrb_obj_value
(
sce
),
"_sys_fail"
,
2
,
mrb_fixnum_value
(
no
),
mrb_str_new2
(
mrb
,
mesg
));
}
else
{
mrb_funcall
(
mrb
,
mrb_obj_value
(
sce
),
"_sys_fail"
,
1
,
mrb_fixnum_value
(
no
));
}
}
else
{
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
mesg
);
}
}
void
...
...
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