matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1a9a0e7d98
commit
f32c76a266
@ -1,3 +1,11 @@
|
|||||||
|
Wed Aug 2 08:22:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* gc.c (rb_gc): clear malloc_memories to zero, to avoid potential
|
||||||
|
super frequent GC invocation. (ruby-bugs:#PR48)
|
||||||
|
|
||||||
|
* gc.c (rb_gc): only add_heap() if GC trigger condition is
|
||||||
|
satisfied.
|
||||||
|
|
||||||
Tue Aug 1 16:41:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Aug 1 16:41:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* ruby.c (proc_options): global load path setting moved from
|
* ruby.c (proc_options): global load path setting moved from
|
||||||
|
17
eval.c
17
eval.c
@ -6768,12 +6768,14 @@ rb_thread_ready(th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_thread_remove()
|
rb_thread_remove(th)
|
||||||
|
rb_thread_t th;
|
||||||
{
|
{
|
||||||
rb_thread_ready(curr_thread);
|
if (th->status == THREAD_KILLED) return;
|
||||||
curr_thread->status = THREAD_KILLED;
|
rb_thread_ready(th);
|
||||||
curr_thread->prev->next = curr_thread->next;
|
th->status = THREAD_KILLED;
|
||||||
curr_thread->next->prev = curr_thread->prev;
|
th->prev->next = th->next;
|
||||||
|
th->next->prev = th->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -7661,7 +7663,7 @@ rb_thread_start_0(fn, arg, th)
|
|||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
status = th->status;
|
status = th->status;
|
||||||
rb_thread_remove();
|
rb_thread_remove(th);
|
||||||
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
|
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
|
||||||
th->flags |= THREAD_RAISED;
|
th->flags |= THREAD_RAISED;
|
||||||
if (state == TAG_FATAL) {
|
if (state == TAG_FATAL) {
|
||||||
@ -8090,7 +8092,8 @@ rb_callcc(self)
|
|||||||
for (tag=prot_tag; tag; tag=tag->prev) {
|
for (tag=prot_tag; tag; tag=tag->prev) {
|
||||||
scope_dup(tag->scope);
|
scope_dup(tag->scope);
|
||||||
}
|
}
|
||||||
th->prev = th->next = 0;
|
th->prev = 0;
|
||||||
|
th->next = curr_thread;
|
||||||
if (THREAD_SAVE_CONTEXT(th)) {
|
if (THREAD_SAVE_CONTEXT(th)) {
|
||||||
return th->result;
|
return th->result;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ module TkComm
|
|||||||
|
|
||||||
def install_bind(cmd, args=nil)
|
def install_bind(cmd, args=nil)
|
||||||
if args
|
if args
|
||||||
id = install_cmd(proc{|arg|
|
id = install_cmd(proc{|*arg|
|
||||||
TkUtil.eval_cmd cmd, *arg
|
TkUtil.eval_cmd cmd, *arg
|
||||||
})
|
})
|
||||||
id + " " + args
|
id + " " + args
|
||||||
@ -784,6 +784,96 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# convert kanji string to/from utf-8
|
||||||
|
###########################################
|
||||||
|
if /^8\.[1-9]/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK
|
||||||
|
class TclTkIp
|
||||||
|
# from tkencoding.rb by ttate@jaist.ac.jp
|
||||||
|
alias __eval _eval
|
||||||
|
alias __invoke _invoke
|
||||||
|
private :__eval
|
||||||
|
private :__invoke
|
||||||
|
|
||||||
|
attr_accessor :encoding
|
||||||
|
|
||||||
|
def _eval(cmd)
|
||||||
|
if @encoding
|
||||||
|
_fromUTF8(__eval(_toUTF8(cmd, @encoding)), @encoding)
|
||||||
|
else
|
||||||
|
__eval(cmd)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def _invoke(*cmds)
|
||||||
|
if @encoding
|
||||||
|
cmds = cmds.collect{|cmd| _toUTF8(cmd, @encoding)}
|
||||||
|
_fromUTF8(__invoke(*cmds), @encoding)
|
||||||
|
else
|
||||||
|
__invoke(*cmds)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
def encoding=(name)
|
||||||
|
INTERP.encoding = name
|
||||||
|
end
|
||||||
|
|
||||||
|
def encoding
|
||||||
|
INTERP.encoding
|
||||||
|
end
|
||||||
|
|
||||||
|
def encoding_names
|
||||||
|
tk_split_simplelist(tk_call('encoding', 'names'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def encoding_system
|
||||||
|
tk_call('encoding', 'system')
|
||||||
|
end
|
||||||
|
|
||||||
|
def encoding_system=(enc)
|
||||||
|
tk_call('encoding', 'system', enc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# estimate encoding
|
||||||
|
case $KCODE
|
||||||
|
when /^e/i # EUC
|
||||||
|
Tk.encoding = 'euc-jp'
|
||||||
|
when /^s/i # SJIS
|
||||||
|
Tk.encoding = 'shiftjis'
|
||||||
|
when /^u/i # UTF8
|
||||||
|
Tk.encoding = 'utf-8'
|
||||||
|
else # NONE
|
||||||
|
begin
|
||||||
|
Tk.encoding = Tk.encoding_system
|
||||||
|
rescue StandardError, NameError
|
||||||
|
Tk.encoding = 'utf-8'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
# dummy methods
|
||||||
|
module Tk
|
||||||
|
def encoding=(name)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
def encoding
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
def encoding_names
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
def encoding_system
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
def encoding_system=(enc)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module TkBindCore
|
module TkBindCore
|
||||||
def bind(context, cmd=Proc.new, args=nil)
|
def bind(context, cmd=Proc.new, args=nil)
|
||||||
Tk.bind(to_eval, context, cmd, args)
|
Tk.bind(to_eval, context, cmd, args)
|
||||||
|
@ -13,6 +13,7 @@ class TkFont
|
|||||||
Tk_FontNameTBL = {}
|
Tk_FontNameTBL = {}
|
||||||
Tk_FontUseTBL = {}
|
Tk_FontUseTBL = {}
|
||||||
|
|
||||||
|
# set default font
|
||||||
case Tk::TK_VERSION
|
case Tk::TK_VERSION
|
||||||
when /^4\.*/
|
when /^4\.*/
|
||||||
DEFAULT_LATIN_FONT_NAME = 'a14'.freeze
|
DEFAULT_LATIN_FONT_NAME = 'a14'.freeze
|
||||||
@ -33,6 +34,43 @@ class TkFont
|
|||||||
'-compound'))
|
'-compound'))
|
||||||
else
|
else
|
||||||
# unknown Tcl/Tk-JP
|
# unknown Tcl/Tk-JP
|
||||||
|
platform = tk_call('set', 'tcl_platform(platform)')
|
||||||
|
case platform
|
||||||
|
when 'unix'
|
||||||
|
ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12}
|
||||||
|
knj = 'k14'
|
||||||
|
#knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
|
||||||
|
when 'windows'
|
||||||
|
ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
|
||||||
|
knj = 'mincho'
|
||||||
|
when 'macintosh'
|
||||||
|
ltn = 'system'
|
||||||
|
knj = 'mincho'
|
||||||
|
else # unknown
|
||||||
|
ltn = 'Helvetica'
|
||||||
|
knj = 'mincho'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
ltn = 'Helvetica'
|
||||||
|
knj = 'mincho'
|
||||||
|
end
|
||||||
|
|
||||||
|
else # not JAPANIZED_TK
|
||||||
|
begin
|
||||||
|
platform = tk_call('set', 'tcl_platform(platform)')
|
||||||
|
case platform
|
||||||
|
when 'unix'
|
||||||
|
ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12}
|
||||||
|
knj = 'k14'
|
||||||
|
#knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
|
||||||
|
when 'windows'
|
||||||
|
ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
|
||||||
|
knj = 'mincho'
|
||||||
|
when 'macintosh'
|
||||||
|
ltn = 'system'
|
||||||
|
knj = 'mincho'
|
||||||
|
else # unknown
|
||||||
ltn = 'Helvetica'
|
ltn = 'Helvetica'
|
||||||
knj = 'mincho'
|
knj = 'mincho'
|
||||||
end
|
end
|
||||||
@ -40,15 +78,21 @@ class TkFont
|
|||||||
ltn = 'Helvetica'
|
ltn = 'Helvetica'
|
||||||
knj = 'mincho'
|
knj = 'mincho'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
DEFAULT_LATIN_FONT_NAME = ltn.freeze
|
DEFAULT_LATIN_FONT_NAME = ltn.freeze
|
||||||
DEFAULT_KANJI_FONT_NAME = knj.freeze
|
DEFAULT_KANJI_FONT_NAME = knj.freeze
|
||||||
else
|
|
||||||
|
else # unknown version
|
||||||
DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
|
DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
|
||||||
DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
|
DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if $DEBUG
|
||||||
|
print "default latin font = "; p DEFAULT_LATIN_FONT_NAME
|
||||||
|
print "default kanji font = "; p DEFAULT_KANJI_FONT_NAME
|
||||||
end
|
end
|
||||||
p "default latin font = #{DEFAULT_LATIN_FONT_NAME}" if $DEBUG
|
|
||||||
p "default kanji font = #{DEFAULT_KANJI_FONT_NAME}" if $DEBUG
|
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# class methods
|
# class methods
|
||||||
@ -167,14 +211,12 @@ class TkFont
|
|||||||
###################################
|
###################################
|
||||||
private
|
private
|
||||||
###################################
|
###################################
|
||||||
def initialize(ltn=DEFAULT_LATIN_FONT_NAME, knj=DEFAULT_KANJI_FONT_NAME,
|
def initialize(ltn=DEFAULT_LATIN_FONT_NAME, knj=nil, keys=nil)
|
||||||
keys=nil)
|
|
||||||
@id = format("@font%.4d", Tk_FontID[0])
|
@id = format("@font%.4d", Tk_FontID[0])
|
||||||
Tk_FontID[0] += 1
|
Tk_FontID[0] += 1
|
||||||
Tk_FontNameTBL[@id] = self
|
Tk_FontNameTBL[@id] = self
|
||||||
create_latinfont(ltn)
|
knj = DEFAULT_KANJI_FONT_NAME if JAPANIZED_TK && !knj
|
||||||
create_kanjifont(knj)
|
create_compoundfont(ltn, knj, keys)
|
||||||
create_compoundfont(keys)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def _get_font_info_from_hash(font)
|
def _get_font_info_from_hash(font)
|
||||||
@ -293,7 +335,10 @@ class TkFont
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_compoundfont_tk4x(keys)
|
def create_compoundfont_tk4x(ltn, knj, keys)
|
||||||
|
create_latinfont(ltn)
|
||||||
|
create_kanjifont(knj)
|
||||||
|
|
||||||
if JAPANIZED_TK
|
if JAPANIZED_TK
|
||||||
@compoundfont = [[@latinfont], [@kanjifont]]
|
@compoundfont = [[@latinfont], [@kanjifont]]
|
||||||
@fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
|
@fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
|
||||||
@ -339,17 +384,19 @@ class TkFont
|
|||||||
end
|
end
|
||||||
tk_call('font', 'create', @latinfont, *hash_kv(keys))
|
tk_call('font', 'create', @latinfont, *hash_kv(keys))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if font && @compoundfont
|
||||||
|
keys = {}
|
||||||
|
actual_core(@latinfont).each{|key,val| keys[key] = val}
|
||||||
|
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_kanjifont_tk80(font)
|
def create_kanjifont_tk8x(font)
|
||||||
unless JAPANIZED_TK
|
|
||||||
@kanjifont = ""
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
@kanjifont = @id + 'k'
|
@kanjifont = @id + 'k'
|
||||||
|
|
||||||
|
if JAPANIZED_TK
|
||||||
if font.kind_of? Hash
|
if font.kind_of? Hash
|
||||||
if font['charset']
|
if font['charset']
|
||||||
tk_call('font', 'create', @kanjifont, *hash_kv(font))
|
tk_call('font', 'create', @kanjifont, *hash_kv(font))
|
||||||
@ -368,11 +415,9 @@ class TkFont
|
|||||||
else
|
else
|
||||||
tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
|
tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
|
||||||
end
|
end
|
||||||
end
|
# end of JAPANIZED_TK
|
||||||
|
|
||||||
def create_kanjifont_tk81(font)
|
|
||||||
@kanjifont = @id + 'k'
|
|
||||||
|
|
||||||
|
else
|
||||||
if font.kind_of? Hash
|
if font.kind_of? Hash
|
||||||
tk_call('font', 'create', @kanjifont, *hash_kv(font))
|
tk_call('font', 'create', @kanjifont, *hash_kv(font))
|
||||||
else
|
else
|
||||||
@ -387,15 +432,18 @@ class TkFont
|
|||||||
tk_call('font', 'create', @kanjifont, *hash_kv(keys))
|
tk_call('font', 'create', @kanjifont, *hash_kv(keys))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if font && @compoundfont
|
||||||
keys = {}
|
keys = {}
|
||||||
actual_core(@kanjifont).each{|key,val| keys[key] = val}
|
actual_core(@kanjifont).each{|key,val| keys[key] = val}
|
||||||
begin
|
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
||||||
rescue
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_compoundfont_tk80(keys)
|
def create_compoundfont_tk8x(ltn, knj, keys)
|
||||||
|
create_latinfont(ltn)
|
||||||
|
create_kanjifont(knj)
|
||||||
|
|
||||||
@compoundfont = @id + 'c'
|
@compoundfont = @id + 'c'
|
||||||
if JAPANIZED_TK
|
if JAPANIZED_TK
|
||||||
@fontslot = {'font'=>@compoundfont}
|
@fontslot = {'font'=>@compoundfont}
|
||||||
@ -403,23 +451,6 @@ class TkFont
|
|||||||
'-compound', [@latinfont, @kanjifont], *hash_kv(keys))
|
'-compound', [@latinfont, @kanjifont], *hash_kv(keys))
|
||||||
else
|
else
|
||||||
tk_call('font', 'create', @compoundfont)
|
tk_call('font', 'create', @compoundfont)
|
||||||
latinkeys = {}
|
|
||||||
begin
|
|
||||||
actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
|
|
||||||
rescue
|
|
||||||
latinkeys {}
|
|
||||||
end
|
|
||||||
if latinkeys != {}
|
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
|
||||||
end
|
|
||||||
@fontslot = {'font'=>@compoundfont}
|
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_compoundfont_tk81(keys)
|
|
||||||
@compoundfont = @id + 'c'
|
|
||||||
tk_call('font', 'create', @compoundfont)
|
|
||||||
|
|
||||||
latinkeys = {}
|
latinkeys = {}
|
||||||
begin
|
begin
|
||||||
@ -431,6 +462,7 @@ class TkFont
|
|||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if knj
|
||||||
kanjikeys = {}
|
kanjikeys = {}
|
||||||
begin
|
begin
|
||||||
actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
|
actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
|
||||||
@ -440,10 +472,12 @@ class TkFont
|
|||||||
if kanjikeys != {}
|
if kanjikeys != {}
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
|
tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@fontslot = {'font'=>@compoundfont}
|
@fontslot = {'font'=>@compoundfont}
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def actual_core_tk4x(font, window=nil, option=nil)
|
def actual_core_tk4x(font, window=nil, option=nil)
|
||||||
# dummy
|
# dummy
|
||||||
@ -623,9 +657,7 @@ class TkFont
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def kanji_replace_core_tk80(knj)
|
def kanji_replace_core_tk8x(knj)
|
||||||
return self unless JAPANIZED_TK
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
tk_call('font', 'delete', @kanjifont)
|
tk_call('font', 'delete', @kanjifont)
|
||||||
rescue
|
rescue
|
||||||
@ -634,23 +666,6 @@ class TkFont
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def kanji_replace_core_tk81(knj)
|
|
||||||
if font.kind_of? Hash
|
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(knj))
|
|
||||||
else
|
|
||||||
keys = {}
|
|
||||||
if knj.kind_of? Array
|
|
||||||
actual_core(array2tk_list(knj)).each{|key,val| keys[key] = val}
|
|
||||||
elsif knj.kind_of? TkFont
|
|
||||||
actual_core(knj.latin_font).each{|key,val| keys[key] = val}
|
|
||||||
else
|
|
||||||
actual_core(knj).each{|key,val| keys[key] = val}
|
|
||||||
end
|
|
||||||
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
|
|
||||||
end
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
def measure_core_tk4x(window, text)
|
def measure_core_tk4x(window, text)
|
||||||
0
|
0
|
||||||
end
|
end
|
||||||
@ -712,42 +727,29 @@ class TkFont
|
|||||||
alias measure_core measure_core_tk4x
|
alias measure_core measure_core_tk4x
|
||||||
alias metrics_core metrics_core_tk4x
|
alias metrics_core metrics_core_tk4x
|
||||||
|
|
||||||
when /^8\.0/
|
when /^8\.[0123]/
|
||||||
alias create_latinfont create_latinfont_tk8x
|
alias create_latinfont create_latinfont_tk8x
|
||||||
alias create_kanjifont create_kanjifont_tk80
|
alias create_kanjifont create_kanjifont_tk8x
|
||||||
alias create_compoundfont create_compoundfont_tk80
|
alias create_compoundfont create_compoundfont_tk8x
|
||||||
alias actual_core actual_core_tk8x
|
alias actual_core actual_core_tk8x
|
||||||
alias configure_core configure_core_tk8x
|
alias configure_core configure_core_tk8x
|
||||||
alias configinfo_core configinfo_core_tk8x
|
alias configinfo_core configinfo_core_tk8x
|
||||||
alias delete_core delete_core_tk8x
|
alias delete_core delete_core_tk8x
|
||||||
alias latin_replace_core latin_replace_core_tk8x
|
alias latin_replace_core latin_replace_core_tk8x
|
||||||
alias kanji_replace_core kanji_replace_core_tk80
|
alias kanji_replace_core kanji_replace_core_tk8x
|
||||||
alias measure_core measure_core_tk8x
|
|
||||||
alias metrics_core metrics_core_tk8x
|
|
||||||
|
|
||||||
when /^8\.[123]/
|
|
||||||
alias create_latinfont create_latinfont_tk8x
|
|
||||||
alias create_kanjifont create_kanjifont_tk81
|
|
||||||
alias create_compoundfont create_compoundfont_tk81
|
|
||||||
alias actual_core actual_core_tk8x
|
|
||||||
alias configure_core configure_core_tk8x
|
|
||||||
alias configinfo_core configinfo_core_tk8x
|
|
||||||
alias delete_core delete_core_tk8x
|
|
||||||
alias latin_replace_core latin_replace_core_tk8x
|
|
||||||
alias kanji_replace_core kanji_replace_core_tk81
|
|
||||||
alias measure_core measure_core_tk8x
|
alias measure_core measure_core_tk8x
|
||||||
alias metrics_core metrics_core_tk8x
|
alias metrics_core metrics_core_tk8x
|
||||||
|
|
||||||
when /^8\.*/
|
when /^8\.*/
|
||||||
alias create_latinfont create_latinfont_tk8x
|
alias create_latinfont create_latinfont_tk8x
|
||||||
alias create_kanjifont create_kanjifont_tk81
|
alias create_kanjifont create_kanjifont_tk8x
|
||||||
alias create_compoundfont create_compoundfont_tk81
|
alias create_compoundfont create_compoundfont_tk8x
|
||||||
alias actual_core actual_core_tk8x
|
alias actual_core actual_core_tk8x
|
||||||
alias configure_core configure_core_tk8x
|
alias configure_core configure_core_tk8x
|
||||||
alias configinfo_core configinfo_core_tk8x
|
alias configinfo_core configinfo_core_tk8x
|
||||||
alias delete_core delete_core_tk8x
|
alias delete_core delete_core_tk8x
|
||||||
alias latin_replace_core latin_replace_core_tk8x
|
alias latin_replace_core latin_replace_core_tk8x
|
||||||
alias kanji_replace_core kanji_replace_core_tk81
|
alias kanji_replace_core kanji_replace_core_tk8x
|
||||||
alias measure_core measure_core_tk8x
|
alias measure_core measure_core_tk8x
|
||||||
alias metrics_core metrics_core_tk8x
|
alias metrics_core metrics_core_tk8x
|
||||||
|
|
||||||
|
@ -334,17 +334,42 @@ class TkText<TkTextWin
|
|||||||
tk_split_simplelist(tk_send('tag', 'prevrange', tag, first, last))
|
tk_split_simplelist(tk_send('tag', 'prevrange', tag, first, last))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _ktext_length(txt)
|
||||||
|
if $KCODE !~ /n/i
|
||||||
|
return txt.gsub(/[^\Wa-zA-Z_\d]/, ' ').length
|
||||||
|
end
|
||||||
|
|
||||||
|
# $KCODE == 'NONE'
|
||||||
|
if JAPANIZED_TK
|
||||||
|
tk_call('kstring', 'length', txt).to_i
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
tk_call('encoding', 'convertto', 'ascii', txt).length
|
||||||
|
rescue StandardError, NameError
|
||||||
|
# sorry, I have no plan
|
||||||
|
txt.length
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private :_ktext_length
|
||||||
|
|
||||||
def search_with_length(pat,start,stop=None)
|
def search_with_length(pat,start,stop=None)
|
||||||
pat = pat.char if pat.kind_of? Integer
|
pat = pat.chr if pat.kind_of? Integer
|
||||||
if stop != None
|
if stop != None
|
||||||
return ["", 0] if compare(start,'>=',stop)
|
return ["", 0] if compare(start,'>=',stop)
|
||||||
txt = get(start,stop)
|
txt = get(start,stop)
|
||||||
if (pos = txt.index(pat))
|
if (pos = txt.index(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index(start + " + #{pos} chars"), pat.split('').length]
|
#return [index(start + " + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index(start + " + #{pos} chars"),
|
||||||
|
_ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index(start + " + #{pos} chars"), $&.split('').length]
|
#return [index(start + " + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index(start + " + #{pos} chars"),
|
||||||
|
_ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ["", 0]
|
return ["", 0]
|
||||||
@ -352,20 +377,31 @@ class TkText<TkTextWin
|
|||||||
else
|
else
|
||||||
txt = get(start,'end - 1 char')
|
txt = get(start,'end - 1 char')
|
||||||
if (pos = txt.index(pat))
|
if (pos = txt.index(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index(start + " + #{pos} chars"), pat.split('').length]
|
#return [index(start + " + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index(start + " + #{pos} chars"),
|
||||||
|
_ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index(start + " + #{pos} chars"), $&.split('').length]
|
#return [index(start + " + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index(start + " + #{pos} chars"),
|
||||||
|
_ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
txt = get('1.0','end - 1 char')
|
txt = get('1.0','end - 1 char')
|
||||||
if (pos = txt.index(pat))
|
if (pos = txt.index(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index("1.0 + #{pos} chars"), pat.split('').length]
|
#return [index("1.0 + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"),
|
||||||
|
_ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index("1.0 + #{pos} chars"), $&.split('').length]
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ["", 0]
|
return ["", 0]
|
||||||
@ -379,16 +415,20 @@ class TkText<TkTextWin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rsearch_with_length(pat,start,stop=None)
|
def rsearch_with_length(pat,start,stop=None)
|
||||||
pat = pat.char if pat.kind_of? Integer
|
pat = pat.chr if pat.kind_of? Integer
|
||||||
if stop != None
|
if stop != None
|
||||||
return ["", 0] if compare(start,'<=',stop)
|
return ["", 0] if compare(start,'<=',stop)
|
||||||
txt = get(stop,start)
|
txt = get(stop,start)
|
||||||
if (pos = txt.rindex(pat))
|
if (pos = txt.rindex(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index(stop + " + #{pos} chars"), pat.split('').length]
|
#return [index(stop + " + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index(stop + " + #{pos} chars"), $&.split('').length]
|
#return [index(stop + " + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ["", 0]
|
return ["", 0]
|
||||||
@ -396,20 +436,28 @@ class TkText<TkTextWin
|
|||||||
else
|
else
|
||||||
txt = get('1.0',start)
|
txt = get('1.0',start)
|
||||||
if (pos = txt.rindex(pat))
|
if (pos = txt.rindex(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index("1.0 + #{pos} chars"), pat.split('').length]
|
#return [index("1.0 + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index("1.0 + #{pos} chars"), $&.split('').length]
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
txt = get('1.0','end - 1 char')
|
txt = get('1.0','end - 1 char')
|
||||||
if (pos = txt.rindex(pat))
|
if (pos = txt.rindex(pat))
|
||||||
pos = txt[0..(pos-1)].split('').length if pos > 0
|
match = $&
|
||||||
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
||||||
if pat.kind_of? String
|
if pat.kind_of? String
|
||||||
return [index("1.0 + #{pos} chars"), pat.split('').length]
|
#return [index("1.0 + #{pos} chars"), pat.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
return [index("1.0 + #{pos} chars"), $&.split('').length]
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
||||||
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ["", 0]
|
return ["", 0]
|
||||||
|
3
gc.c
3
gc.c
@ -901,7 +901,10 @@ rb_gc()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dont_gc || during_gc || rb_prohibit_interrupt || ruby_in_compile) {
|
if (dont_gc || during_gc || rb_prohibit_interrupt || ruby_in_compile) {
|
||||||
|
if (!freelist || malloc_memories > GC_MALLOC_LIMIT) {
|
||||||
|
malloc_memories = 0;
|
||||||
add_heap();
|
add_heap();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user