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
@@ -4,10 +4,16 @@
4
4
  namespace Rice
5
5
  {
6
6
 
7
- template<typename Func_T>
8
- void define_global_function(
9
- char const * name,
10
- Func_T func);
7
+ /**
8
+ * Helper forwarder method to easily wrap
9
+ * globally available functions. This simply
10
+ * forwards off a call to define_module_function
11
+ * on rb_mKernel
12
+ */
13
+ template<typename Func_T>
14
+ void define_global_function(
15
+ char const * name,
16
+ Func_T func);
11
17
 
12
18
  } // Rice
13
19
 
@@ -5,7 +5,6 @@ void Rice::define_global_function(
5
5
  char const * name,
6
6
  Func_T func)
7
7
  {
8
- detail::define_method_and_auto_wrap(
9
- rb_cObject, name, func);
8
+ Module(rb_mKernel).define_module_function(name, func);
10
9
  }
11
10
 
@@ -0,0 +1,13 @@
1
+ #ifndef ruby_mark__hpp
2
+ #define ruby_mark__hpp
3
+
4
+ //! Default function to call to mark a data object.
5
+ /*! This function can be specialized for a particular type to override
6
+ * the default behavior (which is to not mark any additional objects).
7
+ */
8
+ template<typename T>
9
+ void ruby_mark(T * obj)
10
+ {
11
+ }
12
+
13
+ #endif // ruby_mark__hpp
@@ -1,7 +1,7 @@
1
1
  #ifndef Rice__ruby_try_catch__hpp_
2
2
  #define Rice__ruby_try_catch__hpp_
3
3
 
4
- #include "Exception_Base.hpp"
4
+ #include "Exception_Base_defn.hpp"
5
5
  #include "Jump_Tag.hpp"
6
6
  #include "detail/ruby.hpp"
7
7
  #include <stdexcept>
