1
0
Fork 0
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:
matz 2000-06-13 09:51:02 +00:00
parent 1c940e6cdd
commit 1b47fa1097
18 changed files with 729 additions and 356 deletions

View file

@ -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> Fri Jun 9 01:05:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* regex.h: export re_mbctab properly on cygwin. * regex.h: export re_mbctab properly on cygwin.

4
config.guess vendored
View file

@ -969,10 +969,6 @@ EOF
*:Rhapsody:*:*) *:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:"Mac OS":*:*)
echo `uname -p`-apple-macos${UNAME_RELEASE}
exit 0 ;;
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2

2
config.sub vendored
View file

@ -910,7 +910,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ | -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. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \

477
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -43,12 +43,6 @@ AC_ARG_ENABLE(fat-binary,
TARGET_ARCHS="ppc i386" TARGET_ARCHS="ppc i386"
fi fi
;; ;;
macos*)
echo -n "MacOS X : "
if test "$TARGET_ARCHS" = "" ; then
TARGET_ARCHS="ppc i386"
fi
;;
nextstep*|openstep*) nextstep*|openstep*)
echo -n "NeXTSTEP/OPENSTEP: " echo -n "NeXTSTEP/OPENSTEP: "
if test "$TARGET_ARCHS" = "" ; then if test "$TARGET_ARCHS" = "" ; then
@ -146,7 +140,6 @@ case "$host_os" in
nextstep*) ;; nextstep*) ;;
openstep*) ;; openstep*) ;;
rhapsody*) ;; rhapsody*) ;;
macos*) ;;
human*) ac_cv_func_getpgrp_void=yes;; human*) ac_cv_func_getpgrp_void=yes;;
beos*) ;; beos*) ;;
cygwin*) ;; cygwin*) ;;
@ -401,7 +394,6 @@ if test "$with_dln_a_out" != yes; then
nextstep*) ;; nextstep*) ;;
openstep*) ;; openstep*) ;;
rhapsody*) ;; rhapsody*) ;;
macos*) ;;
human*) ;; human*) ;;
bsdi*) ;; bsdi*) ;;
cygwin*) ;; cygwin*) ;;
@ -481,10 +473,6 @@ if test "$with_dln_a_out" != yes; then
LDFLAGS="" LDFLAGS=""
DLDFLAGS="$ARCH_FLAG" DLDFLAGS="$ARCH_FLAG"
rb_cv_dlopen=yes ;; 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' aix*) LDSHARED='/usr/ccs/bin/ld'
XLDFLAGS='-Wl,-bE:ruby.imp' XLDFLAGS='-Wl,-bE:ruby.imp'
DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc' DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
@ -553,8 +541,6 @@ else
AC_DEFINE(DLEXT, ".bundle");; AC_DEFINE(DLEXT, ".bundle");;
rhapsody*) DLEXT=bundle rhapsody*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");; AC_DEFINE(DLEXT, ".bundle");;
macos*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");;
cygwin*) DLEXT=dll cygwin*) DLEXT=dll
AC_DEFINE(DLEXT, ".dll");; AC_DEFINE(DLEXT, ".dll");;
os2_emx*) DLEXT=dll os2_emx*) DLEXT=dll
@ -580,8 +566,6 @@ case "$host_os" in
STRIP='strip -A -n';; STRIP='strip -A -n';;
rhapsody*) rhapsody*)
STRIP='strip -A -n';; STRIP='strip -A -n';;
macos*)
STRIP='strip -A -n';;
esac esac
EXTSTATIC= EXTSTATIC=

View file

@ -503,7 +503,7 @@ def extmake(target)
$objs = nil $objs = nil
$local_flags = "" $local_flags = ""
case RUBY_PLATFORM case RUBY_PLATFORM
when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/ when /cygwin|beos|openstep|nextstep|rhapsody|i386-os2_emx/
$libs = "" $libs = ""
when /mswin32/ when /mswin32/
$LIBEXT = "lib" $LIBEXT = "lib"

View file

