rice 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/COPYING +2 -2
  2. data/Doxyfile +1 -1
  3. data/Makefile.in +8 -3
  4. data/Rakefile +3 -3
  5. data/config.guess +30 -49
  6. data/config.sub +4 -22
  7. data/configure +319 -104
  8. data/configure.ac +6 -2
  9. data/doxygen.ac +2 -2
  10. data/extconf.rb +22 -0
  11. data/post-autoconf.rb +3 -3
  12. data/post-automake.rb +2 -2
  13. data/rice/Array.ipp +7 -6
  14. data/rice/Critical_Guard.hpp +6 -0
  15. data/rice/Critical_Guard.ipp +6 -0
  16. data/rice/Data_Object.hpp +1 -120
  17. data/rice/Data_Object.ipp +5 -1
  18. data/rice/Data_Object_defn.hpp +132 -0
  19. data/rice/Data_Type.ipp +18 -2
  20. data/rice/Enum.ipp +3 -3
  21. data/rice/Exception.hpp +1 -61
  22. data/rice/Exception_Base.hpp +2 -24
  23. data/rice/Exception_Base.ipp +2 -0
  24. data/rice/Exception_Base_defn.hpp +27 -0
  25. data/rice/Exception_defn.hpp +69 -0
  26. data/rice/Hash.hpp +5 -1
  27. data/rice/Hash.ipp +7 -7
  28. data/rice/Makefile.am +20 -3
  29. data/rice/Makefile.in +39 -4
  30. data/rice/Module.cpp +11 -3
  31. data/rice/Module_impl.hpp +20 -9
  32. data/rice/Module_impl.ipp +84 -87
  33. data/rice/Object.cpp +1 -1
  34. data/rice/VM.cpp +14 -1
  35. data/rice/VM.hpp +6 -1
  36. data/rice/config.hpp +24 -3
  37. data/rice/config.hpp.in +21 -0
  38. data/rice/detail/Auto_Function_Wrapper.hpp +97 -65
  39. data/rice/detail/Auto_Function_Wrapper.ipp +160 -128
  40. data/rice/detail/Auto_Member_Function_Wrapper.hpp +96 -64
  41. data/rice/detail/Auto_Member_Function_Wrapper.ipp +160 -128
  42. data/rice/detail/Exception_Handler.hpp +2 -112
  43. data/rice/detail/Exception_Handler.ipp +68 -0
  44. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  45. data/rice/detail/Iterator.hpp +93 -0
  46. data/rice/detail/check_ruby_type.cpp +8 -2
  47. data/rice/detail/creation_funcs.ipp +2 -2
  48. data/rice/detail/define_method_and_auto_wrap.hpp +4 -2
  49. data/rice/detail/define_method_and_auto_wrap.ipp +14 -5
  50. data/rice/detail/env.hpp +4 -0
  51. data/rice/detail/method_data.cpp +362 -75
  52. data/rice/detail/method_data.cpp.rpp +301 -0
  53. data/rice/detail/method_data.hpp +6 -18
  54. data/rice/detail/mininode.cpp +1220 -0
  55. data/rice/detail/mininode.cpp.rpp +62 -0
  56. data/rice/detail/mininode.hpp +320 -0
  57. data/rice/detail/mininode.hpp.rpp +119 -0
  58. data/rice/detail/protect.cpp +4 -2
  59. data/rice/detail/ruby.hpp +44 -18
  60. data/rice/detail/ruby_version_code.hpp +6 -0
  61. data/rice/detail/ruby_version_code.hpp.in +6 -0
  62. data/rice/detail/rubysig.hpp +6 -0
  63. data/rice/detail/st.hpp +6 -2
  64. data/rice/detail/wrap_function.hpp +50 -48
  65. data/rice/detail/wrap_function.ipp +48 -48
  66. data/rice/generate_code.rb +43 -293
  67. data/rice/global_function.hpp +10 -4
  68. data/rice/global_function.ipp +1 -2
  69. data/rice/ruby_mark.hpp +13 -0
  70. data/rice/ruby_try_catch.hpp +1 -1
  71. data/rice/rubypp.rb +97 -0
  72. data/rice/to_from_ruby.ipp +3 -3
  73. data/ruby.ac +44 -8
  74. data/ruby/Makefile.in +2 -0
  75. data/ruby/lib/Makefile.in +2 -0
  76. data/ruby/lib/mkmf-rice.rb.in +4 -1
  77. data/ruby/lib/version.rb +3 -0
  78. data/sample/Makefile.am +2 -2
  79. data/sample/Makefile.in +4 -2
  80. data/test/Makefile.am +2 -1
  81. data/test/Makefile.in +7 -2
  82. data/test/test_Array.cpp +2 -2
  83. data/test/test_Class.cpp +4 -1
  84. data/test/test_Critical_Guard.cpp +4 -0
  85. data/test/test_Data_Object.cpp +43 -3
  86. data/test/test_Hash.cpp +3 -3
  87. data/test/test_String.cpp +8 -8
  88. data/test/test_VM.cpp +1 -1
  89. data/test/test_global_functions.cpp +45 -0
  90. data/test/test_rice.rb +5 -0
  91. metadata +115 -98
  92. data/rice/detail/Iterator_Definer.hpp +0 -98
