Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4bfb84746553
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fab96d4359c9
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 24, 2016

  1. [Truffle rb_exc_new3

    chrisseaton committed Jul 24, 2016
    Copy the full SHA
    a712772 View commit details
  2. Copy the full SHA
    fab96d4 View commit details
Showing with 21 additions and 0 deletions.
  1. +4 −0 lib/ruby/truffle/cext/ruby.h
  2. +17 −0 truffle/src/main/c/cext/ruby.c
4 changes: 4 additions & 0 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -220,6 +220,8 @@ VALUE rb_str_to_str(VALUE string);
#define SafeStringValue StringValue
VALUE rb_string_value(VALUE *value_pointer);
VALUE rb_str_buf_new(long capacity);
VALUE rb_sprintf(const char *format, ...);
VALUE rb_vsprintf(const char *format, va_list args);

// Symbol

@@ -296,6 +298,8 @@ void rb_define_global_const(const char *name, VALUE value);

// Exceptions

VALUE rb_exc_new3(VALUE exception_class, VALUE message);

NORETURN(void rb_exc_raise(VALUE exception));
NORETURN(void rb_raise(VALUE exception, const char *format, ...));

17 changes: 17 additions & 0 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -240,6 +240,19 @@ VALUE rb_str_buf_new(long capacity) {
return rb_str_new_cstr("");
}

VALUE rb_sprintf(const char *format, ...) {
va_list args;
va_start(args, format);
VALUE *string = rb_vsprintf(format, args);
va_end(args);
return string;
}

VALUE rb_vsprintf(const char *format, va_list args) {
fprintf(stderr, "rb_vsprintf not implemented\n");
abort();
}

// Symbol

ID rb_intern(const char *string) {
@@ -422,6 +435,10 @@ void rb_define_global_const(const char *name, VALUE value) {

// Raising exceptions

VALUE rb_exc_new3(VALUE exception_class, VALUE message) {
return truffle_invoke(exception_class, "new", message);
}

void rb_exc_raise(VALUE exception) {
truffle_invoke(RUBY_CEXT, "rb_exc_raise", exception);
abort();