@ -457,6 +457,21 @@ module TkCore
_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg)) _get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
end 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) def appname(name=None)
tk_call('tk', 'appname', name) tk_call('tk', 'appname', name)
end end
@ -526,7 +541,7 @@ module TkCore
def tk_call(*args) def tk_call(*args)
print args.join(" "), "\n" if $DEBUG print args.join(" "), "\n" if $DEBUG
args.filter {|x|_get_eval_string(x)} args.filter{|x|_get_eval_string(x)}
args.compact! args.compact!
args.flatten! args.flatten!
begin begin
@ -772,6 +787,24 @@ class TkBindTag
end end
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 class TkVariable
include Tk include Tk
extend TkCore extend TkCore
@ -1151,6 +1184,31 @@ module TkKinput
end end
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 module TkWinfo
include Tk include Tk
extend Tk extend Tk
@ -1807,7 +1865,7 @@ class TkWindow<TkObject
self self
end end
def unpack(keys = nil) def unpack
tk_call 'pack', 'forget', epath tk_call 'pack', 'forget', epath
self self
end end
@ -1817,7 +1875,7 @@ class TkWindow<TkObject
self self
end end
def ungrid(keys = nil) def ungrid
tk_call 'grid', 'forget', epath tk_call 'grid', 'forget', epath
self self
end end
@ -1827,8 +1885,8 @@ class TkWindow<TkObject
self self
end end
def unplace(keys = nil) def unplace
tk_call 'place', 'forget', epath, *hash_kv(keys) tk_call 'place', 'forget', epath
self self
end end
alias place_forget unplace alias place_forget unplace
@ -1894,11 +1952,11 @@ class TkWindow<TkObject
end end
def lower(below=None) def lower(below=None)
tk_call 'lower', path, below tk_call 'lower', epath, below
self self
end end
def raise(above=None) def raise(above=None)
tk_call 'raise', path, above tk_call 'raise', epath, above
self self
end end
@ -1912,7 +1970,7 @@ class TkWindow<TkObject
end end
def destroy def destroy
tk_call 'destroy', path tk_call 'destroy', epath
if @cmdtbl if @cmdtbl
for id in @cmdtbl for id in @cmdtbl
uninstall_cmd id uninstall_cmd id
@ -1927,7 +1985,7 @@ class TkWindow<TkObject
alias wait wait_visibility alias wait wait_visibility
def wait_destroy def wait_destroy
tk_call 'tkwait', 'window', path tk_call 'tkwait', 'window', epath
end end
def bindtags(taglist=nil) def bindtags(taglist=nil)
@ -2259,6 +2317,41 @@ class TkListbox<TkTextWin
def selection_set(first, last=None) def selection_set(first, last=None)
tk_send 'selection', 'set', first, last tk_send 'selection', 'set', first, last
end 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 end
module TkTreatMenuEntryFont module TkTreatMenuEntryFont
@ -2397,6 +2490,9 @@ class TkMenu<TkWindow
def delete(index, last=None) def delete(index, last=None)
tk_send 'delete', index, last tk_send 'delete', index, last
end end
def popup(x, y, index=nil)
tk_call 'tk_popup', path, x, y, index
end
def post(x, y) def post(x, y)
tk_send 'post', x, y tk_send 'post', x, y
end end
@ -2451,6 +2547,34 @@ class TkMenu<TkWindow
end end
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 class TkMenubutton<TkLabel
WidgetClassNames['Menubutton'] = self WidgetClassNames['Menubutton'] = self
def TkMenubutton.to_eval def TkMenubutton.to_eval
@ -2461,6 +2585,71 @@ class TkMenubutton<TkLabel
end end
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 module TkComposite
include Tk include Tk
extend Tk extend Tk

View file

