matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8f54a9b470
commit
39563af994
33
ChangeLog
33
ChangeLog
@ -1,7 +1,36 @@
|
|||||||
|
Mon Nov 20 13:45:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_eval): should treat class variables specially in a
|
||||||
|
method defined in the singleton class.
|
||||||
|
|
||||||
Mon Nov 20 10:20:21 2000 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Nov 20 10:20:21 2000 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* dir.c, win32/win32.c, ruby.h: add rb_iglob().
|
* dir.c, win32/win32.c, ruby.h: add rb_iglob().
|
||||||
|
|
||||||
|
Mon Nov 20 00:18:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_subseq): should return nil for outbound start
|
||||||
|
index.
|
||||||
|
|
||||||
|
* marshal.c (marshal_load): show format versions explicitly when
|
||||||
|
format version mismatch happens.
|
||||||
|
|
||||||
|
Sun Nov 19 06:13:24 2000 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
|
* marshal.c: use long for string/array length.
|
||||||
|
|
||||||
|
* pack.c (swaps): use bit-or(|) instead of plus(+).
|
||||||
|
|
||||||
|
* pack.c (swapl): ditto.
|
||||||
|
|
||||||
|
Sat Nov 18 15:18:16 2000 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
|
* array.c (rb_ary_replace): array size should be in long.
|
||||||
|
|
||||||
|
* array.c (rb_ary_concat): ditto.
|
||||||
|
|
||||||
|
* array.c (rb_ary_hash): ditto.
|
||||||
|
|
||||||
Sat Nov 18 14:07:20 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
Sat Nov 18 14:07:20 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
* lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n"
|
* lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n"
|
||||||
@ -40,7 +69,7 @@ Thu Nov 16 23:06:07 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||||||
* lib/net/http.rb: not check Connection:/Proxy-Connection;
|
* lib/net/http.rb: not check Connection:/Proxy-Connection;
|
||||||
always read until eof.
|
always read until eof.
|
||||||
|
|
||||||
* lib/net/protocol: detects and catches "break" from block.
|
* lib/net/protocol.rb: detects and catches "break" from block.
|
||||||
|
|
||||||
Thu Nov 16 16:32:45 2000 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
|
Thu Nov 16 16:32:45 2000 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
|
||||||
|
|
||||||
@ -266,7 +295,7 @@ Mon Oct 16 14:06:00 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||||||
|
|
||||||
* pack.c (I32,U32): 32 bit sized integer.
|
* pack.c (I32,U32): 32 bit sized integer.
|
||||||
|
|
||||||
* pack.c (OFF16,OFF32B): big endien offset for network byteorder.
|
* pack.c (OFF16,OFF32B): big endian offset for network byteorder.
|
||||||
|
|
||||||
Mon Oct 16 06:39:32 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
Mon Oct 16 06:39:32 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
|
20
array.c
20
array.c
@ -22,7 +22,7 @@ VALUE rb_cArray;
|
|||||||
void
|
void
|
||||||
rb_mem_clear(mem, size)
|
rb_mem_clear(mem, size)
|
||||||
register VALUE *mem;
|
register VALUE *mem;
|
||||||
register size_t size;
|
register long size;
|
||||||
{
|
{
|
||||||
while (size--) {
|
while (size--) {
|
||||||
*mem++ = Qnil;
|
*mem++ = Qnil;
|
||||||
@ -32,7 +32,7 @@ rb_mem_clear(mem, size)
|
|||||||
static void
|
static void
|
||||||
memfill(mem, size, val)
|
memfill(mem, size, val)
|
||||||
register VALUE *mem;
|
register VALUE *mem;
|
||||||
register size_t size;
|
register long size;
|
||||||
register VALUE val;
|
register VALUE val;
|
||||||
{
|
{
|
||||||
while (size--) {
|
while (size--) {
|
||||||
@ -400,11 +400,8 @@ rb_ary_subseq(ary, beg, len)
|
|||||||
VALUE ary2;
|
VALUE ary2;
|
||||||
|
|
||||||
if (beg > RARRAY(ary)->len) return Qnil;
|
if (beg > RARRAY(ary)->len) return Qnil;
|
||||||
if (beg < 0) {
|
if (beg < 0 || len < 0) return Qnil;
|
||||||
len += beg;
|
|
||||||
beg = 0;
|
|
||||||
}
|
|
||||||
if (len < 0) return Qnil;
|
|
||||||
if (beg + len > RARRAY(ary)->len) {
|
if (beg + len > RARRAY(ary)->len) {
|
||||||
len = RARRAY(ary)->len - beg;
|
len = RARRAY(ary)->len - beg;
|
||||||
}
|
}
|
||||||
@ -532,7 +529,7 @@ rb_ary_replace(ary, beg, len, rpl)
|
|||||||
VALUE ary, rpl;
|
VALUE ary, rpl;
|
||||||
long beg, len;
|
long beg, len;
|
||||||
{
|
{
|
||||||
int rlen;
|
long rlen;
|
||||||
|
|
||||||
if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len);
|
if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len);
|
||||||
if (beg < 0) {
|
if (beg < 0) {
|
||||||
@ -1254,8 +1251,8 @@ VALUE
|
|||||||
rb_ary_concat(x, y)
|
rb_ary_concat(x, y)
|
||||||
VALUE x, y;
|
VALUE x, y;
|
||||||
{
|
{
|
||||||
int xlen = RARRAY(x)->len;
|
long xlen = RARRAY(x)->len;
|
||||||
int ylen;
|
long ylen;
|
||||||
|
|
||||||
y = to_ary(y);
|
y = to_ary(y);
|
||||||
ylen = RARRAY(y)->len;
|
ylen = RARRAY(y)->len;
|
||||||
@ -1371,7 +1368,8 @@ rb_ary_hash(ary)
|
|||||||
VALUE ary;
|
VALUE ary;
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
int n, h;
|
VALUE n;
|
||||||
|
long h;
|
||||||
|
|
||||||
h = RARRAY(ary)->len;
|
h = RARRAY(ary)->len;
|
||||||
for (i=0; i<RARRAY(ary)->len; i++) {
|
for (i=0; i<RARRAY(ary)->len; i++) {
|
||||||
|
12
eval.c
12
eval.c
@ -2594,18 +2594,20 @@ rb_eval(self, n)
|
|||||||
rb_const_set(ruby_class, node->nd_vid, result);
|
rb_const_set(ruby_class, node->nd_vid, result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_CVASGN2:
|
|
||||||
result = rb_eval(self, node->nd_value);
|
|
||||||
rb_cvar_set_singleton(self, node->nd_vid, result);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NODE_CVDECL:
|
case NODE_CVDECL:
|
||||||
if (NIL_P(ruby_cbase)) {
|
if (NIL_P(ruby_cbase)) {
|
||||||
rb_raise(rb_eTypeError, "no class/module to define class variable");
|
rb_raise(rb_eTypeError, "no class/module to define class variable");
|
||||||
}
|
}
|
||||||
|
if (!FL_TEST(ruby_cbase, FL_SINGLETON)) {
|
||||||
result = rb_eval(self, node->nd_value);
|
result = rb_eval(self, node->nd_value);
|
||||||
rb_cvar_declare(ruby_cbase, node->nd_vid, result);
|
rb_cvar_declare(ruby_cbase, node->nd_vid, result);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
case NODE_CVASGN2:
|
||||||
|
result = rb_eval(self, node->nd_value);
|
||||||
|
rb_cvar_set_singleton(self, node->nd_vid, result);
|
||||||
|
break;
|
||||||
|
|
||||||
case NODE_LVAR:
|
case NODE_LVAR:
|
||||||
if (ruby_scope->local_vars == 0) {
|
if (ruby_scope->local_vars == 0) {
|
||||||
|
@ -269,40 +269,61 @@ module TkComm
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
def initialize(seq,b,f,h,k,s,t,w,x,y,aa,ee,kk,nn,ww,tt,xx,yy)
|
def initialize(seq,a,b,c,d,f,h,k,m,o,p,s,t,w,x,y,
|
||||||
|
aa,bb,dd,ee,kk,nn,rr,ss,tt,ww,xx,yy)
|
||||||
@serial = seq
|
@serial = seq
|
||||||
|
@above = a
|
||||||
@num = b
|
@num = b
|
||||||
|
@count = c
|
||||||
|
@detail = d
|
||||||
@focus = (f == 1)
|
@focus = (f == 1)
|
||||||
@height = h
|
@height = h
|
||||||
@keycode = k
|
@keycode = k
|
||||||
|
@mode = m
|
||||||
|
@override = (o == 1)
|
||||||
|
@place = p
|
||||||
@state = s
|
@state = s
|
||||||
@time = t
|
@time = t
|
||||||
@width = w
|
@width = w
|
||||||
@x = x
|
@x = x
|
||||||
@y = y
|
@y = y
|
||||||
@char = aa
|
@char = aa
|
||||||
|
@borderwidth = bb
|
||||||
|
@wheel_delta = dd
|
||||||
@send_event = (ee == 1)
|
@send_event = (ee == 1)
|
||||||
@keysym = kk
|
@keysym = kk
|
||||||
@keysym_num = nn
|
@keysym_num = nn
|
||||||
|
@rootwin_id = rr
|
||||||
|
@subwindow = ss
|
||||||
@type = tt
|
@type = tt
|
||||||
@widget = ww
|
@widget = ww
|
||||||
@x_root = xx
|
@x_root = xx
|
||||||
@y_root = yy
|
@y_root = yy
|
||||||
end
|
end
|
||||||
attr :serial
|
attr :serial
|
||||||
|
attr :above
|
||||||
attr :num
|
attr :num
|
||||||
|
attr :count
|
||||||
|
attr :detail
|
||||||
attr :focus
|
attr :focus
|
||||||
attr :height
|
attr :height
|
||||||
attr :keycode
|
attr :keycode
|
||||||
|
attr :mode
|
||||||
|
attr :override
|
||||||
|
attr :place
|
||||||
attr :state
|
attr :state
|
||||||
attr :time
|
attr :time
|
||||||
attr :width
|
attr :width
|
||||||
attr :x
|
attr :x
|
||||||
attr :y
|
attr :y
|
||||||
attr :char
|
attr :char
|
||||||
|
attr :borderwidth
|
||||||
|
attr :wheel_delta
|
||||||
attr :send_event
|
attr :send_event
|
||||||
attr :keysym
|
attr :keysym
|
||||||
attr :keysym_num
|
attr :keysym_num
|
||||||
|
attr :rootwin_id
|
||||||
|
attr :subwindow
|
||||||
attr :type
|
attr :type
|
||||||
attr :widget
|
attr :widget
|
||||||
attr :x_root
|
attr :x_root
|
||||||
@ -319,7 +340,8 @@ module TkComm
|
|||||||
id = install_cmd(proc{|arg|
|
id = install_cmd(proc{|arg|
|
||||||
TkUtil.eval_cmd cmd, Event.new(*arg)
|
TkUtil.eval_cmd cmd, Event.new(*arg)
|
||||||
})
|
})
|
||||||
id + ' %# %b %f %h %k %s %t %w %x %y %A %E %K %N %W %T %X %Y'
|
id + ' %# %a %b %c %d %f %h %k %m %o %p %s %t %w %x %y' +
|
||||||
|
' %A %B %D %E %K %N %R %S %T %W %X %Y'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -550,6 +572,10 @@ module TkCore
|
|||||||
tk_call 'tk_chooseColor', *hash_kv(keys)
|
tk_call 'tk_chooseColor', *hash_kv(keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def chooseDirectory(keys = nil)
|
||||||
|
tk_call 'tk_chooseDirectory', *hash_kv(keys)
|
||||||
|
end
|
||||||
|
|
||||||
def tk_call(*args)
|
def tk_call(*args)
|
||||||
print args.join(" "), "\n" if $DEBUG
|
print args.join(" "), "\n" if $DEBUG
|
||||||
args.collect! {|x|ruby2tcl(x)}
|
args.collect! {|x|ruby2tcl(x)}
|
||||||
@ -2352,7 +2378,7 @@ class TkRadiobutton<TkButton
|
|||||||
configure 'variable', tk_trace_variable(v)
|
configure 'variable', tk_trace_variable(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
tkRadioButton = TkRadiobutton
|
TkRadioButton = TkRadiobutton
|
||||||
|
|
||||||
class TkCheckbutton<TkRadiobutton
|
class TkCheckbutton<TkRadiobutton
|
||||||
WidgetClassNames['Checkbutton'] = self
|
WidgetClassNames['Checkbutton'] = self
|
||||||
@ -2377,6 +2403,7 @@ class TkMessage<TkLabel
|
|||||||
tk_call 'message', @path
|
tk_call 'message', @path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TkRadiobutton = TkRadioButton
|
||||||
|
|
||||||
class TkScale<TkWindow
|
class TkScale<TkWindow
|
||||||
WidgetClassName = 'Scale'.freeze
|
WidgetClassName = 'Scale'.freeze
|
||||||
@ -2405,6 +2432,7 @@ class TkScale<TkWindow
|
|||||||
set val
|
set val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TkCheckbutton = TkCheckButton
|
||||||
|
|
||||||
class TkScrollbar<TkWindow
|
class TkScrollbar<TkWindow
|
||||||
WidgetClassName = 'Scrollbar'.freeze
|
WidgetClassName = 'Scrollbar'.freeze
|
||||||
@ -2702,6 +2730,9 @@ class TkMenu<TkWindow
|
|||||||
def postcommand(cmd=Proc.new)
|
def postcommand(cmd=Proc.new)
|
||||||
configure_cmd 'postcommand', cmd
|
configure_cmd 'postcommand', cmd
|
||||||
end
|
end
|
||||||
|
def tearoffcommand(cmd=Proc.new)
|
||||||
|
configure_cmd 'tearoffcommand', cmd
|
||||||
|
end
|
||||||
def menutype(index)
|
def menutype(index)
|
||||||
tk_send 'type', index
|
tk_send 'type', index
|
||||||
end
|
end
|
||||||
@ -2747,6 +2778,17 @@ class TkMenu<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TkMenuClone<TkMenu
|
||||||
|
def initialize(parent, type=nil)
|
||||||
|
unless parent.kind_of?(TkMenu)
|
||||||
|
fail ArgumentError, "parent must be TkMenu"
|
||||||
|
end
|
||||||
|
@parent = parent
|
||||||
|
install_win(@parent)
|
||||||
|
tk_call @parent.path, 'clone', @path, type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module TkSystemMenu
|
module TkSystemMenu
|
||||||
def initialize(parent, keys=nil)
|
def initialize(parent, keys=nil)
|
||||||
fail unless parent.kind_of? TkMenu
|
fail unless parent.kind_of? TkMenu
|
||||||
@ -2932,6 +2974,7 @@ autoload :TkImage, 'tkcanvas'
|
|||||||
autoload :TkBitmapImage, 'tkcanvas'
|
autoload :TkBitmapImage, 'tkcanvas'
|
||||||
autoload :TkPhotoImage, 'tkcanvas'
|
autoload :TkPhotoImage, 'tkcanvas'
|
||||||
autoload :TkEntry, 'tkentry'
|
autoload :TkEntry, 'tkentry'
|
||||||
|
autoload :TkSpinbox, 'tkentry'
|
||||||
autoload :TkText, 'tktext'
|
autoload :TkText, 'tktext'
|
||||||
autoload :TkDialog, 'tkdialog'
|
autoload :TkDialog, 'tkdialog'
|
||||||
autoload :TkMenubar, 'tkmenubar'
|
autoload :TkMenubar, 'tkmenubar'
|
||||||
|
@ -781,6 +781,9 @@ class TkImage<TkObject
|
|||||||
def height
|
def height
|
||||||
number(tk_call('image', 'height', @path))
|
number(tk_call('image', 'height', @path))
|
||||||
end
|
end
|
||||||
|
def inuse
|
||||||
|
bool(tk_call('image', 'inuse', @path))
|
||||||
|
end
|
||||||
def itemtype
|
def itemtype
|
||||||
tk_call('image', 'type', @path)
|
tk_call('image', 'type', @path)
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ Frame = TkFrame
|
|||||||
Label = TkLabel
|
Label = TkLabel
|
||||||
Button = TkButton
|
Button = TkButton
|
||||||
Radiobutton = TkRadiobutton
|
Radiobutton = TkRadiobutton
|
||||||
Checkbutton = TkCheckButton
|
Checkbutton = TkCheckbutton
|
||||||
Message = TkMessage
|
Message = TkMessage
|
||||||
Entry = TkEntry
|
Entry = TkEntry
|
||||||
Text = TkText
|
Text = TkText
|
||||||
|
@ -18,6 +18,10 @@ class TkEntry<TkLabel
|
|||||||
tk_call 'entry', @path
|
tk_call 'entry', @path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bbox(index)
|
||||||
|
tk_send 'bbox', index
|
||||||
|
end
|
||||||
|
|
||||||
def delete(s, e=None)
|
def delete(s, e=None)
|
||||||
tk_send 'delete', s, e
|
tk_send 'delete', s, e
|
||||||
end
|
end
|
||||||
@ -59,13 +63,76 @@ class TkEntry<TkLabel
|
|||||||
tk_send 'selection', 'to', index
|
tk_send 'selection', 'to', index
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate(mode = nil)
|
||||||
|
if mode
|
||||||
|
configure 'validate', mode
|
||||||
|
else
|
||||||
if tk_send('validate') == '0'
|
if tk_send('validate') == '0'
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class ValidateCmd
|
||||||
|
include TkComm
|
||||||
|
|
||||||
|
class ValidateArgs
|
||||||
|
def initialize(d,i,s,v,pp,ss,vv,ww)
|
||||||
|
@action = d
|
||||||
|
@index = i
|
||||||
|
@current = s
|
||||||
|
@type = v
|
||||||
|
@value = pp
|
||||||
|
@string = ss
|
||||||
|
@triggered = vv
|
||||||
|
@widget = ww
|
||||||
|
end
|
||||||
|
attr :action
|
||||||
|
attr :index
|
||||||
|
attr :current
|
||||||
|
attr :type
|
||||||
|
attr :value
|
||||||
|
attr :string
|
||||||
|
attr :triggered
|
||||||
|
attr :widget
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(cmd = Proc.new, args=nil)
|
||||||
|
if args
|
||||||
|
@id = install_cmd(proc{|*arg|
|
||||||
|
TkUtil.eval_cmd cmd, *arg
|
||||||
|
}) + " " + args
|
||||||
|
else
|
||||||
|
@id = install_cmd(proc{|arg|
|
||||||
|
TkUtil.eval_cmd cmd, ValidateArgs.new(*arg)
|
||||||
|
}) + ' %d %i %s %v %P %S %V %W'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_eval
|
||||||
|
@id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def validatecommand(cmd = ValidateCmd.new, args = nil)
|
||||||
|
if cmd.kind_of?(ValidateCmd)
|
||||||
|
configure('validatecommand', cmd)
|
||||||
|
else
|
||||||
|
configure('validatecommand', ValidateCmd.new(cmd, args))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias vcmd validatecommand
|
||||||
|
|
||||||
|
def invalidcommand(cmd = ValidateCmd.new, args = nil)
|
||||||
|
if cmd.kind_of?(ValidateCmd)
|
||||||
|
configure('invalidcommand', cmd)
|
||||||
|
else
|
||||||
|
configure('invalidcommand', ValidateCmd.new(cmd, args))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias invcmd invalidcommand
|
||||||
|
|
||||||
def value
|
def value
|
||||||
tk_send 'get'
|
tk_send 'get'
|
||||||
@ -75,3 +142,31 @@ class TkEntry<TkLabel
|
|||||||
tk_send 'insert', 0, val
|
tk_send 'insert', 0, val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TkSpinbox<TkEntry
|
||||||
|
WidgetClassName = 'Spinbox'.freeze
|
||||||
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
def self.to_eval
|
||||||
|
WidgetClassName
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_self
|
||||||
|
tk_call 'spinbox', @path
|
||||||
|
end
|
||||||
|
|
||||||
|
def identify(x, y)
|
||||||
|
tk_send 'identify', x, y
|
||||||
|
end
|
||||||
|
|
||||||
|
def spinup
|
||||||
|
tk_send 'invoke', 'spinup'
|
||||||
|
end
|
||||||
|
|
||||||
|
def spindown
|
||||||
|
tk_send 'invoke', 'spindown'
|
||||||
|
end
|
||||||
|
|
||||||
|
def set(str)
|
||||||
|
tk_send 'set', str
|
||||||
|
end
|
||||||
|
end
|
||||||
|
4
intern.h
4
intern.h
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* array.c */
|
/* array.c */
|
||||||
void rb_mem_clear _((register VALUE*, register size_t));
|
void rb_mem_clear _((register VALUE*, register long));
|
||||||
VALUE rb_assoc_new _((VALUE, VALUE));
|
VALUE rb_assoc_new _((VALUE, VALUE));
|
||||||
VALUE rb_ary_new _((void));
|
VALUE rb_ary_new _((void));
|
||||||
VALUE rb_ary_new2 _((long));
|
VALUE rb_ary_new2 _((long));
|
||||||
@ -260,7 +260,7 @@ VALUE rb_range_new _((VALUE, VALUE, int));
|
|||||||
VALUE rb_range_beg_len _((VALUE, long*, long*, long, int));
|
VALUE rb_range_beg_len _((VALUE, long*, long*, long, int));
|
||||||
VALUE rb_length_by_each _((VALUE));
|
VALUE rb_length_by_each _((VALUE));
|
||||||
/* re.c */
|
/* re.c */
|
||||||
int rb_memcmp _((char*,char*,size_t));
|
int rb_memcmp _((char*,char*,long));
|
||||||
VALUE rb_reg_nth_defined _((int, VALUE));
|
VALUE rb_reg_nth_defined _((int, VALUE));
|
||||||
VALUE rb_reg_nth_match _((int, VALUE));
|
VALUE rb_reg_nth_match _((int, VALUE));
|
||||||
VALUE rb_reg_last_match _((VALUE));
|
VALUE rb_reg_last_match _((VALUE));
|
||||||
|
6
io.c
6
io.c
@ -453,13 +453,13 @@ rb_io_to_io(io)
|
|||||||
|
|
||||||
/* reading functions */
|
/* reading functions */
|
||||||
|
|
||||||
static size_t
|
static long
|
||||||
io_fread(ptr, len, f)
|
io_fread(ptr, len, f)
|
||||||
char *ptr;
|
char *ptr;
|
||||||
size_t len;
|
long len;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
{
|
{
|
||||||
size_t n = len;
|
long n = len;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
|
63
marshal.c
63
marshal.c
@ -350,11 +350,11 @@ w_object(obj, arg, limit)
|
|||||||
w_byte(TYPE_BIGNUM, arg);
|
w_byte(TYPE_BIGNUM, arg);
|
||||||
{
|
{
|
||||||
char sign = RBIGNUM(obj)->sign?'+':'-';
|
char sign = RBIGNUM(obj)->sign?'+':'-';
|
||||||
int len = RBIGNUM(obj)->len;
|
long len = RBIGNUM(obj)->len;
|
||||||
BDIGIT *d = RBIGNUM(obj)->digits;
|
BDIGIT *d = RBIGNUM(obj)->digits;
|
||||||
|
|
||||||
w_byte(sign, arg);
|
w_byte(sign, arg);
|
||||||
w_long(SHORTLEN(len), arg);
|
w_long(SHORTLEN(len), arg); /* w_short? */
|
||||||
while (len--) {
|
while (len--) {
|
||||||
#if SIZEOF_BDIGITS > SIZEOF_SHORT
|
#if SIZEOF_BDIGITS > SIZEOF_SHORT
|
||||||
BDIGIT num = *d;
|
BDIGIT num = *d;
|
||||||
@ -390,7 +390,7 @@ w_object(obj, arg, limit)
|
|||||||
w_uclass(obj, rb_cArray, arg);
|
w_uclass(obj, rb_cArray, arg);
|
||||||
w_byte(TYPE_ARRAY, arg);
|
w_byte(TYPE_ARRAY, arg);
|
||||||
{
|
{
|
||||||
int len = RARRAY(obj)->len;
|
long len = RARRAY(obj)->len;
|
||||||
VALUE *ptr = RARRAY(obj)->ptr;
|
VALUE *ptr = RARRAY(obj)->ptr;
|
||||||
|
|
||||||
w_long(len, arg);
|
w_long(len, arg);
|
||||||
@ -419,10 +419,10 @@ w_object(obj, arg, limit)
|
|||||||
case T_STRUCT:
|
case T_STRUCT:
|
||||||
w_byte(TYPE_STRUCT, arg);
|
w_byte(TYPE_STRUCT, arg);
|
||||||
{
|
{
|
||||||
int len = RSTRUCT(obj)->len;
|
long len = RSTRUCT(obj)->len;
|
||||||
char *path = rb_class2name(CLASS_OF(obj));
|
char *path = rb_class2name(CLASS_OF(obj));
|
||||||
VALUE mem;
|
VALUE mem;
|
||||||
int i;
|
long i;
|
||||||
|
|
||||||
w_unique(path, arg);
|
w_unique(path, arg);
|
||||||
w_long(len, arg);
|
w_long(len, arg);
|
||||||
@ -597,12 +597,12 @@ r_long(arg)
|
|||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
register long x;
|
register long x;
|
||||||
int c = (char)r_byte(arg);
|
int c = r_byte(arg);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (c == 0) return 0;
|
if (c == 0) return 0;
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
if (c > sizeof(long)) long_toobig((int)c);
|
if (c > sizeof(long)) long_toobig(c);
|
||||||
x = 0;
|
x = 0;
|
||||||
for (i=0;i<c;i++) {
|
for (i=0;i<c;i++) {
|
||||||
x |= (long)r_byte(arg) << (8*i);
|
x |= (long)r_byte(arg) << (8*i);
|
||||||
@ -610,7 +610,7 @@ r_long(arg)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c = -c;
|
c = -c;
|
||||||
if (c > sizeof(long)) long_toobig((int)c);
|
if (c > sizeof(long)) long_toobig(c);
|
||||||
x = -1;
|
x = -1;
|
||||||
for (i=0;i<c;i++) {
|
for (i=0;i<c;i++) {
|
||||||
x &= ~(0xff << (8*i));
|
x &= ~(0xff << (8*i));
|
||||||
@ -627,14 +627,14 @@ r_long(arg)
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define r_bytes(s, arg) do { \
|
#define r_bytes(s, arg) do { \
|
||||||
int r_bytes_len; \
|
long r_bytes_len; \
|
||||||
r_bytes2((s), r_bytes_len, (arg)); \
|
r_bytes2((s), r_bytes_len, (arg)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
r_bytes0(s, len, arg)
|
r_bytes0(s, len, arg)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
long len;
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
if (arg->fp) {
|
if (arg->fp) {
|
||||||
@ -655,7 +655,7 @@ r_symlink(arg)
|
|||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
ID id;
|
ID id;
|
||||||
int num = r_long(arg);
|
long num = r_long(arg);
|
||||||
|
|
||||||
if (st_lookup(arg->symbol, num, &id)) {
|
if (st_lookup(arg->symbol, num, &id)) {
|
||||||
return id;
|
return id;
|
||||||
@ -699,7 +699,7 @@ r_string(arg)
|
|||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int len;
|
long len;
|
||||||
|
|
||||||
r_bytes2(buf, len, arg);
|
r_bytes2(buf, len, arg);
|
||||||
return rb_str_new(buf, len);
|
return rb_str_new(buf, len);
|
||||||
@ -723,7 +723,7 @@ r_ivar(obj, arg)
|
|||||||
VALUE obj;
|
VALUE obj;
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
int len;
|
long len;
|
||||||
|
|
||||||
len = r_long(arg);
|
len = r_long(arg);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
@ -780,7 +780,7 @@ r_object(arg)
|
|||||||
|
|
||||||
case TYPE_FIXNUM:
|
case TYPE_FIXNUM:
|
||||||
{
|
{
|
||||||
int i = r_long(arg);
|
long i = r_long(arg);
|
||||||
return INT2FIX(i);
|
return INT2FIX(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ r_object(arg)
|
|||||||
|
|
||||||
case TYPE_BIGNUM:
|
case TYPE_BIGNUM:
|
||||||
{
|
{
|
||||||
int len;
|
long len;
|
||||||
BDIGIT *digits;
|
BDIGIT *digits;
|
||||||
|
|
||||||
NEWOBJ(big, struct RBignum);
|
NEWOBJ(big, struct RBignum);
|
||||||
@ -835,7 +835,7 @@ r_object(arg)
|
|||||||
case TYPE_REGEXP:
|
case TYPE_REGEXP:
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int len;
|
long len;
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
r_bytes2(buf, len, arg);
|
r_bytes2(buf, len, arg);
|
||||||
@ -845,7 +845,7 @@ r_object(arg)
|
|||||||
|
|
||||||
case TYPE_ARRAY:
|
case TYPE_ARRAY:
|
||||||
{
|
{
|
||||||
volatile int len = r_long(arg); /* gcc 2.7.2.3 -O2 bug?? */
|
volatile long len = r_long(arg); /* gcc 2.7.2.3 -O2 bug?? */
|
||||||
|
|
||||||
v = rb_ary_new2(len);
|
v = rb_ary_new2(len);
|
||||||
r_regist(v, arg);
|
r_regist(v, arg);
|
||||||
@ -858,7 +858,7 @@ r_object(arg)
|
|||||||
case TYPE_HASH:
|
case TYPE_HASH:
|
||||||
case TYPE_HASH_DEF:
|
case TYPE_HASH_DEF:
|
||||||
{
|
{
|
||||||
int len = r_long(arg);
|
long len = r_long(arg);
|
||||||
|
|
||||||
v = rb_hash_new();
|
v = rb_hash_new();
|
||||||
r_regist(v, arg);
|
r_regist(v, arg);
|
||||||
@ -876,8 +876,8 @@ r_object(arg)
|
|||||||
case TYPE_STRUCT:
|
case TYPE_STRUCT:
|
||||||
{
|
{
|
||||||
VALUE klass, mem, values;
|
VALUE klass, mem, values;
|
||||||
volatile int i; /* gcc 2.7.2.3 -O2 bug?? */
|
volatile long i; /* gcc 2.7.2.3 -O2 bug?? */
|
||||||
int len;
|
long len;
|
||||||
ID slot;
|
ID slot;
|
||||||
|
|
||||||
klass = rb_path2class(r_unique(arg));
|
klass = rb_path2class(r_unique(arg));
|
||||||
@ -1001,10 +1001,11 @@ marshal_load(argc, argv)
|
|||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
{
|
{
|
||||||
VALUE port, proc;
|
VALUE port, proc;
|
||||||
int major;
|
int major, minor;
|
||||||
VALUE v;
|
VALUE v;
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
struct load_arg arg;
|
struct load_arg arg;
|
||||||
|
volatile VALUE hash; /* protect from GC */
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "11", &port, &proc);
|
rb_scan_args(argc, argv, "11", &port, &proc);
|
||||||
if (rb_obj_is_kind_of(port, rb_cIO)) {
|
if (rb_obj_is_kind_of(port, rb_cIO)) {
|
||||||
@ -1027,21 +1028,23 @@ marshal_load(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
major = r_byte(&arg);
|
major = r_byte(&arg);
|
||||||
if (major == MARSHAL_MAJOR) {
|
minor = r_byte(&arg);
|
||||||
volatile VALUE hash; /* protect from GC */
|
if (major != MARSHAL_MAJOR) {
|
||||||
|
rb_raise(rb_eTypeError, "incompatible marshal file format (can't be read)\n\
|
||||||
if (r_byte(&arg) != MARSHAL_MINOR) {
|
\tformat version %d.%d required; %d.%d given",
|
||||||
rb_warn("Old marshal file format (can be read)");
|
MARSHAL_MAJOR, MARSHAL_MINOR, major, minor);
|
||||||
}
|
}
|
||||||
|
if (minor != MARSHAL_MINOR) {
|
||||||
|
rb_warn("incompatible marshal file format (can be read)\n\
|
||||||
|
\tformat version %d.%d required; %d.%d given",
|
||||||
|
MARSHAL_MAJOR, MARSHAL_MINOR, major, minor);
|
||||||
|
}
|
||||||
|
|
||||||
arg.symbol = st_init_numtable();
|
arg.symbol = st_init_numtable();
|
||||||
arg.data = hash = rb_hash_new();
|
arg.data = hash = rb_hash_new();
|
||||||
if (NIL_P(proc)) arg.proc = 0;
|
if (NIL_P(proc)) arg.proc = 0;
|
||||||
else arg.proc = proc;
|
else arg.proc = proc;
|
||||||
v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
|
v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
|
||||||
}
|
|
||||||
else {
|
|
||||||
rb_raise(rb_eTypeError, "old marshal file format (can't read)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||||||
(setq start (ruby-calculate-indent))
|
(setq start (ruby-calculate-indent))
|
||||||
(if (eobp)
|
(if (eobp)
|
||||||
nil
|
nil
|
||||||
(while (and (not (bobp)) (not done))
|
(while (and (not (bobp)) (not (eobp)) (not done))
|
||||||
(forward-line n)
|
(forward-line n)
|
||||||
(cond
|
(cond
|
||||||
((looking-at "^$"))
|
((looking-at "^$"))
|
||||||
|
28
pack.c
28
pack.c
@ -71,13 +71,13 @@ TOKEN_PASTE(swap,x)(z) \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if SIZEOF_SHORT == 2
|
#if SIZEOF_SHORT == 2
|
||||||
#define swaps(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
|
#define swaps(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
|
||||||
#else
|
#else
|
||||||
#if SIZEOF_SHORT == 4
|
#if SIZEOF_SHORT == 4
|
||||||
#define swaps(x) ((((x)&0xFF)<<24) \
|
#define swaps(x) ((((x)&0xFF)<<24) \
|
||||||
+(((x)>>24)&0xFF) \
|
|(((x)>>24)&0xFF) \
|
||||||
+(((x)&0x0000FF00)<<8) \
|
|(((x)&0x0000FF00)<<8) \
|
||||||
+(((x)&0x00FF0000)>>8) )
|
|(((x)&0x00FF0000)>>8) )
|
||||||
#else
|
#else
|
||||||
define_swapx(s,short);
|
define_swapx(s,short);
|
||||||
#endif
|
#endif
|
||||||
@ -85,19 +85,19 @@ define_swapx(s,short);
|
|||||||
|
|
||||||
#if SIZEOF_LONG == 4
|
#if SIZEOF_LONG == 4
|
||||||
#define swapl(x) ((((x)&0xFF)<<24) \
|
#define swapl(x) ((((x)&0xFF)<<24) \
|
||||||
+(((x)>>24)&0xFF) \
|
|(((x)>>24)&0xFF) \
|
||||||
+(((x)&0x0000FF00)<<8) \
|
|(((x)&0x0000FF00)<<8) \
|
||||||
+(((x)&0x00FF0000)>>8) )
|
|(((x)&0x00FF0000)>>8) )
|
||||||
#else
|
#else
|
||||||
#if SIZEOF_LONG == 8
|
#if SIZEOF_LONG == 8
|
||||||
#define swapl(x) ((((x)&0x00000000000000FF)<<56) \
|
#define swapl(x) ((((x)&0x00000000000000FF)<<56) \
|
||||||
+(((x)&0xFF00000000000000)>>56) \
|
|(((x)&0xFF00000000000000)>>56) \
|
||||||
+(((x)&0x000000000000FF00)<<40) \
|
|(((x)&0x000000000000FF00)<<40) \
|
||||||
+(((x)&0x00FF000000000000)>>40) \
|
|(((x)&0x00FF000000000000)>>40) \
|
||||||
+(((x)&0x0000000000FF0000)<<24) \
|
|(((x)&0x0000000000FF0000)<<24) \
|
||||||
+(((x)&0x0000FF0000000000)>>24) \
|
|(((x)&0x0000FF0000000000)>>24) \
|
||||||
+(((x)&0x00000000FF000000)<<8) \
|
|(((x)&0x00000000FF000000)<<8) \
|
||||||
+(((x)&0x000000FF00000000)>>8))
|
|(((x)&0x000000FF00000000)>>8))
|
||||||
#else
|
#else
|
||||||
define_swapx(l,long);
|
define_swapx(l,long);
|
||||||
#endif
|
#endif
|
||||||
|
4
re.c
4
re.c
@ -73,7 +73,7 @@ static const char casetable[] = {
|
|||||||
int
|
int
|
||||||
rb_memcmp(p1, p2, len)
|
rb_memcmp(p1, p2, len)
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
size_t len;
|
long len;
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
@ -1054,7 +1054,7 @@ rb_reg_s_quote(argc, argv)
|
|||||||
|
|
||||||
for (; s < send; s++) {
|
for (; s < send; s++) {
|
||||||
if (ismbchar(*s)) {
|
if (ismbchar(*s)) {
|
||||||
size_t n = mbclen(*s);
|
int n = mbclen(*s);
|
||||||
|
|
||||||
while (n-- && s < send)
|
while (n-- && s < send)
|
||||||
*t++ = *s++;
|
*t++ = *s++;
|
||||||
|
2
ruby.c
2
ruby.c
@ -208,7 +208,7 @@ ruby_init_loadpath()
|
|||||||
#if defined(_WIN32) || defined(DJGPP) || defined(__EMX__)
|
#if defined(_WIN32) || defined(DJGPP) || defined(__EMX__)
|
||||||
char libpath[FILENAME_MAX+1];
|
char libpath[FILENAME_MAX+1];
|
||||||
char *p;
|
char *p;
|
||||||
size_t rest;
|
int rest;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
GetModuleFileName(NULL, libpath, sizeof libpath);
|
GetModuleFileName(NULL, libpath, sizeof libpath);
|
||||||
#elif defined(DJGPP)
|
#elif defined(DJGPP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user