data/rice/rubypp.rb ADDED
@@ -0,0 +1,97 @@
1
+ class Preprocessor
2
+ def initialize(input, output, filename)
3
+ @input = input
4
+ @output = output
5
+ @filename = filename
6
+ @linenum = 1
7
+ end
8
+
9
+ def getline
10
+ line = @input.gets
11
+ @linenum += 1 if not line.nil?
12
+ return line
13
+ end
14
+
15
+ def preprocess
16
+ success = false
17
+ begin
18
+ loop do
19
+ line = getline
20
+ break if line.nil?
21
+ case line
22
+ when /(.*[^\\]|^)\#\{(.*?)\}(.*)/
23
+ puts "#{$1}#{evaluate($2, @linenum)}#{$3}"
24
+ when /^\#ruby\s+<<(.*)/
25
+ marker = $1
26
+ str = ''
27
+ evalstart = @linenum
28
+ loop do
29
+ line = getline
30
+ if line.nil? then
31
+ raise "End of input without #{marker}"
32
+ end
33
+ break if line.chomp == marker
34
+ str << line
35
+ end
36
+ result = evaluate(str, evalstart)
37
+ puts result if not result.nil?
38
+ when /^\#ruby\s+(.*)/
39
+ str = line = $1
40
+ while line[-1] == ?\\
41
+ str.chop!
42
+ line = getline
43
+ break if line.nil?
44
+ line.chomp!
45
+ str << line
46
+ end
47
+ result = evaluate(str, @linenum)
48
+ puts result if not result.nil?
49
+ else
50
+ puts line
51
+ end
52
+ end
53
+ success = true
54
+ ensure
55
+ if not success then
56
+ $stderr.puts "Error on line #{@linenum}:"
57
+ end
58
+ end
59
+ end
60
+
61
+ def evaluate(str, linenum)
62
+ result = eval(str, TOPLEVEL_BINDING, @filename, linenum)
63
+ success = true
64
+ return result
65
+ end
66
+
67
+ def puts(line='')
68
+ @output.puts(line)
69
+ end
70
+ end
71
+
72
+ def puts(line='')
73
+ $preprocessor.puts(line)
74
+ end
75
+
76
+ def rubypp(input_file, output_file)
77
+ input = input_file ? File.open(input_file) : $stdin
78
+ output = output_file ? File.open(output_file, 'w') : $stdout
79
+
80
+ success = false
81
+ begin
82
+ $preprocessor = Preprocessor.new(input, output, input_file || "(stdin)")
83
+ $preprocessor.preprocess()
84
+ success = true
85
+ ensure
86
+ if not success then
87
+ File.unlink(output_file) rescue Errno::ENOENT
88
+ end
89
+ end
90
+ end
91
+
92
+ if __FILE__ == $0 then
93
+ input_file = ARGV[0]
94
+ output_file = ARGV[1]
95
+ rubypp(input_file, output_file)
96
+ end
97
+
@@ -164,9 +164,9 @@ char from_ruby<char>(Rice::Object x)
164
164
  {
165
165
  if(x.rb_type() == T_STRING)
166
166
  {
167
- if(RSTRING(x.value())->len == 0)
167
+ if(RSTRING_LEN(x.value()) == 0)
168
168
  {
169
- return RSTRING(x.value())->ptr[0];
169
+ return RSTRING_PTR(x.value())[0];
170
170
  }
171
171
  else
172
172
  {
@@ -263,7 +263,7 @@ namespace Rice
263
263
  {
264
264
  inline VALUE str2ccstr(VALUE x)
265
265
  {
266
- return (VALUE)(STR2CSTR(x));
266
+ return (VALUE)(StringValuePtr(x));
267
267
  }
268
268
  }
269
269
  }
data/ruby.ac CHANGED
@@ -1,5 +1,6 @@
1
1
  dnl Get a key from ruby's configuration table
2
- AC_DEFUN([RUBY_CONFIG], [$RUBY -rrbconfig -e "puts Config::CONFIG[['$1']]"])
2
+ AC_DEFUN([RUBY_CONFIG], [
3
+ $RUBY -rrbconfig -e "puts(Config::CONFIG[['$1']] || '')"])
3
4
 
4
5
  AC_DEFUN([RB_INIT_RUBY], [
5
6
 
@@ -20,9 +21,15 @@ AC_ARG_WITH(
20
21
 
21
22
  AC_SUBST(RUBY)
22
23
 
24
+ RUBY_VERSION_CODE=`$RUBY -e "puts RUBY_VERSION.gsub(/\./, '')"`
25
+ AC_SUBST(RUBY_VERSION_CODE)
26
+
27
+ RUBY_CONFIG_SO_NAME=`RUBY_CONFIG(RUBY_SO_NAME)`
23
28
  RUBY_CONFIG_ARCHDIR=`RUBY_CONFIG(archdir)`
29
+ RUBY_CONFIG_ARCH=`RUBY_CONFIG(arch)`
24
30
  RUBY_CONFIG_LIBDIR=`RUBY_CONFIG(libdir)`
25
31
  RUBY_CONFIG_BINDIR=`RUBY_CONFIG(bindir)`
32
+ RUBY_CONFIG_RUBYHDRDIR=`RUBY_CONFIG(rubyhdrdir)`
26
33
  RUBY_CONFIG_CFLAGS=`RUBY_CONFIG(CFLAGS)`
27
34
  RUBY_CONFIG_LIBS=`RUBY_CONFIG(LIBS)`
28
35
  RUBY_CONFIG_DLDLIBS=`RUBY_CONFIG(DLDLIBS)`
@@ -31,7 +38,14 @@ RUBY_CONFIG_LIBRUBYARG=`RUBY_CONFIG(LIBRUBYARG)`
31
38
  RUBY_CONFIG_LIBRUBYARG_STATIC=`RUBY_CONFIG(LIBRUBYARG_STATIC)`
32
39
  RUBY_CONFIG_CCDLFLAGS=`RUBY_CONFIG(CCDLFLAGS)`
33
40
 
34
- RUBY_CPPFLAGS="-I${RUBY_CONFIG_ARCHDIR}"
41
+ if test "x${RUBY_CONFIG_RUBYHDRDIR}x" != "xx"; then
42
+ # 1.9
43
+ RUBY_CPPFLAGS="-I${RUBY_CONFIG_RUBYHDRDIR}"
44
+ RUBY_CPPFLAGS="${RUBY_CPPFLAGS} -I${RUBY_CONFIG_RUBYHDRDIR}/${RUBY_CONFIG_ARCH}"
45
+ else
46
+ # 1.8
47
+ RUBY_CPPFLAGS="-I${RUBY_CONFIG_ARCHDIR}"
48
+ fi
35
49
  AC_SUBST(RUBY_CPPFLAGS)
36
50
 
37
51
  RUBY_CFLAGS="${RUBY_CONFIG_CFLAGS} ${RUBY_CONFIG_CCDLFLAGS}"
@@ -40,7 +54,7 @@ AC_SUBST(RUBY_CFLAGS)
40
54
  RUBY_CXXFLAGS="${RUBY_CONFIG_CFLAGS} ${RUBY_CONFIG_CCDLFLAGS}"
41
55
  AC_SUBST(RUBY_CXXFLAGS)
42
56
 
43
- RUBY_LDFLAGS="-L${RUBY_ARCHDIR} -L${RUBY_CONFIG_LIBDIR} ${RUBY_LDFLAGS}"
57
+ RUBY_LDFLAGS="-L${RUBY_CONFIG_ARCHDIR} -L${RUBY_CONFIG_LIBDIR} ${RUBY_CONFIG_LDFLAGS}"
44
58
  AC_SUBST(RUBY_LDFLAGS)
45
59
 
46
60
  RUBY_LIBS="${RUBY_CONFIG_LIBS} ${RUBY_CONFIG_DLDLIBS}"
@@ -75,16 +89,38 @@ dnl searching for standard header files as a side-effect (which we want)
75
89
  CPPFLAGS_save="${CPPFLAGS}"
76
90
  CPPFLAGS="${CPPFLAGS} ${RUBY_CPPFLAGS}"
77
91
  CXXFLAGS="${CPPFLAGS}"
78
- AC_CHECK_HEADER(ruby.h,,AC_MSG_ERROR(
92
+ AC_CHECK_HEADERS(ruby.h,,AC_MSG_ERROR(
79
93
  could not find ruby.h (check config.log)),[ ])
80
- AC_CHECK_HEADER(node.h,,AC_MSG_ERROR(
81
- could not find node.h (check config.log)),[
94
+ AC_CHECK_HEADERS(node.h,,,[
95
+ #include <ruby.h>
96
+ ])
97
+ AC_CHECK_HEADERS(ruby/node.h,
98
+ [ AC_DEFINE(REALLY_HAVE_RUBY_NODE_H, [],
99
+ [ Define this macro to use ruby/node.h ]) ],
100
+ ,[
101
+ #include <ruby.h>
102
+ ])
103
+ AC_CHECK_HEADERS(version.h,,,[
82
104
  #include <ruby.h>
83
105
  ])
84
- AC_CHECK_HEADER(version.h,,AC_MSG_ERROR(
85
- could not find version.h (check config.log)),[
106
+ AC_CHECK_HEADERS(env.h,,,[
86
107
  #include <ruby.h>
87
108
  ])
109
+
110
+ dnl We need to set the LD flags to include the path to this Ruby's
111
+ dnl library path so that this library check will work for ruby installs
112
+ dnl sitting in unconvential locations
113
+ save_ldflags="$LDFLAGS"
114
+ LDFLAGS="$RUBY_LDFLAGS"
115
+
116
+ AC_CHECK_LIB($RUBY_CONFIG_SO_NAME,
117
+ rb_class_boot,
118
+ [ AC_DEFINE(HAVE_RB_CLASS_BOOT, [], [
119
+ Define this macro if rb_class_boot is defined ]) ] )
120
+
121
+ LDFLAGS="$save_ldflags"
122
+
123
+
88
124
  CPPFLAGS="${CPPFLAGS_save}"
89
125
 
90
126
  AC_MINGW32
data/ruby/Makefile.in CHANGED
@@ -119,6 +119,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
119
119
  RANLIB = @RANLIB@
120
120
  RICE_CPPFLAGS = @RICE_CPPFLAGS@
121
121
  RICE_LDFLAGS = @RICE_LDFLAGS@
122
+ RICE_ROOT = @RICE_ROOT@
122
123
  RICE_SAMPLES = @RICE_SAMPLES@
123
124
  RICE_USING_MINGW32 = @RICE_USING_MINGW32@
124
125
  RUBY = @RUBY@
@@ -130,6 +131,7 @@ RUBY_LIBRUBYARG = @RUBY_LIBRUBYARG@
130
131
  RUBY_LIBRUBYARG_STATIC = @RUBY_LIBRUBYARG_STATIC@
131
132
  RUBY_LIBS = @RUBY_LIBS@
132
133
  RUBY_SITELIBDIR = @RUBY_SITELIBDIR@
134
+ RUBY_VERSION_CODE = @RUBY_VERSION_CODE@
133
135
  SET_MAKE = @SET_MAKE@
134
136
  SHELL = @SHELL@
135
137
  STRIP = @STRIP@
data/ruby/lib/Makefile.in CHANGED
@@ -118,6 +118,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
118
118
  RANLIB = @RANLIB@
119
119
  RICE_CPPFLAGS = @RICE_CPPFLAGS@
120
120
  RICE_LDFLAGS = @RICE_LDFLAGS@
121
+ RICE_ROOT = @RICE_ROOT@
121
122
  RICE_SAMPLES = @RICE_SAMPLES@
122
123
  RICE_USING_MINGW32 = @RICE_USING_MINGW32@
123
124
  RUBY = @RUBY@
@@ -129,6 +130,7 @@ RUBY_LIBRUBYARG = @RUBY_LIBRUBYARG@
129
130
  RUBY_LIBRUBYARG_STATIC = @RUBY_LIBRUBYARG_STATIC@
130
131
  RUBY_LIBS = @RUBY_LIBS@
131
132
  RUBY_SITELIBDIR = @RUBY_SITELIBDIR@
133
+ RUBY_VERSION_CODE = @RUBY_VERSION_CODE@
132
134
  SET_MAKE = @SET_MAKE@
133
135
  SHELL = @SHELL@
134
136
  STRIP = @STRIP@
@@ -31,6 +31,9 @@ def init_mkmf_rice(config = CONFIG)
31
31
  # Ruby < 1.8.6 does not have $DEFLIBPATH
32
32
  $DEFLIBPATH ||= []
33
33
 
34
+ # We use this for the samples
35
+ $DEFLIBPATH.unshift(with_config('libpath')) if with_config('libpath')
36
+
34
37
  # Ruby 1.8.6 uses $preload without setting it
35
38
  $preload ||= nil
36
39
 
@@ -180,7 +183,7 @@ class RiceMakefileCreator
180
183
  end
181
184
 
182
185
  def puts(*strings)
183
- print strings.map { |s| "#{s}\n" }
186
+ print(*strings.map { |s| "#{s}\n" })
184
187
  end
185
188
 
186
189
  def close
@@ -0,0 +1,3 @@
1
+ module Rice
2
+ VERSION = "1.1.0"
3
+ end
data/sample/Makefile.am CHANGED
@@ -1,5 +1,5 @@
1
- RUBY_EXTCONF_OPTIONS = -I../../ruby/lib
2
- EXTCONF_OPTIONS = --with-cppflags="-I../.." --with-ldflags="-L../../rice"
1
+ RUBY_EXTCONF_OPTIONS = -I@RICE_ROOT@/ruby/lib
2
+ EXTCONF_OPTIONS = --with-cppflags="-I@RICE_ROOT@" --with-libpath="@RICE_ROOT@/rice"
3
3
 
4
4
  EXTRA_DIST = \
5
5
  enum/extconf.rb \
data/sample/Makefile.in CHANGED
@@ -107,6 +107,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
107
107
  RANLIB = @RANLIB@
108
108
  RICE_CPPFLAGS = @RICE_CPPFLAGS@
109
109
  RICE_LDFLAGS = @RICE_LDFLAGS@
110
+ RICE_ROOT = @RICE_ROOT@
110
111
  RICE_SAMPLES = @RICE_SAMPLES@
111
112
  RICE_USING_MINGW32 = @RICE_USING_MINGW32@
112
113
  RUBY = @RUBY@
@@ -118,6 +119,7 @@ RUBY_LIBRUBYARG = @RUBY_LIBRUBYARG@
118
119
  RUBY_LIBRUBYARG_STATIC = @RUBY_LIBRUBYARG_STATIC@
119
120
  RUBY_LIBS = @RUBY_LIBS@
120
121
  RUBY_SITELIBDIR = @RUBY_SITELIBDIR@
122
+ RUBY_VERSION_CODE = @RUBY_VERSION_CODE@
121
123
  SET_MAKE = @SET_MAKE@
122
124
  SHELL = @SHELL@
123
125
  STRIP = @STRIP@
@@ -171,8 +173,8 @@ sysconfdir = @sysconfdir@
171
173
  target_alias = @target_alias@
172
174
  top_builddir = @top_builddir@
173
175
  top_srcdir = @top_srcdir@
174
- RUBY_EXTCONF_OPTIONS = -I../../ruby/lib
175
- EXTCONF_OPTIONS = --with-cppflags="-I../.." --with-ldflags="-L../../rice"
176
+ RUBY_EXTCONF_OPTIONS = -I@RICE_ROOT@/ruby/lib
177
+ EXTCONF_OPTIONS = --with-cppflags="-I@RICE_ROOT@" --with-libpath="@RICE_ROOT@/rice"
176
178
  EXTRA_DIST = \
177
179
  enum/extconf.rb \
178
180
  enum/sample_enum.cpp \
data/test/Makefile.am CHANGED
@@ -22,7 +22,8 @@ unittest_SOURCES = \
22
22
  test_String.cpp \
23
23
  test_Struct.cpp \
24
24
  test_Symbol.cpp \
25
- test_To_From_Ruby.cpp
25
+ test_To_From_Ruby.cpp \
26
+ test_global_functions.cpp
26
27
 
27
28
  vm_unittest_SOURCES = \
28
29
  unittest.cpp \
data/test/Makefile.in CHANGED
@@ -55,7 +55,8 @@ am_unittest_OBJECTS = unittest.$(OBJEXT) \
55
55
  test_Identifier.$(OBJEXT) test_Jump_Tag.$(OBJEXT) \
56
56
  test_Module.$(OBJEXT) test_Object.$(OBJEXT) \
57
57
  test_String.$(OBJEXT) test_Struct.$(OBJEXT) \
58
- test_Symbol.$(OBJEXT) test_To_From_Ruby.$(OBJEXT)
58
+ test_Symbol.$(OBJEXT) test_To_From_Ruby.$(OBJEXT) \
59
+ test_global_functions.$(OBJEXT)
59
60
  unittest_OBJECTS = $(am_unittest_OBJECTS)
60
61
  unittest_LDADD = $(LDADD)
61
62
  am_vm_unittest_OBJECTS = unittest.$(OBJEXT) test_VM.$(OBJEXT)
@@ -141,6 +142,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
141
142
  RANLIB = @RANLIB@
142
143
  RICE_CPPFLAGS = @RICE_CPPFLAGS@
143
144
  RICE_LDFLAGS = @RICE_LDFLAGS@
145
+ RICE_ROOT = @RICE_ROOT@
144
146
  RICE_SAMPLES = @RICE_SAMPLES@
145
147
  RICE_USING_MINGW32 = @RICE_USING_MINGW32@
146
148
  RUBY = @RUBY@
@@ -152,6 +154,7 @@ RUBY_LIBRUBYARG = @RUBY_LIBRUBYARG@
152
154
  RUBY_LIBRUBYARG_STATIC = @RUBY_LIBRUBYARG_STATIC@
153
155
  RUBY_LIBS = @RUBY_LIBS@
154
156
  RUBY_SITELIBDIR = @RUBY_SITELIBDIR@
157
+ RUBY_VERSION_CODE = @RUBY_VERSION_CODE@
155
158
  SET_MAKE = @SET_MAKE@
156
159
  SHELL = @SHELL@
157
160
  STRIP = @STRIP@
@@ -225,7 +228,8 @@ unittest_SOURCES = \
225
228
  test_String.cpp \
226
229
  test_Struct.cpp \
227
230
  test_Symbol.cpp \
228
- test_To_From_Ruby.cpp
231
+ test_To_From_Ruby.cpp \
232
+ test_global_functions.cpp
229
233
 
230
234
  vm_unittest_SOURCES = \
231
235
  unittest.cpp \
@@ -311,6 +315,7 @@ distclean-compile:
311
315
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_Symbol.Po@am__quote@
312
316
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_To_From_Ruby.Po@am__quote@
313
317
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_VM.Po@am__quote@
318
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_global_functions.Po@am__quote@
314
319
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unittest.Po@am__quote@
315
320
 
316
321
  .cpp.o:
data/test/test_Array.cpp CHANGED
@@ -15,7 +15,7 @@ TESTCASE(default_construct)
15
15
  {
16
16
  Array a;
17
17
  ASSERT_EQUAL(T_ARRAY, rb_type(a));
18
- ASSERT_EQUAL(0, RARRAY(a.value())->len);
18
+ ASSERT_EQUAL(0, RARRAY_LEN(a.value()));
19
19
  }
20
20
 
21
21
  TESTCASE(construct_from_vector_of_int)
@@ -158,7 +158,7 @@ TESTCASE(shift)
158
158
  TESTCASE(to_c_array)
159
159
  {
160
160
  Array a;
161
- ASSERT_EQUAL(RARRAY(a.value())->ptr, a.to_c_array());
161
+ ASSERT_EQUAL(RARRAY_PTR(a.value()), a.to_c_array());
162
162
  }
163
163
 
164
164
  TESTCASE(iterate)
data/test/test_Class.cpp CHANGED
@@ -49,6 +49,9 @@ TESTCASE(include_module)
49
49
  expected_ancestors.push(Module(rb_mEnumerable));
50
50
  expected_ancestors.push(Module(rb_cObject));
51
51
  expected_ancestors.push(Module(rb_mKernel));
52
+ #ifdef RUBY_VM
53
+ expected_ancestors.push(Module(rb_cBasicObject));
54
+ #endif
52
55
  ASSERT_EQUAL(expected_ancestors, ancestors);
53
56
  }
54
57
 
@@ -118,7 +121,7 @@ TESTCASE(define_module_function_simple)
118
121
  Exception,
119
122
  c.define_module_function("foo", &define_method_simple_helper),
120
123
  ASSERT_EQUAL(
121
- Object(rb_eNoMethodError), // TODO: 1.6.x?
124
+ Object(rb_eTypeError),
122
125
  Object(CLASS_OF(ex.value()))
123
126
  )
124
127
  );