keyme-rice 1.5.1.keyme

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. checksums.yaml +15 -0
  2. data/COPYING +23 -0
  3. data/Doxyfile +1253 -0
  4. data/Makefile.am +26 -0
  5. data/Makefile.in +853 -0
  6. data/README +1124 -0
  7. data/README.mingw +8 -0
  8. data/Rakefile +34 -0
  9. data/aclocal.m4 +971 -0
  10. data/bootstrap +8 -0
  11. data/config.guess +1530 -0
  12. data/config.sub +1773 -0
  13. data/configure +7121 -0
  14. data/configure.ac +52 -0
  15. data/depcomp +688 -0
  16. data/doxygen.ac +314 -0
  17. data/doxygen.am +186 -0
  18. data/extconf.rb +51 -0
  19. data/install-sh +527 -0
  20. data/missing +331 -0
  21. data/post-autoconf.rb +22 -0
  22. data/post-automake.rb +28 -0
  23. data/rice/Address_Registration_Guard.cpp +22 -0
  24. data/rice/Address_Registration_Guard.hpp +7 -0
  25. data/rice/Address_Registration_Guard.ipp +37 -0
  26. data/rice/Address_Registration_Guard_defn.hpp +75 -0
  27. data/rice/Arg.hpp +8 -0
  28. data/rice/Arg_impl.hpp +127 -0
  29. data/rice/Arg_operators.cpp +21 -0
  30. data/rice/Arg_operators.hpp +19 -0
  31. data/rice/Array.hpp +220 -0
  32. data/rice/Array.ipp +263 -0
  33. data/rice/Builtin_Object.hpp +8 -0
  34. data/rice/Builtin_Object.ipp +50 -0
  35. data/rice/Builtin_Object_defn.hpp +50 -0
  36. data/rice/Class.cpp +57 -0
  37. data/rice/Class.hpp +8 -0
  38. data/rice/Class.ipp +6 -0
  39. data/rice/Class_defn.hpp +83 -0
  40. data/rice/Constructor.hpp +368 -0
  41. data/rice/Critical_Guard.hpp +40 -0
  42. data/rice/Critical_Guard.ipp +26 -0
  43. data/rice/Data_Object.hpp +8 -0
  44. data/rice/Data_Object.ipp +133 -0
  45. data/rice/Data_Object_defn.hpp +138 -0
  46. data/rice/Data_Type.cpp +54 -0
  47. data/rice/Data_Type.hpp +8 -0
  48. data/rice/Data_Type.ipp +365 -0
  49. data/rice/Data_Type_defn.hpp +261 -0
  50. data/rice/Data_Type_fwd.hpp +12 -0
  51. data/rice/Director.cpp +13 -0
  52. data/rice/Director.hpp +39 -0
  53. data/rice/Enum.hpp +117 -0
  54. data/rice/Enum.ipp +246 -0
  55. data/rice/Exception.cpp +59 -0
  56. data/rice/Exception.hpp +9 -0
  57. data/rice/Exception_Base.hpp +8 -0
  58. data/rice/Exception_Base.ipp +13 -0
  59. data/rice/Exception_Base_defn.hpp +27 -0
  60. data/rice/Exception_defn.hpp +69 -0
  61. data/rice/Hash.hpp +227 -0
  62. data/rice/Hash.ipp +330 -0
  63. data/rice/Identifier.cpp +8 -0
  64. data/rice/Identifier.hpp +50 -0
  65. data/rice/Identifier.ipp +33 -0
  66. data/rice/Jump_Tag.hpp +24 -0
  67. data/rice/Makefile.am +129 -0
  68. data/rice/Makefile.in +769 -0
  69. data/rice/Module.cpp +84 -0
  70. data/rice/Module.hpp +8 -0
  71. data/rice/Module.ipp +6 -0
  72. data/rice/Module_defn.hpp +88 -0
  73. data/rice/Module_impl.hpp +281 -0
  74. data/rice/Module_impl.ipp +348 -0
  75. data/rice/Object.cpp +160 -0
  76. data/rice/Object.hpp +8 -0
  77. data/rice/Object.ipp +19 -0
  78. data/rice/Object_defn.hpp +191 -0
  79. data/rice/Require_Guard.hpp +21 -0
  80. data/rice/String.cpp +94 -0
  81. data/rice/String.hpp +89 -0
  82. data/rice/Struct.cpp +117 -0
  83. data/rice/Struct.hpp +162 -0
  84. data/rice/Struct.ipp +26 -0
  85. data/rice/Symbol.cpp +25 -0
  86. data/rice/Symbol.hpp +66 -0
  87. data/rice/Symbol.ipp +44 -0
  88. data/rice/VM.cpp +82 -0
  89. data/rice/VM.hpp +32 -0
  90. data/rice/config.hpp +44 -0
  91. data/rice/config.hpp.in +43 -0
  92. data/rice/detail/Arguments.hpp +118 -0
  93. data/rice/detail/Auto_Function_Wrapper.hpp +898 -0
  94. data/rice/detail/Auto_Function_Wrapper.ipp +3694 -0
  95. data/rice/detail/Auto_Member_Function_Wrapper.hpp +897 -0
  96. data/rice/detail/Auto_Member_Function_Wrapper.ipp +2774 -0
  97. data/rice/detail/Caster.hpp +103 -0
  98. data/rice/detail/Exception_Handler.hpp +8 -0
  99. data/rice/detail/Exception_Handler.ipp +68 -0
  100. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  101. data/rice/detail/Iterator.hpp +93 -0
  102. data/rice/detail/Not_Copyable.hpp +25 -0
  103. data/rice/detail/Wrapped_Function.hpp +33 -0
  104. data/rice/detail/cfp.hpp +24 -0
  105. data/rice/detail/cfp.ipp +51 -0
  106. data/rice/detail/check_ruby_type.cpp +27 -0
  107. data/rice/detail/check_ruby_type.hpp +23 -0
  108. data/rice/detail/creation_funcs.hpp +37 -0
  109. data/rice/detail/creation_funcs.ipp +36 -0
  110. data/rice/detail/default_allocation_func.hpp +23 -0
  111. data/rice/detail/default_allocation_func.ipp +11 -0
  112. data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
  113. data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
  114. data/rice/detail/demangle.cpp +56 -0
  115. data/rice/detail/demangle.hpp +19 -0
  116. data/rice/detail/env.hpp +19 -0
  117. data/rice/detail/from_ruby.hpp +43 -0
  118. data/rice/detail/from_ruby.ipp +60 -0
  119. data/rice/detail/method_data.cpp +159 -0
  120. data/rice/detail/method_data.hpp +21 -0
  121. data/rice/detail/mininode.cpp +1220 -0
  122. data/rice/detail/mininode.hpp +320 -0
  123. data/rice/detail/node.hpp +13 -0
  124. data/rice/detail/object_call.hpp +69 -0
  125. data/rice/detail/object_call.ipp +131 -0
  126. data/rice/detail/protect.cpp +29 -0
  127. data/rice/detail/protect.hpp +34 -0
  128. data/rice/detail/ruby.hpp +84 -0
  129. data/rice/detail/ruby_version_code.hpp +6 -0
  130. data/rice/detail/ruby_version_code.hpp.in +6 -0
  131. data/rice/detail/rubysig.hpp +19 -0
  132. data/rice/detail/st.hpp +22 -0
  133. data/rice/detail/to_ruby.hpp +22 -0
  134. data/rice/detail/to_ruby.ipp +36 -0
  135. data/rice/detail/traits.hpp +43 -0
  136. data/rice/detail/win32.hpp +16 -0
  137. data/rice/detail/wrap_function.hpp +341 -0
  138. data/rice/detail/wrap_function.ipp +514 -0
  139. data/rice/global_function.hpp +33 -0
  140. data/rice/global_function.ipp +22 -0
  141. data/rice/protect.hpp +92 -0
  142. data/rice/protect.ipp +1134 -0
  143. data/rice/ruby_mark.hpp +13 -0
  144. data/rice/ruby_try_catch.hpp +86 -0
  145. data/rice/rubypp.rb +97 -0
  146. data/rice/to_from_ruby.hpp +8 -0
  147. data/rice/to_from_ruby.ipp +294 -0
  148. data/rice/to_from_ruby_defn.hpp +71 -0
  149. data/ruby/Makefile.am +1 -0
  150. data/ruby/Makefile.in +569 -0
  151. data/ruby/lib/Makefile.am +3 -0
  152. data/ruby/lib/Makefile.in +423 -0
  153. data/ruby/lib/mkmf-rice.rb.in +213 -0
  154. data/ruby/lib/version.rb +3 -0
  155. data/ruby.ac +136 -0
  156. data/sample/Makefile.am +47 -0
  157. data/sample/Makefile.in +408 -0
  158. data/sample/enum/extconf.rb +3 -0
  159. data/sample/enum/sample_enum.cpp +54 -0
  160. data/sample/enum/test.rb +8 -0
  161. data/sample/inheritance/animals.cpp +98 -0
  162. data/sample/inheritance/extconf.rb +3 -0
  163. data/sample/inheritance/test.rb +7 -0
  164. data/sample/map/extconf.rb +3 -0
  165. data/sample/map/map.cpp +81 -0
  166. data/sample/map/test.rb +7 -0
  167. data/test/Makefile.am +77 -0
  168. data/test/Makefile.in +820 -0
  169. data/test/ext/Makefile.am +43 -0
  170. data/test/ext/Makefile.in +404 -0
  171. data/test/ext/t1/Foo.hpp +10 -0
  172. data/test/ext/t1/extconf.rb +2 -0
  173. data/test/ext/t1/t1.cpp +15 -0
  174. data/test/ext/t2/extconf.rb +2 -0
  175. data/test/ext/t2/t2.cpp +11 -0
  176. data/test/test_Address_Registration_Guard.cpp +43 -0
  177. data/test/test_Array.cpp +241 -0
  178. data/test/test_Builtin_Object.cpp +72 -0
  179. data/test/test_Class.cpp +498 -0
  180. data/test/test_Constructor.cpp +128 -0
  181. data/test/test_Critical_Guard.cpp +51 -0
  182. data/test/test_Data_Object.cpp +275 -0
  183. data/test/test_Data_Type.cpp +348 -0
  184. data/test/test_Director.cpp +303 -0
  185. data/test/test_Enum.cpp +195 -0
  186. data/test/test_Exception.cpp +46 -0
  187. data/test/test_Hash.cpp +198 -0
  188. data/test/test_Identifier.cpp +70 -0
  189. data/test/test_Jump_Tag.cpp +17 -0
  190. data/test/test_Memory_Management.cpp +50 -0
  191. data/test/test_Module.cpp +497 -0
  192. data/test/test_Object.cpp +148 -0
  193. data/test/test_String.cpp +94 -0
  194. data/test/test_Struct.cpp +192 -0
  195. data/test/test_Symbol.cpp +63 -0
  196. data/test/test_To_From_Ruby.cpp +321 -0
  197. data/test/test_VM.cpp +26 -0
  198. data/test/test_global_functions.cpp +114 -0
  199. data/test/test_rice.rb +43 -0
  200. data/test/unittest.cpp +136 -0
  201. data/test/unittest.hpp +294 -0
  202. metadata +259 -0