@ -217,7 +217,7 @@ class TkCanvas<TkWindow
def find(mode, *args) def find(mode, *args)
list(tk_send 'find', mode, *args).filter{|id| list(tk_send 'find', mode, *args).filter{|id|
TkcItem.id2obj(id) TkcItem.id2obj(self, id)
} }
end end
def find_above(target) def find_above(target)
@ -250,14 +250,14 @@ class TkCanvas<TkWindow
if ret == "" if ret == ""
nil nil
else else
TkcItem.id2obj(ret) TkcItem.id2obj(self, ret)
end end
end end
end end
def gettags(tagOrId) def gettags(tagOrId)
list(tk_send('gettags', tagid(tagOrId))).collect{|tag| list(tk_send('gettags', tagid(tagOrId))).collect{|tag|
TkcTag.id2obj(tag) TkcTag.id2obj(self, tag)
} }
end end
@ -478,6 +478,41 @@ module TkcTagAccess
def itemtype def itemtype
@c.itemtype @id @c.itemtype @id
end 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 end
class TkcTag<TkObject class TkcTag<TkObject
@ -485,8 +520,10 @@ class TkcTag<TkObject
CTagID_TBL = {} CTagID_TBL = {}
def TkcTag.id2obj(id) def TkcTag.id2obj(canvas, id)
CTagID_TBL[id]? CTagID_TBL[id]: id cpath = canvas.path
return id unless CTagID_TBL[cpath]
CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id
end end
Tk_CanvasTag_ID = ['ctag0000'] Tk_CanvasTag_ID = ['ctag0000']
@ -495,8 +532,10 @@ class TkcTag<TkObject
fail format("%s need to be TkCanvas", parent.inspect) fail format("%s need to be TkCanvas", parent.inspect)
end end
@c = parent @c = parent
@cpath = parent.path
@path = @id = Tk_CanvasTag_ID[0] @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 Tk_CanvasTag_ID[0] = Tk_CanvasTag_ID[0].succ
if mode if mode
tk_call @c.path, "addtag", @id, mode, *args tk_call @c.path, "addtag", @id, mode, *args
@ -508,7 +547,7 @@ class TkcTag<TkObject
def delete def delete
@c.delete @id @c.delete @id
CTagID_TBL[@id] = nil CTagID_TBL[@path][@id] = nil if CTagID_TBL[@path]
end end
alias remove delete alias remove delete
alias destroy delete alias destroy delete
@ -534,7 +573,7 @@ class TkcTag<TkObject
alias closest set_to_closest alias closest set_to_closest
def set_to_enclosed(x1, y1, x2, y2) 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 end
alias enclosed set_to_enclosed alias enclosed set_to_enclosed
@ -549,14 +588,40 @@ class TkcTag<TkObject
alias withtag set_to_withtag alias withtag set_to_withtag
end 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 class TkcTagAll<TkcTag
def initialize(parent) def initialize(parent)
if not parent.kind_of?(TkCanvas) if not parent.kind_of?(TkCanvas)
fail format("%s need to be TkCanvas", parent.inspect) fail format("%s need to be TkCanvas", parent.inspect)
end end
@c = parent @c = parent
@cpath = parent.path
@path = @id = 'all' @path = @id = 'all'
CTagID_TBL[@id] = self CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
CTagID_TBL[@cpath][@id] = self
end end
end end
@ -566,8 +631,10 @@ class TkcTagCurrent<TkcTag
fail format("%s need to be TkCanvas", parent.inspect) fail format("%s need to be TkCanvas", parent.inspect)
end end
@c = parent @c = parent
@cpath = parent.path
@path = @id = 'current' @path = @id = 'current'
CTagID_TBL[@id] = self CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
CTagID_TBL[@cpath][@id] = self
end end
end end
@ -578,8 +645,10 @@ class TkcGroup<TkcTag
fail format("%s need to be TkCanvas", parent.inspect) fail format("%s need to be TkCanvas", parent.inspect)
end end
@c = parent @c = parent
@cpath = parent.path
@path = @id = Tk_cGroup_ID[0] @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 Tk_cGroup_ID[0] = Tk_cGroup_ID[0].succ
add(*args) if args != [] add(*args) if args != []
end end
@ -597,7 +666,6 @@ class TkcGroup<TkcTag
end end
end end
class TkcItem<TkObject class TkcItem<TkObject
include TkcTagAccess include TkcTagAccess
@ -608,8 +676,10 @@ class TkcItem<TkObject
CItemTypeToClass[type] CItemTypeToClass[type]
end end
def TkcItem.id2obj(id) def TkcItem.id2obj(canvas, id)
CItemID_TBL[id]? CItemID_TBL[id]: id cpath = canvas.path
return id unless CItemID_TBL[cpath]
CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
end end
def initialize(parent, *args) def initialize(parent, *args)
@ -622,7 +692,8 @@ class TkcItem<TkObject
keys = args.pop keys = args.pop
end end
@id = create_self(*args).to_i ;# 'canvas item id' is integer number @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 if keys
# tk_call @path, 'itemconfigure', @id, *hash_kv(keys) # tk_call @path, 'itemconfigure', @id, *hash_kv(keys)
configure(keys) if keys configure(keys) if keys
@ -636,7 +707,7 @@ class TkcItem<TkObject
def delete def delete
@c.delete @id @c.delete @id
CItemID_TBL[@id] = nil CItemID_TBL[@path][@id] = nil if CItemID_TBL[@path]
end end
alias remove delete alias remove delete
alias destroy delete alias destroy delete
@ -768,6 +839,10 @@ class TkPhotoImage<TkImage
tk_send 'copy', source, *args tk_send 'copy', source, *args
end end
def data(keys=nil)
tk_send 'data', *hash_kv(keys)
end
def get(x, y) def get(x, y)
tk_send 'get', x, y tk_send 'get', x, y
end end

