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
4e40121f
Commit
4e40121f
authored
May 10, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove regex_class and match_class from mrb_state
parent
4d3ed8c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
include/mruby.h
include/mruby.h
+0
-4
src/re.c
src/re.c
+8
-9
No files found.
include/mruby.h
View file @
4e40121f
...
...
@@ -241,10 +241,6 @@ typedef struct mrb_state {
struct
RClass
*
string_class
;
struct
RClass
*
array_class
;
struct
RClass
*
hash_class
;
#ifdef INCLUDE_REGEXP
struct
RClass
*
regex_class
;
struct
RClass
*
match_class
;
#endif
#ifdef INCLUDE_ENCODING
struct
RClass
*
encode_class
;
struct
RClass
*
converter_class
;
...
...
src/re.c
View file @
4e40121f
...
...
@@ -20,6 +20,9 @@
#include "error.h"
#ifdef INCLUDE_REGEXP
#define REGEX_CLASS (mrb_class_obj_get(mrb, "Regexp"))
#define MATCH_CLASS (mrb_class_obj_get(mrb, "MatchData"))
//from opcode.h
#define GETARG_A(i) ((((mrb_code)(i)) >> 24) & 0xff)
#define GETARG_B(i) ((((mrb_code)(i)) >> 16) & 0xff)
...
...
@@ -88,7 +91,7 @@ mrb_reg_s_new_instance(mrb_state *mrb, /*int argc, mrb_value *argv, */mrb_value
struct
RRegexp
*
re
;
mrb_get_args
(
mrb
,
"*"
,
&
argv
,
&
argc
);
re
=
mrb_obj_alloc
(
mrb
,
MRB_TT_REGEX
,
mrb
->
regex_class
);
re
=
mrb_obj_alloc
(
mrb
,
MRB_TT_REGEX
,
REGEX_CLASS
);
re
->
ptr
=
0
;
re
->
src
=
0
;
re
->
usecnt
=
0
;
...
...
@@ -1665,9 +1668,7 @@ match_alloc(mrb_state *mrb)
{
struct
RMatch
*
m
;
m
=
mrb_obj_alloc
(
mrb
,
MRB_TT_MATCH
,
mrb
->
match_class
);
// NEWOBJ(match, struct RMatch);
// OBJSETUP(match, klass, T_MATCH);
m
=
mrb_obj_alloc
(
mrb
,
MRB_TT_MATCH
,
MATCH_CLASS
);
m
->
str
=
0
;
m
->
rmatch
=
0
;
...
...
@@ -2455,7 +2456,7 @@ mrb_reg_s_alloc(mrb_state *mrb, mrb_value dummy)
//NEWOBJ(re, struct RRegexp);
//OBJSETUP(re, klass, T_REGEXP);
re
=
mrb_obj_alloc
(
mrb
,
MRB_TT_REGEX
,
mrb
->
regex_class
);
re
=
mrb_obj_alloc
(
mrb
,
MRB_TT_REGEX
,
REGEX_CLASS
);
re
->
ptr
=
0
;
re
->
src
=
0
;
...
...
@@ -2626,10 +2627,8 @@ void
mrb_init_regexp
(
mrb_state
*
mrb
)
{
struct
RClass
*
s
;
s
=
mrb
->
regex_clas
s
=
mrb_define_class
(
mrb
,
"Regexp"
,
mrb
->
object_class
);
s
=
mrb_define_class
(
mrb
,
"Regexp"
,
mrb
->
object_class
);
//mrb->encode_class = mrb_define_class(mrb, "Encoding", mrb->object_class);
//mrb_define_alloc_func(mrb, s, mrb_reg_s_alloc);
mrb_define_class_method
(
mrb
,
s
,
"compile"
,
mrb_reg_s_new_instance
,
ARGS_ANY
());
/* 15.2.15.6.1 */
mrb_define_class_method
(
mrb
,
s
,
"escape"
,
mrb_reg_s_quote
,
ARGS_REQ
(
1
));
/* 15.2.15.6.2 */
mrb_define_class_method
(
mrb
,
s
,
"last_match"
,
mrb_reg_s_last_match
,
ARGS_ANY
());
/* 15.2.15.6.3 */
...
...
@@ -2667,7 +2666,7 @@ mrb_init_regexp(mrb_state *mrb)
//mrb_global_variable(®_cache);
s
=
mrb
->
match_class
=
mrb
_define_class
(
mrb
,
"MatchData"
,
mrb
->
object_class
);
s
=
mrb_define_class
(
mrb
,
"MatchData"
,
mrb
->
object_class
);
//mrb_undef_method(CLASS_OF(rb_cMatch), "new");
mrb_define_method
(
mrb
,
s
,
"[]"
,
mrb_match_aref
,
ARGS_ANY
());
/* 15.2.16.3.1 */
...
...
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