mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-06-13
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1c940e6cdd
commit
1b47fa1097
18 changed files with 729 additions and 356 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Jun 9 15:11:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* time.c (make_time_t): supports daylight saving time.
|
||||
|
||||
Fri Jun 9 01:05:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
|
||||
|
||||
* regex.h: export re_mbctab properly on cygwin.
|
||||
|
|
4
config.guess
vendored
4
config.guess
vendored
|
@ -969,10 +969,6 @@ EOF
|
|||
*:Rhapsody:*:*)
|
||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:"Mac OS":*:*)
|
||||
echo `uname -p`-apple-macos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
|
2
config.sub
vendored
2
config.sub
vendored
|
@ -910,7 +910,7 @@ case $os in
|
|||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -openstep* | -macos | -oskit*)
|
||||
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
|
|
16
configure.in
16
configure.in
|
@ -43,12 +43,6 @@ AC_ARG_ENABLE(fat-binary,
|
|||
TARGET_ARCHS="ppc i386"
|
||||
fi
|
||||
;;
|
||||
macos*)
|
||||
echo -n "MacOS X : "
|
||||
if test "$TARGET_ARCHS" = "" ; then
|
||||
TARGET_ARCHS="ppc i386"
|
||||
fi
|
||||
;;
|
||||
nextstep*|openstep*)
|
||||
echo -n "NeXTSTEP/OPENSTEP: "
|
||||
if test "$TARGET_ARCHS" = "" ; then
|
||||
|
@ -146,7 +140,6 @@ case "$host_os" in
|
|||
nextstep*) ;;
|
||||
openstep*) ;;
|
||||
rhapsody*) ;;
|
||||
macos*) ;;
|
||||
human*) ac_cv_func_getpgrp_void=yes;;
|
||||
beos*) ;;
|
||||
cygwin*) ;;
|
||||
|
@ -401,7 +394,6 @@ if test "$with_dln_a_out" != yes; then
|
|||
nextstep*) ;;
|
||||
openstep*) ;;
|
||||
rhapsody*) ;;
|
||||
macos*) ;;
|
||||
human*) ;;
|
||||
bsdi*) ;;
|
||||
cygwin*) ;;
|
||||
|
@ -481,10 +473,6 @@ if test "$with_dln_a_out" != yes; then
|
|||
LDFLAGS=""
|
||||
DLDFLAGS="$ARCH_FLAG"
|
||||
rb_cv_dlopen=yes ;;
|
||||
macos*) LDSHARED='cc -dynamic -bundle -undefined suppress'
|
||||
LDFLAGS=""
|
||||
DLDFLAGS="$ARCH_FLAG"
|
||||
rb_cv_dlopen=yes ;;
|
||||
aix*) LDSHARED='/usr/ccs/bin/ld'
|
||||
XLDFLAGS='-Wl,-bE:ruby.imp'
|
||||
DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
|
||||
|
@ -553,8 +541,6 @@ else
|
|||
AC_DEFINE(DLEXT, ".bundle");;
|
||||
rhapsody*) DLEXT=bundle
|
||||
AC_DEFINE(DLEXT, ".bundle");;
|
||||
macos*) DLEXT=bundle
|
||||
AC_DEFINE(DLEXT, ".bundle");;
|
||||
cygwin*) DLEXT=dll
|
||||
AC_DEFINE(DLEXT, ".dll");;
|
||||
os2_emx*) DLEXT=dll
|
||||
|
@ -580,8 +566,6 @@ case "$host_os" in
|
|||
STRIP='strip -A -n';;
|
||||
rhapsody*)
|
||||
STRIP='strip -A -n';;
|
||||
macos*)
|
||||
STRIP='strip -A -n';;
|
||||
esac
|
||||
|
||||
EXTSTATIC=
|
||||
|
|
|
@ -503,7 +503,7 @@ def extmake(target)
|
|||
$objs = nil
|
||||
$local_flags = ""
|
||||
case RUBY_PLATFORM
|
||||
when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/
|
||||
when /cygwin|beos|openstep|nextstep|rhapsody|i386-os2_emx/
|
||||
$libs = ""
|
||||
when /mswin32/
|
||||
$LIBEXT = "lib"
|
||||
|
|
207
ext/tk/lib/tk.rb
207
ext/tk/lib/tk.rb
|
@ -457,6 +457,21 @@ module TkCore
|
|||
_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
|
||||
end
|
||||
|
||||
def scaling(scale=nil)
|
||||
if scale
|
||||
tk_call('tk', 'scaling', scale)
|
||||
else
|
||||
Float(number(tk_call('tk', 'scaling')))
|
||||
end
|
||||
end
|
||||
def scaling_displayof(win, scale=nil)
|
||||
if scale
|
||||
tk_call('tk', 'scaling', '-displayof', win, scale)
|
||||
else
|
||||
Float(number(tk_call('tk', '-displayof', win, 'scaling')))
|
||||
end
|
||||
end
|
||||
|
||||
def appname(name=None)
|
||||
tk_call('tk', 'appname', name)
|
||||
end
|
||||
|
@ -526,7 +541,7 @@ module TkCore
|
|||
|
||||
def tk_call(*args)
|
||||
print args.join(" "), "\n" if $DEBUG
|
||||
args.filter {|x|_get_eval_string(x)}
|
||||
args.filter{|x|_get_eval_string(x)}
|
||||
args.compact!
|
||||
args.flatten!
|
||||
begin
|
||||
|
@ -772,6 +787,24 @@ class TkBindTag
|
|||
end
|
||||
end
|
||||
|
||||
class TkBindTagAll<TkBindTag
|
||||
BindTagALL = []
|
||||
def TkBindTagAll.new(*args)
|
||||
if BindTagALL[0]
|
||||
BindTagALL[0].bind(*args) if args != []
|
||||
else
|
||||
new = super()
|
||||
BindTagALL[0] = new
|
||||
end
|
||||
BindTagALL[0]
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
@id = 'all'
|
||||
BindTagALL[0].bind(*args) if args != []
|
||||
end
|
||||
end
|
||||
|
||||
class TkVariable
|
||||
include Tk
|
||||
extend TkCore
|
||||
|
@ -1151,6 +1184,31 @@ module TkKinput
|
|||
end
|
||||
end
|
||||
|
||||
module TkXIM
|
||||
include Tk
|
||||
extend Tk
|
||||
|
||||
def TkXIM.useinputmethods(window=nil,value=nil)
|
||||
if window
|
||||
if value
|
||||
tk_call 'tk', 'useinputmethods', '-displayof', window.path, value
|
||||
else
|
||||
tk_call 'tk', 'useinputmethods', '-displayof', window.path
|
||||
end
|
||||
else
|
||||
if value
|
||||
tk_call 'tk', 'useinputmethods', value
|
||||
else
|
||||
tk_call 'tk', 'useinputmethods'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def useinputmethods(value=nil)
|
||||
TkXIM.useinputmethods(self,value)
|
||||
end
|
||||
end
|
||||
|
||||
module TkWinfo
|
||||
include Tk
|
||||
extend Tk
|
||||
|
@ -1807,7 +1865,7 @@ class TkWindow<TkObject
|
|||
self
|
||||
end
|
||||
|
||||
def unpack(keys = nil)
|
||||
def unpack
|
||||
tk_call 'pack', 'forget', epath
|
||||
self
|
||||
end
|
||||
|
@ -1817,7 +1875,7 @@ class TkWindow<TkObject
|
|||
self
|
||||
end
|
||||
|
||||
def ungrid(keys = nil)
|
||||
def ungrid
|
||||
tk_call 'grid', 'forget', epath
|
||||
self
|
||||
end
|
||||
|
@ -1827,8 +1885,8 @@ class TkWindow<TkObject
|
|||
self
|
||||
end
|
||||
|
||||
def unplace(keys = nil)
|
||||
tk_call 'place', 'forget', epath, *hash_kv(keys)
|
||||
def unplace
|
||||
tk_call 'place', 'forget', epath
|
||||
self
|
||||
end
|
||||
alias place_forget unplace
|
||||
|
@ -1894,11 +1952,11 @@ class TkWindow<TkObject
|
|||
end
|
||||
|
||||
def lower(below=None)
|
||||
tk_call 'lower', path, below
|
||||
tk_call 'lower', epath, below
|
||||
self
|
||||
end
|
||||
def raise(above=None)
|
||||
tk_call 'raise', path, above
|
||||
tk_call 'raise', epath, above
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -1912,7 +1970,7 @@ class TkWindow<TkObject
|
|||
end
|
||||
|
||||
def destroy
|
||||
tk_call 'destroy', path
|
||||
tk_call 'destroy', epath
|
||||
if @cmdtbl
|
||||
for id in @cmdtbl
|
||||
uninstall_cmd id
|
||||
|
@ -1927,7 +1985,7 @@ class TkWindow<TkObject
|
|||
alias wait wait_visibility
|
||||
|
||||
def wait_destroy
|
||||
tk_call 'tkwait', 'window', path
|
||||
tk_call 'tkwait', 'window', epath
|
||||
end
|
||||
|
||||
def bindtags(taglist=nil)
|
||||
|
@ -2259,6 +2317,41 @@ class TkListbox<TkTextWin
|
|||
def selection_set(first, last=None)
|
||||
tk_send 'selection', 'set', first, last
|
||||
end
|
||||
|
||||
def itemcget(index, key)
|
||||
tk_tcl2ruby tk_send 'itemcget', index, "-#{key}"
|
||||
end
|
||||
def itemconfigure(index, key, val=None)
|
||||
if key.kind_of? Hash
|
||||
if (key['font'] || key['kanjifont'] ||
|
||||
key['latinfont'] || key['asciifont'])
|
||||
tagfont_configure(index, key.dup)
|
||||
else
|
||||
tk_send 'itemconfigure', index, *hash_kv(key)
|
||||
end
|
||||
|
||||
else
|
||||
if (key == 'font' || key == 'kanjifont' ||
|
||||
key == 'latinfont' || key == 'asciifont' )
|
||||
tagfont_configure({key=>val})
|
||||
else
|
||||
tk_call 'itemconfigure', index, "-#{key}", val
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def itemconfiginfo(index, key=nil)
|
||||
if key
|
||||
conf = tk_split_list(tk_send('itemconfigure',index,"-#{key}"))
|
||||
conf[0] = conf[0][1..-1]
|
||||
conf
|
||||
else
|
||||
tk_split_list(tk_send('itemconfigure', index)).collect{|conf|
|
||||
conf[0] = conf[0][1..-1]
|
||||
conf
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module TkTreatMenuEntryFont
|
||||
|
@ -2397,6 +2490,9 @@ class TkMenu<TkWindow
|
|||
def delete(index, last=None)
|
||||
tk_send 'delete', index, last
|
||||
end
|
||||
def popup(x, y, index=nil)
|
||||
tk_call 'tk_popup', path, x, y, index
|
||||
end
|
||||
def post(x, y)
|
||||
tk_send 'post', x, y
|
||||
end
|
||||
|
@ -2451,6 +2547,34 @@ class TkMenu<TkWindow
|
|||
end
|
||||
end
|
||||
|
||||
module TkSystemMenu
|
||||
def initialize(parent, keys=nil)
|
||||
fail unless parent.kind_of? TkMenu
|
||||
@path = format("%s.%s", parent.path, self.type::SYSMENU_NAME)
|
||||
TkComm::Tk_WINDOWS[@path] = self
|
||||
create_self
|
||||
configure(keys) if keys
|
||||
end
|
||||
end
|
||||
|
||||
class TkSysMenu_Help<TkMenu
|
||||
# for all platform
|
||||
include TkSystemMenu
|
||||
SYSMENU_NAME = 'help'
|
||||
end
|
||||
|
||||
class TkSysMenu_System<TkMenu
|
||||
# for Windows
|
||||
include TkSystemMenu
|
||||
SYSMENU_NAME = 'system'
|
||||
end
|
||||
|
||||
class TkSysMenu_Apple<TkMenu
|
||||
# for Machintosh
|
||||
include TkSystemMenu
|
||||
SYSMENU_NAME = 'apple'
|
||||
end
|
||||
|
||||
class TkMenubutton<TkLabel
|
||||
WidgetClassNames['Menubutton'] = self
|
||||
def TkMenubutton.to_eval
|
||||
|
@ -2461,6 +2585,71 @@ class TkMenubutton<TkLabel
|
|||
end
|
||||
end
|
||||
|
||||
class TkOptionMenubutton<TkMenubutton
|
||||
class OptionMenu<TkMenu
|
||||
def initialize(parent)
|
||||
@path = parent.path + '.menu'
|
||||
TkComm::Tk_WINDOWS[@path] = self
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(parent=nil, var=TkVariable.new, firstval=nil, *vals)
|
||||
fail unless var.kind_of? TkVariable
|
||||
@variable = var
|
||||
firstval = @variable.value unless firstval
|
||||
@variable.value = firstval
|
||||
install_win(if parent then parent.path end)
|
||||
@menu = OptionMenu.new(self)
|
||||
tk_call 'tk_optionMenu', @path, @variable.id, firstval, *vals
|
||||
end
|
||||
|
||||
def value
|
||||
@variable.value
|
||||
end
|
||||
|
||||
def activate(index)
|
||||
@menu.activate(index)
|
||||
end
|
||||
def add(value)
|
||||
@menu.add('radiobutton', 'variable'=>@variable,
|
||||
'label'=>value, 'value'=>value)
|
||||
end
|
||||
def index(index)
|
||||
@menu.index(index)
|
||||
end
|
||||
def invoke(index)
|
||||
@menu.invoke(index)
|
||||
end
|
||||
def insert(index, value)
|
||||
@menu.add(index, 'radiobutton', 'variable'=>@variable,
|
||||
'label'=>value, 'value'=>value)
|
||||
end
|
||||
def delete(index, last=None)
|
||||
@menu.delete(index, last)
|
||||
end
|
||||
def yposition(index)
|
||||
@menu.yposition(index)
|
||||
end
|
||||
def menucget(index, key)
|
||||
@menu.cget(index, key)
|
||||
end
|
||||
def menuconfigure(index, key, val=None)
|
||||
@menu.configure(index, key, val)
|
||||
end
|
||||
def menuconfiginfo(index, key=nil)
|
||||
@menu.configinfo(index, key)
|
||||
end
|
||||
def entrycget(index, key)
|
||||
@menu.entrycget(index, key)
|
||||
end
|
||||
def entryconfigure(index, key, val=None)
|
||||
@menu.entryconfigure(index, key, val)
|
||||
end
|
||||
def entryconfiginfo(index, key=nil)
|
||||
@menu.entryconfiginfo(index, key)
|
||||
end
|
||||
end
|
||||
|
||||
module TkComposite
|
||||
include Tk
|
||||
extend Tk
|
||||
|
|
|
@ -217,7 +217,7 @@ class TkCanvas<TkWindow
|
|||
|
||||
def find(mode, *args)
|
||||
list(tk_send 'find', mode, *args).filter{|id|
|
||||
TkcItem.id2obj(id)
|
||||
TkcItem.id2obj(self, id)
|
||||
}
|
||||
end
|
||||
def find_above(target)
|
||||
|
@ -250,14 +250,14 @@ class TkCanvas<TkWindow
|
|||
if ret == ""
|
||||
nil
|
||||
else
|
||||
TkcItem.id2obj(ret)
|
||||
TkcItem.id2obj(self, ret)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def gettags(tagOrId)
|
||||
list(tk_send('gettags', tagid(tagOrId))).collect{|tag|
|
||||
TkcTag.id2obj(tag)
|
||||
TkcTag.id2obj(self, tag)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -478,6 +478,41 @@ module TkcTagAccess
|
|||
def itemtype
|
||||
@c.itemtype @id
|
||||
end
|
||||
|
||||
# Followings operators supports logical expressions of canvas tags
|
||||
# (for Tk8.3+).
|
||||
# If tag1.path is 't1' and tag2.path is 't2', then
|
||||
# ltag = tag1 & tag2; ltag.path => "(t1)&&(t2)"
|
||||
# ltag = tag1 | tag2; ltag.path => "(t1)||(t2)"
|
||||
# ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)"
|
||||
# ltag = - tag1; ltag.path => "!(t1)"
|
||||
def & (tag)
|
||||
if tag.kind_of? TkObject
|
||||
TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
|
||||
else
|
||||
TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')')
|
||||
end
|
||||
end
|
||||
|
||||
def | (tag)
|
||||
if tag.kind_of? TkObject
|
||||
TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')')
|
||||
else
|
||||
TkcTagString.new(@c, '(' + @id + ')||(' + tag.to_s + ')')
|
||||
end
|
||||
end
|
||||
|
||||
def ^ (tag)
|
||||
if tag.kind_of? TkObject
|
||||
TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
|
||||
else
|
||||
TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')')
|
||||
end
|
||||
end
|
||||
|
||||
def -@
|
||||
TkcTagString.new(@c, '!(' + @id + ')')
|
||||
end
|
||||
end
|
||||
|
||||
class TkcTag<TkObject
|
||||
|
@ -485,8 +520,10 @@ class TkcTag<TkObject
|
|||
|
||||
CTagID_TBL = {}
|
||||
|
||||
def TkcTag.id2obj(id)
|
||||
CTagID_TBL[id]? CTagID_TBL[id]: id
|
||||
def TkcTag.id2obj(canvas, id)
|
||||
cpath = canvas.path
|
||||
return id unless CTagID_TBL[cpath]
|
||||
CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id
|
||||
end
|
||||
|
||||
Tk_CanvasTag_ID = ['ctag0000']
|
||||
|
@ -495,8 +532,10 @@ class TkcTag<TkObject
|
|||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
@path = @id = Tk_CanvasTag_ID[0]
|
||||
CTagID_TBL[@id] = self
|
||||
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath][@id] = self
|
||||
Tk_CanvasTag_ID[0] = Tk_CanvasTag_ID[0].succ
|
||||
if mode
|
||||
tk_call @c.path, "addtag", @id, mode, *args
|
||||
|
@ -508,7 +547,7 @@ class TkcTag<TkObject
|
|||
|
||||
def delete
|
||||
@c.delete @id
|
||||
CTagID_TBL[@id] = nil
|
||||
CTagID_TBL[@path][@id] = nil if CTagID_TBL[@path]
|
||||
end
|
||||
alias remove delete
|
||||
alias destroy delete
|
||||
|
@ -534,7 +573,7 @@ class TkcTag<TkObject
|
|||
alias closest set_to_closest
|
||||
|
||||
def set_to_enclosed(x1, y1, x2, y2)
|
||||
@c.addtag_enclosest(@id, x1, y1, x2, y2)
|
||||
@c.addtag_enclosed(@id, x1, y1, x2, y2)
|
||||
end
|
||||
alias enclosed set_to_enclosed
|
||||
|
||||
|
@ -549,14 +588,40 @@ class TkcTag<TkObject
|
|||
alias withtag set_to_withtag
|
||||
end
|
||||
|
||||
class TkcTagString<TkcTag
|
||||
def self.new(parent, name, *args)
|
||||
if CTagID_TBL[parent.path] && CTagID_TBL[parent.path][name]
|
||||
return CTagID_TBL[parent.path][name]
|
||||
else
|
||||
super(parent, name, *args)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(parent, name, mode=nil, *args)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
@path = @id = name
|
||||
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath][@id] = self
|
||||
if mode
|
||||
tk_call @c.path, "addtag", @id, mode, *args
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TkcTagAll<TkcTag
|
||||
def initialize(parent)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
@path = @id = 'all'
|
||||
CTagID_TBL[@id] = self
|
||||
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath][@id] = self
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -566,8 +631,10 @@ class TkcTagCurrent<TkcTag
|
|||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
@path = @id = 'current'
|
||||
CTagID_TBL[@id] = self
|
||||
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath][@id] = self
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -578,8 +645,10 @@ class TkcGroup<TkcTag
|
|||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
@path = @id = Tk_cGroup_ID[0]
|
||||
CTagID_TBL[@id] = self
|
||||
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath][@id] = self
|
||||
Tk_cGroup_ID[0] = Tk_cGroup_ID[0].succ
|
||||
add(*args) if args != []
|
||||
end
|
||||
|
@ -597,7 +666,6 @@ class TkcGroup<TkcTag
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
class TkcItem<TkObject
|
||||
include TkcTagAccess
|
||||
|
||||
|
@ -608,8 +676,10 @@ class TkcItem<TkObject
|
|||
CItemTypeToClass[type]
|
||||
end
|
||||
|
||||
def TkcItem.id2obj(id)
|
||||
CItemID_TBL[id]? CItemID_TBL[id]: id
|
||||
def TkcItem.id2obj(canvas, id)
|
||||
cpath = canvas.path
|
||||
return id unless CItemID_TBL[cpath]
|
||||
CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
|
||||
end
|
||||
|
||||
def initialize(parent, *args)
|
||||
|
@ -622,7 +692,8 @@ class TkcItem<TkObject
|
|||
keys = args.pop
|
||||
end
|
||||
@id = create_self(*args).to_i ;# 'canvas item id' is integer number
|
||||
CItemID_TBL[@id] = self
|
||||
CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
|
||||
CItemID_TBL[@path][@id] = self
|
||||
if keys
|
||||
# tk_call @path, 'itemconfigure', @id, *hash_kv(keys)
|
||||
configure(keys) if keys
|
||||
|
@ -636,7 +707,7 @@ class TkcItem<TkObject
|
|||
|
||||
def delete
|
||||
@c.delete @id
|
||||
CItemID_TBL[@id] = nil
|
||||
CItemID_TBL[@path][@id] = nil if CItemID_TBL[@path]
|
||||
end
|
||||
alias remove delete
|
||||
alias destroy delete
|
||||
|
@ -768,6 +839,10 @@ class TkPhotoImage<TkImage
|
|||
tk_send 'copy', source, *args
|
||||
end
|
||||
|
||||
def data(keys=nil)
|
||||
tk_send 'data', *hash_kv(keys)
|
||||
end
|
||||
|
||||
def get(x, y)
|
||||
tk_send 'get', x, y
|
||||
end
|
||||
|
|
|
@ -59,6 +59,14 @@ class TkEntry<TkLabel
|
|||
tk_send 'selection', 'to', index
|
||||
end
|
||||
|
||||
def validate
|
||||
if tk_send('validate') == '0'
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def value
|
||||
tk_send 'get'
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ class TkFont
|
|||
|
||||
def TkFont.create_copy(font)
|
||||
keys = {}
|
||||
font.configure.each{|key,value| keys[key] = value }
|
||||
font.configinfo.each{|key,value| keys[key] = value }
|
||||
new_font = TkFont.new(font.latin_font, font.kanji_font, keys)
|
||||
end
|
||||
|
||||
|
@ -123,17 +123,13 @@ class TkFont
|
|||
###################################
|
||||
private
|
||||
###################################
|
||||
def initialize(ltn=nil, knj=nil, keys=nil)
|
||||
def initialize(ltn=DEFAULT_LATIN_FONT_NAME, knj=DEFAULT_KANJI_FONT_NAME,
|
||||
keys=nil)
|
||||
@id = format("@font%.4d", Tk_FontID[0])
|
||||
Tk_FontID[0] += 1
|
||||
Tk_FontNameTBL[@id] = self
|
||||
|
||||
ltn = DEFAULT_LATIN_FONT_NAME unless ltn
|
||||
create_latinfont(ltn)
|
||||
|
||||
knj = DEFAULT_KANJI_FONT_NAME unless knj
|
||||
create_kanjifont(knj)
|
||||
|
||||
create_compoundfont(keys)
|
||||
end
|
||||
|
||||
|
@ -714,7 +710,7 @@ class TkFont
|
|||
if winobj.kind_of? TkText
|
||||
ret.push([winobj, winobj.tagid2obj(tag)])
|
||||
elsif winobj.kind_of? TkCanvas
|
||||
if (tagobj = TkcTag.id2obj(tag)).kind_of? TkcTag
|
||||
if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
|
||||
ret.push([winobj, tagobj])
|
||||
elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
|
||||
ret.push([winobj, tagobj])
|
||||
|
@ -822,7 +818,7 @@ class TkFont
|
|||
if JAPANIZED_TK
|
||||
configinfo_core(@latinfont, slot)
|
||||
else
|
||||
configure(slot, value)
|
||||
configinfo(slot)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
10
io.c
10
io.c
|
@ -582,7 +582,10 @@ rb_io_gets_internal(argc, argv, io)
|
|||
c = getc(f);
|
||||
TRAP_END;
|
||||
if (c == EOF) {
|
||||
if (ferror(f) && errno == EINTR) continue;
|
||||
if (ferror(f)) {
|
||||
ig (errno == EINTR) continue;
|
||||
rb_sys_fail(fptr->path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((*bp++ = c) == newline) break;
|
||||
|
@ -669,7 +672,10 @@ rb_io_gets(io)
|
|||
c = getc(f);
|
||||
TRAP_END;
|
||||
if (c == EOF) {
|
||||
if (ferror(f) && errno == EINTR) continue;
|
||||
if (ferror(f)) {
|
||||
ig (errno == EINTR) continue;
|
||||
rb_sys_fail(fptr->path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((*bp++ = c) == '\n') break;
|
||||
|
|
16
lib/jcode.rb
16
lib/jcode.rb
|
@ -84,10 +84,6 @@ class String
|
|||
h
|
||||
end
|
||||
|
||||
def bsquote(str)
|
||||
str.gsub(/\\/, '\\\\\\\\')
|
||||
end
|
||||
|
||||
HashCache = {}
|
||||
TrPatternCache = {}
|
||||
DeletePatternCache = {}
|
||||
|
@ -98,7 +94,7 @@ class String
|
|||
def tr!(from, to)
|
||||
return self.delete!(from) if to.length == 0
|
||||
|
||||
pattern = TrPatternCache[from] ||= /[#{bsquote(from)}]/
|
||||
pattern = TrPatternCache[from] ||= /[#{Regexp::quote(from)}]/
|
||||
if from[0] == ?^
|
||||
last = /.$/.match(to)[0]
|
||||
self.gsub!(pattern, last)
|
||||
|
@ -113,7 +109,7 @@ class String
|
|||
end
|
||||
|
||||
def delete!(del)
|
||||
self.gsub!(DeletePatternCache[del] ||= /[#{bsquote(del)}]+/, '')
|
||||
self.gsub!(DeletePatternCache[del] ||= /[#{Regexp::quote(del)}]+/, '')
|
||||
end
|
||||
|
||||
def delete(del)
|
||||
|
@ -123,7 +119,7 @@ class String
|
|||
def squeeze!(del=nil)
|
||||
pattern =
|
||||
if del
|
||||
SqueezePatternCache[del] ||= /([#{bsquote(del)}])\1+/
|
||||
SqueezePatternCache[del] ||= /([#{Regexp::quote(del)}])\1+/
|
||||
else
|
||||
/(.|\n)\1+/
|
||||
end
|
||||
|
@ -137,7 +133,7 @@ class String
|
|||
def tr_s!(from, to)
|
||||
return self.delete!(from) if to.length == 0
|
||||
|
||||
pattern = SqueezePatternCache[from] ||= /([#{bsquote(from)}])\1+"/
|
||||
pattern = SqueezePatternCache[from] ||= /([#{Regexp::quote(from)}])\1+"/
|
||||
if from[0] == ?^
|
||||
last = /.$/.match(to)[0]
|
||||
self.gsub!(pattern, last)
|
||||
|
@ -163,5 +159,9 @@ class String
|
|||
self.delete("^#{str}").jlength
|
||||
end
|
||||
|
||||
def each_char(&block)
|
||||
scan(/.|\n/, &block)
|
||||
end
|
||||
end
|
||||
|
||||
$VERBOSE = $vsave
|
||||
|
|
|
@ -88,14 +88,14 @@ class PStore
|
|||
file = File::open(@filename, "r+")
|
||||
orig = true
|
||||
else
|
||||
@table = {}
|
||||
file = File::open(@filename, "w+")
|
||||
Marshal::dump(@table, file)
|
||||
end
|
||||
file.flock(File::LOCK_EX)
|
||||
if orig
|
||||
File::copy @filename, backup
|
||||
@table = Marshal::load(file)
|
||||
else
|
||||
@table = {}
|
||||
end
|
||||
begin
|
||||
catch(:pstore_abort_transaction) do
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
"class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin\\|do"
|
||||
)
|
||||
|
||||
(defconst ruby-non-block-do-re
|
||||
"\\(while\\|until\\|for\\|rescue\\)\\>"
|
||||
)
|
||||
|
||||
(defconst ruby-indent-beg-re
|
||||
"\\(\\s *\\(class\\|module\\|def\\)\\)\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
|
||||
)
|
||||
|
@ -114,6 +118,31 @@
|
|||
(defvar ruby-indent-level 2
|
||||
"*Indentation of ruby statements.")
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(defun ruby-imenu-create-index ()
|
||||
(let ((index-alist '())
|
||||
class-name class-begin method-name method-begin decl)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^\\s *\\(class\\|def\\)\\s *\\([^(\n ]+\\)" nil t)
|
||||
(setq decl (buffer-substring (match-beginning 1) (match-end 1)))
|
||||
(cond
|
||||
((string= "class" decl)
|
||||
(setq class-begin (match-beginning 2))
|
||||
(setq class-name (buffer-substring class-begin (match-end 2)))
|
||||
(push (cons class-name (match-beginning 0)) index-alist)
|
||||
(ruby-mark-defun)
|
||||
(save-restriction
|
||||
(narrow-to-region (region-beginning) (region-end))
|
||||
(while (re-search-forward "^\\s *def\\s *\\([^(\n ]+\\)" nil t)
|
||||
(setq method-begin (match-beginning 1))
|
||||
(setq method-name (buffer-substring method-begin (match-end 1)))
|
||||
(push (cons (concat class-name "#" method-name) (match-beginning 0)) index-alist))))
|
||||
((string= "def" decl)
|
||||
(setq method-begin (match-beginning 2))
|
||||
(setq method-name (buffer-substring method-begin (match-end 2)))
|
||||
(push (cons method-name (match-beginning 0)) index-alist))))
|
||||
index-alist))
|
||||
|
||||
(defun ruby-mode-variables ()
|
||||
(set-syntax-table ruby-mode-syntax-table)
|
||||
(setq local-abbrev-table ruby-mode-abbrev-table)
|
||||
|
@ -153,6 +182,9 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(setq major-mode 'ruby-mode)
|
||||
(ruby-mode-variables)
|
||||
|
||||
(make-local-variable 'imenu-create-index-function)
|
||||
(setq imenu-create-index-function 'ruby-imenu-create-index)
|
||||
|
||||
(run-hooks 'ruby-mode-hook))
|
||||
|
||||
(defun ruby-current-indentation ()
|
||||
|
@ -172,8 +204,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(defun ruby-indent-to (x)
|
||||
(if x
|
||||
(let (shift top beg)
|
||||
(and (< x 0)
|
||||
(error "invalid nest"))
|
||||
(and (< x 0) (error "invalid nest"))
|
||||
(setq shift (current-column))
|
||||
(beginning-of-line)
|
||||
(setq beg (point))
|
||||
|
@ -191,7 +222,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(indent-to x)
|
||||
(move-to-column (+ x shift))))))
|
||||
|
||||
(defun ruby-expr-beg (&optional modifier)
|
||||
(defun ruby-expr-beg (&optional option)
|
||||
(save-excursion
|
||||
(if (looking-at "\\?")
|
||||
(progn
|
||||
|
@ -203,10 +234,11 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(or (bolp)
|
||||
(looking-at ruby-operator-re)
|
||||
(looking-at "[\\[({]")
|
||||
(and (not modifier) (looking-at "[!?]"))
|
||||
(and (not (eq option 'modifier))
|
||||
(looking-at "[!?]"))
|
||||
(and (looking-at ruby-symbol-re)
|
||||
(forward-word -1)
|
||||
(if (and (not modifier) (bolp))
|
||||
(skip-chars-backward ruby-symbol-chars)
|
||||
(if (and (not (eq option 'modifier)) (bolp))
|
||||
t
|
||||
(if (or (looking-at ruby-block-beg-re)
|
||||
(looking-at ruby-block-op-re)
|
||||
|
@ -214,7 +246,8 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(progn
|
||||
(goto-char (match-end 0))
|
||||
(looking-at "\\>"))
|
||||
(looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))))))))
|
||||
(and (not (eq option 'expr-arg))
|
||||
(looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]")))))))))
|
||||
|
||||
(defun ruby-parse-region (start end)
|
||||
(let ((indent-point end)
|
||||
|
@ -250,7 +283,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
((looking-at "/")
|
||||
(cond
|
||||
((and (not (eobp)) (ruby-expr-beg))
|
||||
(if (re-search-forward "[^\\]/" indent-point t)
|
||||
(if (re-search-forward "[^\\]\\(\\\\\\\\\\)*/" indent-point t)
|
||||
nil
|
||||
(setq in-string (point))
|
||||
(goto-char indent-point)))
|
||||
|
@ -258,18 +291,24 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(goto-char pnt))))
|
||||
((looking-at "%")
|
||||
(cond
|
||||
((and (not (eobp)) (ruby-expr-beg)
|
||||
((and (not (eobp)) (ruby-expr-beg 'expr-arg)
|
||||
(not (looking-at "%="))
|
||||
(looking-at "%[Qqrxw]?\\(.\\)"))
|
||||
(goto-char (match-beginning 1))
|
||||
(setq w (buffer-substring (match-beginning 1)
|
||||
(match-end 1)))
|
||||
(cond
|
||||
((string= w "[") (setq w "]"))
|
||||
((string= w "[") (setq w "\\]"))
|
||||
((string= w "{") (setq w "}"))
|
||||
((string= w "(") (setq w ")"))
|
||||
((string= w "<") (setq w ">")))
|
||||
(goto-char (match-end 0))
|
||||
(if (search-forward w indent-point t)
|
||||
((string= w "<") (setq w ">"))
|
||||
((member w '("*" "." "+" "?" "^" "$"))
|
||||
(setq w (concat "\\" w))))
|
||||
(if (re-search-forward
|
||||
(if (string= w "\\")
|
||||
"\\\\[^\\]*\\\\"
|
||||
(concat "[^\\]\\(\\\\\\\\\\)*" w))
|
||||
indent-point t)
|
||||
nil
|
||||
(setq in-string (point))
|
||||
(goto-char indent-point)))
|
||||
|
@ -313,7 +352,9 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(if (or (and (not (bolp))
|
||||
(progn
|
||||
(forward-char -1)
|
||||
(eq ?_ (char-after (point)))))
|
||||
(setq w (char-after (point)))
|
||||
(or (eq ?_ w)
|
||||
(eq ?. w))))
|
||||
(progn
|
||||
(goto-char pnt)
|
||||
(setq w (char-after (point)))
|
||||
|
@ -335,10 +376,16 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(goto-char (match-end 0)))
|
||||
((looking-at ruby-block-beg-re)
|
||||
(and
|
||||
(or (not (looking-at "do\\>[^_]"))
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(not (looking-at ruby-non-block-do-re))))
|
||||
(or (bolp)
|
||||
(progn
|
||||
(forward-char -1)
|
||||
(not (eq ?_ (char-after (point))))))
|
||||
(setq w (char-after (point)))
|
||||
(not (or (eq ?_ w)
|
||||
(eq ?. w)))))
|
||||
(goto-char pnt)
|
||||
(setq w (char-after (point)))
|
||||
(not (eq ?_ w))
|
||||
|
@ -349,7 +396,36 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(progn
|
||||
(goto-char (match-beginning 0))
|
||||
(if (looking-at ruby-modifier-re)
|
||||
(ruby-expr-beg t)
|
||||
(ruby-expr-beg 'modifier)
|
||||
t))
|
||||
t)
|
||||
(goto-char pnt)
|
||||
(setq nest (cons (cons nil pnt) nest))
|
||||
(setq depth (1+ depth)))
|
||||
(goto-char pnt))
|
||||
((looking-at ruby-block-beg-re)
|
||||
(and
|
||||
(or (not (looking-at "do\\>[^_]"))
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(not (looking-at ruby-non-block-do-re))))
|
||||
(or (bolp)
|
||||
(progn
|
||||
(forward-char -1)
|
||||
(setq w (char-after (point)))
|
||||
(not (or (eq ?_ w)
|
||||
(eq ?. w)))))
|
||||
(goto-char pnt)
|
||||
(setq w (char-after (point)))
|
||||
(not (eq ?_ w))
|
||||
(not (eq ?! w))
|
||||
(not (eq ?? w))
|
||||
(skip-chars-forward " \t")
|
||||
(if (not (eolp))
|
||||
(progn
|
||||
(goto-char (match-beginning 0))
|
||||
(if (looking-at ruby-modifier-re)
|
||||
(ruby-expr-beg 'modifier)
|
||||
t))
|
||||
t)
|
||||
(goto-char pnt)
|
||||
|
@ -423,7 +499,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(goto-char (cdr (nth 1 state)))
|
||||
(forward-word -1) ; skip back a keyword
|
||||
(cond
|
||||
((looking-at "do") ; iter block is a special case
|
||||
((looking-at "do\\>[^_]") ; iter block is a special case
|
||||
(cond
|
||||
((nth 3 state)
|
||||
(goto-char (nth 3 state))
|
||||
|
@ -621,12 +697,12 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
(setq font-lock-keywords ruby-font-lock-keywords)))
|
||||
|
||||
(defun ruby-font-lock-docs (limit)
|
||||
(if (re-search-forward "^=begin\\s *$" limit t)
|
||||
(if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t)
|
||||
(let (beg)
|
||||
(beginning-of-line)
|
||||
(setq beg (point))
|
||||
(forward-line 1)
|
||||
(if (re-search-forward "^=end\\s *$" limit t)
|
||||
(if (re-search-forward "^=end\\(\\s \\|$\\)" limit t)
|
||||
(progn
|
||||
(set-match-data (list beg (point)))
|
||||
t)))))
|
||||
|
@ -671,12 +747,13 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
"until"
|
||||
"when"
|
||||
"while"
|
||||
"yield"
|
||||
)
|
||||
"\\|")
|
||||
"\\)\\>[^_]")
|
||||
"\\)\\>\\([^_]\\|$\\)")
|
||||
2)
|
||||
;; variables
|
||||
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]"
|
||||
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b\\([^_]\\|$\\)"
|
||||
2 font-lock-variable-name-face)
|
||||
;; variables
|
||||
'("[$@].\\(\\w\\|_\\)*"
|
||||
|
@ -688,7 +765,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
||||
2 font-lock-type-face)
|
||||
;; functions
|
||||
'("^\\s *def\\s *\\([^( ]+\\)"
|
||||
'("^\\s *def\\s +\\([^( ]+\\)"
|
||||
1 font-lock-function-name-face)
|
||||
;; symbols
|
||||
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
|
||||
|
@ -707,8 +784,8 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
("^\\s *\\(require\\|load\\).*$" nil include)
|
||||
("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl)
|
||||
("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun)
|
||||
("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\)\\>[^_]" 1 defun)
|
||||
("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>[^_]" 1 keyword)
|
||||
("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\|yield\\)\\>\\([^_]\\|$\\)" 1 defun)
|
||||
("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>\\([^_]\\|$\\)" 1 keyword)
|
||||
("\\$\\(.\\|\\sw+\\)" nil type)
|
||||
("[$@].[a-zA-Z_0-9]*" nil struct)
|
||||
("^__END__" nil label))))
|
||||
|
|
22
re.c
22
re.c
|
@ -477,14 +477,20 @@ rb_reg_prepare_re(reg)
|
|||
{
|
||||
int need_recompile = 0;
|
||||
|
||||
/* case-flag not set for the object */
|
||||
if (!FL_TEST(reg, REG_IGNORECASE)) {
|
||||
int state = FL_TEST(reg, REG_CASESTATE);
|
||||
int state;
|
||||
|
||||
if ((ruby_ignorecase || state) && !(ruby_ignorecase && state)) {
|
||||
RBASIC(reg)->flags ^= REG_CASESTATE;
|
||||
need_recompile = 1;
|
||||
}
|
||||
rb_reg_check(re);
|
||||
state = FL_TEST(re, REG_CASESTATE);
|
||||
/* ignorecase status */
|
||||
if (ruby_ignorecase && !state) {
|
||||
FL_SET(re, REG_CASESTATE);
|
||||
RREGEXP(re)->ptr->options |= RE_OPTION_IGNORECASE;
|
||||
need_recompile = 1;
|
||||
}
|
||||
if (!ruby_ignorecase && state) {
|
||||
FL_UNSET(re, REG_CASESTATE);
|
||||
RREGEXP(re)->ptr->options &= ~RE_OPTION_IGNORECASE;
|
||||
need_recompile = 1;
|
||||
}
|
||||
|
||||
if (!FL_TEST(reg, KCODE_FIXED) &&
|
||||
|
@ -558,7 +564,7 @@ rb_reg_search(reg, str, pos, reverse)
|
|||
|
||||
if (result == -2) {
|
||||
rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len,
|
||||
"Stack overfow in regexp matcher", reg);
|
||||
"Stack overflow in regexp matcher", reg);
|
||||
}
|
||||
if (result < 0) {
|
||||
matchcache = match;
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
require 'rbconfig'
|
||||
include Config
|
||||
|
||||
unless File.exist? "./#{CONFIG['ruby_install_name']}"
|
||||
print "./#{CONFIG['ruby_install_name']} is not found.\n"
|
||||
print "Try `make' first, then `make test', please.\n"
|
||||
exit 0
|
||||
end
|
||||
|
||||
if File.exist? CONFIG['LIBRUBY_SO']
|
||||
case RUBY_PLATFORM
|
||||
when /-hpux/
|
||||
|
|
57
time.c
57
time.c
|
@ -195,6 +195,7 @@ time_arg(argc, argv, tm)
|
|||
VALUE v[6];
|
||||
int i;
|
||||
|
||||
MEMZERO(tm, struct tm, 1);
|
||||
if (argc == 10) {
|
||||
v[0] = argv[5];
|
||||
v[1] = argv[4];
|
||||
|
@ -202,6 +203,7 @@ time_arg(argc, argv, tm)
|
|||
v[3] = argv[2];
|
||||
v[4] = argv[1];
|
||||
v[5] = argv[0];
|
||||
tm->tm_isdst = RTEST(argv[9]) ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
rb_scan_args(argc, argv, "15", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5]);
|
||||
|
@ -258,9 +260,9 @@ static VALUE time_localtime _((VALUE));
|
|||
static VALUE time_get_tm _((VALUE, int));
|
||||
|
||||
static time_t
|
||||
make_time_t(tptr, fn)
|
||||
make_time_t(tptr, utc_or_local)
|
||||
struct tm *tptr;
|
||||
struct tm *(*fn)();
|
||||
int utc_or_local;
|
||||
{
|
||||
struct timeval tv;
|
||||
time_t oguess, guess;
|
||||
|
@ -272,21 +274,21 @@ make_time_t(tptr, fn)
|
|||
}
|
||||
guess = tv.tv_sec;
|
||||
|
||||
tm = (*fn)(&guess);
|
||||
tm = gmtime(&guess);
|
||||
if (!tm) goto error;
|
||||
t = tptr->tm_year;
|
||||
if (t < 69) goto out_of_range;
|
||||
while (diff = t - tm->tm_year) {
|
||||
oguess = guess;
|
||||
guess += diff * 364 * 24 * 3600;
|
||||
guess += diff * 363 * 24 * 3600;
|
||||
if (diff > 0 && guess <= oguess) goto out_of_range;
|
||||
tm = (*fn)(&guess);
|
||||
tm = gmtime(&guess);
|
||||
if (!tm) goto error;
|
||||
}
|
||||
t = tptr->tm_mon;
|
||||
while (diff = t - tm->tm_mon) {
|
||||
guess += diff * 27 * 24 * 3600;
|
||||
tm = (*fn)(&guess);
|
||||
tm = gmtime(&guess);
|
||||
if (!tm) goto error;
|
||||
if (tptr->tm_year != tm->tm_year) goto out_of_range;
|
||||
}
|
||||
|
@ -296,6 +298,49 @@ make_time_t(tptr, fn)
|
|||
guess += (tptr->tm_sec - tm->tm_sec);
|
||||
if (guess < 0) goto out_of_range;
|
||||
|
||||
if (!utc_or_local) { /* localtime zone adjust */
|
||||
#if defined(HAVE_DAYLIGHT)
|
||||
extern int daylight;
|
||||
extern long timezone;
|
||||
|
||||
localtime(&guess);
|
||||
guess += timezone + daylight;
|
||||
#else
|
||||
struct tm gt, lt;
|
||||
long tzsec;
|
||||
|
||||
t = 0;
|
||||
gt = *gmtime(&guess);
|
||||
lt = *localtime(&guess);
|
||||
tzsec = (gt.tm_min-lt.tm_min)*60 + (gt.tm_hour-lt.tm_hour)*3600;
|
||||
|
||||
if(lt.tm_year > gt.tm_year) {
|
||||
tzsec -= 24*3600;
|
||||
}
|
||||
else if(gt.tm_year > lt.tm_year) {
|
||||
tzsec += 24*3600;
|
||||
}
|
||||
else {
|
||||
tzsec += (gt.tm_yday - lt.tm_yday)*24*3600;
|
||||
}
|
||||
|
||||
if (lt.tm_isdst) tzsec += 3600;
|
||||
|
||||
guess += tzsec;
|
||||
if (guess < 0) {
|
||||
goto out_of_range;
|
||||
}
|
||||
tm = localtime(&guess);
|
||||
if (!tm) goto error;
|
||||
if (tm->tm_hour != tptr->tm_hour) {
|
||||
guess -= 3600;
|
||||
}
|
||||
#endif
|
||||
if (guess < 0) {
|
||||
goto out_of_range;
|
||||
}
|
||||
}
|
||||
|
||||
return guess;
|
||||
|
||||
out_of_range:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.4.4"
|
||||
#define RUBY_RELEASE_DATE "2000-06-05"
|
||||
#define RUBY_RELEASE_DATE "2000-06-13"
|
||||
#define RUBY_VERSION_CODE 144
|
||||
#define RUBY_RELEASE_CODE 20000605
|
||||
#define RUBY_RELEASE_CODE 20000613
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue