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
6d742ef9
Commit
6d742ef9
authored
Jul 22, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2482 from take-cheeze/exc_tt
Use MRB_TT_EXCEPTION in exception object.
parents
4b691212
3c966025
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
0 deletions
+17
-0
include/mruby/error.h
include/mruby/error.h
+7
-0
include/mruby/value.h
include/mruby/value.h
+1
-0
src/error.c
src/error.c
+2
-0
src/gc.c
src/gc.c
+5
-0
src/kernel.c
src/kernel.c
+1
-0
src/variable.c
src/variable.c
+1
-0
No files found.
include/mruby/error.h
View file @
6d742ef9
...
...
@@ -11,6 +11,13 @@
extern
"C"
{
#endif
struct
RException
{
MRB_OBJECT_HEADER
;
struct
iv_tbl
*
iv
;
};
#define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))
void
mrb_sys_fail
(
mrb_state
*
mrb
,
const
char
*
mesg
);
mrb_value
mrb_exc_new_str
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_value
str
);
#define mrb_exc_new_str_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
...
...
include/mruby/value.h
View file @
6d742ef9
...
...
@@ -122,6 +122,7 @@ enum mrb_vtype {
#define mrb_string_p(o) (mrb_type(o) == MRB_TT_STRING)
#define mrb_hash_p(o) (mrb_type(o) == MRB_TT_HASH)
#define mrb_cptr_p(o) (mrb_type(o) == MRB_TT_CPTR)
#define mrb_exception_p(o) (mrb_type(o) == MRB_TT_EXCEPTION)
#define mrb_test(o) mrb_bool(o)
mrb_bool
mrb_regexp_p
(
struct
mrb_state
*
,
mrb_value
);
...
...
src/error.c
View file @
6d742ef9
...
...
@@ -15,6 +15,7 @@
#include "mruby/variable.h"
#include "mruby/debug.h"
#include "mruby/error.h"
#include "mruby/class.h"
#include "mrb_throw.h"
mrb_value
...
...
@@ -442,6 +443,7 @@ mrb_init_exception(mrb_state *mrb)
struct
RClass
*
exception
,
*
runtime_error
,
*
script_error
;
mrb
->
eException_class
=
exception
=
mrb_define_class
(
mrb
,
"Exception"
,
mrb
->
object_class
);
/* 15.2.22 */
MRB_SET_INSTANCE_TT
(
exception
,
MRB_TT_EXCEPTION
);
mrb_define_class_method
(
mrb
,
exception
,
"exception"
,
mrb_instance_new
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"exception"
,
exc_exception
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"initialize"
,
exc_initialize
,
MRB_ARGS_ANY
());
...
...
src/gc.c
View file @
6d742ef9
...
...
@@ -16,6 +16,7 @@
#include "mruby/string.h"
#include "mruby/variable.h"
#include "mruby/gc.h"
#include "mruby/error.h"
/*
= Tri-color Incremental Garbage Collection
...
...
@@ -107,6 +108,7 @@ typedef struct {
struct
RRange
range
;
struct
RData
data
;
struct
RProc
proc
;
struct
RException
exc
;
#ifdef MRB_WORD_BOXING
struct
RFloat
floatv
;
struct
RCptr
cptr
;
...
...
@@ -513,6 +515,7 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_OBJECT
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
mrb_gc_mark_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
...
...
@@ -612,6 +615,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
#endif
case
MRB_TT_OBJECT
:
case
MRB_TT_EXCEPTION
:
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
...
...
@@ -747,6 +751,7 @@ gc_gray_mark(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_OBJECT
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
children
+=
mrb_gc_mark_iv_size
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
...
...
src/kernel.c
View file @
6d742ef9
...
...
@@ -275,6 +275,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
case
MRB_TT_SCLASS
:
case
MRB_TT_HASH
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
mrb_iv_copy
(
mrb
,
dest
,
obj
);
break
;
...
...
src/variable.c
View file @
6d742ef9
...
...
@@ -459,6 +459,7 @@ obj_iv_p(mrb_value obj)
case
MRB_TT_SCLASS
:
case
MRB_TT_HASH
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
return
TRUE
;
default:
return
FALSE
;
...
...
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