summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/util
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 11:30:24 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 11:30:24 +0000
commit2810c12a99fed7297d558d8b1aaaf755eb8b8a2d (patch)
tree03ded624e1b6eab7bcf9059c5193c25f10ee26ae /ext/bigdecimal/util
parentae88d2fc93e887f22d025b4738ebbb00f6ae53e9 (diff)
Import bigdecimal 1.4.0.pre.20181205a
* https://github.com/ruby/bigdecimal/compare/74d25ef..v1.4.0.pre.20181205a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/util')
-rw-r--r--ext/bigdecimal/util/extconf.rb24
-rw-r--r--ext/bigdecimal/util/util.c9
2 files changed, 33 insertions, 0 deletions
diff --git a/ext/bigdecimal/util/extconf.rb b/ext/bigdecimal/util/extconf.rb
new file mode 100644
index 00000000000..8750db1c52c
--- /dev/null
+++ b/ext/bigdecimal/util/extconf.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: false
+require 'mkmf'
+
+checking_for(checking_message("Windows")) do
+ case RUBY_PLATFORM
+ when /cygwin|mingw/
+ if defined?($extlist)
+ build_dir = "$(TARGET_SO_DIR)../"
+ else
+ base_dir = File.expand_path('../../../..', __FILE__)
+ build_dir = File.join(base_dir, "tmp", RUBY_PLATFORM, "bigdecimal", RUBY_VERSION, "")
+ end
+ $libs << " #{build_dir}bigdecimal.so"
+ true
+ when /mswin/
+ $DLDFLAGS << " -libpath:.."
+ $libs << " bigdecimal-$(arch).lib"
+ true
+ else
+ false
+ end
+end
+
+create_makefile('bigdecimal/util')
diff --git a/ext/bigdecimal/util/util.c b/ext/bigdecimal/util/util.c
new file mode 100644
index 00000000000..8d38d87852d
--- /dev/null
+++ b/ext/bigdecimal/util/util.c
@@ -0,0 +1,9 @@
+#include "ruby.h"
+
+RUBY_EXTERN VALUE rmpd_util_str_to_d(VALUE str);
+
+void
+Init_util(void)
+{
+ rb_define_method(rb_cString, "to_d", rmpd_util_str_to_d, 0);
+}