io-console 0.8.2 → 0.9.5
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.
- checksums.yaml +4 -4
- data/ext/io/console/console.c +628 -42
- data/ext/io/console/extconf.rb +43 -15
- data/ext/io/console/win32_vk.inc +313 -165
- data/lib/io/console/size.rb +4 -2
- metadata +2 -2
data/ext/io/console/extconf.rb
CHANGED
|
@@ -5,17 +5,12 @@ require 'mkmf'
|
|
|
5
5
|
# See https://bugs.ruby-lang.org/issues/20345
|
|
6
6
|
MakeMakefile::RbConfig ||= ::RbConfig
|
|
7
7
|
|
|
8
|
-
have_func("
|
|
9
|
-
have_func("
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
have_func("
|
|
13
|
-
have_func("
|
|
14
|
-
have_func("rb_io_descriptor", "ruby/io.h")
|
|
15
|
-
have_func("rb_io_get_write_io", "ruby/io.h")
|
|
16
|
-
have_func("rb_io_closed_p", "ruby/io.h")
|
|
17
|
-
have_func("rb_io_open_descriptor", "ruby/io.h")
|
|
18
|
-
have_func("rb_ractor_local_storage_value_newkey")
|
|
8
|
+
have_func("rb_interned_str_cstr") # Ruby 3.0
|
|
9
|
+
have_func("rb_ractor_local_storage_value_newkey") # Ruby 3.0
|
|
10
|
+
have_func("rb_io_descriptor", "ruby/io.h") # Ruby 3.1
|
|
11
|
+
have_func("rb_io_path", "ruby/io.h") # Ruby 3.3
|
|
12
|
+
have_func("rb_io_closed_p", "ruby/io.h") # Ruby 3.3
|
|
13
|
+
have_func("rb_io_open_descriptor", "ruby/io.h") # Ruby 3.3
|
|
19
14
|
|
|
20
15
|
is_wasi = /wasi/ =~ MakeMakefile::RbConfig::CONFIG["platform"]
|
|
21
16
|
# `ok` can be `true`, `false`, or `nil`:
|
|
@@ -28,6 +23,7 @@ ok = true if (RUBY_ENGINE == "ruby" && !is_wasi) || RUBY_ENGINE == "truffleruby"
|
|
|
28
23
|
hdr = nil
|
|
29
24
|
case
|
|
30
25
|
when macro_defined?("_WIN32", "")
|
|
26
|
+
win32 = true
|
|
31
27
|
# rb_w32_map_errno: 1.8.7
|
|
32
28
|
vk_header = File.exist?("#$srcdir/win32_vk.list") ? "chksum" : "inc"
|
|
33
29
|
vk_header = "#{'{$(srcdir)}' if $nmake == ?m}win32_vk.#{vk_header}"
|
|
@@ -49,12 +45,44 @@ when true
|
|
|
49
45
|
# rb_sym2str: 2.2.0
|
|
50
46
|
if have_macro("HAVE_RUBY_FIBER_SCHEDULER_H")
|
|
51
47
|
$defs << "-D""HAVE_RB_IO_WAIT=1"
|
|
52
|
-
elsif have_func("rb_scheduler_timeout") # 3.0
|
|
53
|
-
have_func("rb_io_wait")
|
|
48
|
+
elsif have_func("rb_scheduler_timeout") # Ruby 3.0 (internal)
|
|
49
|
+
have_func("rb_io_wait") # Ruby 3.0
|
|
50
|
+
end
|
|
51
|
+
have_func("rb_category_warn")
|
|
52
|
+
have_const("RB_WARN_CATEGORY_DEPRECATED")
|
|
53
|
+
unless win32
|
|
54
|
+
if have_func("ttyname_r")
|
|
55
|
+
ret = checking_for("type of ttyname_r()", "%s") {try_link(<<~C) ? "int" : "char *"}
|
|
56
|
+
#{cpp_include %<unistd.h>}
|
|
57
|
+
int t(void) {char name[1024]; return ttyname_r(0, name, sizeof(name)) % 1024;}
|
|
58
|
+
#{MAIN_DOES_NOTHING('t')}
|
|
59
|
+
C
|
|
60
|
+
$defs << "-DTTYNAME_R_RETURNS_#{ret.tr_cpp}"
|
|
61
|
+
else
|
|
62
|
+
have_func("ttyname")
|
|
63
|
+
end
|
|
54
64
|
end
|
|
55
|
-
have_func("
|
|
65
|
+
have_func("rb_prepend_module") # not exported by TruffleRuby
|
|
66
|
+
|
|
67
|
+
if find_executable("gperf") and vk_mk = (File.read("#$srcdir/win32_vk.mk") rescue nil)
|
|
68
|
+
$cleanfiles.concat(%w'win32_vk.inc win32_vk.chksum')
|
|
69
|
+
end
|
|
70
|
+
|
|
56
71
|
create_makefile("io/console") {|conf|
|
|
57
|
-
conf << "
|
|
72
|
+
conf << "###\n" "all: # the default target\n"
|
|
73
|
+
if vk_header
|
|
74
|
+
conf << <<~MK
|
|
75
|
+
VK_HEADER = #{vk_header}
|
|
76
|
+
console.#$OBJEXT: $(VK_HEADER)
|
|
77
|
+
MK
|
|
78
|
+
end
|
|
79
|
+
if vk_mk
|
|
80
|
+
unless conf.any? {|c| /^ *top_srcdir *=/.match?(c)}
|
|
81
|
+
conf << "top_srcdir = $(srcdir)/../../..\n"
|
|
82
|
+
end
|
|
83
|
+
conf << depend_rules(vk_mk).join("")
|
|
84
|
+
end
|
|
85
|
+
conf
|
|
58
86
|
}
|
|
59
87
|
when nil
|
|
60
88
|
File.write("Makefile", dummy_makefile($srcdir).join(""))
|