rucy 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.doc/ext/rucy/class.cpp +244 -0
  2. data/.doc/ext/rucy/exception.cpp +99 -0
  3. data/.doc/ext/rucy/function.cpp +63 -0
  4. data/.doc/ext/rucy/struct.cpp +80 -0
  5. data/.doc/ext/rucy/tester.cpp +41 -184
  6. data/.doc/ext/rucy/value.cpp +42 -0
  7. data/.gitignore +22 -0
  8. data/Rakefile +4 -29
  9. data/VERSION +1 -1
  10. data/ext/rucy/class.cpp +262 -0
  11. data/ext/rucy/class.h +96 -0
  12. data/ext/rucy/exception.cpp +107 -0
  13. data/ext/rucy/extconf.rb +9 -8
  14. data/ext/rucy/function.cpp +68 -0
  15. data/ext/rucy/struct.cpp +83 -0
  16. data/ext/rucy/tester.cpp +41 -197
  17. data/ext/rucy/tester.h +10 -0
  18. data/ext/rucy/value.cpp +46 -0
  19. data/include/rucy/defs.h.erb +17 -0
  20. data/include/rucy/exception.h +2 -0
  21. data/include/rucy/extension.h +206 -0
  22. data/include/rucy/rucy.h +25 -2
  23. data/include/rucy/symbol.h +11 -0
  24. data/include/rucy/value.h.erb +66 -14
  25. data/include/rucy.h +1 -1
  26. data/lib/rucy/module.rb +9 -2
  27. data/rucy.gemspec +16 -40
  28. data/src/exception.cpp +17 -25
  29. data/src/rucy.cpp +2 -2
  30. data/src/symbol.cpp +24 -0
  31. data/src/value.cpp.erb +161 -25
  32. data/task/doc.rake +50 -0
  33. data/test/helpers.rb +7 -0
  34. data/test/test_class.rb +161 -0
  35. data/test/test_exception.rb +39 -0
  36. data/test/test_function.rb +31 -0
  37. data/test/test_struct.rb +30 -0
  38. data/test/test_value.rb +18 -0
  39. metadata +123 -74
  40. data/include/rucy/defs.h +0 -101
  41. data/include/rucy/function.h +0 -245
  42. data/include/rucy/gc.h +0 -59
  43. data/include/rucy/module.h +0 -98
  44. data/include/rucy/value.h +0 -291
  45. data/src/function.cpp +0 -158
  46. data/src/gc.cpp +0 -63
  47. data/src/module.cpp +0 -325
  48. data/src/value.cpp +0 -511
  49. data/task/ext.rake +0 -96
  50. data/test/test_rucy.rb +0 -73
metadata CHANGED
@@ -1,125 +1,174 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rucy
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
4
5
  prerelease:
5
- version: 0.1.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - snori
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-09-19 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: xot
12
+ date: 2013-04-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
17
23
  prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: xot
32
+ requirement: !ruby/object:Gem::Requirement
19
33
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
24
38
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
39
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
30
49
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
35
54
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: gemcutter
39
55
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
41
57
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: gemcutter
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
46
70
  type: :development
47
- version_requirements: *id003
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
48
78
  description: This library helps you to develop Ruby Extension by C++.
49
79
  email: snori@xord.org
50
- executables:
80
+ executables:
51
81
  - rucy2rdoc
52
- extensions:
82
+ extensions:
53
83
  - Rakefile
54
- extra_rdoc_files:
84
+ extra_rdoc_files:
55
85
  - README
86
+ - .doc/ext/rucy/class.cpp
87
+ - .doc/ext/rucy/exception.cpp
88
+ - .doc/ext/rucy/function.cpp
89
+ - .doc/ext/rucy/struct.cpp
56
90
  - .doc/ext/rucy/tester.cpp
57
- files:
58
- - README
91
+ - .doc/ext/rucy/value.cpp
92
+ files:
93
+ - .gitignore
59
94
  - ChangeLog
