mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_mod_define_method): should have clear method cache.
* eval.c (rb_mod_define_method): should have raised exception for type error. * ruby.h: changed "extern INLINE" to "static inline". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2559f0d90d
commit
b60a365763
10 changed files with 124 additions and 40 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Tue Mar 27 15:00:54 2001 K.Kosako <kosako@sofnec.co.jp>
|
||||||
|
|
||||||
|
* eval.c (rb_mod_define_method): should have clear method cache.
|
||||||
|
|
||||||
|
* eval.c (rb_mod_define_method): should have raised exception for
|
||||||
|
type error.
|
||||||
|
|
||||||
|
Tue Mar 27 14:48:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.h: changed "extern INLINE" to "static inline".
|
||||||
|
|
||||||
Mon Mar 26 23:19:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Mar 26 23:19:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* time.c (rb_strftime): check whether strftime returns empty string.
|
* time.c (rb_strftime): check whether strftime returns empty string.
|
||||||
|
|
|
@ -378,9 +378,6 @@ AC_C_BIGENDIAN
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_CHAR_UNSIGNED
|
AC_C_CHAR_UNSIGNED
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
if test "$ac_cv_c_inline" = no; then
|
|
||||||
AC_DEFINE(NO_C_INLINE)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
|
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
|
||||||
[AC_TRY_RUN([
|
[AC_TRY_RUN([
|
||||||
|
|
3
eval.c
3
eval.c
|
@ -6730,6 +6730,7 @@ rb_mod_define_method(argc, argv, mod)
|
||||||
}
|
}
|
||||||
if (TYPE(body) != T_DATA) {
|
if (TYPE(body) != T_DATA) {
|
||||||
/* type error */
|
/* type error */
|
||||||
|
rb_raise(rb_eTypeError, "wrong argument type (expected Proc)");
|
||||||
}
|
}
|
||||||
if (RDATA(body)->dmark == (RUBY_DATA_FUNC)bm_mark) {
|
if (RDATA(body)->dmark == (RUBY_DATA_FUNC)bm_mark) {
|
||||||
rb_add_method(mod, id, NEW_DMETHOD(method_unbind(body)), NOEX_PUBLIC);
|
rb_add_method(mod, id, NEW_DMETHOD(method_unbind(body)), NOEX_PUBLIC);
|
||||||
|
@ -6739,8 +6740,10 @@ rb_mod_define_method(argc, argv, mod)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* type error */
|
/* type error */
|
||||||
|
rb_raise(rb_eTypeError, "wrong argument type (expected Proc)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rb_clear_cache_by_id(id);
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
104
ext/tk/lib/tk.rb
104
ext/tk/lib/tk.rb
|
@ -651,12 +651,76 @@ module TkCore
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module TkPackage
|
||||||
|
include TkCore
|
||||||
|
extend TkPackage
|
||||||
|
|
||||||
|
def forget(package)
|
||||||
|
tk_call('package', 'forget', package)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def names
|
||||||
|
tk_split_simplelist(tk_call('package', 'names'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def provide(package, version=nil)
|
||||||
|
if version
|
||||||
|
tk_call('package', 'provide', package, version)
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
tk_call('package', 'provide', package)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def present(package, version=None)
|
||||||
|
tk_call('package', 'present', package, version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def present_exact(package, version)
|
||||||
|
tk_call('package', 'present', '-exact', package, version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def require(package, version=None)
|
||||||
|
tk_call('package', 'require', package, version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def require_exact(package, version)
|
||||||
|
tk_call('package', 'require', '-exact', package, version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def versions(package)
|
||||||
|
tk_split_simplelist(tk_call('package', 'versions', package))
|
||||||
|
end
|
||||||
|
|
||||||
|
def vcompare(version1, version2)
|
||||||
|
Integer(tk_call('package', 'vcompare', version1, version2))
|
||||||
|
end
|
||||||
|
|
||||||
|
def vsatisfies(version1, version2)
|
||||||
|
bool(tk_call('package', 'vsatisfies', version1, version2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
include TkCore
|
include TkCore
|
||||||
extend Tk
|
extend Tk
|
||||||
|
|
||||||
TCL_VERSION = INTERP._invoke("info", "tclversion")
|
TCL_VERSION = INTERP._invoke("info", "tclversion")
|
||||||
TK_VERSION = INTERP._invoke("set", "tk_version")
|
TK_VERSION = INTERP._invoke("set", "tk_version")
|
||||||
|
|
||||||
|
TCL_PATCHLEVEL = INTERP._invoke("info", "patchlevel")
|
||||||
|
TK_PATCHLEVEL = INTERP._invoke("set", "tk_patchLevel")
|
||||||
|
|
||||||
|
TCL_LIBRARY = INTERP._invoke("set", "tcl_library")
|
||||||
|
TK_LIBRARY = INTERP._invoke("set", "tk_library")
|
||||||
|
LIBRARY = INTERP._invoke("info", "library")
|
||||||
|
|
||||||
|
TCL_PACKAGE_PATH = INTERP._invoke("set", "tcl_pkgPath")
|
||||||
|
AUTO_PATH = tk_split_simplelist(INTERP._invoke("set", "auto_path"))
|
||||||
|
|
||||||
|
PLATFORM = Hash[*tk_split_simplelist(INTERP._eval('array get tcl_platform'))]
|
||||||
|
|
||||||
JAPANIZED_TK = (INTERP._invoke("info", "commands", "kanji") != "")
|
JAPANIZED_TK = (INTERP._invoke("info", "commands", "kanji") != "")
|
||||||
|
|
||||||
def root
|
def root
|
||||||
|
@ -680,6 +744,10 @@ module Tk
|
||||||
tk_tcl2ruby(tk_call('focus', '-lastfor', win))
|
tk_tcl2ruby(tk_call('focus', '-lastfor', win))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def Tk.strictMotif(bool=None)
|
||||||
|
bool(tk_call('set', 'tk_strictMotif', bool))
|
||||||
|
end
|
||||||
|
|
||||||
def Tk.show_kinsoku(mode='both')
|
def Tk.show_kinsoku(mode='both')
|
||||||
begin
|
begin
|
||||||
if /^8\.*/ === TK_VERSION && JAPANIZED_TK
|
if /^8\.*/ === TK_VERSION && JAPANIZED_TK
|
||||||
|
@ -710,11 +778,11 @@ module Tk
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def toUTF8(str,encoding)
|
def Tk.toUTF8(str,encoding)
|
||||||
INTERP._toUTF8(str,encoding)
|
INTERP._toUTF8(str,encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fromUTF8(str,encoding)
|
def Tk.fromUTF8(str,encoding)
|
||||||
INTERP._fromUTF8(str,encoding)
|
INTERP._fromUTF8(str,encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1446,7 +1514,7 @@ module TkXIM
|
||||||
end
|
end
|
||||||
|
|
||||||
def useinputmethods(value=nil)
|
def useinputmethods(value=nil)
|
||||||
TkXIM.useinputmethods(self, value=nil)
|
TkXIM.useinputmethods(self, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
def imconfigure(window, slot, value=None)
|
def imconfigure(window, slot, value=None)
|
||||||
|
@ -2370,7 +2438,7 @@ class TkWindow<TkObject
|
||||||
|
|
||||||
def grid_propagate(mode=nil)
|
def grid_propagate(mode=nil)
|
||||||
if mode
|
if mode
|
||||||
tk_call('grid', 'propagate', epath, bool)
|
tk_call('grid', 'propagate', epath, mode)
|
||||||
else
|
else
|
||||||
bool(tk_call('grid', 'propagate', epath))
|
bool(tk_call('grid', 'propagate', epath))
|
||||||
end
|
end
|
||||||
|
@ -2708,8 +2776,16 @@ class TkScale<TkWindow
|
||||||
tk_call 'scale', path
|
tk_call 'scale', path
|
||||||
end
|
end
|
||||||
|
|
||||||
def get
|
def get(x=None, y=None)
|
||||||
number(tk_send('get'))
|
number(tk_send('get', x, y))
|
||||||
|
end
|
||||||
|
|
||||||
|
def coords(val=None)
|
||||||
|
tk_split_list(tk_send('coords', val))
|
||||||
|
end
|
||||||
|
|
||||||
|
def identify(x, y)
|
||||||
|
tk_send('identify', x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(val)
|
def set(val)
|
||||||
|
@ -2744,8 +2820,8 @@ class TkScrollbar<TkWindow
|
||||||
number(tk_send('fraction', x, y))
|
number(tk_send('fraction', x, y))
|
||||||
end
|
end
|
||||||
|
|
||||||
def identify(x=None, y=None)
|
def identify(x, y)
|
||||||
tk_send('fraction', x, y)
|
tk_send('identify', x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get
|
def get
|
||||||
|
@ -2760,6 +2836,10 @@ class TkScrollbar<TkWindow
|
||||||
def set(first, last)
|
def set(first, last)
|
||||||
tk_send "set", first, last
|
tk_send "set", first, last
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def activate(element=None)
|
||||||
|
tk_send('activate', element)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextWin<TkWindow
|
class TkTextWin<TkWindow
|
||||||
|
@ -3033,12 +3113,12 @@ class TkMenu<TkWindow
|
||||||
tk_send 'invoke', index
|
tk_send 'invoke', index
|
||||||
end
|
end
|
||||||
def insert(index, type, keys=nil)
|
def insert(index, type, keys=nil)
|
||||||
tk_send 'add', index, type, *hash_kv(keys)
|
tk_send 'insert', index, type, *hash_kv(keys)
|
||||||
end
|
end
|
||||||
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)
|
def popup(x, y, index=None)
|
||||||
tk_call 'tk_popup', path, x, y, index
|
tk_call 'tk_popup', path, x, y, index
|
||||||
end
|
end
|
||||||
def post(x, y)
|
def post(x, y)
|
||||||
|
@ -3128,12 +3208,12 @@ class TkMenu<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkMenuClone<TkMenu
|
class TkMenuClone<TkMenu
|
||||||
def initialize(parent, type=nil)
|
def initialize(parent, type=None)
|
||||||
unless parent.kind_of?(TkMenu)
|
unless parent.kind_of?(TkMenu)
|
||||||
fail ArgumentError, "parent must be TkMenu"
|
fail ArgumentError, "parent must be TkMenu"
|
||||||
end
|
end
|
||||||
@parent = parent
|
@parent = parent
|
||||||
install_win(@parent)
|
install_win(@parent.path)
|
||||||
tk_call @parent.path, 'clone', @path, type
|
tk_call @parent.path, 'clone', @path, type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -172,7 +172,7 @@ class TkCanvas<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def bbox(tagOrId, *tags)
|
def bbox(tagOrId, *tags)
|
||||||
list(tk_send('bbox', tagid(tagOrId), *tags))
|
list(tk_send('bbox', tagid(tagOrId), *tags.collect{|t| tagid(t)}))
|
||||||
end
|
end
|
||||||
|
|
||||||
def itembind(tag, context, cmd=Proc.new, args=nil)
|
def itembind(tag, context, cmd=Proc.new, args=nil)
|
||||||
|
@ -207,7 +207,7 @@ class TkCanvas<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(*args)
|
def delete(*args)
|
||||||
tk_send 'delete', *args
|
tk_send 'delete', *args.collect{|t| tagid(t)}
|
||||||
end
|
end
|
||||||
alias remove delete
|
alias remove delete
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ class TkCanvas<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def lower(tag, below=None)
|
def lower(tag, below=None)
|
||||||
tk_send 'lower', tagid(tag), below
|
tk_send 'lower', tagid(tag), tagid(below)
|
||||||
end
|
end
|
||||||
|
|
||||||
def move(tag, x, y)
|
def move(tag, x, y)
|
||||||
|
@ -387,7 +387,7 @@ class TkCanvas<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def raise(tag, above=None)
|
def raise(tag, above=None)
|
||||||
tk_send 'raise', tagid(tag), above
|
tk_send 'raise', tagid(tag), tagid(above)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scale(tag, x, y, xs, ys)
|
def scale(tag, x, y, xs, ys)
|
||||||
|
|
|
@ -136,7 +136,7 @@ class TkEntry<TkLabel
|
||||||
tk_send 'selection', 'from', index
|
tk_send 'selection', 'from', index
|
||||||
end
|
end
|
||||||
def selection_present()
|
def selection_present()
|
||||||
tk_send('selection', 'present') == 1
|
bool(tk_send('selection', 'present'))
|
||||||
end
|
end
|
||||||
def selection_range(s, e)
|
def selection_range(s, e)
|
||||||
tk_send 'selection', 'range', s, e
|
tk_send 'selection', 'range', s, e
|
||||||
|
|
|
@ -189,6 +189,14 @@ class TkText<TkTextWin
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mark_next(index)
|
||||||
|
tagid2obj(tk_send('mark', 'next', index))
|
||||||
|
end
|
||||||
|
|
||||||
|
def mark_previous(index)
|
||||||
|
tagid2obj(tk_send('mark', 'previous', index))
|
||||||
|
end
|
||||||
|
|
||||||
def window_names
|
def window_names
|
||||||
tk_send('window', 'names').collect{|elt|
|
tk_send('window', 'names').collect{|elt|
|
||||||
tagid2obj(elt)
|
tagid2obj(elt)
|
||||||
|
|
20
ruby.h
20
ruby.h
|
@ -541,18 +541,7 @@ EXTERN VALUE rb_eNameError;
|
||||||
EXTERN VALUE rb_eSyntaxError;
|
EXTERN VALUE rb_eSyntaxError;
|
||||||
EXTERN VALUE rb_eLoadError;
|
EXTERN VALUE rb_eLoadError;
|
||||||
|
|
||||||
#ifdef INLINE_DEFINE
|
static inline VALUE
|
||||||
#define INLINE
|
|
||||||
#else
|
|
||||||
#define INLINE inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern INLINE VALUE rb_class_of _((VALUE));
|
|
||||||
extern INLINE int rb_type _((VALUE));
|
|
||||||
extern INLINE int rb_special_const_p _((VALUE));
|
|
||||||
|
|
||||||
#if !defined(NO_C_INLINE) || defined(INLINE_DEFINE)
|
|
||||||
extern INLINE VALUE
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
rb_class_of(VALUE obj)
|
rb_class_of(VALUE obj)
|
||||||
#else
|
#else
|
||||||
|
@ -569,7 +558,7 @@ rb_class_of(obj)
|
||||||
return RBASIC(obj)->klass;
|
return RBASIC(obj)->klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern INLINE int
|
static inline int
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
rb_type(VALUE obj)
|
rb_type(VALUE obj)
|
||||||
#else
|
#else
|
||||||
|
@ -586,7 +575,7 @@ rb_type(obj)
|
||||||
return BUILTIN_TYPE(obj);
|
return BUILTIN_TYPE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern INLINE int
|
static inline int
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
rb_special_const_p(VALUE obj)
|
rb_special_const_p(VALUE obj)
|
||||||
#else
|
#else
|
||||||
|
@ -597,9 +586,6 @@ rb_special_const_p(obj)
|
||||||
if (SPECIAL_CONST_P(obj)) return Qtrue;
|
if (SPECIAL_CONST_P(obj)) return Qtrue;
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef INLINE
|
|
||||||
|
|
||||||
#include "intern.h"
|
#include "intern.h"
|
||||||
|
|
||||||
|
|
1
util.c
1
util.c
|
@ -16,7 +16,6 @@
|
||||||
#include "missing/file.h"
|
#include "missing/file.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INLINE_DEFINE
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.7.0"
|
#define RUBY_VERSION "1.7.0"
|
||||||
#define RUBY_RELEASE_DATE "2001-03-26"
|
#define RUBY_RELEASE_DATE "2001-03-27"
|
||||||
#define RUBY_VERSION_CODE 170
|
#define RUBY_VERSION_CODE 170
|
||||||
#define RUBY_RELEASE_CODE 20010326
|
#define RUBY_RELEASE_CODE 20010327
|
||||||
|
|
Loading…
Add table
Reference in a new issue