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
3c966025
Commit
3c966025
authored
Jul 21, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use MRB_TT_EXCEPTION in exception object.
parent
4cc9e5d8
Changes
6
Show 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 @
3c966025
...
@@ -11,6 +11,13 @@
...
@@ -11,6 +11,13 @@
extern
"C"
{
extern
"C"
{
#endif
#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
);
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
);
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))
#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 @
3c966025
...
@@ -122,6 +122,7 @@ enum mrb_vtype {
...
@@ -122,6 +122,7 @@ enum mrb_vtype {
#define mrb_string_p(o) (mrb_type(o) == MRB_TT_STRING)
#define mrb_string_p(o) (mrb_type(o) == MRB_TT_STRING)
#define mrb_hash_p(o) (mrb_type(o) == MRB_TT_HASH)
#define mrb_hash_p(o) (mrb_type(o) == MRB_TT_HASH)
#define mrb_cptr_p(o) (mrb_type(o) == MRB_TT_CPTR)
#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)
#define mrb_test(o) mrb_bool(o)
mrb_bool
mrb_regexp_p
(
struct
mrb_state
*
,
mrb_value
);
mrb_bool
mrb_regexp_p
(
struct
mrb_state
*
,
mrb_value
);
...
...
src/error.c
View file @
3c966025
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include "mruby/variable.h"
#include "mruby/variable.h"
#include "mruby/debug.h"
#include "mruby/debug.h"
#include "mruby/error.h"
#include "mruby/error.h"
#include "mruby/class.h"
#include "mrb_throw.h"
#include "mrb_throw.h"
mrb_value
mrb_value
...
@@ -442,6 +443,7 @@ mrb_init_exception(mrb_state *mrb)
...
@@ -442,6 +443,7 @@ mrb_init_exception(mrb_state *mrb)
struct
RClass
*
exception
,
*
runtime_error
,
*
script_error
;
struct
RClass
*
exception
,
*
runtime_error
,
*
script_error
;
mrb
->
eException_class
=
exception
=
mrb_define_class
(
mrb
,
"Exception"
,
mrb
->
object_class
);
/* 15.2.22 */
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_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
,
"exception"
,
exc_exception
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"initialize"
,
exc_initialize
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"initialize"
,
exc_initialize
,
MRB_ARGS_ANY
());
...
...
src/gc.c
View file @
3c966025
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "mruby/string.h"
#include "mruby/string.h"
#include "mruby/variable.h"
#include "mruby/variable.h"
#include "mruby/gc.h"
#include "mruby/gc.h"
#include "mruby/error.h"
/*
/*
= Tri-color Incremental Garbage Collection
= Tri-color Incremental Garbage Collection
...
@@ -107,6 +108,7 @@ typedef struct {
...
@@ -107,6 +108,7 @@ typedef struct {
struct
RRange
range
;
struct
RRange
range
;
struct
RData
data
;
struct
RData
data
;
struct
RProc
proc
;
struct
RProc
proc
;
struct
RException
exc
;
#ifdef MRB_WORD_BOXING
#ifdef MRB_WORD_BOXING
struct
RFloat
floatv
;
struct
RFloat
floatv
;
struct
RCptr
cptr
;
struct
RCptr
cptr
;
...
@@ -513,6 +515,7 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
...
@@ -513,6 +515,7 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_OBJECT
:
case
MRB_TT_OBJECT
:
case
MRB_TT_DATA
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
mrb_gc_mark_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
mrb_gc_mark_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
break
;
...
@@ -612,6 +615,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
...
@@ -612,6 +615,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
#endif
#endif
case
MRB_TT_OBJECT
:
case
MRB_TT_OBJECT
:
case
MRB_TT_EXCEPTION
:
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
break
;
...
@@ -747,6 +751,7 @@ gc_gray_mark(mrb_state *mrb, struct RBasic *obj)
...
@@ -747,6 +751,7 @@ gc_gray_mark(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_OBJECT
:
case
MRB_TT_OBJECT
:
case
MRB_TT_DATA
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
children
+=
mrb_gc_mark_iv_size
(
mrb
,
(
struct
RObject
*
)
obj
);
children
+=
mrb_gc_mark_iv_size
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
break
;
...
...
src/kernel.c
View file @
3c966025
...
@@ -275,6 +275,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
...
@@ -275,6 +275,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
case
MRB_TT_SCLASS
:
case
MRB_TT_SCLASS
:
case
MRB_TT_HASH
:
case
MRB_TT_HASH
:
case
MRB_TT_DATA
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
mrb_iv_copy
(
mrb
,
dest
,
obj
);
mrb_iv_copy
(
mrb
,
dest
,
obj
);
break
;
break
;
...
...
src/variable.c
View file @
3c966025
...
@@ -459,6 +459,7 @@ obj_iv_p(mrb_value obj)
...
@@ -459,6 +459,7 @@ obj_iv_p(mrb_value obj)
case
MRB_TT_SCLASS
:
case
MRB_TT_SCLASS
:
case
MRB_TT_HASH
:
case
MRB_TT_HASH
:
case
MRB_TT_DATA
:
case
MRB_TT_DATA
:
case
MRB_TT_EXCEPTION
:
return
TRUE
;
return
TRUE
;
default:
default:
return
FALSE
;
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