95
+ - README
60
96
  - Rakefile
61
- - rucy.gemspec
62
97
  - VERSION
63
- - task/ext.rake
98
+ - bin/rucy2rdoc
99
+ - ext/rucy/class.cpp
100
+ - ext/rucy/class.h
101
+ - ext/rucy/exception.cpp
64
102
  - ext/rucy/extconf.rb
103
+ - ext/rucy/function.cpp
104
+ - ext/rucy/struct.cpp
65
105
  - ext/rucy/tester.cpp
106
+ - ext/rucy/tester.h
107
+ - ext/rucy/value.cpp
108
+ - include/rucy.h
109
+ - include/rucy/class.h
66
110
  - include/rucy/defs.h.erb
111
+ - include/rucy/exception.h
112
+ - include/rucy/extension.h
67
113
  - include/rucy/function.h.erb
68
114
  - include/rucy/module.h.erb
69
- - include/rucy/value.h.erb
70
- - include/rucy/class.h
71
- - include/rucy/defs.h
72
- - include/rucy/exception.h
73
- - include/rucy/function.h
74
- - include/rucy/gc.h
75
- - include/rucy/module.h
76
115
  - include/rucy/rucy.h
77
116
  - include/rucy/symbol.h
78
- - include/rucy/value.h
79
- - include/rucy.h
80
- - lib/rucy/module.rb
117
+ - include/rucy/value.h.erb
81
118
  - lib/rucy.rb
82
- - src/function.cpp.erb
83
- - src/module.cpp.erb
84
- - src/value.cpp.erb
119
+ - lib/rucy/module.rb
120
+ - rucy.gemspec
85
121
  - src/class.cpp
86
122
  - src/exception.cpp
87
- - src/function.cpp
88
- - src/gc.cpp
89
- - src/module.cpp
123
+ - src/function.cpp.erb
124
+ - src/module.cpp.erb
90
125
  - src/rucy.cpp
91
126
  - src/symbol.cpp
92
- - src/value.cpp
93
- - test/test_rucy.rb
127
+ - src/value.cpp.erb
128
+ - task/doc.rake
129
+ - test/helpers.rb
130
+ - test/test_class.rb
131
+ - test/test_exception.rb
132
+ - test/test_function.rb
133
+ - test/test_struct.rb
134
+ - test/test_value.rb
135
+ - .doc/ext/rucy/class.cpp
136
+ - .doc/ext/rucy/exception.cpp
137
+ - .doc/ext/rucy/function.cpp
138
+ - .doc/ext/rucy/struct.cpp
94
139
  - .doc/ext/rucy/tester.cpp
95
- - bin/rucy2rdoc
140
+ - .doc/ext/rucy/value.cpp
96
141
  homepage: http://github.com/xord/rucy
97
142
  licenses: []
98
-
99
143
  post_install_message:
100
144
  rdoc_options: []
101
-
102
- require_paths:
145
+ require_paths:
103
146
  - lib
104
- - ext
105
- required_ruby_version: !ruby/object:Gem::Requirement
147
+ required_ruby_version: !ruby/object:Gem::Requirement
106
148
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
110
152
  version: 1.9.0
111
- required_rubygems_version: !ruby/object:Gem::Requirement
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
154
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: "0"
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ segments:
160
+ - 0
161
+ hash: -3704850249383636708
117
162
  requirements: []
118
-
119
163
  rubyforge_project:
120
- rubygems_version: 1.8.1
164
+ rubygems_version: 1.8.25
121
165
  signing_key:
122
166
  specification_version: 3
123
167
  summary: A Ruby C++ Extension Helper Library.
