rice-jdguyot 1.4.0.p1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/extconf.rb CHANGED
@@ -14,9 +14,13 @@
14
14
  $:.unshift File.expand_path(File.dirname(__FILE__))
15
15
 
16
16
  require 'rbconfig'
17
+ require 'rubygems'
17
18
  require 'ruby/lib/version.rb'
18
19
 
19
- prefix_dir = File.join(File.dirname(File.expand_path(__FILE__)), "ruby", "lib")
20
+ gem_name = "rice-#{Rice::VERSION}"
21
+
22
+ gem_base_dir = File.writable?(Gem.default_dir) ? Gem.default_dir : Gem.user_dir
23
+ prefix_dir = File.join(gem_base_dir, "gems", gem_name, "ruby", "lib")
20
24
  with_ruby = File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])
21
25
 
22
26
  other_opts = ""
@@ -5,7 +5,6 @@ inline Rice::Address_Registration_Guard::
5
5
  Address_Registration_Guard(VALUE * address)
6
6
  : address_(address)
7
7
  {
8
- registerExitHandler();
9
8
  rb_gc_register_address(address);
10
9
  }
11
10
 
@@ -13,15 +12,13 @@ inline Rice::Address_Registration_Guard::
13
12
  Address_Registration_Guard(Object * object)
14
13
  : address_(const_cast<VALUE *>(&object->value()))
15
14
  {
16
- registerExitHandler();
17
15
  rb_gc_register_address(address_);
18
16
  }
19
17
 
20
18
  inline Rice::Address_Registration_Guard::
21
19
  ~Address_Registration_Guard()
22
20
  {
23
- if (enabled)
24
- rb_gc_unregister_address(address_);
21
+ rb_gc_unregister_address(address_);
25
22
  }
26
23
 
27
24
  inline VALUE * Rice::Address_Registration_Guard::
@@ -56,17 +56,7 @@ public:
56
56
  //! Swap with another Address_Registration_Guard.
57
57
  void swap(Address_Registration_Guard & other);
58
58
 
59
- /** Called during Ruby's exit process since we should not call
60
- * rb_gc unregister_address there
61
- */
62
- static void disable();
63
-
64
59
  private:
65
- static bool enabled;
66
- static bool exit_handler_registered;
67
-
68
- static void registerExitHandler();
69
-
70
60
  VALUE * address_;
71
61
  };
72
62
 
@@ -13,7 +13,6 @@ Struct.cpp \
13
13
  Symbol.cpp \
14
14
  VM.cpp \
15
15
  Arg_operators.cpp \
16
- Address_Registration_Guard.cpp \
17
16
  detail/check_ruby_type.cpp \
18
17
  detail/demangle.cpp \
19
18
  detail/method_data.cpp \
@@ -61,9 +61,8 @@ am_librice_a_OBJECTS = Class.$(OBJEXT) Data_Type.$(OBJEXT) \
61
61
  Director.$(OBJEXT) Exception.$(OBJEXT) Identifier.$(OBJEXT) \
62
62
  Module.$(OBJEXT) Object.$(OBJEXT) String.$(OBJEXT) \
63
63
  Struct.$(OBJEXT) Symbol.$(OBJEXT) VM.$(OBJEXT) \
64
- Arg_operators.$(OBJEXT) Address_Registration_Guard.$(OBJEXT) \
65
- check_ruby_type.$(OBJEXT) demangle.$(OBJEXT) \
66
- method_data.$(OBJEXT) protect.$(OBJEXT)
64
+ Arg_operators.$(OBJEXT) check_ruby_type.$(OBJEXT) \
65
+ demangle.$(OBJEXT) method_data.$(OBJEXT) protect.$(OBJEXT)
67
66
  librice_a_OBJECTS = $(am_librice_a_OBJECTS)
68
67
  DEFAULT_INCLUDES = -I.@am__isrc@
69
68
  depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -223,7 +222,6 @@ Struct.cpp \
223
222
  Symbol.cpp \
224
223
  VM.cpp \
225
224
  Arg_operators.cpp \
226
- Address_Registration_Guard.cpp \
227
225
  detail/check_ruby_type.cpp \
228
226
  detail/demangle.cpp \
229
227
  detail/method_data.cpp \
