Skip to content

Commit

Permalink
C-API patch from kubo. Closes rubinius#460.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford committed Sep 6, 2010
1 parent 0cc191d commit a0c2643
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vm/capi/include/ruby.h
Expand Up @@ -1310,6 +1310,16 @@ VALUE rb_uint2big(unsigned long number);
*/
VALUE rb_reg_regcomp(VALUE str);

/**
* Tests whether the given Regexp matches to the given String
*/
VALUE rb_reg_match(VALUE re, VALUE str);

/**
* Retrieves the last MatchData
*/
VALUE rb_backref_get(void);

/**
* Require a Ruby file.
*
Expand Down
8 changes: 8 additions & 0 deletions vm/capi/regexp.cpp
Expand Up @@ -40,4 +40,12 @@ extern "C" {
VALUE rb_reg_regcomp(VALUE str) {
return rb_funcall(rb_cRegexp, rb_intern("new"), 1, str);
}

VALUE rb_reg_match(VALUE re, VALUE str) {
return rb_funcall(re, rb_intern("=~"), 1, str);
}

VALUE rb_backref_get(void) {
return rb_gv_get("$~");
}
}

0 comments on commit a0c2643

Please sign in to comment.