View file

@ -59,6 +59,14 @@ class TkEntry<TkLabel
tk_send 'selection', 'to', index tk_send 'selection', 'to', index
end end
def validate
if tk_send('validate') == '0'
false
else
true
end
end
def value def value
tk_send 'get' tk_send 'get'
end end

View file

@ -49,7 +49,7 @@ class TkFont
def TkFont.create_copy(font) def TkFont.create_copy(font)
keys = {} 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) new_font = TkFont.new(font.latin_font, font.kanji_font, keys)
end end
@ -123,17 +123,13 @@ class TkFont
################################### ###################################
private 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]) @id = format("@font%.4d", Tk_FontID[0])
Tk_FontID[0] += 1 Tk_FontID[0] += 1
Tk_FontNameTBL[@id] = self Tk_FontNameTBL[@id] = self
ltn = DEFAULT_LATIN_FONT_NAME unless ltn
create_latinfont(ltn) create_latinfont(ltn)
knj = DEFAULT_KANJI_FONT_NAME unless knj
create_kanjifont(knj) create_kanjifont(knj)
create_compoundfont(keys) create_compoundfont(keys)
end end
@ -714,7 +710,7 @@ class TkFont
if winobj.kind_of? TkText if winobj.kind_of? TkText
ret.push([winobj, winobj.tagid2obj(tag)]) ret.push([winobj, winobj.tagid2obj(tag)])
elsif winobj.kind_of? TkCanvas 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]) ret.push([winobj, tagobj])
elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
ret.push([winobj, tagobj]) ret.push([winobj, tagobj])
@ -822,7 +818,7 @@ class TkFont
if JAPANIZED_TK if JAPANIZED_TK
configinfo_core(@latinfont, slot) configinfo_core(@latinfont, slot)
else else
configure(slot, value) configinfo(slot)
end end
end end

10
io.c
View file

@ -582,7 +582,10 @@ rb_io_gets_internal(argc, argv, io)
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f) && errno == EINTR) continue; if (ferror(f)) {
ig (errno == EINTR) continue;
rb_sys_fail(fptr->path);
}
break; break;
} }
if ((*bp++ = c) == newline) break; if ((*bp++ = c) == newline) break;
@ -669,7 +672,10 @@ rb_io_gets(io)
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f) && errno == EINTR) continue; if (ferror(f)) {
ig (errno == EINTR) continue;
rb_sys_fail(fptr->path);
}
break; break;
} }
if ((*bp++ = c) == '\n') break; if ((*bp++ = c) == '\n') break;