@@ -425,7 +423,6 @@ mostlyclean-compile:
425
423
  distclean-compile:
426
424
  -rm -f *.tab.c
427
425
 
428
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Address_Registration_Guard.Po@am__quote@
429
426
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Arg_operators.Po@am__quote@
430
427
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Class.Po@am__quote@
431
428
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Data_Type.Po@am__quote@
@@ -588,8 +585,8 @@ distdir: $(DISTFILES)
588
585
  sed -e "s|^$$srcdirstrip/||;t" \
589
586
  -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
590
587
  case $$dist_files in \
591
- */*) $(MKDIR_P) `echo "$$dist_files" | \
592
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
588
+ */*) eval $(MKDIR_P) `echo "$$dist_files" | \
589
+ sed '/\//!d;s|^|"$(distdir)"/|;s,/[^/]*$$,,' | \
593
590
  sort -u` ;; \
594
591
  esac; \
595
592
  for file in $$dist_files; do \
@@ -597,12 +594,12 @@ distdir: $(DISTFILES)
597
594
  if test -d $$d/$$file; then \
598
595
  dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
599
596
  if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
600
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
597
+ cp -pR $(srcdir)/$$file "$(distdir)"$$dir || exit 1; \
601
598
  fi; \
602
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
599
+ cp -pR $$d/$$file "$(distdir)"$$dir || exit 1; \
603
600
  else \
604
- test -f $(distdir)/$$file \
605
- || cp -p $$d/$$file $(distdir)/$$file \
601
+ test -f "$(distdir)"/$$file \
602
+ || cp -p $$d/$$file "$(distdir)"/$$file \
606
603
  || exit 1; \
607
604
  fi; \
608
605
  done
@@ -37,7 +37,7 @@ String(char const * s)
37
37
 
38
38
  Rice::String::
39
39
  String(std::string const & s)
40
- : Builtin_Object<RString, T_STRING>(protect(rb_str_new, s.data(), s.length()))
40
+ : Builtin_Object<RString, T_STRING>(protect(rb_str_new, s.c_str(), s.length()))
41
41
  {
42
42
  }
43
43
 
@@ -83,7 +83,7 @@ c_str() const
83
83
  std::string Rice::String::
84
84
  str() const
85
85
  {
86
- return std::string(RSTRING_PTR(value()), length());
86
+ return RSTRING_PTR(value());
87
87
  }
88
88
 
89
89
  Rice::Identifier Rice::String::
@@ -261,7 +261,10 @@ template<>
261
261
  inline
262
262
  char const * from_ruby<char const *>(Rice::Object x)
263
263
  {
264
- return Rice::String(x).str().data();
264
+ // TODO: Maybe not the right way to do this conversion (what happens
265
+ // if the object gets GC'd?)
266
+ VALUE v(x.value());
267
+ return (char const *)Rice::protect<char const *>(rb_string_value_cstr, &v);
265
268
  }
266
269
 
267
270
  template<>
@@ -276,19 +279,19 @@ template<>
276
279
  inline
277
280
  std::string from_ruby<std::string>(Rice::Object x)
278
281
  {
279
- return Rice::String(x).str();
282
+ return std::string(from_ruby<char const *>(x));
280
283
  }
281
284
 
282
285
  template<>
283
286
  inline
284
287
  Rice::Object to_ruby<std::string>(std::string const & x)
285
288
  {
286
- return Rice::protect(rb_str_new, x.data(), x.size());
289
+ return to_ruby(x.c_str());
287
290
  }
288
291
 
289
292
  template<>
290
293
  inline
291
294
  std::string* from_ruby<std::string* >(Rice::Object x)
292
295
  {
293
- return new std::string(Rice::String(x).str());
296
+ return new std::string(from_ruby<char const *>(x));
294
297
  }
@@ -1,3 +1,3 @@
1
1
  module Rice
2
- VERSION = "1.4.0.p1"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -261,17 +261,3 @@ TESTCASE(std_string_from_ruby)
261
261
  ASSERT_EQUAL(std::string("foo"), from_ruby<std::string>(rb_str_new2("foo")));
262
262
  }
263
263
 
