зеркало из https://github.com/github/ruby.git
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8f54a9b470
Коммит
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>
|
||||
|
||||
* 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>
|
||||
|
||||
* 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;
|
||||
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>
|
||||
|
||||
|
@ -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 (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>
|
||||
|
||||
|
|
20
array.c
20
array.c
|
@ -22,7 +22,7 @@ VALUE rb_cArray;
|
|||
void
|
||||
rb_mem_clear(mem, size)
|
||||
register VALUE *mem;
|
||||
register size_t size;
|
||||
register long size;
|
||||
{
|
||||
while (size--) {
|
||||
*mem++ = Qnil;
|
||||
|
@ -32,7 +32,7 @@ rb_mem_clear(mem, size)
|
|||
static void
|
||||
memfill(mem, size, val)
|
||||
register VALUE *mem;
|
||||
register size_t size;
|
||||
register long size;
|
||||
register VALUE val;
|
||||
{
|
||||
while (size--) {
|
||||
|
@ -400,11 +400,8 @@ rb_ary_subseq(ary, beg, len)
|
|||
VALUE ary2;
|
||||
|
||||
if (beg > RARRAY(ary)->len) return Qnil;
|
||||
if (beg < 0) {
|
||||
len += beg;
|
||||
beg = 0;
|
||||
}
|
||||
if (len < 0) return Qnil;
|
||||
if (beg < 0 || len < 0) return Qnil;
|
||||
|
||||
if (beg + len > RARRAY(ary)->len) {
|
||||
len = RARRAY(ary)->len - beg;
|
||||
}
|
||||
|
@ -532,7 +529,7 @@ rb_ary_replace(ary, beg, len, rpl)
|
|||
VALUE ary, rpl;
|
||||
long beg, len;
|
||||
{
|
||||
int rlen;
|
||||
long rlen;
|
||||
|
||||
if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len);
|
||||
if (beg < 0) {
|
||||
|
@ -1254,8 +1251,8 @@ VALUE
|
|||
rb_ary_concat(x, y)
|
||||
VALUE x, y;
|
||||
{
|
||||
int xlen = RARRAY(x)->len;
|
||||
int ylen;
|
||||
long xlen = RARRAY(x)->len;
|
||||
long ylen;
|
||||
|
||||
y = to_ary(y);
|
||||
ylen = RARRAY(y)->len;
|
||||
|
@ -1371,7 +1368,8 @@ rb_ary_hash(ary)
|
|||
VALUE ary;
|
||||
{
|
||||
long i;
|
||||
int n, h;
|
||||
VALUE n;
|
||||
long h;
|
||||
|
||||
h = RARRAY(ary)->len;
|
||||
for (i=0; i<RARRAY(ary)->len; i++) {
|
||||
|
|
14
eval.c
14
eval.c
|
@ -2594,17 +2594,19 @@ rb_eval(self, n)
|
|||
rb_const_set(ruby_class, node->nd_vid, result);
|
||||
break;
|
||||
|
||||
case NODE_CVASGN2:
|
||||
result = rb_eval(self, node->nd_value);
|
||||
rb_cvar_set_singleton(self, node->nd_vid, result);
|
||||
break;
|
||||
|
||||
case NODE_CVDECL:
|
||||
if (NIL_P(ruby_cbase)) {
|
||||
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);
|
||||
rb_cvar_declare(ruby_cbase, node->nd_vid, result);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case NODE_CVASGN2:
|
||||
result = rb_eval(self, node->nd_value);
|
||||
rb_cvar_declare(ruby_cbase, node->nd_vid, result);
|
||||
rb_cvar_set_singleton(self, node->nd_vid, result);
|
||||
break;
|
||||
|
||||
case NODE_LVAR:
|
||||
|
|
|
@ -269,40 +269,61 @@ module TkComm
|
|||
end
|
||||
|
||||
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
|
||||
@above = a
|
||||
@num = b
|
||||
@count = c
|
||||
@detail = d
|
||||
@focus = (f == 1)
|
||||
@height = h
|
||||
@keycode = k
|
||||
@mode = m
|
||||
@override = (o == 1)
|
||||
@place = p
|
||||
@state = s
|
||||
@time = t
|
||||
@width = w
|
||||
@x = x
|
||||
@y = y
|
||||
@char = aa
|
||||
@borderwidth = bb
|
||||
@wheel_delta = dd
|
||||
@send_event = (ee == 1)
|
||||
@keysym = kk
|
||||
@keysym_num = nn
|
||||
@rootwin_id = rr
|
||||
@subwindow = ss
|
||||
@type = tt
|
||||
@widget = ww
|
||||
@x_root = xx
|
||||
@y_root = yy
|
||||
end
|
||||
attr :serial
|
||||
attr :above
|
||||
attr :num
|
||||
attr :count
|
||||
attr :detail
|
||||
attr :focus
|
||||
attr :height
|
||||
attr :keycode
|
||||
attr :mode
|
||||
attr :override
|
||||
attr :place
|
||||
attr :state
|
||||
attr :time
|
||||
attr :width
|
||||
attr :x
|
||||
attr :y
|
||||
attr :char
|
||||
attr :borderwidth
|
||||
attr :wheel_delta
|
||||
attr :send_event
|
||||
attr :keysym
|
||||
attr :keysym_num
|
||||
attr :rootwin_id
|
||||
attr :subwindow
|
||||
attr :type
|
||||
attr :widget
|
||||
attr :x_root
|
||||
|
@ -319,7 +340,8 @@ module TkComm
|
|||
id = install_cmd(proc{|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
|
||||
|
||||
|
@ -550,6 +572,10 @@ module TkCore
|
|||
tk_call 'tk_chooseColor', *hash_kv(keys)
|
||||
end
|
||||
|
||||
def chooseDirectory(keys = nil)
|
||||
tk_call 'tk_chooseDirectory', *hash_kv(keys)
|
||||
end
|
||||
|
||||
def tk_call(*args)
|
||||
print args.join(" "), "\n" if $DEBUG
|
||||
args.collect! {|x|ruby2tcl(x)}
|
||||
|
@ -2352,7 +2378,7 @@ class TkRadiobutton<TkButton
|
|||
configure 'variable', tk_trace_variable(v)
|
||||
end
|
||||
end
|
||||
tkRadioButton = TkRadiobutton
|
||||
TkRadioButton = TkRadiobutton
|
||||
|
||||
class TkCheckbutton<TkRadiobutton
|
||||
WidgetClassNames['Checkbutton'] = self
|
||||
|
@ -2377,6 +2403,7 @@ class TkMessage<TkLabel
|
|||
tk_call 'message', @path
|
||||
end
|
||||
end
|
||||
TkRadiobutton = TkRadioButton
|
||||
|
||||
class TkScale<TkWindow
|
||||
WidgetClassName = 'Scale'.freeze
|
||||
|
@ -2405,6 +2432,7 @@ class TkScale<TkWindow
|
|||
set val
|
||||
end
|
||||
end
|
||||
TkCheckbutton = TkCheckButton
|
||||
|
||||
class TkScrollbar<TkWindow
|
||||
WidgetClassName = 'Scrollbar'.freeze
|
||||
|
@ -2702,6 +2730,9 @@ class TkMenu<TkWindow
|
|||
def postcommand(cmd=Proc.new)
|
||||
configure_cmd 'postcommand', cmd
|
||||
end
|
||||
def tearoffcommand(cmd=Proc.new)
|
||||
configure_cmd 'tearoffcommand', cmd
|
||||
end
|
||||
def menutype(index)
|
||||
tk_send 'type', index
|
||||
end
|
||||
|
@ -2747,6 +2778,17 @@ class TkMenu<TkWindow
|
|||
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
|
||||
def initialize(parent, keys=nil)
|
||||
fail unless parent.kind_of? TkMenu
|
||||
|
@ -2932,6 +2974,7 @@ autoload :TkImage, 'tkcanvas'
|
|||
autoload :TkBitmapImage, 'tkcanvas'
|
||||
autoload :TkPhotoImage, 'tkcanvas'
|
||||
autoload :TkEntry, 'tkentry'
|
||||
autoload :TkSpinbox, 'tkentry'
|
||||
autoload :TkText, 'tktext'
|
||||
autoload :TkDialog, 'tkdialog'
|
||||
autoload :TkMenubar, 'tkmenubar'
|
||||
|
|
|
@ -781,6 +781,9 @@ class TkImage<TkObject
|
|||
def height
|
||||
number(tk_call('image', 'height', @path))
|
||||
end
|
||||
def inuse
|
||||
bool(tk_call('image', 'inuse', @path))
|
||||
end
|
||||
def itemtype
|
||||
tk_call('image', 'type', @path)
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ Frame = TkFrame
|
|||
Label = TkLabel
|
||||
Button = TkButton
|
||||
Radiobutton = TkRadiobutton
|
||||
Checkbutton = TkCheckButton
|
||||
Checkbutton = TkCheckbutton
|
||||
Message = TkMessage
|
||||
Entry = TkEntry
|
||||
Text = TkText
|
||||
|
|
|
@ -18,6 +18,10 @@ class TkEntry<TkLabel
|
|||
tk_call 'entry', @path
|
||||
end
|
||||
|
||||
def bbox(index)
|
||||
tk_send 'bbox', index
|
||||
end
|
||||
|
||||
def delete(s, e=None)
|
||||
tk_send 'delete', s, e
|
||||
end
|
||||
|
@ -59,14 +63,77 @@ class TkEntry<TkLabel
|
|||
tk_send 'selection', 'to', index
|
||||
end
|
||||
|
||||
def validate
|
||||
if tk_send('validate') == '0'
|
||||
false
|
||||
else
|
||||
true
|
||||
def validate(mode = nil)
|
||||
if mode
|
||||
configure 'validate', mode
|
||||
else
|
||||
if tk_send('validate') == '0'
|
||||
false
|
||||
else
|
||||
true
|
||||
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
|
||||
tk_send 'get'
|
||||
end
|
||||
|
@ -75,3 +142,31 @@ class TkEntry<TkLabel
|
|||
tk_send 'insert', 0, val
|
||||
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 */
|
||||
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_ary_new _((void));
|
||||
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_length_by_each _((VALUE));
|
||||
/* 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_match _((int, VALUE));
|
||||
VALUE rb_reg_last_match _((VALUE));
|
||||
|
|
6
io.c
6
io.c
|
@ -453,13 +453,13 @@ rb_io_to_io(io)
|
|||
|
||||
/* reading functions */
|
||||
|
||||
static size_t
|
||||
static long
|
||||
io_fread(ptr, len, f)
|
||||
char *ptr;
|
||||
size_t len;
|
||||
long len;
|
||||
FILE *f;
|
||||
{
|
||||
size_t n = len;
|
||||
long n = len;
|
||||
int c;
|
||||
|
||||
while (n--) {
|
||||
|
|
73
marshal.c
73
marshal.c
|
@ -350,11 +350,11 @@ w_object(obj, arg, limit)
|
|||
w_byte(TYPE_BIGNUM, arg);
|
||||
{
|
||||
char sign = RBIGNUM(obj)->sign?'+':'-';
|
||||
int len = RBIGNUM(obj)->len;
|
||||
long len = RBIGNUM(obj)->len;
|
||||
BDIGIT *d = RBIGNUM(obj)->digits;
|
||||
|
||||
w_byte(sign, arg);
|
||||
w_long(SHORTLEN(len), arg);
|
||||
w_long(SHORTLEN(len), arg); /* w_short? */
|
||||
while (len--) {
|
||||
#if SIZEOF_BDIGITS > SIZEOF_SHORT
|
||||
BDIGIT num = *d;
|
||||
|
@ -390,7 +390,7 @@ w_object(obj, arg, limit)
|
|||
w_uclass(obj, rb_cArray, arg);
|
||||
w_byte(TYPE_ARRAY, arg);
|
||||
{
|
||||
int len = RARRAY(obj)->len;
|
||||
long len = RARRAY(obj)->len;
|
||||
VALUE *ptr = RARRAY(obj)->ptr;
|
||||
|
||||
w_long(len, arg);
|
||||
|
@ -419,10 +419,10 @@ w_object(obj, arg, limit)
|
|||
case T_STRUCT:
|
||||
w_byte(TYPE_STRUCT, arg);
|
||||
{
|
||||
int len = RSTRUCT(obj)->len;
|
||||
long len = RSTRUCT(obj)->len;
|
||||
char *path = rb_class2name(CLASS_OF(obj));
|
||||
VALUE mem;
|
||||
int i;
|
||||
long i;
|
||||
|
||||
w_unique(path, arg);
|
||||
w_long(len, arg);
|
||||
|
@ -597,12 +597,12 @@ r_long(arg)
|
|||
struct load_arg *arg;
|
||||
{
|
||||
register long x;
|
||||
int c = (char)r_byte(arg);
|
||||
int c = r_byte(arg);
|
||||
int i;
|
||||
|
||||
if (c == 0) return 0;
|
||||
if (c > 0) {
|
||||
if (c > sizeof(long)) long_toobig((int)c);
|
||||
if (c > sizeof(long)) long_toobig(c);
|
||||
x = 0;
|
||||
for (i=0;i<c;i++) {
|
||||
x |= (long)r_byte(arg) << (8*i);
|
||||
|
@ -610,7 +610,7 @@ r_long(arg)
|
|||
}
|
||||
else {
|
||||
c = -c;
|
||||
if (c > sizeof(long)) long_toobig((int)c);
|
||||
if (c > sizeof(long)) long_toobig(c);
|
||||
x = -1;
|
||||
for (i=0;i<c;i++) {
|
||||
x &= ~(0xff << (8*i));
|
||||
|
@ -627,14 +627,14 @@ r_long(arg)
|
|||
} while (0)
|
||||
|
||||
#define r_bytes(s, arg) do { \
|
||||
int r_bytes_len; \
|
||||
long r_bytes_len; \
|
||||
r_bytes2((s), r_bytes_len, (arg)); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
r_bytes0(s, len, arg)
|
||||
char *s;
|
||||
int len;
|
||||
long len;
|
||||
struct load_arg *arg;
|
||||
{
|
||||
if (arg->fp) {
|
||||
|
@ -655,7 +655,7 @@ r_symlink(arg)
|
|||
struct load_arg *arg;
|
||||
{
|
||||
ID id;
|
||||
int num = r_long(arg);
|
||||
long num = r_long(arg);
|
||||
|
||||
if (st_lookup(arg->symbol, num, &id)) {
|
||||
return id;
|
||||
|
@ -699,7 +699,7 @@ r_string(arg)
|
|||
struct load_arg *arg;
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
long len;
|
||||
|
||||
r_bytes2(buf, len, arg);
|
||||
return rb_str_new(buf, len);
|
||||
|
@ -723,7 +723,7 @@ r_ivar(obj, arg)
|
|||
VALUE obj;
|
||||
struct load_arg *arg;
|
||||
{
|
||||
int len;
|
||||
long len;
|
||||
|
||||
len = r_long(arg);
|
||||
if (len > 0) {
|
||||
|
@ -780,7 +780,7 @@ r_object(arg)
|
|||
|
||||
case TYPE_FIXNUM:
|
||||
{
|
||||
int i = r_long(arg);
|
||||
long i = r_long(arg);
|
||||
return INT2FIX(i);
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ r_object(arg)
|
|||
|
||||
case TYPE_BIGNUM:
|
||||
{
|
||||
int len;
|
||||
long len;
|
||||
BDIGIT *digits;
|
||||
|
||||
NEWOBJ(big, struct RBignum);
|
||||
|
@ -835,7 +835,7 @@ r_object(arg)
|
|||
case TYPE_REGEXP:
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
long len;
|
||||
int options;
|
||||
|
||||
r_bytes2(buf, len, arg);
|
||||
|
@ -845,7 +845,7 @@ r_object(arg)
|
|||
|
||||
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);
|
||||
r_regist(v, arg);
|
||||
|
@ -858,7 +858,7 @@ r_object(arg)
|
|||
case TYPE_HASH:
|
||||
case TYPE_HASH_DEF:
|
||||
{
|
||||
int len = r_long(arg);
|
||||
long len = r_long(arg);
|
||||
|
||||
v = rb_hash_new();
|
||||
r_regist(v, arg);
|
||||
|
@ -876,8 +876,8 @@ r_object(arg)
|
|||
case TYPE_STRUCT:
|
||||
{
|
||||
VALUE klass, mem, values;
|
||||
volatile int i; /* gcc 2.7.2.3 -O2 bug?? */
|
||||
int len;
|
||||
volatile long i; /* gcc 2.7.2.3 -O2 bug?? */
|
||||
long len;
|
||||
ID slot;
|
||||
|
||||
klass = rb_path2class(r_unique(arg));
|
||||
|
@ -1001,10 +1001,11 @@ marshal_load(argc, argv)
|
|||
VALUE *argv;
|
||||
{
|
||||
VALUE port, proc;
|
||||
int major;
|
||||
int major, minor;
|
||||
VALUE v;
|
||||
OpenFile *fptr;
|
||||
struct load_arg arg;
|
||||
volatile VALUE hash; /* protect from GC */
|
||||
|
||||
rb_scan_args(argc, argv, "11", &port, &proc);
|
||||
if (rb_obj_is_kind_of(port, rb_cIO)) {
|
||||
|
@ -1027,21 +1028,23 @@ marshal_load(argc, argv)
|
|||
}
|
||||
|
||||
major = r_byte(&arg);
|
||||
if (major == MARSHAL_MAJOR) {
|
||||
volatile VALUE hash; /* protect from GC */
|
||||
minor = r_byte(&arg);
|
||||
if (major != MARSHAL_MAJOR) {
|
||||
rb_raise(rb_eTypeError, "incompatible marshal file format (can't be read)\n\
|
||||
\tformat version %d.%d required; %d.%d given",
|
||||
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);
|
||||
}
|
||||
|
||||
if (r_byte(&arg) != MARSHAL_MINOR) {
|
||||
rb_warn("Old marshal file format (can be read)");
|
||||
}
|
||||
arg.symbol = st_init_numtable();
|
||||
arg.data = hash = rb_hash_new();
|
||||
if (NIL_P(proc)) arg.proc = 0;
|
||||
else arg.proc = proc;
|
||||
v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eTypeError, "old marshal file format (can't read)");
|
||||
}
|
||||
arg.symbol = st_init_numtable();
|
||||
arg.data = hash = rb_hash_new();
|
||||
if (NIL_P(proc)) arg.proc = 0;
|
||||
else arg.proc = proc;
|
||||
v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
|
||||
|
||||
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))
|
||||
(if (eobp)
|
||||
nil
|
||||
(while (and (not (bobp)) (not done))
|
||||
(while (and (not (bobp)) (not (eobp)) (not done))
|
||||
(forward-line n)
|
||||
(cond
|
||||
((looking-at "^$"))
|
||||
|
|
28
pack.c
28
pack.c
|
@ -71,13 +71,13 @@ TOKEN_PASTE(swap,x)(z) \
|
|||
}
|
||||
|
||||
#if SIZEOF_SHORT == 2
|
||||
#define swaps(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
|
||||
#define swaps(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
|
||||
#else
|
||||
#if SIZEOF_SHORT == 4
|
||||
#define swaps(x) ((((x)&0xFF)<<24) \
|
||||
+(((x)>>24)&0xFF) \
|
||||
+(((x)&0x0000FF00)<<8) \
|
||||
+(((x)&0x00FF0000)>>8) )
|
||||
|(((x)>>24)&0xFF) \
|
||||
|(((x)&0x0000FF00)<<8) \
|
||||
|(((x)&0x00FF0000)>>8) )
|
||||
#else
|
||||
define_swapx(s,short);
|
||||
#endif
|
||||
|
@ -85,19 +85,19 @@ define_swapx(s,short);
|
|||
|
||||
#if SIZEOF_LONG == 4
|
||||
#define swapl(x) ((((x)&0xFF)<<24) \
|
||||
+(((x)>>24)&0xFF) \
|
||||
+(((x)&0x0000FF00)<<8) \
|
||||
+(((x)&0x00FF0000)>>8) )
|
||||
|(((x)>>24)&0xFF) \
|
||||
|(((x)&0x0000FF00)<<8) \
|
||||
|(((x)&0x00FF0000)>>8) )
|
||||
#else
|
||||
#if SIZEOF_LONG == 8
|
||||
#define swapl(x) ((((x)&0x00000000000000FF)<<56) \
|
||||
+(((x)&0xFF00000000000000)>>56) \
|
||||
+(((x)&0x000000000000FF00)<<40) \
|
||||
+(((x)&0x00FF000000000000)>>40) \
|
||||
+(((x)&0x0000000000FF0000)<<24) \
|
||||
+(((x)&0x0000FF0000000000)>>24) \
|
||||
+(((x)&0x00000000FF000000)<<8) \
|
||||
+(((x)&0x000000FF00000000)>>8))
|
||||
|(((x)&0xFF00000000000000)>>56) \
|
||||
|(((x)&0x000000000000FF00)<<40) \
|
||||
|(((x)&0x00FF000000000000)>>40) \
|
||||
|(((x)&0x0000000000FF0000)<<24) \
|
||||
|(((x)&0x0000FF0000000000)>>24) \
|
||||
|(((x)&0x00000000FF000000)<<8) \
|
||||
|(((x)&0x000000FF00000000)>>8))
|
||||
#else
|
||||
define_swapx(l,long);
|
||||
#endif
|
||||
|
|
4
re.c
4
re.c
|
@ -73,7 +73,7 @@ static const char casetable[] = {
|
|||
int
|
||||
rb_memcmp(p1, p2, len)
|
||||
char *p1, *p2;
|
||||
size_t len;
|
||||
long len;
|
||||
{
|
||||
int tmp;
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ rb_reg_s_quote(argc, argv)
|
|||
|
||||
for (; s < send; s++) {
|
||||
if (ismbchar(*s)) {
|
||||
size_t n = mbclen(*s);
|
||||
int n = mbclen(*s);
|
||||
|
||||
while (n-- && s < send)
|
||||
*t++ = *s++;
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -208,7 +208,7 @@ ruby_init_loadpath()
|
|||
#if defined(_WIN32) || defined(DJGPP) || defined(__EMX__)
|
||||
char libpath[FILENAME_MAX+1];
|
||||
char *p;
|
||||
size_t rest;
|
||||
int rest;
|
||||
#if defined(_WIN32)
|
||||
GetModuleFileName(NULL, libpath, sizeof libpath);
|
||||
#elif defined(DJGPP)
|
||||
|
|
Загрузка…
Ссылка в новой задаче