rucy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +12 -0
- data/README +4 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/ext/rucy/extconf.rb +50 -0
- data/ext/rucy/tester.cpp +102 -0
- data/include/rucy/class.h +37 -0
- data/include/rucy/defs.h +97 -0
- data/include/rucy/defs.h.erb +56 -0
- data/include/rucy/exception.h +124 -0
- data/include/rucy/function.h +245 -0
- data/include/rucy/function.h.erb +73 -0
- data/include/rucy/gc.h +59 -0
- data/include/rucy/module.h +96 -0
- data/include/rucy/module.h.erb +68 -0
- data/include/rucy/rucy.h +64 -0
- data/include/rucy/string.h +28 -0
- data/include/rucy/symbol.h +50 -0
- data/include/rucy/value.h +291 -0
- data/include/rucy/value.h.erb +278 -0
- data/include/rucy.h +10 -0
- data/lib/rucy.rb +24 -0
- data/rucy.gemspec +50 -0
- data/src/class.cpp +35 -0
- data/src/exception.cpp +124 -0
- data/src/function.cpp +157 -0
- data/src/function.cpp.erb +74 -0
- data/src/gc.cpp +63 -0
- data/src/module.cpp +321 -0
- data/src/module.cpp.erb +103 -0
- data/src/rucy.cpp +56 -0
- data/src/string.cpp +78 -0
- data/src/symbol.cpp +51 -0
- data/src/value.cpp +511 -0
- data/src/value.cpp.erb +409 -0
- data/support.rb +58 -0
- data/task/ext.rake +36 -0
- data/task/gem.rake +33 -0
- data/task/lib.rake +47 -0
- data/test/test_rucy.rb +57 -0
- metadata +116 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
$: << File.expand_path(File.dirname __FILE__)
|
3
|
+
require 'rbconfig'
|
4
|
+
require 'support'
|
5
|
+
|
6
|
+
|
7
|
+
NAME = 'rucy'
|
8
|
+
|
9
|
+
SRCDIR = 'src'
|
10
|
+
INCDIR = 'include'
|
11
|
+
LIBDIR = 'lib'
|
12
|
+
EXTDIR = 'ext'
|
13
|
+
TASKDIR = 'task'
|
14
|
+
|
15
|
+
EXTEXT = RbConfig::CONFIG['DLEXT'] || 'so'
|
16
|
+
|
17
|
+
incroot = RbConfig::CONFIG['rubyhdrdir']
|
18
|
+
INCDIRS = [
|
19
|
+
'include',
|
20
|
+
incroot,
|
21
|
+
"#{incroot}/#{RUBY_PLATFORM}",
|
22
|
+
'/opt/local/include',
|
23
|
+
'/opt/include'
|
24
|
+
]
|
25
|
+
|
26
|
+
RBS = glob '**/*.rb'
|
27
|
+
|
28
|
+
RUBY = ENV['RUBY'] || 'ruby'
|
29
|
+
GEM = ENV['GEM'] || 'gem'
|
30
|
+
MAKE = ENV['MAKE'] || 'make'
|
31
|
+
CC = RbConfig::CONFIG['CC'] || ENV['CC'] || 'g++'
|
32
|
+
CFLAGS = '-Wall -O'
|
33
|
+
AR = ENV['AR'] || 'ar'
|
34
|
+
ARFLAGS = 'crs'
|
35
|
+
|
36
|
+
|
37
|
+
task :default => :ext
|
38
|
+
|
39
|
+
task :lib => 'lib:build'
|
40
|
+
|
41
|
+
task :ext => 'ext:build'
|
42
|
+
|
43
|
+
task :gem => 'gem:build'
|
44
|
+
|
45
|
+
task :install => 'gem:install'
|
46
|
+
|
47
|
+
task :uninstall => 'gem:uninstall'
|
48
|
+
|
49
|
+
task :clean => ['lib:clean', 'ext:clean', 'gem:clean']
|
50
|
+
|
51
|
+
task :test => :ext do
|
52
|
+
Dir['test/**/test_*.rb'].each do |rb|
|
53
|
+
sh %( ruby #{rb} )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
Dir["#{TASKDIR}/**/*.rake"].each {|path| load path}
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/ext/rucy/extconf.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
%w[../../lib].each do |path|
|
3
|
+
$: << File.expand_path(File.join File.dirname(__FILE__), *path.split('/'))
|
4
|
+
end
|
5
|
+
require 'rubygems'
|
6
|
+
require 'mkmf'
|
7
|
+
require 'rucy'
|
8
|
+
|
9
|
+
|
10
|
+
DEBUG = ENV["DEBUG"] || false
|
11
|
+
|
12
|
+
DEFS = []
|
13
|
+
INCDIRS = %w[/opt/local/include /opt/include]
|
14
|
+
LIBDIRS = []
|
15
|
+
|
16
|
+
HEADERS = %w[
|
17
|
+
boost/noncopyable.hpp
|
18
|
+
ruby.h
|
19
|
+
rucy.h
|
20
|
+
]
|
21
|
+
LIBS = %w[stdc++ rucy]
|
22
|
+
|
23
|
+
|
24
|
+
DEFS << "_DEBUG" if DEBUG
|
25
|
+
|
26
|
+
case RUBY_PLATFORM
|
27
|
+
when /cygwin/
|
28
|
+
DEFS << "WIN32" << "WINDOWS" << "CYGWIN"
|
29
|
+
when /mswin/
|
30
|
+
DEFS << "WIN32" << "WINDOWS"
|
31
|
+
when /darwin/
|
32
|
+
DEFS << "COCOA"
|
33
|
+
end
|
34
|
+
|
35
|
+
$CPPFLAGS << DEFS.map {|s| " -D#{s}"}.join
|
36
|
+
$CPPFLAGS << INCDIRS.map {|s| " -I#{s}"}.join
|
37
|
+
$LDFLAGS << LIBDIRS.map {|s| " -L#{s}"}.join
|
38
|
+
$LOCAL_LIBS << " -lrucy"
|
39
|
+
|
40
|
+
dir_config "boost"
|
41
|
+
dir_config "rucy", Rucy.root_dir
|
42
|
+
|
43
|
+
|
44
|
+
Config::CONFIG.each {|key, val| val.gsub!(/gcc/, "g++")}
|
45
|
+
|
46
|
+
exit 1 unless HEADERS.all? {|s| have_header(s)}
|
47
|
+
exit 1 unless LIBS.all? {|s| have_library(s)}
|
48
|
+
|
49
|
+
|
50
|
+
create_makefile "rucy/tester"
|
data/ext/rucy/tester.cpp
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#include <rucy.h>
|
2
|
+
|
3
|
+
|
4
|
+
using namespace Rucy;
|
5
|
+
|
6
|
+
|
7
|
+
static
|
8
|
+
RUBY_DEF0(do_nothing)
|
9
|
+
{
|
10
|
+
}
|
11
|
+
RUBY_END
|
12
|
+
|
13
|
+
static
|
14
|
+
RUBY_DEF0(return_nil)
|
15
|
+
{
|
16
|
+
return Qnil;
|
17
|
+
}
|
18
|
+
RUBY_END
|
19
|
+
|
20
|
+
static
|
21
|
+
RUBY_DEF0(return_int)
|
22
|
+
{
|
23
|
+
return Value(1);
|
24
|
+
}
|
25
|
+
RUBY_END
|
26
|
+
|
27
|
+
static
|
28
|
+
RUBY_DEF0(return_float)
|
29
|
+
{
|
30
|
+
return Value(1.0f);
|
31
|
+
}
|
32
|
+
RUBY_END
|
33
|
+
|
34
|
+
static
|
35
|
+
RUBY_DEF0(return_string)
|
36
|
+
{
|
37
|
+
return Value("");
|
38
|
+
}
|
39
|
+
RUBY_END
|
40
|
+
|
41
|
+
static
|
42
|
+
RUBY_DEF0(raise_ruby_exception)
|
43
|
+
{
|
44
|
+
throw RubyException(rb_eStandardError, "raise_ruby_exception");
|
45
|
+
}
|
46
|
+
RUBY_END
|
47
|
+
|
48
|
+
static
|
49
|
+
RUBY_DEF0(raise_in_eval)
|
50
|
+
{
|
51
|
+
eval("raise 'raise_in_eval'");
|
52
|
+
}
|
53
|
+
RUBY_END
|
54
|
+
|
55
|
+
static
|
56
|
+
RUBY_DEF0(throw_std_exception)
|
57
|
+
{
|
58
|
+
throw std::exception();
|
59
|
+
}
|
60
|
+
RUBY_END
|
61
|
+
|
62
|
+
static
|
63
|
+
RUBY_DEF0(throw_std_runtime_error)
|
64
|
+
{
|
65
|
+
throw std::runtime_error("std::runtime_error");
|
66
|
+
}
|
67
|
+
RUBY_END
|
68
|
+
|
69
|
+
static
|
70
|
+
RUBY_DEF0(throw_std_string)
|
71
|
+
{
|
72
|
+
throw std::string("std::string");
|
73
|
+
}
|
74
|
+
RUBY_END
|
75
|
+
|
76
|
+
static
|
77
|
+
RUBY_DEF0(throw_cstring)
|
78
|
+
{
|
79
|
+
throw "cstring";
|
80
|
+
}
|
81
|
+
RUBY_END
|
82
|
+
|
83
|
+
|
84
|
+
extern "C" void
|
85
|
+
Init_tester ()
|
86
|
+
{
|
87
|
+
if (!init()) return;
|
88
|
+
|
89
|
+
define_module("Rucy")
|
90
|
+
.define_class("Tester")
|
91
|
+
.define_method("do_nothing", do_nothing)
|
92
|
+
.define_method("return_nil", return_nil)
|
93
|
+
.define_method("return_int", return_int)
|
94
|
+
.define_method("return_float", return_float)
|
95
|
+
.define_method("return_string", return_string)
|
96
|
+
.define_method("raise_ruby_exception", raise_ruby_exception)
|
97
|
+
.define_method("raise_in_eval", raise_in_eval)
|
98
|
+
.define_method("throw_std_exception", throw_std_exception)
|
99
|
+
.define_method("throw_std_runtime_error", throw_std_runtime_error)
|
100
|
+
.define_method("throw_std_string", throw_std_string)
|
101
|
+
.define_method("throw_cstring", throw_cstring);
|
102
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RUCY_CLASS_H__
|
4
|
+
#define __RUCY_CLASS_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/module.h>
|
8
|
+
|
9
|
+
|
10
|
+
namespace Rucy
|
11
|
+
{
|
12
|
+
|
13
|
+
|
14
|
+
class Class : public Module
|
15
|
+
{
|
16
|
+
|
17
|
+
typedef Module Super;
|
18
|
+
|
19
|
+
public:
|
20
|
+
|
21
|
+
Class (VALUE v = Qnil);
|
22
|
+
|
23
|
+
Class define_alloc_func (RubyFunction0 fun);
|
24
|
+
|
25
|
+
Class define_alloc_func (const char* name, RubyFunction0 fun);
|
26
|
+
// for RUBY_METHOD macro
|
27
|
+
|
28
|
+
};// Class
|
29
|
+
|
30
|
+
|
31
|
+
Class define_class (const char* name, Value super = rb_cObject);
|
32
|
+
|
33
|
+
|
34
|
+
}// Rucy
|
35
|
+
|
36
|
+
|
37
|
+
#endif//EOH
|
data/include/rucy/defs.h
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RUCY_DEFS_H__
|
4
|
+
#define __RUCY_DEFS_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <ruby.h>
|
8
|
+
|
9
|
+
|
10
|
+
namespace Rucy
|
11
|
+
{
|
12
|
+
|
13
|
+
|
14
|
+
class Value;
|
15
|
+
|
16
|
+
|
17
|
+
typedef VALUE (*RubyFunctionN) (int argc, const Value* argv, Value self);
|
18
|
+
typedef VALUE (*RubyFunction0) (Value self);
|
19
|
+
typedef VALUE (*RubyFunction1) (Value self, Value v1);
|
20
|
+
typedef VALUE (*RubyFunction2) (Value self, Value v1, Value v2);
|
21
|
+
typedef VALUE (*RubyFunction3) (Value self, Value v1, Value v2, Value v3);
|
22
|
+
typedef VALUE (*RubyFunction4) (Value self, Value v1, Value v2, Value v3, Value v4);
|
23
|
+
typedef VALUE (*RubyFunction5) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5);
|
24
|
+
typedef VALUE (*RubyFunction6) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6);
|
25
|
+
typedef VALUE (*RubyFunction7) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7);
|
26
|
+
typedef VALUE (*RubyFunction8) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7, Value v8);
|
27
|
+
|
28
|
+
|
29
|
+
}// Rucy
|
30
|
+
|
31
|
+
|
32
|
+
#define RUBY_DEF_ALLOC(name, klass) \
|
33
|
+
VALUE name (Value klass) \
|
34
|
+
{ \
|
35
|
+
RUBY_TRY
|
36
|
+
#define RUBY_DEFN(name) \
|
37
|
+
VALUE name (int argc, const Value* argv, Value self) \
|
38
|
+
{ \
|
39
|
+
RUBY_TRY
|
40
|
+
#define RUBY_DEF0(name) \
|
41
|
+
VALUE name (Value self) \
|
42
|
+
{ \
|
43
|
+
RUBY_TRY
|
44
|
+
#define RUBY_DEF1(name, v1) \
|
45
|
+
VALUE name (Value self, Value v1) \
|
46
|
+
{ \
|
47
|
+
RUBY_TRY
|
48
|
+
#define RUBY_DEF2(name, v1, v2) \
|
49
|
+
VALUE name (Value self, Value v1, Value v2) \
|
50
|
+
{ \
|
51
|
+
RUBY_TRY
|
52
|
+
#define RUBY_DEF3(name, v1, v2, v3) \
|
53
|
+
VALUE name (Value self, Value v1, Value v2, Value v3) \
|
54
|
+
{ \
|
55
|
+
RUBY_TRY
|
56
|
+
#define RUBY_DEF4(name, v1, v2, v3, v4) \
|
57
|
+
VALUE name (Value self, Value v1, Value v2, Value v3, Value v4) \
|
58
|
+
{ \
|
59
|
+
RUBY_TRY
|
60
|
+
#define RUBY_DEF5(name, v1, v2, v3, v4, v5) \
|
61
|
+
VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5) \
|
62
|
+
{ \
|
63
|
+
RUBY_TRY
|
64
|
+
#define RUBY_DEF6(name, v1, v2, v3, v4, v5, v6) \
|
65
|
+
VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6) \
|
66
|
+
{ \
|
67
|
+
RUBY_TRY
|
68
|
+
#define RUBY_DEF7(name, v1, v2, v3, v4, v5, v6, v7) \
|
69
|
+
VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7) \
|
70
|
+
{ \
|
71
|
+
RUBY_TRY
|
72
|
+
#define RUBY_DEF8(name, v1, v2, v3, v4, v5, v6, v7, v8) \
|
73
|
+
VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7, Value v8) \
|
74
|
+
{ \
|
75
|
+
RUBY_TRY
|
76
|
+
|
77
|
+
#define RUBY_END \
|
78
|
+
RUBY_CATCH \
|
79
|
+
return Qnil; \
|
80
|
+
}
|
81
|
+
|
82
|
+
#ifdef RUCY_USE_DEF
|
83
|
+
#define DEFN RUBY_DEFN
|
84
|
+
#define DEF0 RUBY_DEF0
|
85
|
+
#define DEF1 RUBY_DEF1
|
86
|
+
#define DEF2 RUBY_DEF2
|
87
|
+
#define DEF3 RUBY_DEF3
|
88
|
+
#define DEF4 RUBY_DEF4
|
89
|
+
#define DEF5 RUBY_DEF5
|
90
|
+
#define DEF6 RUBY_DEF6
|
91
|
+
#define DEF7 RUBY_DEF7
|
92
|
+
#define DEF8 RUBY_DEF8
|
93
|
+
#define END RUBY_END
|
94
|
+
#endif
|
95
|
+
|
96
|
+
|
97
|
+
#endif//EOH
|
@@ -0,0 +1,56 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
% require 'support'
|
3
|
+
#pragma once
|
4
|
+
#ifndef __RUCY_DEFS_H__
|
5
|
+
#define __RUCY_DEFS_H__
|
6
|
+
|
7
|
+
|
8
|
+
#include <ruby.h>
|
9
|
+
|
10
|
+
|
11
|
+
namespace Rucy
|
12
|
+
{
|
13
|
+
|
14
|
+
|
15
|
+
class Value;
|
16
|
+
|
17
|
+
|
18
|
+
typedef VALUE (*RubyFunctionN) (int argc, const Value* argv, Value self);
|
19
|
+
% NTIMES.each do |n|
|
20
|
+
typedef VALUE (*RubyFunction<%= n %>) (Value self<%= params(n) {|i| ", Value v#{i}"} %>);
|
21
|
+
% end
|
22
|
+
|
23
|
+
|
24
|
+
}// Rucy
|
25
|
+
|
26
|
+
|
27
|
+
#define RUBY_DEF_ALLOC(name, klass) \
|
28
|
+
VALUE name (Value klass) \
|
29
|
+
{ \
|
30
|
+
RUBY_TRY
|
31
|
+
#define RUBY_DEFN(name) \
|
32
|
+
VALUE name (int argc, const Value* argv, Value self) \
|
33
|
+
{ \
|
34
|
+
RUBY_TRY
|
35
|
+
% NTIMES.each do |n|
|
36
|
+
#define RUBY_DEF<%= n %>(name<%= params(n) {|i| ", v#{i}"} %>) \
|
37
|
+
VALUE name (Value self<%= params(n) {|i| ", Value v#{i}"} %>) \
|
38
|
+
{ \
|
39
|
+
RUBY_TRY
|
40
|
+
% end
|
41
|
+
|
42
|
+
#define RUBY_END \
|
43
|
+
RUBY_CATCH \
|
44
|
+
return Qnil; \
|
45
|
+
}
|
46
|
+
|
47
|
+
#ifdef RUCY_USE_DEF
|
48
|
+
#define DEFN RUBY_DEFN
|
49
|
+
% NTIMES.each do |n|
|
50
|
+
#define DEF<%= n %> RUBY_DEF<%= n %>
|
51
|
+
% end
|
52
|
+
#define END RUBY_END
|
53
|
+
#endif
|
54
|
+
|
55
|
+
|
56
|
+
#endif//EOH
|
@@ -0,0 +1,124 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RUCY_EXCEPTION_H__
|
4
|
+
#define __RUCY_EXCEPTION_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <stdexcept>
|
8
|
+
#include <rucy/value.h>
|
9
|
+
#include <rucy/class.h>
|
10
|
+
|
11
|
+
|
12
|
+
namespace Rucy
|
13
|
+
{
|
14
|
+
|
15
|
+
|
16
|
+
Class native_error_class ();
|
17
|
+
// class Rucy::NativeError < RuntimeError
|
18
|
+
|
19
|
+
|
20
|
+
void error (const char* format, ...);
|
21
|
+
|
22
|
+
void raise (Value exception, const char* format = NULL, ...);
|
23
|
+
|
24
|
+
|
25
|
+
void type_error (const char* format = NULL, ...);
|
26
|
+
|
27
|
+
void argument_error (const char* format = NULL, ...);
|
28
|
+
|
29
|
+
void argument_error (
|
30
|
+
const char* method, int nargs, int nargs_expected,
|
31
|
+
int n1 = -1, int n2 = -1, int n3 = -1, int n4 = -1, int n5 = -1);
|
32
|
+
|
33
|
+
void not_implemented_error (const char* format = NULL, ...);
|
34
|
+
|
35
|
+
|
36
|
+
class RubyException : public std::runtime_error
|
37
|
+
{
|
38
|
+
|
39
|
+
typedef std::runtime_error Super;
|
40
|
+
|
41
|
+
public:
|
42
|
+
|
43
|
+
RubyException (Value exception);
|
44
|
+
|
45
|
+
RubyException (Value type, const char* format, ...);
|
46
|
+
|
47
|
+
const char* what () const throw();
|
48
|
+
|
49
|
+
Value value () const;
|
50
|
+
|
51
|
+
private:
|
52
|
+
|
53
|
+
/*Global*/Value val;
|
54
|
+
|
55
|
+
};// RubyException
|
56
|
+
|
57
|
+
|
58
|
+
struct RubyJumptag
|
59
|
+
{
|
60
|
+
|
61
|
+
public:
|
62
|
+
|
63
|
+
int tag;
|
64
|
+
|
65
|
+
RubyJumptag (int tag);
|
66
|
+
|
67
|
+
};// RubyJumptag
|
68
|
+
|
69
|
+
|
70
|
+
}// Rucy
|
71
|
+
|
72
|
+
|
73
|
+
#define RUBY_TRY \
|
74
|
+
VALUE RUCY__rubyexception__ = Qnil; \
|
75
|
+
int RUCY__rubyjumptag__ = 0; \
|
76
|
+
\
|
77
|
+
goto RUCY__ruby_try_start__; \
|
78
|
+
\
|
79
|
+
RUCY__ruby_jump_tag__: \
|
80
|
+
if (RUCY__rubyjumptag__) rb_jump_tag(RUCY__rubyjumptag__); \
|
81
|
+
RUBY_THROW(rb_exc_new2(Rucy::native_error_class(), "Bad jump tag.")); \
|
82
|
+
\
|
83
|
+
RUCY__ruby_raise_exception__: \
|
84
|
+
rb_exc_raise(RUCY__rubyexception__); \
|
85
|
+
\
|
86
|
+
RUCY__ruby_try_start__: \
|
87
|
+
try \
|
88
|
+
{
|
89
|
+
|
90
|
+
#define RUBY_CATCH \
|
91
|
+
} \
|
92
|
+
catch (const Rucy::RubyJumptag& e) \
|
93
|
+
{ \
|
94
|
+
RUCY__rubyjumptag__ = e.tag; \
|
95
|
+
goto RUCY__ruby_jump_tag__; \
|
96
|
+
} \
|
97
|
+
catch (const Rucy::RubyException& e) \
|
98
|
+
{ \
|
99
|
+
RUBY_THROW(e.value()); \
|
100
|
+
} \
|
101
|
+
catch (const std::exception& e) \
|
102
|
+
{ \
|
103
|
+
RUBY_THROW(rb_exc_new2(Rucy::native_error_class(), e.what())); \
|
104
|
+
} \
|
105
|
+
catch (const std::string& s) \
|
106
|
+
{ \
|
107
|
+
RUBY_THROW(rb_exc_new2(Rucy::native_error_class(), s.c_str())); \
|
108
|
+
} \
|
109
|
+
catch (const char* s) \
|
110
|
+
{ \
|
111
|
+
RUBY_THROW(rb_exc_new2(Rucy::native_error_class(), s)); \
|
112
|
+
} \
|
113
|
+
catch (...) \
|
114
|
+
{ \
|
115
|
+
RUBY_THROW(rb_exc_new2( \
|
116
|
+
Rucy::native_error_class(), "Unknown C++ exception thrown.")); \
|
117
|
+
}
|
118
|
+
|
119
|
+
#define RUBY_THROW(exception) \
|
120
|
+
RUCY__rubyexception__ = (exception); \
|
121
|
+
goto RUCY__ruby_raise_exception__
|
122
|
+
|
123
|
+
|
124
|
+
#endif//EOH
|