264
- TESTCASE(std_string_to_ruby_with_binary)
265
- {
266
- Rice::String got = to_ruby(std::string("\000test", 5));
267
-
268
- ASSERT_EQUAL(String(std::string("\000test", 5)), got);
269
- ASSERT_EQUAL(5, got.length());
270
- }
271
-
272
- TESTCASE(std_string_from_ruby_with_binary)
273
- {
274
- std::string got = from_ruby<std::string>(rb_str_new("\000test", 5));
275
- ASSERT_EQUAL(5, got.length());
276
- ASSERT_EQUAL(std::string("\000test", 5), got);
277
- }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rice-jdguyot
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ hash: 7
5
+ prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 4
8
9
  - 0
9
- - p1
10
- version: 1.4.0.p1
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Brannan
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-12-06 00:00:00 +01:00
19
+ date: 2010-09-16 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,6 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
+ hash: 3
30
31
  segments:
31
32
  - 0
32
33
  version: "0"
@@ -81,7 +82,6 @@ files:
81
82
  - sample/Makefile.in
82
83
  - test/Makefile.am
83
84
  - test/Makefile.in
84
- - rice/Address_Registration_Guard.cpp
85
85
  - rice/Address_Registration_Guard.hpp
86
86
  - rice/Address_Registration_Guard.ipp
87
87
  - rice/Address_Registration_Guard_defn.hpp
@@ -99,7 +99,6 @@ files:
99
99
  - rice/Class.hpp
100
100
  - rice/Class.ipp
101
101
  - rice/Class_defn.hpp
102
- - rice/config.hpp
103
102
  - rice/Constructor.hpp
104
103
  - rice/Critical_Guard.hpp
105
104
  - rice/Critical_Guard.ipp
@@ -195,7 +194,6 @@ files:
195
194
  - rice/detail/protect.cpp
196
195
  - rice/detail/protect.hpp
197
196
  - rice/detail/ruby.hpp
198
- - rice/detail/ruby_version_code.hpp
199
197
  - rice/detail/rubysig.hpp
200
198
  - rice/detail/st.hpp
201
199
  - rice/detail/to_ruby.hpp
@@ -265,19 +263,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
263
  requirements:
266
264
  - - ">="
267
265
  - !ruby/object:Gem::Version
266
+ hash: 3
268
267
  segments:
269
268
  - 0
270
269
  version: "0"
271
270
  required_rubygems_version: !ruby/object:Gem::Requirement
272
271
  none: false
273
272
  requirements:
274
- - - ">"
273
+ - - ">="
275
274
  - !ruby/object:Gem::Version
275
+ hash: 3
276
276
  segments:
277
- - 1
278
- - 3
279
- - 1
280
- version: 1.3.1
277
+ - 0
278
+ version: "0"
281
279
  requirements: []
282
280
 
283
281
  rubyforge_project: rice
@@ -1,22 +0,0 @@
1
- #include "Address_Registration_Guard.hpp"
2
-
3
- bool Rice::Address_Registration_Guard::enabled = true;
4
- bool Rice::Address_Registration_Guard::exit_handler_registered = false;
5
-
6
- static void disable_all_guards(VALUE)
7
- {
8
- Rice::Address_Registration_Guard::disable();
9
- }
10
-
11
- void Rice::Address_Registration_Guard::registerExitHandler()
12
- {
13
- if (exit_handler_registered) return;
14
- rb_set_end_proc(&disable_all_guards, Qnil);
15
- exit_handler_registered = true;
16
- }
17
-
18
- void Rice::Address_Registration_Guard::disable()
19
- {
20
- enabled = false;
21
- }
22
-
@@ -1,41 +0,0 @@
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 version of this package. */
35
- #define PACKAGE_VERSION "1.1"
36
-
37
- /* Define this macro to use ruby/node.h */
38
- /* #undef REALLY_HAVE_RUBY_NODE_H */
39
-
40
- /* Version number of package */
41
- #define VERSION "1.1"
@@ -1,6 +0,0 @@
1
- #ifndef Rice__detail__ruby_version_code__hpp
2
- #define Rice__detail__ruby_version_code__hpp
3
-
4
- #define RICE__RUBY_VERSION_CODE 192
5
-
6
- #endif // Rice__detail__ruby_version_code__hpp