@@ -1,98 +0,0 @@
1
- #ifndef Rice__detail__Iterator_Definer__hpp_
2
- #define Rice__detail__Iterator_Definer__hpp_
3
-
4
- #include "method_data.hpp"
5
- #include "ruby.hpp"
6
- #include "../protect.hpp"
7
- #include "../Data_Object.hpp"
8
-
9
- namespace Rice
10
- {
11
-
12
- namespace detail
13
- {
14
-
15
- template<typename Derived_T>
16
- class Iterator_Definer
17
- {
18
- public:
19
- virtual ~Iterator_Definer()
20
- {
21
- }
22
-
23
- class Iterator
24
- {
25
- public:
26
- virtual ~Iterator() { }
27
-
28
- virtual VALUE call_impl(VALUE self) = 0;
29
-
30
- static VALUE call(VALUE self)
31
- {
32
- void * data = method_data();
33
- Iterator * iterator = static_cast<Iterator *>(data);
34
- return iterator->call_impl(self);
35
- }
36
- };
37
-
38
- template<typename T, typename Iterator_T>
39
- class Iterator_Impl
40
- : public Iterator
41
- {
42
- public:
43
- Iterator_Impl(
44
- Iterator_T (T::*begin)(),
45
- Iterator_T (T::*end)(),
46
- Data_Type<T> data_type)
47
- : begin_(begin)
48
- , end_(end)
49
- , data_type_(data_type)
50
- {
51
- }
52
-
53
- virtual VALUE call_impl(VALUE self)
54
- {
55
- Data_Object<T> obj(self, data_type_);
56
- Iterator_T it = obj->begin();
57
- Iterator_T end = obj->end();
58
- for(; it != end; ++it)
59
- {
60
- Rice::protect(rb_yield, to_ruby(*it));
61
- }
62
- return self;
63
- }
64
-
65
- private:
66
- Iterator_T (T::*begin_)();
67
- Iterator_T (T::*end_)();
68
- Data_Type<T> data_type_;
69
- };
70
-
71
- template<typename T, typename Iterator_T>
72
- Derived_T & define_iterator(
73
- char const * name,
74
- Iterator_T (T::*begin)(),
75
- Iterator_T (T::*end)())
76
- {
77
- Derived_T & self = static_cast<Derived_T &>(*this);
78
- // TODO: memory leak!!!!!!!
79
- Iterator * iterator = new Iterator_Impl<T, Iterator_T>(
80
- begin,
81
- end,
82
- Data_Type<T>(self));
83
- define_method_with_data(
84
- static_cast<VALUE>(self),
85
- name,
86
- (RUBY_METHOD_FUNC)iterator->call,
87
- 0,
88
- iterator);
89
- return self;
90
- }
91
- };
92
-
93
- } // namespac edetail
94
-
95
- } // namespace Rice
96
-
97
- #endif // Rice__detail__Iterator_Definer__hpp_
98
-