fxruby 1.6.40-x86-mingw32 → 1.6.41-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/History.md +1315 -23
- data/README.rdoc +1 -1
- data/Rakefile +90 -68
- data/appveyor.yml +3 -1
- data/examples/inputs.rb +9 -4
- data/examples/pig.rb +2 -2
- data/examples/unicode.rb +6 -27
- data/ext/fox16_c/FXRbApp.cpp +0 -14
- data/ext/fox16_c/FXRuby.cpp +21 -31
- data/ext/fox16_c/extconf.rb +44 -25
- data/ext/fox16_c/impl.cpp +1 -1
- data/ext/fox16_c/include/FXRbCommon.h +0 -2
- data/ext/fox16_c/include/FXRbText.h +82 -2
- data/ext/fox16_c/include/FXRbTextVirtuals.h +22 -0
- data/ext/fox16_c/include/FXRuby.h +20 -2
- data/ext/fox16_c/include/gvl_wrappers.h +29 -11
- data/ext/fox16_c/make_impl.rb +1 -1
- data/fxruby.gemspec +1 -1
- data/lib/fox16/input.rb +9 -7
- data/lib/fox16/version.rb +1 -1
- data/rdoc-sources/FXGLVisual.rb +1 -1
- data/rdoc-sources/FXIconList.rb +2 -0
- data/rdoc-sources/FXList.rb +2 -0
- data/rdoc-sources/FXListBox.rb +1 -1
- data/rdoc-sources/FXText.rb +4 -2
- data/swig-interfaces/FXText.i +10 -8
- data/swig-interfaces/macros.i +9 -0
- data/test/TC_FXText.rb +19 -0
- data/test/TC_FXVec4f.rb +26 -12
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -31,7 +31,7 @@ FXRuby supportes everything of FOX, that is useful in Ruby:
|
|
31
31
|
|
32
32
|
== INSTALL:
|
33
33
|
|
34
|
-
FXRuby runs on Linux, Windows and OS-X with Ruby-
|
34
|
+
FXRuby runs on Linux, Windows and OS-X with Ruby-2.2 or newer. Installation on Unix requires
|
35
35
|
FOX development headers and libraries installed:
|
36
36
|
* on Debian/Ubuntu: <tt>sudo apt-get install g++ libxrandr-dev libfox-1.6-dev</tt>
|
37
37
|
* see also detailed installation instructions in the {https://github.com/lylejohnson/fxruby/wiki Wiki}
|
data/Rakefile
CHANGED
@@ -6,23 +6,6 @@ require 'bundler'
|
|
6
6
|
require 'bundler/gem_helper'
|
7
7
|
require './lib/fox16/version.rb'
|
8
8
|
|
9
|
-
# Use forked process for chdir'ed environment, to allow parallel execution with rake -m
|
10
|
-
module FileUtils
|
11
|
-
alias unforked_fileutils_cd cd
|
12
|
-
def cd(dir, options={}, &block)
|
13
|
-
raise "chdir called without block" unless block_given?
|
14
|
-
begin
|
15
|
-
pid = Process.waitpid(fork{ unforked_fileutils_cd(dir, options, &block) })
|
16
|
-
raise "Error in subprocess" if $?.exitstatus != 0
|
17
|
-
rescue NotImplementedError
|
18
|
-
unforked_fileutils_cd(dir, options, &block)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
module_function :cd
|
22
|
-
alias chdir cd
|
23
|
-
module_function :chdir
|
24
|
-
end
|
25
|
-
|
26
9
|
|
27
10
|
class FoxGemHelper < Bundler::GemHelper
|
28
11
|
attr_accessor :cross_platforms
|
@@ -93,7 +76,7 @@ LIBFXSCINTILLA_SOURCE_URI = "http://download.savannah.gnu.org/releases/f
|
|
93
76
|
SWIG = (RUBY_PLATFORM =~ /mingw/) ? "swig.exe" : "swig"
|
94
77
|
SWIGFLAGS = "-c++ -ruby -nodefaultdtor -nodefaultctor -w302 -features compactdefaultargs -I../fox-includes"
|
95
78
|
|
96
|
-
CLEAN.include( ".config", "ext/fox16_c/Makefile", "ext/fox16_c/*.o", "ext/fox16_c/*.bundle", "ext/fox16_c/mkmf.log", "ext/fox16_c/conftest.dSYM", "ext/fox16_c/swigruby.h", "ext/fox16_c/librb.c", "ext/fox16_c/include/inlinestubs.h", "ext/fox16_c/*_wrap.cpp", "tmp", "ports/*.installed", "ports/*mingw32*" )
|
79
|
+
CLEAN.include( ".config", "ext/fox16_c/Makefile", "ext/fox16_c/*.o", "ext/fox16_c/*.bundle", "ext/fox16_c/mkmf.log", "ext/fox16_c/conftest.dSYM", "ext/fox16_c/swigruby.h*", "ext/fox16_c/librb.c", "ext/fox16_c/include/inlinestubs.h", "ext/fox16_c/*_wrap.cpp", "tmp", "ports/*.installed", "ports/*mingw32*" )
|
97
80
|
|
98
81
|
CLOBBER.include( "pkg" )
|
99
82
|
|
@@ -102,12 +85,12 @@ task :test => [:compile] do
|
|
102
85
|
sh "ruby -w -W2 -Ilib test/TS_All.rb -v"
|
103
86
|
end
|
104
87
|
|
105
|
-
task :gem => [
|
88
|
+
task :gem => ["ext/fox16_c/extconf.rb", :build]
|
106
89
|
|
107
90
|
|
108
91
|
gem_spec = Bundler.load_gemspec('fxruby.gemspec')
|
109
92
|
|
110
|
-
Rake::ExtensionTask.new("fox16_c", gem_spec) do |ext|
|
93
|
+
ext_task = Rake::ExtensionTask.new("fox16_c", gem_spec) do |ext|
|
111
94
|
ext.cross_compile = true
|
112
95
|
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
|
113
96
|
# Enable FXTRACE and FXASSERT for 'rake compile'
|
@@ -149,7 +132,7 @@ Rake::ExtensionTask.new("fox16_c", gem_spec) do |ext|
|
|
149
132
|
unless ENV['FXRUBY_MINGW_DEBUG']
|
150
133
|
dlls.each do |dll|
|
151
134
|
task "ports/#{host}/bin/#{dll}" do |t|
|
152
|
-
sh "
|
135
|
+
sh "#{host}-strip", t.name
|
153
136
|
end
|
154
137
|
end
|
155
138
|
end
|
@@ -160,53 +143,85 @@ Rake::ExtensionTask.new("fox16_c", gem_spec) do |ext|
|
|
160
143
|
Bundler::GemHelper.instance.cross_platforms = ext.cross_platform
|
161
144
|
end
|
162
145
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
146
|
+
namespace :gem do
|
147
|
+
ext_task.cross_platform.each do |plat|
|
148
|
+
desc "Build the windows binary gems"
|
149
|
+
multitask 'windows' => plat
|
150
|
+
|
151
|
+
task 'prepare' do
|
152
|
+
require 'rake_compiler_dock'
|
153
|
+
sh "bundle package"
|
168
154
|
end
|
169
155
|
|
170
|
-
task
|
171
|
-
|
156
|
+
task plat => ['gem', 'prepare'] do
|
157
|
+
debug = "FXRUBY_MINGW_DEBUG=#{ENV['FXRUBY_MINGW_DEBUG'].inspect}" if ENV['FXRUBY_MINGW_DEBUG']
|
158
|
+
RakeCompilerDock.sh <<-EOT, platform: plat
|
159
|
+
sudo apt update &&
|
160
|
+
sudo apt install yasm &&
|
161
|
+
bundle --local --without=test &&
|
162
|
+
rake native:#{plat} pkg/#{ext_task.gem_spec.full_name}-#{plat}.gem MAKE=\"nice make V=1 VERBOSE=1 -j `nproc`\" #{debug}
|
163
|
+
EOT
|
172
164
|
end
|
173
165
|
end
|
174
166
|
end
|
175
167
|
|
176
|
-
desc "Build the windows binary gems"
|
177
|
-
task 'gem:windows' => 'gem' do
|
178
|
-
require 'rake_compiler_dock'
|
179
|
-
|
180
|
-
sh "bundle package"
|
181
|
-
debug = "FXRUBY_MINGW_DEBUG=#{ENV['FXRUBY_MINGW_DEBUG'].inspect}" if ENV['FXRUBY_MINGW_DEBUG']
|
182
|
-
RakeCompilerDock.sh <<-EOT
|
183
|
-
sudo apt update &&
|
184
|
-
sudo apt install yasm &&
|
185
|
-
bundle --local --without=test &&
|
186
|
-
rake cross native gem MAKE=\"nice make V=1 -j `nproc`\" #{debug}
|
187
|
-
EOT
|
188
|
-
end
|
189
|
-
|
190
|
-
# Set environment variable SWIG_LIB to
|
191
|
-
# c:/ruby-1.8.6-p383-preview2/devkit/msys/1.0.11/usr/local/share/swig/1.3.22
|
192
|
-
# before running swig on MinGW.
|
193
168
|
namespace :swig do
|
169
|
+
def patch_swigruby(line)
|
170
|
+
# Ruby-2.7+ finally changed callback function signatures from (*)(ANYARGS) to a proper signature, on which the compiler is able to check parameter types.
|
171
|
+
# Unfortunately this requires a bunch of patches to swig's generated code.
|
172
|
+
|
173
|
+
line.gsub! '#include <ruby.h>', <<-EOT
|
174
|
+
#include <ruby.h>
|
175
|
+
|
176
|
+
#if defined(RB_METHOD_DEFINITION_DECL)
|
177
|
+
# define RUBY_VALUE_METHOD_FUNC(func) (func)
|
178
|
+
# define RUBY_INT_METHOD_FUNC(func) (func)
|
179
|
+
# define RUBY_VOID_METHOD_FUNC(func) (func)
|
180
|
+
# define RUBY_VOIDP_METHOD_FUNC(func) (func)
|
181
|
+
#else
|
182
|
+
# define RUBY_VALUE_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))(func))
|
183
|
+
# define RUBY_INT_METHOD_FUNC(func) ((int (*)(ANYARGS))(func))
|
184
|
+
# define RUBY_VOID_METHOD_FUNC(func) ((void (*)(ANYARGS))(func))
|
185
|
+
# define RUBY_VOIDP_METHOD_FUNC(func) ((void *(*)(ANYARGS))(func))
|
186
|
+
#endif
|
187
|
+
EOT
|
188
|
+
line.gsub! /rb_define_virtual_variable\((.*?), (\w+), NULL\)/, <<-EOT
|
189
|
+
rb_define_virtual_variable(\\1, RUBY_VALUE_METHOD_FUNC(\\2), RUBY_VOID_METHOD_FUNC((rb_gvar_setter_t*)NULL))
|
190
|
+
EOT
|
191
|
+
|
192
|
+
line.gsub!('static VALUE swig_ruby_trackings_count(ANYARGS)', 'static VALUE swig_ruby_trackings_count(ID id, VALUE *var)')
|
193
|
+
line.gsub!('SWIG_ruby_failed(void)', 'SWIG_ruby_failed(VALUE, VALUE)')
|
194
|
+
|
195
|
+
line.gsub!(/SWIGINTERN VALUE SWIG_AUX_(\w+)\(VALUE \*args\)\s\{/m, 'SWIGINTERN VALUE SWIG_AUX_\\1(VALUE pargs){VALUE *args=(VALUE *)pargs;')
|
196
|
+
|
197
|
+
line.gsub! /static int swig_ruby_internal_iterate_callback\(void\* ptr, VALUE obj, void\(\*meth\)\(void\* ptr, VALUE obj\)\)\s*{\s*\(\*meth\)\(ptr, obj\);/m, <<-EOT
|
198
|
+
static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) {
|
199
|
+
((void(*)(void*, VALUE))meth)((void*)ptr, (VALUE)obj);
|
200
|
+
EOT
|
201
|
+
|
202
|
+
line.gsub!('(int (*)(ANYARGS))&swig_ruby_internal_iterate_callback', 'RUBY_INT_METHOD_FUNC(swig_ruby_internal_iterate_callback)')
|
203
|
+
|
204
|
+
line.gsub! /rb_ensure\(VALUEFUNC\((.*)\), self, VALUEFUNC\((.*)\), self\);/, 'rb_ensure(RUBY_VALUE_METHOD_FUNC(\\1), self, RUBY_VALUE_METHOD_FUNC(\\2), self);'
|
205
|
+
line.gsub! /rb_rescue\(RUBY_METHOD_FUNC\((.*)\), \(VALUE\)a, RUBY_METHOD_FUNC\((.*)\), 0\)/, 'rb_rescue(RUBY_VALUE_METHOD_FUNC(\\1), (VALUE)a, RUBY_VALUE_METHOD_FUNC(\\2), 0)'
|
206
|
+
|
207
|
+
line
|
208
|
+
end
|
209
|
+
|
194
210
|
def sed(wrapper_src_file_name)
|
195
211
|
puts "Update #{wrapper_src_file_name}"
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
end
|
212
|
+
|
213
|
+
line = File.read(wrapper_src_file_name)
|
214
|
+
line.gsub!(/static VALUE mCore;/, "VALUE mCore;")
|
215
|
+
line.gsub!(/mCore = rb_define_module\("Core"\)/, "mFox = rb_define_module(\"Fox\")")
|
216
|
+
line.gsub!(/mCore/, "mFox")
|
217
|
+
line.gsub!(/static VALUE m(Dc|Dialogs|Frames|Iconlist|Icons|Image|Label|Layout|List|Mdi|Menu|Fx3d|Scintilla|Table|Text|Treelist|Ui);/, '')
|
218
|
+
line.gsub!(/m(Dc|Dialogs|Frames|Iconlist|Icons|Image|Label|Layout|List|Mdi|Menu|Fx3d|Scintilla|Table|Text|Treelist|Ui) = rb_define_module.*/, '')
|
219
|
+
line.gsub!(/rb_require.*/, '')
|
220
|
+
line.gsub!(/m(Dc|Dialogs|Frames|Iconlist|Icons|Image|Label|Layout|List|Mdi|Menu|Fx3d|Scintilla|Table|Text|Treelist|Ui),/, "mFox,")
|
221
|
+
|
222
|
+
line = patch_swigruby(line)
|
223
|
+
|
224
|
+
File.write(wrapper_src_file_name, line)
|
210
225
|
end
|
211
226
|
|
212
227
|
def add_with_fxscintilla_cond(file)
|
@@ -227,23 +242,30 @@ namespace :swig do
|
|
227
242
|
end
|
228
243
|
|
229
244
|
task :swigruby_h => ["ext/fox16_c/swigruby.h"]
|
230
|
-
file "ext/fox16_c/swigruby.h" do |task|
|
245
|
+
file "ext/fox16_c/swigruby.h.orig" do |task|
|
231
246
|
puts "generate #{task.name}"
|
232
247
|
system "#{SWIG} -ruby -external-runtime #{task.name}"
|
233
248
|
end
|
234
249
|
|
250
|
+
file "ext/fox16_c/swigruby.h"=>["ext/fox16_c/swigruby.h.orig"] do |task|
|
251
|
+
puts "generate #{task.name}"
|
252
|
+
text = File.read(task.prerequisites[0])
|
253
|
+
text = patch_swigruby(text)
|
254
|
+
File.write(task.name, text)
|
255
|
+
end
|
256
|
+
|
235
257
|
desc "Run SWIG to generate the wrapper files."
|
236
258
|
multitask :swig => [:swigruby_h] + SWIG_MODULES.map{|ifile, cppfile| File.join("ext/fox16_c", cppfile) }
|
259
|
+
end
|
237
260
|
|
238
|
-
|
239
|
-
|
240
|
-
|
261
|
+
# add dependencies for compile *.i to *_wrap.cpp
|
262
|
+
SWIG_MODULES.each do |ifile, cppfile|
|
263
|
+
cppfile_path = File.join("ext/fox16_c", cppfile)
|
241
264
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
end
|
265
|
+
file cppfile_path => [ifile, 'macros.i', 'common.i', 'fxdefs.i', 'ruby-typemaps.i',
|
266
|
+
'markfuncs.i', 'exceptions.i', 'freefuncs.i', 'macros.i', 'handlers.i'
|
267
|
+
].map{|f| File.join("swig-interfaces", f) } do |task|
|
268
|
+
swig(File.join("swig-interfaces", ifile), cppfile_path)
|
247
269
|
end
|
248
270
|
end
|
249
271
|
|
data/appveyor.yml
CHANGED
@@ -10,12 +10,14 @@ install:
|
|
10
10
|
- ruby --version
|
11
11
|
- gem --version
|
12
12
|
- ridk version
|
13
|
+
# Remove gcc-ada and gcc-objc, since they are no longer supported by msys2 and therefore cause a dependency issue
|
14
|
+
- c:/msys64/usr/bin/bash -lc "pacman --noconfirm --remove mingw-w64-i686-gcc-ada mingw-w64-i686-gcc-objc mingw-w64-x86_64-gcc-ada mingw-w64-x86_64-gcc-objc"
|
13
15
|
- c:/msys64/usr/bin/bash -lc "pacman -Syu --noconfirm --ask 20"
|
14
16
|
- c:/msys64/usr/bin/bash -lc "pacman -Su --noconfirm"
|
15
17
|
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-fox ${MINGW_PACKAGE_PREFIX}-swig"
|
16
18
|
- swig -version
|
17
19
|
- gem install bundler --conservative
|
18
|
-
- bundle config force_ruby_platform true
|
20
|
+
- bundle config set force_ruby_platform true
|
19
21
|
- bundle install
|
20
22
|
build_script:
|
21
23
|
- bundle exec rake compile
|
data/examples/inputs.rb
CHANGED
@@ -21,6 +21,7 @@ class InputHandlerWindow < FXMainWindow
|
|
21
21
|
|
22
22
|
# Output will be displayed in a multiline text area
|
23
23
|
@cmdOutput = FXText.new(textFrame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
24
|
+
@cmdInput.text = "ping rubyinstaller.org"
|
24
25
|
|
25
26
|
# Initialize the pipe
|
26
27
|
@pipe = nil
|
@@ -30,6 +31,7 @@ class InputHandlerWindow < FXMainWindow
|
|
30
31
|
def create
|
31
32
|
super
|
32
33
|
show(PLACEMENT_SCREEN)
|
34
|
+
@cmdInput.setFocus
|
33
35
|
end
|
34
36
|
|
35
37
|
# Remove previous input (if any)
|
@@ -54,11 +56,14 @@ class InputHandlerWindow < FXMainWindow
|
|
54
56
|
getApp().addInput(@pipe, INPUT_READ|INPUT_EXCEPT) do |sender, sel, ptr|
|
55
57
|
case FXSELTYPE(sel)
|
56
58
|
when SEL_IO_READ
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
begin
|
60
|
+
text = @pipe.read_nonblock(256)
|
61
|
+
rescue IO::WaitReadable
|
62
|
+
rescue EOFError
|
63
|
+
@cmdOutput.appendText("[EOF]")
|
61
64
|
closePipe
|
65
|
+
else
|
66
|
+
@cmdOutput.appendText(text)
|
62
67
|
end
|
63
68
|
when SEL_IO_EXCEPT
|
64
69
|
# puts 'onPipeExcept'
|
data/examples/pig.rb
CHANGED
@@ -47,9 +47,8 @@ class PigBox < FXMainWindow
|
|
47
47
|
theLabel.layoutHints = LAYOUT_FILL_X
|
48
48
|
end
|
49
49
|
|
50
|
-
FXTextField.new(top, 20, @text, FXDataTarget::ID_VALUE) do |theTextField|
|
50
|
+
@theTextField = FXTextField.new(top, 20, @text, FXDataTarget::ID_VALUE) do |theTextField|
|
51
51
|
theTextField.layoutHints = LAYOUT_FILL_X
|
52
|
-
theTextField.setFocus()
|
53
52
|
end
|
54
53
|
|
55
54
|
FXButton.new(top, 'Pig It') do |pigButton|
|
@@ -66,6 +65,7 @@ class PigBox < FXMainWindow
|
|
66
65
|
def create
|
67
66
|
super
|
68
67
|
show(PLACEMENT_SCREEN)
|
68
|
+
@theTextField.setFocus
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/examples/unicode.rb
CHANGED
@@ -1,36 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: UTF-8 -*-
|
2
3
|
|
3
4
|
require 'fox16'
|
4
|
-
require 'jcode'
|
5
|
-
|
6
|
-
$KCODE = 'UTF8'
|
7
|
-
|
8
|
-
class UString < String
|
9
|
-
# Show u-prefix as in Python
|
10
|
-
def inspect; "u#{ super }" end
|
11
|
-
|
12
|
-
# Count multibyte characters
|
13
|
-
def length; self.scan(/./).length end
|
14
|
-
|
15
|
-
# Reverse the string
|
16
|
-
def reverse; self.scan(/./).reverse.join end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Kernel
|
20
|
-
def u( str )
|
21
|
-
UString.new str.gsub(/U\+([0-9a-fA-F]{4,4})/u){["#$1".hex ].pack('U*')}
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
include Fox
|
26
5
|
|
27
6
|
# Pass UTF-8 encoded Unicode strings to FXRuby.
|
28
|
-
label =
|
7
|
+
label = "Les enfants vont \u00E0 l'\u00E9cole.\nLa boulang\u00E8re vend-elle le pain en ao\u00FBt?"
|
29
8
|
|
30
|
-
FXApp.new("Unicode Example", "FoxTest") do |app|
|
31
|
-
main = FXMainWindow.new(app, "Unicode Text", nil, nil, DECOR_ALL)
|
32
|
-
FXLabel.new(main, label)
|
9
|
+
Fox::FXApp.new("Unicode Example", "FoxTest") do |app|
|
10
|
+
main = Fox::FXMainWindow.new(app, "Unicode Text", nil, nil, Fox::DECOR_ALL)
|
11
|
+
Fox::FXLabel.new(main, label)
|
33
12
|
app.create
|
34
|
-
main.show(PLACEMENT_SCREEN)
|
13
|
+
main.show(Fox::PLACEMENT_SCREEN)
|
35
14
|
app.run
|
36
15
|
end
|
data/ext/fox16_c/FXRbApp.cpp
CHANGED
@@ -26,12 +26,6 @@
|
|
26
26
|
|
27
27
|
#include "FXRbCommon.h"
|
28
28
|
|
29
|
-
#if defined(RUBY_1_8)
|
30
|
-
extern "C" {
|
31
|
-
#include "rubysig.h" /* For CHECK_INTS */
|
32
|
-
}
|
33
|
-
#endif
|
34
|
-
|
35
29
|
#ifdef HAVE_SYS_TIME_H
|
36
30
|
#include <sys/time.h> /* For struct timeval */
|
37
31
|
#endif
|
@@ -149,15 +143,7 @@ long FXRbApp::onChoreThreads_gvlcb(FXObject*,FXSelector,void*){
|
|
149
143
|
wait.tv_sec=0;
|
150
144
|
wait.tv_usec=100*sleepTime;
|
151
145
|
|
152
|
-
// Confirm that this thread can be interrupted, then go to sleep
|
153
|
-
#if defined(RUBY_1_8)
|
154
|
-
CHECK_INTS;
|
155
|
-
if(!rb_thread_critical)
|
156
|
-
rb_thread_wait_for(wait);
|
157
|
-
#else
|
158
|
-
// if(!rb_thread_critical) rb_thread_wait_for(wait);
|
159
146
|
rb_thread_wait_for(wait);
|
160
|
-
#endif /* RUBY_1_8 */
|
161
147
|
|
162
148
|
// Re-register this chore for next time
|
163
149
|
addChore(this,ID_CHORE_THREADS);
|
data/ext/fox16_c/FXRuby.cpp
CHANGED
@@ -43,20 +43,9 @@
|
|
43
43
|
#include <signal.h> // for definitions of SIGINT, etc.
|
44
44
|
#endif
|
45
45
|
|
46
|
-
#if defined(RUBY_1_8)
|
47
|
-
|
48
|
-
extern "C" {
|
49
|
-
#include "st.h"
|
50
|
-
#include "rubyio.h" // for GetOpenFile(), etc.
|
51
|
-
}
|
52
|
-
|
53
|
-
#else
|
54
|
-
|
55
46
|
#include "ruby/io.h"
|
56
47
|
#include "ruby/st.h"
|
57
48
|
|
58
|
-
#endif /* RUBY_1_8 */
|
59
|
-
|
60
49
|
|
61
50
|
// Opaque type declaration from SWIG runtime
|
62
51
|
struct swig_type_info;
|
@@ -130,7 +119,7 @@ void FXRbUnregisterRubyObj(const void* foxObj){
|
|
130
119
|
* These objects are allocated by FXRuby on the heap.
|
131
120
|
* They are free'd when the FXRuby wrapper is GC'ed and no other reference to the object exists.
|
132
121
|
* They are registered in FXRbObjRegistry as owned object.
|
133
|
-
*
|
122
|
+
* They are built per FXRbRegisterRubyObj().
|
134
123
|
*
|
135
124
|
* Borrowed objects :
|
136
125
|
* These objects are allocated by libfox on the heap.
|
@@ -145,7 +134,7 @@ void FXRbUnregisterRubyObj(const void* foxObj){
|
|
145
134
|
* They are wrapped for the time of one callback only, because stack memory is free'd afterwards.
|
146
135
|
* They are not registered in FXRbObjRegistry, but stored on the stack only.
|
147
136
|
* Therefore callback objects aren't re-used, but newly wrapped for each call.
|
148
|
-
*
|
137
|
+
* The same goes for arguments to ruby blocks.
|
149
138
|
* They are built per FXGetRubyObjCb().
|
150
139
|
*/
|
151
140
|
|
@@ -929,7 +918,6 @@ void* FXRbGetExpectedData(VALUE recv,FXSelector key,VALUE value){
|
|
929
918
|
case SEL_CLICKED:
|
930
919
|
case SEL_DOUBLECLICKED:
|
931
920
|
case SEL_TRIPLECLICKED:
|
932
|
-
case SEL_CHANGED:
|
933
921
|
case SEL_DESELECTED:
|
934
922
|
case SEL_SELECTED:
|
935
923
|
case SEL_INSERTED:
|
@@ -1045,7 +1033,7 @@ void* FXRbGetExpectedData(VALUE recv,FXSelector key,VALUE value){
|
|
1045
1033
|
return NULL;
|
1046
1034
|
case FXWindow::ID_HSCROLLED:
|
1047
1035
|
case FXWindow::ID_VSCROLLED:
|
1048
|
-
return reinterpret_cast<void*>(static_cast<
|
1036
|
+
return reinterpret_cast<void*>(static_cast<long>(NUM2INT(value)));
|
1049
1037
|
case FXWindow::ID_SETINTVALUE:
|
1050
1038
|
if(obj->isMemberOf(FXMETACLASS(FXColorWell))){
|
1051
1039
|
colorValue=NUM2UINT(value);
|
@@ -1086,9 +1074,16 @@ void* FXRbGetExpectedData(VALUE recv,FXSelector key,VALUE value){
|
|
1086
1074
|
if(obj->isMemberOf(FXMETACLASS(FXPicker))){
|
1087
1075
|
SWIG_ConvertPtr(value,&ptr,FXRbTypeQuery("FXPoint *"),1);
|
1088
1076
|
return ptr;
|
1089
|
-
}
|
1090
|
-
return 0;
|
1091
1077
|
}
|
1078
|
+
if(obj->isMemberOf(FXMETACLASS(FXWindow))){
|
1079
|
+
switch(id){
|
1080
|
+
case FXWindow::ID_HSCROLLED:
|
1081
|
+
case FXWindow::ID_VSCROLLED:
|
1082
|
+
return reinterpret_cast<void*>(static_cast<long>(NUM2INT(value)));
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
return 0;
|
1086
|
+
}
|
1092
1087
|
|
1093
1088
|
if(type==SEL_DRAGGED){
|
1094
1089
|
SWIG_ConvertPtr(value,&ptr,FXRbTypeQuery("FXEvent *"),1);
|
@@ -1190,8 +1185,8 @@ long FXRbHandleMessage_gvlcb(FXObject* recv,ID func,FXObject* sender,FXSelector
|
|
1190
1185
|
FXTRACE((100,"FXRbHandleMessage(recv=%p(%s),FXSEL(%s,%d)\n",recv,recv->getClassName(),FXDebugTarget::messageTypeName[FXSELTYPE(key)],FXSELID(key)));
|
1191
1186
|
|
1192
1187
|
if(FXRbCatchExceptions){
|
1193
|
-
retval=rb_rescue2((
|
1194
|
-
(
|
1188
|
+
retval=rb_rescue2(RUBY_VALUE_METHOD_FUNC(handle_body), reinterpret_cast<VALUE>(&hArgs),
|
1189
|
+
RUBY_VALUE_METHOD_FUNC(handle_rescue), Qnil,
|
1195
1190
|
rb_eStandardError, rb_eNameError, 0);
|
1196
1191
|
}
|
1197
1192
|
else{
|
@@ -1483,7 +1478,7 @@ FXRbMenuCommand::~FXRbMenuCommand(){
|
|
1483
1478
|
}
|
1484
1479
|
}
|
1485
1480
|
}
|
1486
|
-
acckey=(FXHotKey)
|
1481
|
+
acckey=(FXHotKey)0;
|
1487
1482
|
FXRbUnregisterRubyObj(this);
|
1488
1483
|
}
|
1489
1484
|
|
@@ -1499,7 +1494,7 @@ FXRbMenuCheck::~FXRbMenuCheck(){
|
|
1499
1494
|
}
|
1500
1495
|
}
|
1501
1496
|
}
|
1502
|
-
acckey=(FXHotKey)
|
1497
|
+
acckey=(FXHotKey)0;
|
1503
1498
|
FXRbUnregisterRubyObj(this);
|
1504
1499
|
}
|
1505
1500
|
|
@@ -1515,7 +1510,7 @@ FXRbMenuRadio::~FXRbMenuRadio(){
|
|
1515
1510
|
}
|
1516
1511
|
}
|
1517
1512
|
}
|
1518
|
-
acckey=(FXHotKey)
|
1513
|
+
acckey=(FXHotKey)0;
|
1519
1514
|
FXRbUnregisterRubyObj(this);
|
1520
1515
|
}
|
1521
1516
|
|
@@ -1656,11 +1651,6 @@ FXInputHandle FXRbGetWriteFileHandle(VALUE obj,FXuint mode) {
|
|
1656
1651
|
VALUE vwrite = rb_intern("@write");
|
1657
1652
|
if(rb_ivar_defined(obj, vwrite)) obj = rb_ivar_get(obj, vwrite);
|
1658
1653
|
fd = FIX2INT(rb_funcall(obj, rb_intern("fileno"), 0));
|
1659
|
-
#elif defined(RUBY_1_8)
|
1660
|
-
OpenFile *fptr;
|
1661
|
-
GetOpenFile(obj, fptr);
|
1662
|
-
FILE *fpw=GetWriteFile(fptr);
|
1663
|
-
fd = fileno(fpw);
|
1664
1654
|
#else
|
1665
1655
|
rb_io_t *fptr;
|
1666
1656
|
GetOpenFile(obj, fptr);
|
@@ -1897,7 +1887,7 @@ void FXRbUnregisterAppSensitiveObject(FXDC* dc){
|
|
1897
1887
|
FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<st_data_t>(dc),reinterpret_cast<st_data_t *>(0))==0);
|
1898
1888
|
}
|
1899
1889
|
|
1900
|
-
static int st_cbfunc_obj(st_data_t key,st_data_t,st_data_t arg
|
1890
|
+
static int st_cbfunc_obj(st_data_t key,st_data_t,st_data_t arg){
|
1901
1891
|
FXASSERT(key!=0);
|
1902
1892
|
FXASSERT(arg!=0);
|
1903
1893
|
FXObjectListOf<FXObject> *pObjectList=reinterpret_cast<FXObjectListOf<FXObject>*>(arg);
|
@@ -1906,7 +1896,7 @@ static int st_cbfunc_obj(st_data_t key,st_data_t,st_data_t arg,int){
|
|
1906
1896
|
return 0;
|
1907
1897
|
}
|
1908
1898
|
|
1909
|
-
static int st_cbfunc_dc(st_data_t key,st_data_t,st_data_t arg
|
1899
|
+
static int st_cbfunc_dc(st_data_t key,st_data_t,st_data_t arg){
|
1910
1900
|
FXASSERT(key!=0);
|
1911
1901
|
FXASSERT(arg!=0);
|
1912
1902
|
FXArray<FXDC*> *pDCArray=reinterpret_cast<FXArray<FXDC*>*>(arg);
|
@@ -1919,7 +1909,7 @@ void FXRbDestroyAppSensitiveObjects(){
|
|
1919
1909
|
FXTRACE((100,"%s:%d: Begin destroying objects that hold references to the FXApp...\n",__FILE__,__LINE__));
|
1920
1910
|
|
1921
1911
|
FXObjectListOf<FXObject> objs;
|
1922
|
-
st_foreach(appSensitiveObjs,
|
1912
|
+
st_foreach(appSensitiveObjs,RUBY_INT_METHOD_FUNC(st_cbfunc_obj),reinterpret_cast<st_data_t>(&objs));
|
1923
1913
|
for(FXint i=0;i<objs.no();i++){
|
1924
1914
|
if(objs[i]->isMemberOf(FXMETACLASS(FXRbCursor))){
|
1925
1915
|
if(dynamic_cast<FXRbCursor*>(objs[i])->ownedByApp)
|
@@ -1949,7 +1939,7 @@ void FXRbDestroyAppSensitiveObjects(){
|
|
1949
1939
|
}
|
1950
1940
|
|
1951
1941
|
FXArray<FXDC*> dcs;
|
1952
|
-
st_foreach(appSensitiveDCs,
|
1942
|
+
st_foreach(appSensitiveDCs,RUBY_INT_METHOD_FUNC(st_cbfunc_dc),reinterpret_cast<st_data_t>(&dcs));
|
1953
1943
|
for(FXint j=0;j<dcs.no();j++){
|
1954
1944
|
delete dcs[j];
|
1955
1945
|
}
|