View file

@ -84,10 +84,6 @@ class String
h h
end end
def bsquote(str)
str.gsub(/\\/, '\\\\\\\\')
end
HashCache = {} HashCache = {}
TrPatternCache = {} TrPatternCache = {}
DeletePatternCache = {} DeletePatternCache = {}
@ -98,7 +94,7 @@ class String
def tr!(from, to) def tr!(from, to)
return self.delete!(from) if to.length == 0 return self.delete!(from) if to.length == 0
pattern = TrPatternCache[from] ||= /[#{bsquote(from)}]/ pattern = TrPatternCache[from] ||= /[#{Regexp::quote(from)}]/
if from[0] == ?^ if from[0] == ?^
last = /.$/.match(to)[0] last = /.$/.match(to)[0]
self.gsub!(pattern, last) self.gsub!(pattern, last)
@ -113,7 +109,7 @@ class String
end end
def delete!(del) def delete!(del)
self.gsub!(DeletePatternCache[del] ||= /[#{bsquote(del)}]+/, '') self.gsub!(DeletePatternCache[del] ||= /[#{Regexp::quote(del)}]+/, '')
end end
def delete(del) def delete(del)
@ -123,7 +119,7 @@ class String
def squeeze!(del=nil) def squeeze!(del=nil)
pattern = pattern =
if del if del
SqueezePatternCache[del] ||= /([#{bsquote(del)}])\1+/ SqueezePatternCache[del] ||= /([#{Regexp::quote(del)}])\1+/
else else
/(.|\n)\1+/ /(.|\n)\1+/
end end
@ -137,7 +133,7 @@ class String
def tr_s!(from, to) def tr_s!(from, to)
return self.delete!(from) if to.length == 0 return self.delete!(from) if to.length == 0
pattern = SqueezePatternCache[from] ||= /([#{bsquote(from)}])\1+"/ pattern = SqueezePatternCache[from] ||= /([#{Regexp::quote(from)}])\1+"/
if from[0] == ?^ if from[0] == ?^
last = /.$/.match(to)[0] last = /.$/.match(to)[0]
self.gsub!(pattern, last) self.gsub!(pattern, last)
@ -163,5 +159,9 @@ class String
self.delete("^#{str}").jlength self.delete("^#{str}").jlength
end end
def each_char(&block)
scan(/.|\n/, &block)
end
end end
$VERBOSE = $vsave $VERBOSE = $vsave

View file

@ -88,14 +88,14 @@ class PStore
file = File::open(@filename, "r+") file = File::open(@filename, "r+")
orig = true orig = true
else else
@table = {}
file = File::open(@filename, "w+") file = File::open(@filename, "w+")
Marshal::dump(@table, file)
end end
file.flock(File::LOCK_EX) file.flock(File::LOCK_EX)
if orig if orig
File::copy @filename, backup File::copy @filename, backup
@table = Marshal::load(file) @table = Marshal::load(file)
else
@table = {}
end end
begin begin
catch(:pstore_abort_transaction) do catch(:pstore_abort_transaction) do

View file

@ -17,6 +17,10 @@
"class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin\\|do" "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 (defconst ruby-indent-beg-re
"\\(\\s *\\(class\\|module\\|def\\)\\)\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin" "\\(\\s *\\(class\\|module\\|def\\)\\)\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
) )
@ -114,6 +118,31 @@
(defvar ruby-indent-level 2 (defvar ruby-indent-level 2
"*Indentation of ruby statements.") "*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 () (defun ruby-mode-variables ()
(set-syntax-table ruby-mode-syntax-table) (set-syntax-table ruby-mode-syntax-table)
(setq local-abbrev-table ruby-mode-abbrev-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) (setq major-mode 'ruby-mode)
(ruby-mode-variables) (ruby-mode-variables)
(make-local-variable 'imenu-create-index-function)
(setq imenu-create-index-function 'ruby-imenu-create-index)
(run-hooks 'ruby-mode-hook)) (run-hooks 'ruby-mode-hook))
(defun ruby-current-indentation () (defun ruby-current-indentation ()
@ -172,8 +204,7 @@ The variable ruby-indent-level controls the amount of indentation.
(defun ruby-indent-to (x) (defun ruby-indent-to (x)
(if x (if x
(let (shift top beg) (let (shift top beg)
(and (< x 0) (and (< x 0) (error "invalid nest"))
(error "invalid nest"))
(setq shift (current-column)) (setq shift (current-column))
(beginning-of-line) (beginning-of-line)
(setq beg (point)) (setq beg (point))
@ -191,7 +222,7 @@ The variable ruby-indent-level controls the amount of indentation.
(indent-to x) (indent-to x)
(move-to-column (+ x shift)))))) (move-to-column (+ x shift))))))
(defun ruby-expr-beg (&optional modifier) (defun ruby-expr-beg (&optional option)
(save-excursion (save-excursion
(if (looking-at "\\?") (if (looking-at "\\?")
(progn (progn
@ -203,10 +234,11 @@ The variable ruby-indent-level controls the amount of indentation.
(or (bolp) (or (bolp)
(looking-at ruby-operator-re) (looking-at ruby-operator-re)
(looking-at "[\\[({]") (looking-at "[\\[({]")
(and (not modifier) (looking-at "[!?]")) (and (not (eq option 'modifier))
(looking-at "[!?]"))
(and (looking-at ruby-symbol-re) (and (looking-at ruby-symbol-re)
(forward-word -1) (skip-chars-backward ruby-symbol-chars)
(if (and (not modifier) (bolp)) (if (and (not (eq option 'modifier)) (bolp))
t t
(if (or (looking-at ruby-block-beg-re) (if (or (looking-at ruby-block-beg-re)
(looking-at ruby-block-op-re) (looking-at ruby-block-op-re)
@ -214,7 +246,8 @@ The variable ruby-indent-level controls the amount of indentation.
(progn (progn
(goto-char (match-end 0)) (goto-char (match-end 0))
(looking-at "\\>")) (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) (defun ruby-parse-region (start end)
(let ((indent-point end) (let ((indent-point end)
@ -250,7 +283,7 @@ The variable ruby-indent-level controls the amount of indentation.
((looking-at "/") ((looking-at "/")
(cond (cond
((and (not (eobp)) (ruby-expr-beg)) ((and (not (eobp)) (ruby-expr-beg))
(if (re-search-forward "[^\\]/" indent-point t) (if (re-search-forward "[^\\]\\(\\\\\\\\\\)*/" indent-point t)
nil nil
(setq in-string (point)) (setq in-string (point))
(goto-char indent-point))) (goto-char indent-point)))
@ -258,18 +291,24 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char pnt)))) (goto-char pnt))))
((looking-at "%") ((looking-at "%")
(cond (cond
((and (not (eobp)) (ruby-expr-beg) ((and (not (eobp)) (ruby-expr-beg 'expr-arg)
(not (looking-at "%=")) (not (looking-at "%="))
(looking-at "%[Qqrxw]?\\(.\\)")) (looking-at "%[Qqrxw]?\\(.\\)"))
(goto-char (match-beginning 1))
(setq w (buffer-substring (match-beginning 1) (setq w (buffer-substring (match-beginning 1)
(match-end 1))) (match-end 1)))
(cond (cond
((string= w "[") (setq w "]")) ((string= w "[") (setq w "\\]"))
((string= w "{") (setq w "}")) ((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)) ((member w '("*" "." "+" "?" "^" "$"))
(if (search-forward w indent-point t) (setq w (concat "\\" w))))
(if (re-search-forward
(if (string= w "\\")
"\\\\[^\\]*\\\\"
(concat "[^\\]\\(\\\\\\\\\\)*" w))
indent-point t)
nil nil
(setq in-string (point)) (setq in-string (point))
(goto-char indent-point))) (goto-char indent-point)))
@ -313,7 +352,9 @@ The variable ruby-indent-level controls the amount of indentation.
(if (or (and (not (bolp)) (if (or (and (not (bolp))
(progn (progn
(forward-char -1) (forward-char -1)
(eq ?_ (char-after (point))))) (setq w (char-after (point)))
(or (eq ?_ w)
(eq ?. w))))
(progn (progn
(goto-char pnt) (goto-char pnt)
(setq w (char-after (point))) (setq w (char-after (point)))
@ -335,10 +376,16 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char (match-end 0))) (goto-char (match-end 0)))
((looking-at ruby-block-beg-re) ((looking-at ruby-block-beg-re)
(and (and
(or (not (looking-at "do\\>[^_]"))
(save-excursion
(back-to-indentation)
(not (looking-at ruby-non-block-do-re))))
(or (bolp) (or (bolp)
(progn (progn
(forward-char -1) (forward-char -1)
(not (eq ?_ (char-after (point)))))) (setq w (char-after (point)))
(not (or (eq ?_ w)
(eq ?. w)))))
(goto-char pnt) (goto-char pnt)
(setq w (char-after (point))) (setq w (char-after (point)))
(not (eq ?_ w)) (not (eq ?_ w))
@ -349,7 +396,36 @@ The variable ruby-indent-level controls the amount of indentation.
(progn (progn
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(if (looking-at ruby-modifier-re) (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))
t) t)
(goto-char pnt) (goto-char pnt)
@ -423,7 +499,7 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char (cdr (nth 1 state))) (goto-char (cdr (nth 1 state)))
(forward-word -1) ; skip back a keyword (forward-word -1) ; skip back a keyword
(cond (cond
((looking-at "do") ; iter block is a special case ((looking-at "do\\>[^_]") ; iter block is a special case
(cond (cond
((nth 3 state) ((nth 3 state)
(goto-char (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))) (setq font-lock-keywords ruby-font-lock-keywords)))
(defun ruby-font-lock-docs (limit) (defun ruby-font-lock-docs (limit)
(if (re-search-forward "^=begin\\s *$" limit t) (if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t)
(let (beg) (let (beg)
(beginning-of-line) (beginning-of-line)
(setq beg (point)) (setq beg (point))
(forward-line 1) (forward-line 1)
(if (re-search-forward "^=end\\s *$" limit t) (if (re-search-forward "^=end\\(\\s \\|$\\)" limit t)
(progn (progn
(set-match-data (list beg (point))) (set-match-data (list beg (point)))
t))))) t)))))
@ -671,12 +747,13 @@ An end of a defun is found by moving forward from the beginning of one."
"until" "until"
"when" "when"
"while" "while"
"yield"
) )
"\\|") "\\|")
"\\)\\>[^_]") "\\)\\>\\([^_]\\|$\\)")
2) 2)
;; variables ;; variables
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]" '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b\\([^_]\\|$\\)"
2 font-lock-variable-name-face) 2 font-lock-variable-name-face)
;; variables ;; variables
'("[$@].\\(\\w\\|_\\)*" '("[$@].\\(\\w\\|_\\)*"
@ -688,7 +765,7 @@ An end of a defun is found by moving forward from the beginning of one."
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
2 font-lock-type-face) 2 font-lock-type-face)
;; functions ;; functions
'("^\\s *def\\s *\\([^( ]+\\)" '("^\\s *def\\s +\\([^( ]+\\)"
1 font-lock-function-name-face) 1 font-lock-function-name-face)
;; symbols ;; symbols
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b" '("\\(^\\|[^:]\\)\\(:\\(\\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 *\\(require\\|load\\).*$" nil include)
("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl) ("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl)
("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun) ("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun)
("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\)\\>[^_]" 1 defun) ("[^_]\\<\\(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) ("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>\\([^_]\\|$\\)" 1 keyword)
("\\$\\(.\\|\\sw+\\)" nil type) ("\\$\\(.\\|\\sw+\\)" nil type)
("[$@].[a-zA-Z_0-9]*" nil struct) ("[$@].[a-zA-Z_0-9]*" nil struct)
("^__END__" nil label)))) ("^__END__" nil label))))

18
re.c
View file

@ -477,14 +477,20 @@ rb_reg_prepare_re(reg)
{ {
int need_recompile = 0; int need_recompile = 0;
/* case-flag not set for the object */ int state;
if (!FL_TEST(reg, REG_IGNORECASE)) {
int state = FL_TEST(reg, REG_CASESTATE);
if ((ruby_ignorecase || state) && !(ruby_ignorecase && state)) { rb_reg_check(re);
RBASIC(reg)->flags ^= REG_CASESTATE; 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; 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) && if (!FL_TEST(reg, KCODE_FIXED) &&
@ -558,7 +564,7 @@ rb_reg_search(reg, str, pos, reverse)
if (result == -2) { if (result == -2) {
rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len, rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len,
"Stack overfow in regexp matcher", reg); "Stack overflow in regexp matcher", reg);
} }
if (result < 0) { if (result < 0) {
matchcache = match; matchcache = match;

View file

@ -3,6 +3,12 @@
require 'rbconfig' require 'rbconfig'
include Config 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'] if File.exist? CONFIG['LIBRUBY_SO']
case RUBY_PLATFORM case RUBY_PLATFORM
when /-hpux/ when /-hpux/

57
time.c
View file

@ -195,6 +195,7 @@ time_arg(argc, argv, tm)
VALUE v[6]; VALUE v[6];
int i; int i;
MEMZERO(tm, struct tm, 1);
if (argc == 10) { if (argc == 10) {
v[0] = argv[5]; v[0] = argv[5];
v[1] = argv[4]; v[1] = argv[4];
@ -202,6 +203,7 @@ time_arg(argc, argv, tm)
v[3] = argv[2]; v[3] = argv[2];
v[4] = argv[1]; v[4] = argv[1];
v[5] = argv[0]; v[5] = argv[0];
tm->tm_isdst = RTEST(argv[9]) ? 1 : 0;
} }
else { else {
rb_scan_args(argc, argv, "15", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5]); 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 VALUE time_get_tm _((VALUE, int));
static time_t static time_t
make_time_t(tptr, fn) make_time_t(tptr, utc_or_local)
struct tm *tptr; struct tm *tptr;
struct tm *(*fn)(); int utc_or_local;
{ {
struct timeval tv; struct timeval tv;
time_t oguess, guess; time_t oguess, guess;
@ -272,21 +274,21 @@ make_time_t(tptr, fn)
} }
guess = tv.tv_sec; guess = tv.tv_sec;
tm = (*fn)(&guess); tm = gmtime(&guess);
if (!tm) goto error; if (!tm) goto error;
t = tptr->tm_year; t = tptr->tm_year;
if (t < 69) goto out_of_range; if (t < 69) goto out_of_range;
while (diff = t - tm->tm_year) { while (diff = t - tm->tm_year) {
oguess = guess; oguess = guess;
guess += diff * 364 * 24 * 3600; guess += diff * 363 * 24 * 3600;
if (diff > 0 && guess <= oguess) goto out_of_range; if (diff > 0 && guess <= oguess) goto out_of_range;
tm = (*fn)(&guess); tm = gmtime(&guess);
if (!tm) goto error; if (!tm) goto error;
} }
t = tptr->tm_mon; t = tptr->tm_mon;
while (diff = t - tm->tm_mon) { while (diff = t - tm->tm_mon) {
guess += diff * 27 * 24 * 3600; guess += diff * 27 * 24 * 3600;
tm = (*fn)(&guess); tm = gmtime(&guess);
if (!tm) goto error; if (!tm) goto error;
if (tptr->tm_year != tm->tm_year) goto out_of_range; 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); guess += (tptr->tm_sec - tm->tm_sec);
if (guess < 0) goto out_of_range; 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; return guess;
out_of_range: out_of_range:

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.4.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_VERSION_CODE 144
#define RUBY_RELEASE_CODE 20000605 #define RUBY_RELEASE_CODE 20000613