124
- test_files:
125
- - test/test_rucy.rb
168
+ test_files:
169
+ - test/helpers.rb
170
+ - test/test_class.rb
171
+ - test/test_exception.rb
172
+ - test/test_function.rb
173
+ - test/test_struct.rb
174
+ - test/test_value.rb
data/include/rucy/defs.h DELETED
@@ -1,101 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RUCY_DEFS_H__
4
- #define __RUCY_DEFS_H__
5
-
6
-
7
- #include <ruby.h>
8
- #include <xot/string.h>
9
-
10
-
11
- namespace Rucy
12
- {
13
-
14
-
15
- using Xot::String;
16
-
17
-
18
- class Value;
19
-
20
-
21
- typedef VALUE (*RubyFunctionN) (int argc, const Value* argv, Value self);
22
- typedef VALUE (*RubyFunction0) (Value self);
23
- typedef VALUE (*RubyFunction1) (Value self, Value v1);
24
- typedef VALUE (*RubyFunction2) (Value self, Value v1, Value v2);
25
- typedef VALUE (*RubyFunction3) (Value self, Value v1, Value v2, Value v3);
26
- typedef VALUE (*RubyFunction4) (Value self, Value v1, Value v2, Value v3, Value v4);
27
- typedef VALUE (*RubyFunction5) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5);
28
- typedef VALUE (*RubyFunction6) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6);
29
- typedef VALUE (*RubyFunction7) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7);
30
- typedef VALUE (*RubyFunction8) (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7, Value v8);
31
-
32
-
33
- }// Rucy
34
-
35
-
36
- #define RUBY_DEF_ALLOC(name, klass) \
37
- VALUE name (Value klass) \
38
- { \
39
- RUBY_TRY
40
- #define RUBY_DEFN(name) \
41
- VALUE name (int argc, const Value* argv, Value self) \
42
- { \
43
- RUBY_TRY
44
- #define RUBY_DEF0(name) \
45
- VALUE name (Value self) \
46
- { \
47
- RUBY_TRY
48
- #define RUBY_DEF1(name, v1) \
49
- VALUE name (Value self, Value v1) \
50
- { \
51
- RUBY_TRY
52
- #define RUBY_DEF2(name, v1, v2) \
53
- VALUE name (Value self, Value v1, Value v2) \
54
- { \
55
- RUBY_TRY
56
- #define RUBY_DEF3(name, v1, v2, v3) \
57
- VALUE name (Value self, Value v1, Value v2, Value v3) \
58
- { \
59
- RUBY_TRY
60
- #define RUBY_DEF4(name, v1, v2, v3, v4) \
61
- VALUE name (Value self, Value v1, Value v2, Value v3, Value v4) \
62
- { \
63
- RUBY_TRY
64
- #define RUBY_DEF5(name, v1, v2, v3, v4, v5) \
65
- VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5) \
66
- { \
67
- RUBY_TRY
68
- #define RUBY_DEF6(name, v1, v2, v3, v4, v5, v6) \
69
- VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6) \
70
- { \
71
- RUBY_TRY
72
- #define RUBY_DEF7(name, v1, v2, v3, v4, v5, v6, v7) \
73
- VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7) \
74
- { \
75
- RUBY_TRY
76
- #define RUBY_DEF8(name, v1, v2, v3, v4, v5, v6, v7, v8) \
77
- VALUE name (Value self, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7, Value v8) \
78
- { \
79
- RUBY_TRY
80
-
81
- #define RUBY_END \
82
- RUBY_CATCH \
83
- return Qnil; \
84
- }
85
-
86
- #ifdef RUCY_USE_DEF
87
- #define DEFN RUBY_DEFN
88
- #define DEF0 RUBY_DEF0
89
- #define DEF1 RUBY_DEF1
90
- #define DEF2 RUBY_DEF2
91
- #define DEF3 RUBY_DEF3
92
- #define DEF4 RUBY_DEF4
93
- #define DEF5 RUBY_DEF5
94
- #define DEF6 RUBY_DEF6
95
- #define DEF7 RUBY_DEF7
96
- #define DEF8 RUBY_DEF8
97
- #define END RUBY_END
98
- #endif
99
-
100
-
101
- #endif//EOH
@@ -1,245 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RUCY_FUNCTION_H__
4
- #define __RUCY_FUNCTION_H__
5
-
6
-
7
- #include <ruby.h>
8
- #include <rucy/defs.h>
9
- #include <rucy/value.h>
10
-
11
-
12
- namespace Rucy
13
- {
14
-
15
-
16
- void define_function (const char* name, RubyFunctionN fun);
17
- void define_function (const char* name, RubyFunction0 fun);
18
- void define_function (const char* name, RubyFunction1 fun);
19
- void define_function (const char* name, RubyFunction2 fun);
20
- void define_function (const char* name, RubyFunction3 fun);
21
- void define_function (const char* name, RubyFunction4 fun);
22
- void define_function (const char* name, RubyFunction5 fun);
23
- void define_function (const char* name, RubyFunction6 fun);
24
- void define_function (const char* name, RubyFunction7 fun);
25
- void define_function (const char* name, RubyFunction8 fun);
26
-
27
- Value call (Symbol name, int argc, const Value* argv);
28
- Value call (Symbol name);
29
- Value call (Symbol name, Value v1);
30
- Value call (Symbol name, Value v1, Value v2);
31
- Value call (Symbol name, Value v1, Value v2, Value v3);
32
- Value call (Symbol name, Value v1, Value v2, Value v3, Value v4);
33
- Value call (Symbol name, Value v1, Value v2, Value v3, Value v4, Value v5);
34
- Value call (Symbol name, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6);
35
- Value call (Symbol name, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7);
36
- Value call (Symbol name, Value v1, Value v2, Value v3, Value v4, Value v5, Value v6, Value v7, Value v8);
37
-
38
- Value eval (const char* str);
39
-
40
-
41
- template <typename F> class Fun0
42
- {
43
- public:
44
- Fun0 (F f) : f(f) {}
45
- static VALUE function (Fun0* fun) {return (*fun->f)();}
46
- private:
47
- F f;
48
- };// Fun0
49
- template <typename F, typename P1> class Fun1
50
- {
51
- public:
52
- Fun1 (F f, P1 p1) : f(f), p1(p1) {}
53
- static VALUE function (Fun1* fun) {return (*fun->f)(fun->p1);}
54
- private:
55
- F f; P1 p1;
56
- };// Fun1
57
- template <typename F, typename P1, typename P2> class Fun2
58
- {
59
- public:
60
- Fun2 (F f, P1 p1, P2 p2) : f(f), p1(p1), p2(p2) {}
61
- static VALUE function (Fun2* fun) {return (*fun->f)(fun->p1, fun->p2);}
62
- private:
63
- F f; P1 p1; P2 p2;
64
- };// Fun2
65
- template <typename F, typename P1, typename P2, typename P3> class Fun3
66
- {
67
- public:
68
- Fun3 (F f, P1 p1, P2 p2, P3 p3) : f(f), p1(p1), p2(p2), p3(p3) {}
69
- static VALUE function (Fun3* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3);}
70
- private:
71
- F f; P1 p1; P2 p2; P3 p3;
72
- };// Fun3
73
- template <typename F, typename P1, typename P2, typename P3, typename P4> class Fun4
74
- {
75
- public:
76
- Fun4 (F f, P1 p1, P2 p2, P3 p3, P4 p4) : f(f), p1(p1), p2(p2), p3(p3), p4(p4) {}
77
- static VALUE function (Fun4* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3, fun->p4);}
78
- private:
79
- F f; P1 p1; P2 p2; P3 p3; P4 p4;
80
- };// Fun4
81
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5> class Fun5
82
- {
83
- public:
84
- Fun5 (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) : f(f), p1(p1), p2(p2), p3(p3), p4(p4), p5(p5) {}
85
- static VALUE function (Fun5* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3, fun->p4, fun->p5);}
86
- private:
87
- F f; P1 p1; P2 p2; P3 p3; P4 p4; P5 p5;
88
- };// Fun5
89
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class Fun6
90
- {
91
- public:
92
- Fun6 (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) : f(f), p1(p1), p2(p2), p3(p3), p4(p4), p5(p5), p6(p6) {}
93
- static VALUE function (Fun6* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3, fun->p4, fun->p5, fun->p6);}
94
- private:
95
- F f; P1 p1; P2 p2; P3 p3; P4 p4; P5 p5; P6 p6;
96
- };// Fun6
97
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7> class Fun7
98
- {
99
- public:
100
- Fun7 (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) : f(f), p1(p1), p2(p2), p3(p3), p4(p4), p5(p5), p6(p6), p7(p7) {}
101
- static VALUE function (Fun7* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3, fun->p4, fun->p5, fun->p6, fun->p7);}
102
- private:
103
- F f; P1 p1; P2 p2; P3 p3; P4 p4; P5 p5; P6 p6; P7 p7;
104
- };// Fun7
105
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8> class Fun8
106
- {
107
- public:
108
- Fun8 (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) : f(f), p1(p1), p2(p2), p3(p3), p4(p4), p5(p5), p6(p6), p7(p7), p8(p8) {}
109
- static VALUE function (Fun8* fun) {return (*fun->f)(fun->p1, fun->p2, fun->p3, fun->p4, fun->p5, fun->p6, fun->p7, fun->p8);}
110
- private:
111
- F f; P1 p1; P2 p2; P3 p3; P4 p4; P5 p5; P6 p6; P7 p7; P8 p8;
112
- };// Fun8
113
-
114
- Value call_protect (VALUE (*fun)(VALUE), VALUE arg);
115
-
116
- template <typename F>
117
- inline Value protect (F f)
118
- {
119
- typedef Fun0<F> FunT;
120
- FunT fun(f);
121
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
122
- }
123
- template <typename F, typename P1>
124
- inline Value protect (F f, P1 p1)
125
- {
126
- typedef Fun1<F, P1> FunT;
127
- FunT fun(f, p1);
128
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
129
- }
130
- template <typename F, typename P1, typename P2>
131
- inline Value protect (F f, P1 p1, P2 p2)
132
- {
133
- typedef Fun2<F, P1, P2> FunT;
134
- FunT fun(f, p1, p2);
135
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
136
- }
137
- template <typename F, typename P1, typename P2, typename P3>
138
- inline Value protect (F f, P1 p1, P2 p2, P3 p3)
139
- {
140
- typedef Fun3<F, P1, P2, P3> FunT;
141
- FunT fun(f, p1, p2, p3);
142
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
143
- }
144
- template <typename F, typename P1, typename P2, typename P3, typename P4>
145
- inline Value protect (F f, P1 p1, P2 p2, P3 p3, P4 p4)
146
- {
147
- typedef Fun4<F, P1, P2, P3, P4> FunT;
148
- FunT fun(f, p1, p2, p3, p4);
149
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
150
- }
151
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5>
152
- inline Value protect (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
153
- {
154
- typedef Fun5<F, P1, P2, P3, P4, P5> FunT;
155
- FunT fun(f, p1, p2, p3, p4, p5);
156
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
157
- }
158
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
159
- inline Value protect (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
160
- {
161
- typedef Fun6<F, P1, P2, P3, P4, P5, P6> FunT;
162
- FunT fun(f, p1, p2, p3, p4, p5, p6);
163
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
164
- }
165
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
166
- inline Value protect (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
167
- {
168
- typedef Fun7<F, P1, P2, P3, P4, P5, P6, P7> FunT;
169
- FunT fun(f, p1, p2, p3, p4, p5, p6, p7);
170
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
171
- }
172
- template <typename F, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
173
- inline Value protect (F f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
174
- {
175
- typedef Fun8<F, P1, P2, P3, P4, P5, P6, P7, P8> FunT;
176
- FunT fun(f, p1, p2, p3, p4, p5, p6, p7, p8);
177
- return call_protect((VALUE(*)(VALUE)) FunT::function, (VALUE) &fun);
178
- }
179
-
180
- inline Value protect (const char* method)
181
- {
182
- return protect(rb_eval_string, method);
183
- }
184
- template <typename P1>
185
- inline Value protect (const char* method, P1 p1)
186
- {
187
- return protect(rb_eval_string, stringf(
188
- "%s(%s)", method,
189
- to_str(p1).c_str()).c_str());
190
- }
191
- template <typename P1, typename P2>
192
- inline Value protect (const char* method, P1 p1, P2 p2)
193
- {
194
- return protect(rb_eval_string, stringf(
195
- "%s(%s, %s)", method,
196
- to_str(p1).c_str(), to_str(p2).c_str()).c_str());
197
- }
198
- template <typename P1, typename P2, typename P3>
199
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3)
200
- {
201
- return protect(rb_eval_string, stringf(
202
- "%s(%s, %s, %s)", method,
203
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str()).c_str());
204
- }
205
- template <typename P1, typename P2, typename P3, typename P4>
206
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3, P4 p4)
207
- {
208
- return protect(rb_eval_string, stringf(
209
- "%s(%s, %s, %s, %s)", method,
210
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str(), to_str(p4).c_str()).c_str());
211
- }
212
- template <typename P1, typename P2, typename P3, typename P4, typename P5>
213
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
214
- {
215
- return protect(rb_eval_string, stringf(
216
- "%s(%s, %s, %s, %s, %s)", method,
217
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str(), to_str(p4).c_str(), to_str(p5).c_str()).c_str());
218
- }
219
- template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
220
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
221
- {
222
- return protect(rb_eval_string, stringf(
223
- "%s(%s, %s, %s, %s, %s, %s)", method,
224
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str(), to_str(p4).c_str(), to_str(p5).c_str(), to_str(p6).c_str()).c_str());
225
- }
226
- template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
227
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
228
- {
229
- return protect(rb_eval_string, stringf(
230
- "%s(%s, %s, %s, %s, %s, %s, %s)", method,
231
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str(), to_str(p4).c_str(), to_str(p5).c_str(), to_str(p6).c_str(), to_str(p7).c_str()).c_str());
232
- }
233
- template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
234
- inline Value protect (const char* method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
235
- {
236
- return protect(rb_eval_string, stringf(
237
- "%s(%s, %s, %s, %s, %s, %s, %s, %s)", method,
238
- to_str(p1).c_str(), to_str(p2).c_str(), to_str(p3).c_str(), to_str(p4).c_str(), to_str(p5).c_str(), to_str(p6).c_str(), to_str(p7).c_str(), to_str(p8).c_str()).c_str());
239
- }
240
-
241
-
242
- }// Rucy
243
-
244
-
245
- #endif//EOH
data/include/rucy/gc.h DELETED
@@ -1,59 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RUCY_GC_H__
4
- #define __RUCY_GC_H__
5
-
6
-
7
- #include <boost/noncopyable.hpp>
8
- #include <ruby.h>
9
- #include <rucy/value.h>
10
-
11
-
12
- namespace Rucy
13
- {
14
-
15
-
16
- class GCGuard : public boost::noncopyable
17
- {
18
-
19
- public:
20
-
21
- GCGuard (VALUE* v);
22
-
23
- GCGuard (Value* v);
24
-
25
- ~GCGuard ();
26
-
27
- private:
28
-
29
- VALUE* pval;
30
-
31
- };// GCGuard
32
-
33
-
34
- class GlobalValue
35
- {
36
-
37
- public:
38
-
39
- GlobalValue (Value v);
40
-
41
- Value value () const;
42
-
43
- operator VALUE () const;
44
-
45
- operator Value () const;
46
-
47
- private:
48
-
49
- Value val;
50
-
51
- GCGuard guard;
52
-
53
- };// GlobalValue
54
-
55
-
56
- }// Rucy
57
-
58
-
59
- #endif//EOH