data/rice/VM.cpp ADDED
@@ -0,0 +1,82 @@
1
+ #include "VM.hpp"
2
+ #include "detail/ruby.hpp"
3
+ #include "detail/env.hpp"
4
+ #include "detail/ruby_version_code.hpp"
5
+
6
+ #include <stdexcept>
7
+
8
+ Rice::VM::
9
+ VM(char * app_name)
10
+ {
11
+ init_stack();
12
+ init(1, &app_name);
13
+ }
14
+
15
+ Rice::VM::
16
+ VM(int argc, char * argv[])
17
+ {
18
+ init_stack();
19
+ init(argc, argv);
20
+ }
21
+
22
+ Rice::VM::
23
+ VM(std::vector<const char *> const & args)
24
+ {
25
+ check_not_initialized();
26
+ init_stack();
27
+ init(args.size(), const_cast<char * *>(&args[0]));
28
+ }
29
+
30
+ Rice::VM::
31
+ ~VM()
32
+ {
33
+ init_stack();
34
+ }
35
+
36
+ void Rice::VM::
37
+ init_stack()
38
+ {
39
+ RUBY_INIT_STACK;
40
+ }
41
+
42
+ void Rice::VM::
43
+ run()
44
+ {
45
+ #if RICE__RUBY_VERSION_CODE >= 190
46
+ ruby_run_node(node_);
47
+ #else
48
+ ruby_run();
49
+ #endif
50
+ }
51
+
52
+ extern "C"
53
+ {
54
+
55
+ #if RICE__RUBY_VERSION_CODE < 190
56
+ RUBY_EXTERN VALUE * rb_gc_stack_start;
57
+ #endif
58
+
59
+ }
60
+
61
+ void Rice::VM::
62
+ check_not_initialized() const
63
+ {
64
+ #if RICE__RUBY_VERSION_CODE < 190
65
+ if(rb_gc_stack_start)
66
+ {
67
+ throw std::runtime_error("Only one VM allowed per application");
68
+ }
69
+ #endif
70
+ // TODO: how to do this check on 1.9?
71
+ }
72
+
73
+ void Rice::VM::
74
+ init(int argc, char * argv[])
75
+ {
76
+ ruby_init();
77
+ #if RICE__RUBY_VERSION_CODE >= 190
78
+ node_ =
79
+ #endif
80
+ ruby_options(argc, argv);
81
+ }
82
+
data/rice/VM.hpp ADDED
@@ -0,0 +1,32 @@
1
+ #ifndef VM__hpp
2
+ #define VM__hpp
3
+
4
+ #include <vector>
5
+ #include "detail/ruby_version_code.hpp"
6
+
7
+ namespace Rice
8
+ {
9
+
10
+ class VM
11
+ {
12
+ public:
13
+ VM(char * app_name);
14
+ VM(int argc, char * argv[]);
15
+ VM(std::vector<const char *> const & args);
16
+ ~VM();
17
+
18
+ void init_stack();
19
+ void run();
20
+
21
+ private:
22
+ void check_not_initialized() const;
23
+ void init(int argc, char * argv[]);
24
+
25
+ #if RICE__RUBY_VERSION_CODE >= 190
26
+ void * node_;
27
+ #endif
28
+ };
29
+
30
+ }
31
+
32
+ #endif // VM__hpp
data/rice/config.hpp ADDED
@@ -0,0 +1,44 @@
1
+ /* rice/config.hpp. Generated from config.hpp.in by configure. */
2
+ /* rice/config.hpp.in. Generated from configure.ac by autoheader. */
3
+
4
+ /* Define to 1 if you have the <env.h> header file. */
5
+ /* #undef HAVE_ENV_H */
6
+
7
+ /* Define to 1 if you have the <node.h> header file. */
8
+ /* #undef HAVE_NODE_H */
9
+
10
+ /* Define to 1 if you have the <ruby.h> header file. */
11
+ #define HAVE_RUBY_H 1
12
+
13
+ /* Define to 1 if you have the <ruby/node.h> header file. */
14
+ /* #undef HAVE_RUBY_NODE_H */
15
+
16
+ /* Define to 1 if you have the <version.h> header file. */
17
+ /* #undef HAVE_VERSION_H */
18
+
19
+ /* Name of package */
20
+ #define PACKAGE "rice"
21
+
22
+ /* Define to the address where bug reports for this package should be sent. */
23
+ #define PACKAGE_BUGREPORT ""
24
+
25
+ /* Define to the full name of this package. */
26
+ #define PACKAGE_NAME "rice"
27
+
28
+ /* Define to the full name and version of this package. */
29
+ #define PACKAGE_STRING "rice 1.1"
30
+
31
+ /* Define to the one symbol short name of this package. */
32
+ #define PACKAGE_TARNAME "rice"
33
+
34
+ /* Define to the home page for this package. */
35
+ #define PACKAGE_URL ""
36
+
37
+ /* Define to the version of this package. */
38
+ #define PACKAGE_VERSION "1.1"
39
+
40
+ /* Define this macro to use ruby/node.h */
41
+ /* #undef REALLY_HAVE_RUBY_NODE_H */
42
+
43
+ /* Version number of package */
44
+ #define VERSION "1.1"
@@ -0,0 +1,43 @@
1
+ /* rice/config.hpp.in. Generated from configure.ac by autoheader. */
2
+
3
+ /* Define to 1 if you have the <env.h> header file. */
4
+ #undef HAVE_ENV_H
5
+
6
+ /* Define to 1 if you have the <node.h> header file. */
7
+ #undef HAVE_NODE_H
8
+
9
+ /* Define to 1 if you have the <ruby.h> header file. */
10
+ #undef HAVE_RUBY_H
11
+
12
+ /* Define to 1 if you have the <ruby/node.h> header file. */
13
+ #undef HAVE_RUBY_NODE_H
14
+
15
+ /* Define to 1 if you have the <version.h> header file. */
16
+ #undef HAVE_VERSION_H
17
+
18
+ /* Name of package */
19
+ #undef PACKAGE
20
+
21
+ /* Define to the address where bug reports for this package should be sent. */
22
+ #undef PACKAGE_BUGREPORT
23
+
24
+ /* Define to the full name of this package. */
25
+ #undef PACKAGE_NAME
26
+
27
+ /* Define to the full name and version of this package. */
28
+ #undef PACKAGE_STRING
29
+
30
+ /* Define to the one symbol short name of this package. */
31
+ #undef PACKAGE_TARNAME
32
+
33
+ /* Define to the home page for this package. */
34
+ #undef PACKAGE_URL
35
+
36
+ /* Define to the version of this package. */
37
+ #undef PACKAGE_VERSION
38
+
39
+ /* Define this macro to use ruby/node.h */
40
+ #undef REALLY_HAVE_RUBY_NODE_H
41
+
42
+ /* Version number of package */
43
+ #undef VERSION
@@ -0,0 +1,118 @@
1
+ #ifndef Rice__Arguments__hpp_
2
+ #define Rice__Arguments__hpp_
3
+
4
+ #include "../Arg_impl.hpp"
5
+ #include <sstream>
6
+ #include <vector>
7
+ #include "../to_from_ruby_defn.hpp"
8
+
9
+ namespace Rice {
10
+
11
+ class Arguments
12
+ {
13
+ public:
14
+ Arguments() {
15
+ required_ = 0;
16
+ optional_ = 0;
17
+ }
18
+
19
+ ~Arguments() {
20
+ }
21
+
22
+ /**
23
+ * Get the full argument count of this
24
+ * list of arguments.
25
+ * Returns -1 no defined arguments
26
+ */
27
+ int count() {
28
+ if(required_ == 0 && optional_ == 0) {
29
+ return -1;
30
+ } else {
31
+ return required_ + optional_;
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Get the rb_scan_args format string for this
37
+ * list of arguments.
38
+ * In the case of no Args (default case), this
39
+ * method uses the passed in full argument count
40
+ */
41
+ std::string formatString(int fullArgCount)
42
+ {
43
+ std::stringstream s;
44
+ if(required_ == 0 && optional_ == 0)
45
+ {
46
+ s << fullArgCount << 0;
47
+ }
48
+ else
49
+ {
50
+ s << required_ << optional_;
51
+ }
52
+
53
+ return s.str();
54
+ }
55
+
56
+ /**
57
+ * Add a defined Arg to this list of Arguments
58
+ */
59
+ void add(const Arg& arg)
60
+ {
61
+ args_.push_back(arg);
62
+
63
+ if(arg.hasDefaultValue())
64
+ {
65
+ optional_++;
66
+ }
67
+ else
68
+ {
69
+ required_++;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Is the argument at the request location an optional
75
+ * argument?
76
+ */
77
+ bool isOptional(unsigned int pos)
78
+ {
79
+ if(required_ == 0 && optional_ == 0)
80
+ {
81
+ return false;
82
+ }
83
+ if(pos >= args_.size())
84
+ {
85
+ return false;
86
+ }
87
+ return args_[pos].hasDefaultValue();
88
+ }
89
+
90
+ /**
91
+ * Given a position, a type, and a ruby VALUE, figure out
92
+ * what argument value we need to return according to
93
+ * defaults and if that VALUE is nil or not
94
+ */
95
+ template<typename Arg_T>
96
+ Arg_T getArgumentOrDefault(int pos, VALUE in)
97
+ {
98
+ if(isOptional(pos) && NIL_P(in))
99
+ {
100
+ return args_[pos].getDefaultValue<Arg_T>();
101
+ }
102
+ else
103
+ {
104
+ return from_ruby<Arg_T>(in);
105
+ }
106
+ }
107
+
108
+ private:
109
+ std::vector<Arg> args_;
110
+
111
+ /** Keep counts of required and optional parameters */
112
+ int required_;
113
+ int optional_;
114
+ };
115
+
116
+ }
117
+
118
+ #endif // Rice__Arguments__hpp_