Skip to content

Commit c786866

Browse files
author
matz
committed
* range.c (range_step): 'iter' here should be an array.
* marshal.c (w_object): should retrieve __member__ data from non-singleton class. * variable.c (rb_cvar_get): class variable override check added. * variable.c (rb_cvar_set): ditto * variable.c (rb_cvar_declare): ditto. * parse.y (parse_regx): handle backslash escaping of delimiter here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 772ed55 commit c786866

File tree

16 files changed

+101
-52
lines changed

16 files changed

+101
-52
lines changed

ChangeLog

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Mon Aug 20 13:24:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* range.c (range_step): 'iter' here should be an array.
4+
5+
Mon Aug 20 12:43:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
6+
7+
* marshal.c (w_object): should retrieve __member__ data from
8+
non-singleton class.
9+
10+
Sat Aug 18 23:11:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
11+
12+
* variable.c (rb_cvar_get): class variable override check added.
13+
14+
* variable.c (rb_cvar_set): ditto
15+
16+
* variable.c (rb_cvar_declare): ditto.
17+
118
Fri Aug 17 12:13:48 2001 Minero Aoki <aamine@loveruby.net>
219

320
* lib/net/protocol.rb: Protocol.new requires at least one arg.
@@ -8,6 +25,10 @@ Fri Aug 17 12:13:48 2001 Minero Aoki <aamine@loveruby.net>
825

926
* lib/net/http.rb: ditto.
1027

28+
Fri Aug 17 00:49:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
29+
30+
* parse.y (parse_regx): handle backslash escaping of delimiter here.
31+
1132
Thu Aug 16 13:54:04 2001 Usaku Nakamura <usa@ruby-lang.org>
1233

1334
* ext/socket/socket.c (s_recvfrom): fix typo.

ToDo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Language Spec.
2727
* raise exception by `` error
2828
* jar like combined library package.
2929
* resumable Exception via Exception#resume.
30+
* method combination, e.g. before, after, around, etc.
3031

3132
Hacking Interpreter
3233

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ rb_ary_dup(ary)
732732
{
733733
VALUE dup = rb_ary_new2(RARRAY(ary)->len);
734734

735-
OBJSETUP(dup, rb_obj_type(ary), T_ARRAY);
735+
OBJSETUP(dup, rb_obj_class(ary), T_ARRAY);
736736
MEMCPY(RARRAY(dup)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
737737
RARRAY(dup)->len = RARRAY(ary)->len;
738738
OBJ_INFECT(dup, ary);

intern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ VALUE rb_obj_tainted _((VALUE));
244244
VALUE rb_obj_untaint _((VALUE));
245245
VALUE rb_obj_freeze _((VALUE));
246246
VALUE rb_obj_id _((VALUE));
247-
VALUE rb_obj_type _((VALUE));
247+
VALUE rb_obj_class _((VALUE));
248248
VALUE rb_class_real _((VALUE));
249249
VALUE rb_convert_type _((VALUE,int,const char*,const char*));
250250
VALUE rb_to_int _((VALUE));

keywords

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ END, klEND, klEND, EXPR_END
77
alias, kALIAS, kALIAS, EXPR_FNAME
88
and, kAND, kAND, EXPR_BEG
99
begin, kBEGIN, kBEGIN, EXPR_BEG
10-
break, kBREAK, kBREAK, EXPR_END
10+
break, kBREAK, kBREAK, EXPR_MID
1111
case, kCASE, kCASE, EXPR_BEG
1212
class, kCLASS, kCLASS, EXPR_CLASS
1313
def, kDEF, kDEF, EXPR_FNAME
@@ -22,7 +22,7 @@ for, kFOR, kFOR, EXPR_BEG
2222
if, kIF, kIF_MOD, EXPR_BEG
2323
in, kIN, kIN, EXPR_BEG
2424
module, kMODULE, kMODULE, EXPR_BEG
25-
next, kNEXT, kNEXT, EXPR_END
25+
next, kNEXT, kNEXT, EXPR_MID
2626
nil, kNIL, kNIL, EXPR_END
2727
not, kNOT, kNOT, EXPR_BEG
2828
or, kOR, kOR, EXPR_BEG

lex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ rb_reserved_word (str, len)
9797
{"defined?", kDEFINED, kDEFINED, EXPR_ARG},
9898
{"super", kSUPER, kSUPER, EXPR_ARG},
9999
{"undef", kUNDEF, kUNDEF, EXPR_FNAME},
100-
{"break", kBREAK, kBREAK, EXPR_END},
100+
{"break", kBREAK, kBREAK, EXPR_MID},
101101
{"in", kIN, kIN, EXPR_BEG},
102102
{"do", kDO, kDO, EXPR_BEG},
103103
{"nil", kNIL, kNIL, EXPR_END},
104104
{"until", kUNTIL, kUNTIL_MOD, EXPR_BEG},
105105
{"unless", kUNLESS, kUNLESS_MOD, EXPR_BEG},
106106
{"or", kOR, kOR, EXPR_BEG},
107-
{"next", kNEXT, kNEXT, EXPR_END},
107+
{"next", kNEXT, kNEXT, EXPR_MID},
108108
{"when", kWHEN, kWHEN, EXPR_BEG},
109109
{"redo", kREDO, kREDO, EXPR_END},
110110
{"and", kAND, kAND, EXPR_BEG},

lib/timeout.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#
2626
#=end
2727

28-
class TimeoutError<StandardError
28+
class TimeoutError<Interrupt
2929
end
3030

3131
def timeout(sec)
@@ -37,14 +37,20 @@ def timeout(sec)
3737
x.raise TimeoutError, "execution expired" if x.alive?
3838
}
3939
yield sec
40-
return true
40+
# return true
4141
ensure
42-
Thread.kill y if y and y.alive?
42+
y.kill if y and y.alive?
4343
end
4444
end
4545

4646
if __FILE__ == $0
47-
timeout(5) {
48-
p 10
47+
p timeout(5) {
48+
45
49+
}
50+
p timeout(5) {
51+
loop {
52+
p 10
53+
sleep 1
54+
}
4955
}
5056
end

marshal.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ w_object(obj, arg, limit)
293293
w_byte(TYPE_FIXNUM, arg);
294294
w_long(FIX2INT(obj), arg);
295295
#else
296-
if (RSHIFT((long)obj, 32) == 0 || RSHIFT((long)obj, 32) == -1) {
296+
if (RSHIFT((long)obj, 30) == 0 || RSHIFT((long)obj, 30) == -1) {
297297
w_byte(TYPE_FIXNUM, arg);
298298
w_long(FIX2LONG(obj), arg);
299299
}
@@ -447,13 +447,12 @@ w_object(obj, arg, limit)
447447
w_byte(TYPE_STRUCT, arg);
448448
{
449449
long len = RSTRUCT(obj)->len;
450-
char *path = rb_class2name(CLASS_OF(obj));
451450
VALUE mem;
452451
long i;
453452

454-
w_unique(path, arg);
453+
w_unique(rb_class2name(CLASS_OF(obj)), arg);
455454
w_long(len, arg);
456-
mem = rb_ivar_get(CLASS_OF(obj), rb_intern("__member__"));
455+
mem = rb_ivar_get(rb_obj_class(obj), rb_intern("__member__"));
457456
if (mem == Qnil) {
458457
rb_raise(rb_eTypeError, "uninitialized struct");
459458
}

object.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ rb_class_real(cl)
8181
}
8282

8383
VALUE
84-
rb_obj_type(obj)
84+
rb_obj_class(obj)
8585
VALUE obj;
8686
{
8787
return rb_class_real(CLASS_OF(obj));
@@ -116,7 +116,7 @@ rb_obj_dup(obj)
116116
rb_raise(rb_eTypeError, "dupulicated object must be same type");
117117
}
118118
if (!SPECIAL_CONST_P(dup)) {
119-
OBJSETUP(dup, rb_obj_type(obj), BUILTIN_TYPE(obj));
119+
OBJSETUP(dup, rb_obj_class(obj), BUILTIN_TYPE(obj));
120120
OBJ_INFECT(dup, obj);
121121
if (FL_TEST(obj, FL_EXIVAR)) {
122122
FL_SET(dup, FL_EXIVAR);
@@ -233,7 +233,7 @@ rb_obj_is_instance_of(obj, c)
233233
rb_raise(rb_eTypeError, "class or module required");
234234
}
235235

236-
if (rb_obj_type(obj) == c) return Qtrue;
236+
if (rb_obj_class(obj) == c) return Qtrue;
237237
return Qfalse;
238238
}
239239

@@ -1155,8 +1155,8 @@ Init_Object()
11551155
rb_define_method(rb_mKernel, "hash", rb_obj_id, 0);
11561156
rb_define_method(rb_mKernel, "id", rb_obj_id, 0);
11571157
rb_define_method(rb_mKernel, "__id__", rb_obj_id, 0);
1158-
rb_define_method(rb_mKernel, "type", rb_obj_type, 0);
1159-
rb_define_method(rb_mKernel, "class", rb_obj_type, 0);
1158+
rb_define_method(rb_mKernel, "type", rb_obj_class, 0);
1159+
rb_define_method(rb_mKernel, "class", rb_obj_class, 0);
11601160

11611161
rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0);
11621162
rb_define_method(rb_mKernel, "dup", rb_obj_dup, 0);

parse.y

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,8 @@ read_escape()
23272327
}
23282328

23292329
static int
2330-
tokadd_escape()
2330+
tokadd_escape(term)
2331+
int term;
23312332
{
23322333
int c;
23332334

@@ -2388,7 +2389,7 @@ tokadd_escape()
23882389
tokadd('\\'); tokadd('c');
23892390
escaped:
23902391
if ((c = nextc()) == '\\') {
2391-
return tokadd_escape();
2392+
return tokadd_escape(term);
23922393
}
23932394
else if (c == -1) goto eof;
23942395
tokadd(c);
@@ -2400,7 +2401,8 @@ tokadd_escape()
24002401
return -1;
24012402

24022403
default:
2403-
tokadd('\\');
2404+
if (c == '/' && c != term)
2405+
tokadd('\\');
24042406
tokadd(c);
24052407
}
24062408
return 0;
@@ -2431,7 +2433,7 @@ parse_regx(term, paren)
24312433
continue;
24322434

24332435
case '\\':
2434-
if (tokadd_escape() < 0)
2436+
if (tokadd_escape(term) < 0)
24352437
return 0;
24362438
continue;
24372439

0 commit comments

Comments
 (0)