2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
be72d9a5da
commit
7194267b3b
74
ChangeLog
74
ChangeLog
@ -1,3 +1,71 @@
|
|||||||
|
Sun Apr 9 20:49:19 2000 Dave Thomas <Dave@Thomases.com>
|
||||||
|
|
||||||
|
* parse.y (str_extend): Allow class variables to be expanded.
|
||||||
|
|
||||||
|
Fri Apr 7 02:03:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* error.c (rb_sys_fail): escape non-printable characters.
|
||||||
|
|
||||||
|
Thu Apr 6 20:10:47 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||||
|
|
||||||
|
* ext/extmk.rb.in (create_makefile): BeOS --program-suffix support.
|
||||||
|
* lib/mkmf.rb (create_makefile): ditto.
|
||||||
|
|
||||||
|
Thu Apr 6 09:55:26 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||||
|
|
||||||
|
* error.c (rb_sys_fail): need rb_exc_new2() call on BeOS.
|
||||||
|
|
||||||
|
Mon Apr 3 17:22:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* io.c (rb_io_reopen): support tempfile.
|
||||||
|
|
||||||
|
* eval.c (catch_i): should supply argument.
|
||||||
|
|
||||||
|
Sat Apr 1 22:50:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* marshal.c (r_object): wrong symbol restoration.
|
||||||
|
|
||||||
|
Sat Apr 1 21:30:53 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
|
||||||
|
|
||||||
|
* io.c(rb_io_printf, rb_f_printf): should use rb_io_write.
|
||||||
|
|
||||||
|
Sat Apr 1 00:16:05 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* gc.c (rb_gc_call_finalizer_at_exit): should be clear flags
|
||||||
|
before calling finalizers.
|
||||||
|
|
||||||
|
* eval.c (specific_eval): can be called without SecurityError, if
|
||||||
|
$SAFE >= 4.
|
||||||
|
|
||||||
|
* object.c (sym_inspect): inspect gives ":sym", to_s gives "sym".
|
||||||
|
|
||||||
|
Fri Mar 31 08:56:55 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* parse.y (yylex):
|
||||||
|
|
||||||
|
Thu Mar 30 12:19:44 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||||
|
|
||||||
|
* enum.c (enum_find): rb_eval_cmd() should be called with array.
|
||||||
|
|
||||||
|
Tue Mar 28 13:57:05 2000 Clemens Hintze <c.hintze@gmx.net>
|
||||||
|
|
||||||
|
* ext/dbm/dbm.c (fdbm_invert): should return new hash.
|
||||||
|
|
||||||
|
* ext/gdbm/gdbm.c (fgdbm_invert): ditto.
|
||||||
|
|
||||||
|
Sat Mar 25 23:21:10 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* marshal.c (w_object): symbols should be converted to ID before
|
||||||
|
dumping out.
|
||||||
|
|
||||||
|
Fri Mar 24 18:26:51 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* file.c (test_check): should have checked exact number of arguments.
|
||||||
|
|
||||||
|
Fri Mar 24 21:02:11 2000 Koji Arai <JCA02266@nifty.ne.jp>
|
||||||
|
|
||||||
|
* signal.c (trap): should treat some symbols as the signal.
|
||||||
|
|
||||||
Thu Mar 23 02:26:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Thu Mar 23 02:26:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* io.c (rb_io_fptr_finalize): fptr may be null.
|
* io.c (rb_io_fptr_finalize): fptr may be null.
|
||||||
@ -46,7 +114,7 @@ Sat Mar 18 12:36:09 2000 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
|||||||
Sat Mar 18 11:25:10 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Sat Mar 18 11:25:10 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* parse.y (rescue): allows `rescue Error in foo'. experimental.
|
* parse.y (rescue): allows `rescue Error in foo'. experimental.
|
||||||
which is better this or preparing alias `exception' for `$!'.
|
which is better this or preparing alias `exception' for `$!'?
|
||||||
|
|
||||||
Fri Mar 17 15:02:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Fri Mar 17 15:02:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
@ -205,7 +273,7 @@ Sun Mar 5 18:49:06 2000 Nakada.Nobuyoshi <nobu.nokada@softhome.net>
|
|||||||
Tue Feb 29 01:08:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Feb 29 01:08:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* range.c (range_initialize): initialization done in `initialize';
|
* range.c (range_initialize): initialization done in `initialize';
|
||||||
`initialize; should not be called more than once.
|
`initialize' should not be called more than once.
|
||||||
|
|
||||||
* object.c (Init_Object): default `initialize' should take zero
|
* object.c (Init_Object): default `initialize' should take zero
|
||||||
argument.
|
argument.
|
||||||
@ -214,7 +282,7 @@ Tue Feb 29 01:08:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||||||
|
|
||||||
Sat Feb 26 22:39:31 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
|
Sat Feb 26 22:39:31 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
|
||||||
|
|
||||||
* Fix String#* with huge string.
|
* string.c (rb_str_times): fix String#* with huge string.
|
||||||
|
|
||||||
Sat Feb 26 00:14:59 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Sat Feb 26 00:14:59 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
8
MANIFEST
8
MANIFEST
@ -76,7 +76,6 @@ variable.c
|
|||||||
version.c
|
version.c
|
||||||
version.h
|
version.h
|
||||||
beos/GNUmakefile.in
|
beos/GNUmakefile.in
|
||||||
beos/ruby.def.in
|
|
||||||
cygwin/GNUmakefile.in
|
cygwin/GNUmakefile.in
|
||||||
ext/Setup
|
ext/Setup
|
||||||
ext/Setup.dj
|
ext/Setup.dj
|
||||||
@ -90,6 +89,8 @@ lib/Env.rb
|
|||||||
lib/README
|
lib/README
|
||||||
lib/base64.rb
|
lib/base64.rb
|
||||||
lib/cgi.rb
|
lib/cgi.rb
|
||||||
|
lib/cgi/session.rb
|
||||||
|
lib/cgi-lib.rb
|
||||||
lib/complex.rb
|
lib/complex.rb
|
||||||
lib/date.rb
|
lib/date.rb
|
||||||
lib/date2.rb
|
lib/date2.rb
|
||||||
@ -125,11 +126,9 @@ lib/matrix.rb
|
|||||||
lib/mkmf.rb
|
lib/mkmf.rb
|
||||||
lib/monitor.rb
|
lib/monitor.rb
|
||||||
lib/mutex_m.rb
|
lib/mutex_m.rb
|
||||||
lib/net/http.rb
|
|
||||||
lib/net/ftp.rb
|
lib/net/ftp.rb
|
||||||
lib/net/http.rb
|
|
||||||
lib/net/pop.rb
|
lib/net/pop.rb
|
||||||
lib/net/session.rb
|
lib/net/protocol.rb
|
||||||
lib/net/smtp.rb
|
lib/net/smtp.rb
|
||||||
lib/observer.rb
|
lib/observer.rb
|
||||||
lib/open3.rb
|
lib/open3.rb
|
||||||
@ -223,7 +222,6 @@ sample/rename.rb
|
|||||||
sample/rcs.awk
|
sample/rcs.awk
|
||||||
sample/rcs.dat
|
sample/rcs.dat
|
||||||
sample/rcs.rb
|
sample/rcs.rb
|
||||||
sample/rd2html.rb
|
|
||||||
sample/regx.rb
|
sample/regx.rb
|
||||||
sample/sieve.rb
|
sample/sieve.rb
|
||||||
sample/svr.rb
|
sample/svr.rb
|
||||||
|
5
ToDo
5
ToDo
@ -35,11 +35,12 @@ Hacking Interpreter
|
|||||||
- all object made freezable
|
- all object made freezable
|
||||||
* non-blocking open (e.g. for named pipe) for thread
|
* non-blocking open (e.g. for named pipe) for thread
|
||||||
* avoid blocking with gethostbyname/gethostbyaddr (use fork ???)
|
* avoid blocking with gethostbyname/gethostbyaddr (use fork ???)
|
||||||
* objectify interpreters
|
* objectify interpreters ???
|
||||||
* remove rb_eval() recursions
|
* remove rb_eval() recursions
|
||||||
* syntax tree -> bytecode ???
|
* syntax tree -> bytecode ???
|
||||||
* scrambled script, or script filter
|
* scrambled script, or script filter
|
||||||
* setuid ruby
|
* setuid ruby
|
||||||
|
* performance tune for in-block (dynamic) local variables.
|
||||||
|
|
||||||
Standard Libraries
|
Standard Libraries
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ Standard Libraries
|
|||||||
- Struct::new([name,]member,...)
|
- Struct::new([name,]member,...)
|
||||||
- IO#reopen accepts path as well
|
- IO#reopen accepts path as well
|
||||||
- Kernel#scan
|
- Kernel#scan
|
||||||
- call initialize for builtin class too (not yet: Regexp, etc)
|
- call initialize for builtin classes too (not yet: Regexp, Class, Module)
|
||||||
- performance tune for String's non-bang methods.
|
- performance tune for String's non-bang methods.
|
||||||
* String#scanf(?)
|
* String#scanf(?)
|
||||||
* Object#fmt(?)
|
* Object#fmt(?)
|
||||||
|
8
array.c
8
array.c
@ -728,8 +728,8 @@ rb_ary_join(ary, sep)
|
|||||||
default:
|
default:
|
||||||
tmp = rb_obj_as_string(tmp);
|
tmp = rb_obj_as_string(tmp);
|
||||||
}
|
}
|
||||||
if (!NIL_P(sep)) rb_str_concat(result, sep);
|
if (!NIL_P(sep)) rb_str_append(result, sep);
|
||||||
rb_str_cat(result, RSTRING(tmp)->ptr, RSTRING(tmp)->len);
|
rb_str_append(result, tmp);
|
||||||
if (OBJ_TAINTED(tmp)) taint = 1;
|
if (OBJ_TAINTED(tmp)) taint = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,8 +841,8 @@ inspect_ary(ary)
|
|||||||
for (i=0; i<RARRAY(ary)->len; i++) {
|
for (i=0; i<RARRAY(ary)->len; i++) {
|
||||||
s = rb_inspect(RARRAY(ary)->ptr[i]);
|
s = rb_inspect(RARRAY(ary)->ptr[i]);
|
||||||
tainted = OBJ_TAINTED(s);
|
tainted = OBJ_TAINTED(s);
|
||||||
if (i > 0) rb_str_cat(str, ", ", 2);
|
if (i > 0) rb_str_cat2(str, ", ");
|
||||||
rb_str_cat(str, RSTRING(s)->ptr, RSTRING(s)->len);
|
rb_str_append(str, s);
|
||||||
}
|
}
|
||||||
rb_str_cat(str, "]", 1);
|
rb_str_cat(str, "]", 1);
|
||||||
|
|
||||||
|
2
enum.c
2
enum.c
@ -88,7 +88,7 @@ enum_find(argc, argv, obj)
|
|||||||
return memo->u1.value;
|
return memo->u1.value;
|
||||||
}
|
}
|
||||||
if (!NIL_P(if_none)) {
|
if (!NIL_P(if_none)) {
|
||||||
rb_eval_cmd(if_none, Qnil);
|
rb_eval_cmd(if_none, rb_ary_new2(0));
|
||||||
}
|
}
|
||||||
rb_gc_force_recycle((VALUE)memo);
|
rb_gc_force_recycle((VALUE)memo);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
12
error.c
12
error.c
@ -344,9 +344,9 @@ exc_inspect(exc)
|
|||||||
|
|
||||||
str = rb_str_new2("#<");
|
str = rb_str_new2("#<");
|
||||||
klass = rb_class_path(klass);
|
klass = rb_class_path(klass);
|
||||||
rb_str_concat(str, klass);
|
rb_str_append(str, klass);
|
||||||
rb_str_cat(str, ": ", 2);
|
rb_str_cat(str, ": ", 2);
|
||||||
rb_str_concat(str, exc);
|
rb_str_append(str, exc);
|
||||||
rb_str_cat(str, ">", 1);
|
rb_str_cat(str, ">", 1);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@ -631,8 +631,10 @@ rb_sys_fail(mesg)
|
|||||||
|
|
||||||
err = strerror(errno);
|
err = strerror(errno);
|
||||||
if (mesg) {
|
if (mesg) {
|
||||||
buf = ALLOCA_N(char, strlen(err)+strlen(mesg)+4);
|
volatile VALUE tmp = rb_str_inspect(rb_str_new2(mesg));
|
||||||
sprintf(buf, "%s - %s", err, mesg);
|
|
||||||
|
buf = ALLOCA_N(char, strlen(err)+RSTRING(tmp)->len+4);
|
||||||
|
sprintf(buf, "%s - %s", err, RSTRING(tmp)->ptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf = ALLOCA_N(char, strlen(err)+1);
|
buf = ALLOCA_N(char, strlen(err)+1);
|
||||||
@ -658,8 +660,8 @@ rb_sys_fail(mesg)
|
|||||||
else {
|
else {
|
||||||
ee = syserr_list[n];
|
ee = syserr_list[n];
|
||||||
}
|
}
|
||||||
ee = rb_exc_new2(ee, buf);
|
|
||||||
#endif
|
#endif
|
||||||
|
ee = rb_exc_new2(ee, buf);
|
||||||
rb_iv_set(ee, "errno", INT2FIX(n));
|
rb_iv_set(ee, "errno", INT2FIX(n));
|
||||||
rb_exc_raise(ee);
|
rb_exc_raise(ee);
|
||||||
}
|
}
|
||||||
|
132
eval.c
132
eval.c
@ -2686,8 +2686,8 @@ rb_eval(self, node)
|
|||||||
str2 = rb_obj_as_string(str2);
|
str2 = rb_obj_as_string(str2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
if (OBJ_TAINTED(str2)) OBJ_TAINT(str);
|
OBJ_INFECT(str, str2);
|
||||||
}
|
}
|
||||||
list = list->nd_next;
|
list = list->nd_next;
|
||||||
}
|
}
|
||||||
@ -4524,8 +4524,8 @@ eval(self, src, scope, file, line)
|
|||||||
if (strcmp(file, "(eval)") == 0) {
|
if (strcmp(file, "(eval)") == 0) {
|
||||||
if (ruby_sourceline > 1) {
|
if (ruby_sourceline > 1) {
|
||||||
err = RARRAY(errat)->ptr[0];
|
err = RARRAY(errat)->ptr[0];
|
||||||
rb_str_cat(err, ": ", 2);
|
rb_str_cat2(err, ": ");
|
||||||
rb_str_concat(err, ruby_errinfo);
|
rb_str_append(err, ruby_errinfo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err = rb_str_dup(ruby_errinfo);
|
err = rb_str_dup(ruby_errinfo);
|
||||||
@ -4560,7 +4560,7 @@ rb_f_eval(argc, argv, self)
|
|||||||
line = NUM2INT(vline);
|
line = NUM2INT(vline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruby_safe_level >= 3) {
|
if (ruby_safe_level >= 4) {
|
||||||
Check_Type(src, T_STRING);
|
Check_Type(src, T_STRING);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4697,7 +4697,12 @@ specific_eval(argc, argv, klass, self)
|
|||||||
int iter = rb_iterator_p();
|
int iter = rb_iterator_p();
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
Check_SafeStr(argv[0]);
|
if (ruby_safe_level >= 4) {
|
||||||
|
Check_Type(argv[0], T_STRING);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Check_SafeStr(argv[0]);
|
||||||
|
}
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rb_raise(rb_eArgError, "wrong # of arguments: %s(src) or %s{..}",
|
rb_raise(rb_eArgError, "wrong # of arguments: %s(src) or %s{..}",
|
||||||
rb_id2name(ruby_frame->last_func),
|
rb_id2name(ruby_frame->last_func),
|
||||||
@ -5708,7 +5713,7 @@ proc_set_safe_level(data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
proc_s_new(klass)
|
proc_new(klass)
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
{
|
{
|
||||||
volatile VALUE proc;
|
volatile VALUE proc;
|
||||||
@ -5743,10 +5748,22 @@ proc_s_new(klass)
|
|||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
proc_s_new(argc, argv, klass)
|
||||||
|
int argc;
|
||||||
|
VALUE *argv;
|
||||||
|
VALUE klass;
|
||||||
|
{
|
||||||
|
VALUE proc = proc_new(klass);
|
||||||
|
|
||||||
|
rb_obj_call_init(proc, argc, argv);
|
||||||
|
return proc;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_f_lambda()
|
rb_f_lambda()
|
||||||
{
|
{
|
||||||
return proc_s_new(rb_cProc);
|
return proc_new(rb_cProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -5763,6 +5780,21 @@ blk_orphan(data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
callargs(args)
|
||||||
|
VALUE args;
|
||||||
|
{
|
||||||
|
switch (RARRAY(args)->len) {
|
||||||
|
case 0:
|
||||||
|
return Qnil;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return RARRAY(args)->ptr[0];
|
||||||
|
default:
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
proc_call(proc, args)
|
proc_call(proc, args)
|
||||||
VALUE proc, args; /* OK */
|
VALUE proc, args; /* OK */
|
||||||
@ -5786,14 +5818,7 @@ proc_call(proc, args)
|
|||||||
ruby_frame->iter = ITER_CUR;
|
ruby_frame->iter = ITER_CUR;
|
||||||
|
|
||||||
if (TYPE(args) == T_ARRAY) {
|
if (TYPE(args) == T_ARRAY) {
|
||||||
switch (RARRAY(args)->len) {
|
args = callargs(args);
|
||||||
case 0:
|
|
||||||
args = Qnil;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
args = RARRAY(args)->ptr[0];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orphan) {/* orphan procedure */
|
if (orphan) {/* orphan procedure */
|
||||||
@ -6087,14 +6112,14 @@ method_inspect(method)
|
|||||||
Data_Get_Struct(method, struct METHOD, data);
|
Data_Get_Struct(method, struct METHOD, data);
|
||||||
str = rb_str_new2("#<");
|
str = rb_str_new2("#<");
|
||||||
s = rb_class2name(CLASS_OF(method));
|
s = rb_class2name(CLASS_OF(method));
|
||||||
rb_str_cat(str, s, strlen(s));
|
rb_str_cat2(str, s);
|
||||||
rb_str_cat(str, ": ", 2);
|
rb_str_cat2(str, ": ");
|
||||||
s = rb_class2name(data->oklass);
|
s = rb_class2name(data->oklass);
|
||||||
rb_str_cat(str, s, strlen(s));
|
rb_str_cat2(str, s);
|
||||||
rb_str_cat(str, "#", 1);
|
rb_str_cat2(str, "#");
|
||||||
s = rb_id2name(data->oid);
|
s = rb_id2name(data->oid);
|
||||||
rb_str_cat(str, s, strlen(s));
|
rb_str_cat2(str, s);
|
||||||
rb_str_cat(str, ">", 1);
|
rb_str_cat2(str, ">");
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -6138,7 +6163,7 @@ Init_Proc()
|
|||||||
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
|
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
|
||||||
|
|
||||||
rb_cProc = rb_define_class("Proc", rb_cObject);
|
rb_cProc = rb_define_class("Proc", rb_cObject);
|
||||||
rb_define_singleton_method(rb_cProc, "new", proc_s_new, 0);
|
rb_define_singleton_method(rb_cProc, "new", proc_s_new, -1);
|
||||||
|
|
||||||
rb_define_method(rb_cProc, "call", proc_call, -2);
|
rb_define_method(rb_cProc, "call", proc_call, -2);
|
||||||
rb_define_method(rb_cProc, "arity", proc_arity, 0);
|
rb_define_method(rb_cProc, "arity", proc_arity, 0);
|
||||||
@ -6333,6 +6358,10 @@ thread_free(th)
|
|||||||
if (th->stk_ptr) free(th->stk_ptr);
|
if (th->stk_ptr) free(th->stk_ptr);
|
||||||
th->stk_ptr = 0;
|
th->stk_ptr = 0;
|
||||||
if (th->locals) st_free_table(th->locals);
|
if (th->locals) st_free_table(th->locals);
|
||||||
|
if (th->status != THREAD_KILLED) {
|
||||||
|
th->prev->next = th->next;
|
||||||
|
th->next->prev = th->prev;
|
||||||
|
}
|
||||||
if (th != main_thread) free(th);
|
if (th != main_thread) free(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7270,12 +7299,11 @@ rb_thread_stop_timer()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_create_0(fn, arg, klass)
|
rb_thread_start_0(fn, arg, th)
|
||||||
VALUE (*fn)();
|
VALUE (*fn)();
|
||||||
void *arg;
|
void *arg;
|
||||||
VALUE klass;
|
thread_t th;
|
||||||
{
|
{
|
||||||
thread_t th = rb_thread_alloc(klass);
|
|
||||||
volatile VALUE thread = th->thread;
|
volatile VALUE thread = th->thread;
|
||||||
enum thread_status status;
|
enum thread_status status;
|
||||||
int state;
|
int state;
|
||||||
@ -7339,7 +7367,7 @@ rb_thread_create(fn, arg)
|
|||||||
VALUE (*fn)();
|
VALUE (*fn)();
|
||||||
void *arg;
|
void *arg;
|
||||||
{
|
{
|
||||||
return rb_thread_create_0(fn, arg, rb_cThread);
|
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -7354,7 +7382,37 @@ rb_thread_yield(arg, th)
|
|||||||
thread_t th;
|
thread_t th;
|
||||||
{
|
{
|
||||||
scope_dup(ruby_block->scope);
|
scope_dup(ruby_block->scope);
|
||||||
return rb_yield_0(arg, 0, 0, Qfalse);
|
return rb_yield_0(callargs(arg), 0, 0, Qfalse);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_thread_s_new(argc, argv, klass)
|
||||||
|
int argc;
|
||||||
|
VALUE *argv;
|
||||||
|
VALUE klass;
|
||||||
|
{
|
||||||
|
thread_t th = rb_thread_alloc(klass);
|
||||||
|
volatile VALUE *pos;
|
||||||
|
|
||||||
|
THREAD_SAVE_CONTEXT(th);
|
||||||
|
pos = th->stk_pos;
|
||||||
|
rb_obj_call_init(th->thread, argc, argv);
|
||||||
|
if (th->stk_pos == pos) {
|
||||||
|
rb_raise(rb_eThreadError, "uninitialized thread - check `initialize' of %s",
|
||||||
|
rb_class2name(klass));
|
||||||
|
}
|
||||||
|
|
||||||
|
return th->thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_thread_initialize(thread, args)
|
||||||
|
VALUE thread, args;
|
||||||
|
{
|
||||||
|
if (!rb_iterator_p()) {
|
||||||
|
rb_raise(rb_eThreadError, "must be called as iterator");
|
||||||
|
}
|
||||||
|
return rb_thread_start_0(rb_thread_yield, args, rb_thread_check(thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -7364,7 +7422,7 @@ rb_thread_start(klass, args)
|
|||||||
if (!rb_iterator_p()) {
|
if (!rb_iterator_p()) {
|
||||||
rb_raise(rb_eThreadError, "must be called as iterator");
|
rb_raise(rb_eThreadError, "must be called as iterator");
|
||||||
}
|
}
|
||||||
return rb_thread_create_0(rb_thread_yield, args, klass);
|
return rb_thread_start_0(rb_thread_yield, args, rb_thread_alloc(klass));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -7743,7 +7801,9 @@ struct thgroup {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
thgroup_s_new(klass)
|
thgroup_s_new(argc, argv, klass)
|
||||||
|
int argc;
|
||||||
|
VALUE *argv;
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
{
|
{
|
||||||
VALUE group;
|
VALUE group;
|
||||||
@ -7753,6 +7813,7 @@ thgroup_s_new(klass)
|
|||||||
group = Data_Make_Struct(klass, struct thgroup, 0, free, data);
|
group = Data_Make_Struct(klass, struct thgroup, 0, free, data);
|
||||||
data->gid = serial++;
|
data->gid = serial++;
|
||||||
|
|
||||||
|
rb_obj_call_init(group, argc, argv);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7800,7 +7861,8 @@ Init_Thread()
|
|||||||
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
|
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
|
||||||
rb_cThread = rb_define_class("Thread", rb_cObject);
|
rb_cThread = rb_define_class("Thread", rb_cObject);
|
||||||
|
|
||||||
rb_define_singleton_method(rb_cThread, "new", rb_thread_start, -2);
|
rb_define_singleton_method(rb_cThread, "new", rb_thread_s_new, -1);
|
||||||
|
rb_define_method(rb_cThread, "initialize", rb_thread_initialize, -2);
|
||||||
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, -2);
|
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, -2);
|
||||||
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, -2);
|
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, -2);
|
||||||
|
|
||||||
@ -7851,10 +7913,10 @@ Init_Thread()
|
|||||||
rb_define_global_function("callcc", rb_callcc, 0);
|
rb_define_global_function("callcc", rb_callcc, 0);
|
||||||
|
|
||||||
cThGroup = rb_define_class("ThreadGroup", rb_cObject);
|
cThGroup = rb_define_class("ThreadGroup", rb_cObject);
|
||||||
rb_define_singleton_method(cThGroup, "new", thgroup_s_new, 0);
|
rb_define_singleton_method(cThGroup, "new", thgroup_s_new, -1);
|
||||||
rb_define_method(cThGroup, "list", thgroup_list, 0);
|
rb_define_method(cThGroup, "list", thgroup_list, 0);
|
||||||
rb_define_method(cThGroup, "add", thgroup_add, 1);
|
rb_define_method(cThGroup, "add", thgroup_add, 1);
|
||||||
rb_define_const(cThGroup, "Default", thgroup_s_new(cThGroup));
|
rb_define_const(cThGroup, "Default", thgroup_s_new(0, 0, cThGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -7884,7 +7946,7 @@ static VALUE
|
|||||||
catch_i(tag)
|
catch_i(tag)
|
||||||
ID tag;
|
ID tag;
|
||||||
{
|
{
|
||||||
return rb_funcall(Qnil, rb_intern("catch"), 0, INT2FIX(tag));
|
return rb_funcall(Qnil, rb_intern("catch"), 1, ID2SYM(tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
@ -7937,7 +7999,7 @@ rb_throw(tag, val)
|
|||||||
VALUE argv[2];
|
VALUE argv[2];
|
||||||
ID t = rb_intern(tag);
|
ID t = rb_intern(tag);
|
||||||
|
|
||||||
argv[0] = INT2FIX(t);
|
argv[0] = ID2SYM(t);
|
||||||
argv[1] = val;
|
argv[1] = val;
|
||||||
rb_f_throw(2, argv);
|
rb_f_throw(2, argv);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ fdbm_invert(obj)
|
|||||||
valstr = rb_tainted_str_new(val.dptr, val.dsize);
|
valstr = rb_tainted_str_new(val.dptr, val.dsize);
|
||||||
rb_hash_aset(hash, valstr, keystr);
|
rb_hash_aset(hash, valstr, keystr);
|
||||||
}
|
}
|
||||||
return obj;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -329,8 +329,8 @@ def create_makefile(target)
|
|||||||
|
|
||||||
$DLDFLAGS = '@DLDFLAGS@'
|
$DLDFLAGS = '@DLDFLAGS@'
|
||||||
|
|
||||||
if RUBY_PLATFORM =~ /beos/
|
if RUBY_PLATFORM =~ /beos/ and not $static
|
||||||
$libs = $libs + " -lruby"
|
$libs = $libs + " @LIBRUBYARG@"
|
||||||
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
|
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ fgdbm_invert(obj)
|
|||||||
valstr = rb_tainted_str_new(val.dptr, val.dsize);
|
valstr = rb_tainted_str_new(val.dptr, val.dsize);
|
||||||
rb_hash_aset(hash, valstr, keystr);
|
rb_hash_aset(hash, valstr, keystr);
|
||||||
}
|
}
|
||||||
return obj;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -427,6 +427,98 @@ class TkText<TkTextWin
|
|||||||
def rsearch(pat,start,stop=None)
|
def rsearch(pat,start,stop=None)
|
||||||
rsearch_with_length(pat,start,stop)[0]
|
rsearch_with_length(pat,start,stop)[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _dump(type, *index)
|
||||||
|
str = tk_send('dump', type, *index)
|
||||||
|
result = []
|
||||||
|
sel = nil
|
||||||
|
i = 0
|
||||||
|
while i < str.size
|
||||||
|
# retrieve key
|
||||||
|
idx = str.index(/ /, i)
|
||||||
|
result.push str[i..(idx-1)]
|
||||||
|
i = idx + 1
|
||||||
|
|
||||||
|
# retrieve value
|
||||||
|
case result[-1]
|
||||||
|
when 'text'
|
||||||
|
if str[i] == ?{
|
||||||
|
# text formed as {...}
|
||||||
|
val, i = _retrieve_braced_text(str, i)
|
||||||
|
result.push val
|
||||||
|
else
|
||||||
|
# text which may contain backslahes
|
||||||
|
val, i = _retrieve_backslashed_text(str, i)
|
||||||
|
result.push val
|
||||||
|
end
|
||||||
|
else
|
||||||
|
idx = str.index(/ /, i)
|
||||||
|
val = str[i..(idx-1)]
|
||||||
|
case result[-1]
|
||||||
|
when 'mark'
|
||||||
|
case val
|
||||||
|
when 'insert'
|
||||||
|
result.push TkTextMarkInsert.new(self)
|
||||||
|
when 'current'
|
||||||
|
result.push TkTextMarkCurrent.new(self)
|
||||||
|
when 'anchor'
|
||||||
|
result.push TkTextMarkAnchor.new(self)
|
||||||
|
else
|
||||||
|
result.push tk_tcl2rb(val)
|
||||||
|
end
|
||||||
|
when 'tagon'
|
||||||
|
if val == 'sel'
|
||||||
|
if sel
|
||||||
|
result.push sel
|
||||||
|
else
|
||||||
|
result.push TkTextTagSel.new(self)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result.push tk_tcl2rb val
|
||||||
|
end
|
||||||
|
when 'tagoff'
|
||||||
|
result.push tk_tcl2rb sel
|
||||||
|
when 'window'
|
||||||
|
result.push tk_tcl2rb val
|
||||||
|
end
|
||||||
|
i = idx + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# retrieve index
|
||||||
|
idx = str.index(/ /, i)
|
||||||
|
if idx
|
||||||
|
result.push str[i..(idx-1)]
|
||||||
|
i = idx + 1
|
||||||
|
else
|
||||||
|
result.push str[i..-1]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
kvis = []
|
||||||
|
until result.empty?
|
||||||
|
kvis.push [result.shift, result.shift, result.shift]
|
||||||
|
end
|
||||||
|
kvis # result is [[key1, value1, index1], [key2, value2, index2], ...]
|
||||||
|
end
|
||||||
|
private :_dump
|
||||||
|
|
||||||
|
def dump_all(*index)
|
||||||
|
_dump('-all', *index)
|
||||||
|
end
|
||||||
|
def dump_mark(*index)
|
||||||
|
_dump('-mark', *index)
|
||||||
|
end
|
||||||
|
def dump_tag(*index)
|
||||||
|
_dump('-tag', *index)
|
||||||
|
end
|
||||||
|
def dump_text(*index)
|
||||||
|
_dump('-text', *index)
|
||||||
|
end
|
||||||
|
def dump_window(*index)
|
||||||
|
_dump('-window', *index)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextTag<TkObject
|
class TkTextTag<TkObject
|
||||||
@ -739,81 +831,6 @@ class TkTextWindow<TkObject
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _dump(type, *index)
|
|
||||||
str = tk_send('dump', type, *index)
|
|
||||||
result = []
|
|
||||||
sel = nil
|
|
||||||
i = 0
|
|
||||||
while i < str.size
|
|
||||||
# retrieve key
|
|
||||||
idx = str.index(/ /, i)
|
|
||||||
result.push str[i..(idx-1)]
|
|
||||||
i = idx + 1
|
|
||||||
|
|
||||||
# retrieve value
|
|
||||||
case result[-1]
|
|
||||||
when 'text'
|
|
||||||
if str[i] == ?{
|
|
||||||
# text formed as {...}
|
|
||||||
val, i = _retrieve_braced_text(str, i)
|
|
||||||
result.push val
|
|
||||||
else
|
|
||||||
# text which may contain backslahes
|
|
||||||
val, i = _retrieve_backslashed_text(str, i)
|
|
||||||
result.push val
|
|
||||||
end
|
|
||||||
else
|
|
||||||
idx = str.index(/ /, i)
|
|
||||||
val = str[i..(idx-1)]
|
|
||||||
case result[-1]
|
|
||||||
when 'mark'
|
|
||||||
case val
|
|
||||||
when 'insert'
|
|
||||||
result.push TkTextMarkInsert.new(self)
|
|
||||||
when 'current'
|
|
||||||
result.push TkTextMarkCurrent.new(self)
|
|
||||||
when 'anchor'
|
|
||||||
result.push TkTextMarkAnchor.new(self)
|
|
||||||
else
|
|
||||||
result.push tk_tcl2rb(val)
|
|
||||||
end
|
|
||||||
when 'tagon'
|
|
||||||
if val == 'sel'
|
|
||||||
if sel
|
|
||||||
result.push sel
|
|
||||||
else
|
|
||||||
result.push TkTextTagSel.new(self)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
result.push tk_tcl2rb val
|
|
||||||
end
|
|
||||||
when 'tagoff'
|
|
||||||
result.push tk_tcl2rb sel
|
|
||||||
when 'window'
|
|
||||||
result.push tk_tcl2rb val
|
|
||||||
end
|
|
||||||
i = idx + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
# retrieve index
|
|
||||||
idx = str.index(/ /, i)
|
|
||||||
if idx
|
|
||||||
result.push str[i..(idx-1)]
|
|
||||||
i = idx + 1
|
|
||||||
else
|
|
||||||
result.push str[i..-1]
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
kvis = []
|
|
||||||
until result.empty?
|
|
||||||
kvis.push [result.shift, result.shift, result.shift]
|
|
||||||
end
|
|
||||||
kvis # result is [[key1, value1, index1], [key2, value2, index2], ...]
|
|
||||||
end
|
|
||||||
private :_dump
|
|
||||||
|
|
||||||
def _retrieve_braced_text(str, i)
|
def _retrieve_braced_text(str, i)
|
||||||
cnt = 0
|
cnt = 0
|
||||||
idx = i
|
idx = i
|
||||||
@ -850,21 +867,6 @@ class TkTextWindow<TkObject
|
|||||||
end
|
end
|
||||||
private :_retrieve_backslashed_text
|
private :_retrieve_backslashed_text
|
||||||
|
|
||||||
def dump_all(*index)
|
|
||||||
_dump('-all', *index)
|
|
||||||
end
|
|
||||||
def dump_mark(*index)
|
|
||||||
_dump('-mark', *index)
|
|
||||||
end
|
|
||||||
def dump_tag(*index)
|
|
||||||
_dump('-tag', *index)
|
|
||||||
end
|
|
||||||
def dump_text(*index)
|
|
||||||
_dump('-text', *index)
|
|
||||||
end
|
|
||||||
def dump_window(*index)
|
|
||||||
_dump('-window', *index)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextImage<TkObject
|
class TkTextImage<TkObject
|
||||||
|
2
file.c
2
file.c
@ -1504,7 +1504,7 @@ test_check(n, argc, argv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
n+=1;
|
n+=1;
|
||||||
if (n < argc) rb_raise(rb_eArgError, "wrong # of arguments(%d for %d)", argc, n);
|
if (n != argc) rb_raise(rb_eArgError, "wrong # of arguments(%d for %d)", argc, n);
|
||||||
for (i=1; i<n; i++) {
|
for (i=1; i<n; i++) {
|
||||||
switch (TYPE(argv[i])) {
|
switch (TYPE(argv[i])) {
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
|
4
gc.c
4
gc.c
@ -1182,8 +1182,10 @@ rb_gc_call_finalizer_at_exit()
|
|||||||
for (i = 0; i < heaps_used; i++) {
|
for (i = 0; i < heaps_used; i++) {
|
||||||
p = heaps[i]; pend = p + HEAP_SLOTS;
|
p = heaps[i]; pend = p + HEAP_SLOTS;
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
if (FL_TEST(p, FL_FINALIZE))
|
if (FL_TEST(p, FL_FINALIZE)) {
|
||||||
|
p->as.free.flag = 0;
|
||||||
run_final((VALUE)p);
|
run_final((VALUE)p);
|
||||||
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
hash.c
10
hash.c
@ -639,14 +639,14 @@ inspect_i(key, value, str)
|
|||||||
|
|
||||||
if (key == Qundef) return ST_CONTINUE;
|
if (key == Qundef) return ST_CONTINUE;
|
||||||
if (RSTRING(str)->len > 1) {
|
if (RSTRING(str)->len > 1) {
|
||||||
rb_str_cat(str, ", ", 2);
|
rb_str_cat2(str, ", ");
|
||||||
}
|
}
|
||||||
str2 = rb_inspect(key);
|
str2 = rb_inspect(key);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
OBJ_INFECT(str, str2);
|
OBJ_INFECT(str, str2);
|
||||||
rb_str_cat(str, "=>", 2);
|
rb_str_cat2(str, "=>");
|
||||||
str2 = rb_inspect(value);
|
str2 = rb_inspect(value);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
OBJ_INFECT(str, str2);
|
OBJ_INFECT(str, str2);
|
||||||
|
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
@ -660,7 +660,7 @@ inspect_hash(hash)
|
|||||||
|
|
||||||
str = rb_str_new2("{");
|
str = rb_str_new2("{");
|
||||||
st_foreach(RHASH(hash)->tbl, inspect_i, str);
|
st_foreach(RHASH(hash)->tbl, inspect_i, str);
|
||||||
rb_str_cat(str, "}", 1);
|
rb_str_cat2(str, "}");
|
||||||
|
|
||||||
OBJ_INFECT(str, hash);
|
OBJ_INFECT(str, hash);
|
||||||
return str;
|
return str;
|
||||||
|
2
intern.h
2
intern.h
@ -286,6 +286,8 @@ void rb_str_modify _((VALUE));
|
|||||||
VALUE rb_str_freeze _((VALUE));
|
VALUE rb_str_freeze _((VALUE));
|
||||||
VALUE rb_str_resize _((VALUE, long));
|
VALUE rb_str_resize _((VALUE, long));
|
||||||
VALUE rb_str_cat _((VALUE, const char*, long));
|
VALUE rb_str_cat _((VALUE, const char*, long));
|
||||||
|
VALUE rb_str_cat2 _((VALUE, const char*));
|
||||||
|
VALUE rb_str_append _((VALUE, VALUE));
|
||||||
VALUE rb_str_concat _((VALUE, VALUE));
|
VALUE rb_str_concat _((VALUE, VALUE));
|
||||||
int rb_str_hash _((VALUE));
|
int rb_str_hash _((VALUE));
|
||||||
int rb_str_cmp _((VALUE, VALUE));
|
int rb_str_cmp _((VALUE, VALUE));
|
||||||
|
11
io.c
11
io.c
@ -1799,7 +1799,7 @@ rb_io_reopen(argc, argv, file)
|
|||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
|
if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
|
||||||
if (TYPE(fname) == T_FILE) { /* fname must be IO */
|
if (TYPE(fname) != T_STRING) { /* fname must be IO */
|
||||||
return io_reopen(file, fname);
|
return io_reopen(file, fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1895,7 +1895,7 @@ rb_io_printf(argc, argv, out)
|
|||||||
VALUE argv[];
|
VALUE argv[];
|
||||||
VALUE out;
|
VALUE out;
|
||||||
{
|
{
|
||||||
io_write(out, rb_f_sprintf(argc, argv));
|
rb_io_write(out, rb_f_sprintf(argc, argv));
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1915,7 +1915,7 @@ rb_f_printf(argc, argv)
|
|||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
io_write(out, rb_f_sprintf(argc, argv));
|
rb_io_write(out, rb_f_sprintf(argc, argv));
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -2334,8 +2334,7 @@ next_argv()
|
|||||||
#if defined(MSDOS) || defined(__CYGWIN__) || defined(NT)
|
#if defined(MSDOS) || defined(__CYGWIN__) || defined(NT)
|
||||||
ruby_add_suffix(str, ruby_inplace_mode);
|
ruby_add_suffix(str, ruby_inplace_mode);
|
||||||
#else
|
#else
|
||||||
rb_str_cat(str, ruby_inplace_mode,
|
rb_str_cat2(str, ruby_inplace_mode);
|
||||||
strlen(ruby_inplace_mode));
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__)
|
#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__)
|
||||||
(void)fclose(fr);
|
(void)fclose(fr);
|
||||||
@ -3063,7 +3062,7 @@ argf_read(argc, argv)
|
|||||||
}
|
}
|
||||||
if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
|
if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
|
||||||
else if (NIL_P(str)) str = tmp;
|
else if (NIL_P(str)) str = tmp;
|
||||||
else rb_str_cat(str, RSTRING(tmp)->ptr, RSTRING(tmp)->len);
|
else rb_str_append(str, tmp);
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ def create_makefile(target)
|
|||||||
$DLDFLAGS = CONFIG["DLDFLAGS"]
|
$DLDFLAGS = CONFIG["DLDFLAGS"]
|
||||||
|
|
||||||
if RUBY_PLATFORM =~ /beos/
|
if RUBY_PLATFORM =~ /beos/
|
||||||
$libs = $libs + " -lruby"
|
$libs = $libs + " " + CONFIG["LIBRUBYARG"]
|
||||||
$DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib"
|
$DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
|
|
||||||
module Observable
|
module Observable
|
||||||
def add_observer(observer)
|
def add_observer(observer)
|
||||||
@observer_peers = [] unless @observer_peers
|
@observer_peers = [] unless defined? @observer_peers
|
||||||
unless defined? observer.update
|
unless defined? observer.update
|
||||||
raise NameError, "observer needs to respond to `update'"
|
raise NameError, "observer needs to respond to `update'"
|
||||||
end
|
end
|
||||||
@observer_peers.push observer
|
@observer_peers.push observer
|
||||||
end
|
end
|
||||||
def delete_observer(observer)
|
def delete_observer(observer)
|
||||||
@observer_peers.delete observer if @observer_peers
|
@observer_peers.delete observer if defined? @observer_peers
|
||||||
end
|
end
|
||||||
def delete_observers
|
def delete_observers
|
||||||
@observer_peers.clear if @observer_peers
|
@observer_peers.clear if defined? @observer_peers
|
||||||
end
|
end
|
||||||
def count_observers
|
def count_observers
|
||||||
if @observer_peers
|
if defined? @observer_peers
|
||||||
@observer_peers.size
|
@observer_peers.size
|
||||||
else
|
else
|
||||||
0
|
0
|
||||||
@ -27,11 +27,15 @@ module Observable
|
|||||||
@observer_state = state
|
@observer_state = state
|
||||||
end
|
end
|
||||||
def changed?
|
def changed?
|
||||||
@observer_state
|
if defined? @observer_state and @observer_state
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def notify_observers(*arg)
|
def notify_observers(*arg)
|
||||||
if @observer_state
|
if defined? @observer_state and @observer_state
|
||||||
if @observer_peers
|
if defined? @observer_peers
|
||||||
for i in @observer_peers.dup
|
for i in @observer_peers.dup
|
||||||
i.update(*arg)
|
i.update(*arg)
|
||||||
end
|
end
|
||||||
|
734
lib/parsedate.rb
734
lib/parsedate.rb
@ -1,589 +1,162 @@
|
|||||||
# parsedate2.ry: Written by Tadayoshi Funaba 1999, 2000
|
# parsedate3.rb: Written by Tadayoshi Funaba 2000
|
||||||
# $Id: parsedate2.ry,v 1.5 2000/03/20 16:23:46 tadf Exp $
|
# $Id: parsedate3.rb,v 1.2 2000/04/01 03:16:56 tadf Exp $
|
||||||
## Generated by rbison version 0.0.5.
|
|
||||||
|
|
||||||
class ParseDatePar
|
module ParseDate
|
||||||
|
|
||||||
class ParseError < StandardError ; end
|
|
||||||
class LexError < StandardError ; end
|
|
||||||
NULL = nil
|
|
||||||
|
|
||||||
attr :yydebug, true
|
|
||||||
|
|
||||||
DAY = 257
|
|
||||||
DIGITS = 258
|
|
||||||
MON = 259
|
|
||||||
LETTERS = 260
|
|
||||||
MERID = 261
|
|
||||||
|
|
||||||
## Parser declarations begin
|
|
||||||
## Parser declarations end
|
|
||||||
|
|
||||||
YYFINAL = 84
|
|
||||||
YYFLAG = -32768
|
|
||||||
YYNTBASE = 14
|
|
||||||
YYTRANSLATE = [ 0,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 13, 8, 9, 10, 11, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
|
||||||
7
|
|
||||||
]
|
|
||||||
YYPRHS = [ 0,
|
|
||||||
0, 1, 3, 6, 8, 12, 14, 20, 26, 32,
|
|
||||||
34, 38, 40, 44, 45, 48, 50, 51, 53, 55,
|
|
||||||
57, 60, 63, 65, 67, 69, 71, 73, 80, 88,
|
|
||||||
94, 98, 104, 108, 115, 116, 119, 122, 123, 125,
|
|
||||||
128, 129, 131, 132, 134, 136, 139, 142, 147, 149
|
|
||||||
]
|
|
||||||
YYRHS = [ -1,
|
|
||||||
17, 0, 16, 15, 0, 19, 0, 19, 18, 22,
|
|
||||||
0, 28, 0, 28, 18, 19, 18, 22, 0, 19,
|
|
||||||
18, 28, 18, 22, 0, 19, 18, 22, 18, 28,
|
|
||||||
0, 23, 0, 23, 18, 28, 0, 30, 0, 30,
|
|
||||||
18, 32, 0, 0, 17, 18, 0, 3, 0, 0,
|
|
||||||
8, 0, 20, 0, 21, 0, 4, 5, 0, 5,
|
|
||||||
4, 0, 4, 0, 24, 0, 25, 0, 26, 0,
|
|
||||||
27, 0, 4, 9, 4, 9, 4, 31, 0, 6,
|
|
||||||
4, 10, 4, 10, 4, 31, 0, 4, 9, 5,
|
|
||||||
9, 4, 0, 4, 11, 4, 0, 4, 11, 4,
|
|
||||||
11, 4, 0, 4, 7, 34, 0, 4, 12, 4,
|
|
||||||
29, 33, 34, 0, 0, 12, 4, 0, 4, 31,
|
|
||||||
0, 0, 6, 0, 4, 34, 0, 0, 7, 0,
|
|
||||||
0, 35, 0, 6, 0, 6, 6, 0, 36, 4,
|
|
||||||
0, 36, 4, 12, 4, 0, 9, 0, 13, 0
|
|
||||||
]
|
|
||||||
YYRLINE = [ 0,
|
|
||||||
14, 14, 14, 16, 17, 18, 19, 20, 21, 22,
|
|
||||||
23, 24, 25, 28, 28, 30, 32, 32, 34, 34,
|
|
||||||
36, 38, 40, 42, 42, 42, 42, 44, 58, 72,
|
|
||||||
86, 91, 105, 109, 116, 116, 118, 141, 141, 143,
|
|
||||||
156, 156, 158, 158, 160, 161, 166, 167, 170, 170
|
|
||||||
]
|
|
||||||
YYTNAME = [ "$","error","$undefined.","DAY","DIGITS",
|
|
||||||
"MON","LETTERS","MERID","','","'-'","'.'","'/'","':'","'+'","repr","dat","odaycom",
|
|
||||||
"day","ocom","woy","eu","us","year","wy","iso","jis","vms","sla","time","osec",
|
|
||||||
"ddd","otee","ttt","omerid","ozone","zone","sign", NULL
|
|
||||||
]
|
|
||||||
YYR1 = [ 0,
|
|
||||||
14, 14, 14, 15, 15, 15, 15, 15, 15, 15,
|
|
||||||
15, 15, 15, 16, 16, 17, 18, 18, 19, 19,
|
|
||||||
20, 21, 22, 23, 23, 23, 23, 24, 25, 26,
|
|
||||||
27, 27, 28, 28, 29, 29, 30, 31, 31, 32,
|
|
||||||
33, 33, 34, 34, 35, 35, 35, 35, 36, 36
|
|
||||||
]
|
|
||||||
YYR2 = [ 0,
|
|
||||||
0, 1, 2, 1, 3, 1, 5, 5, 5, 1,
|
|
||||||
3, 1, 3, 0, 2, 1, 0, 1, 1, 1,
|
|
||||||
2, 2, 1, 1, 1, 1, 1, 6, 7, 5,
|
|
||||||
3, 5, 3, 6, 0, 2, 2, 0, 1, 2,
|
|
||||||
0, 1, 0, 1, 1, 2, 2, 4, 1, 1
|
|
||||||
]
|
|
||||||
YYDEFACT = [ 14,
|
|
||||||
16, 0, 17, 38, 0, 0, 3, 4, 19, 20,
|
|
||||||
10, 24, 25, 26, 27, 17, 12, 18, 15, 21,
|
|
||||||
39, 43, 0, 0, 0, 37, 22, 0, 0, 0,
|
|
||||||
0, 0, 45, 49, 50, 33, 44, 0, 0, 0,
|
|
||||||
31, 35, 0, 23, 5, 17, 0, 11, 0, 17,
|
|
||||||
43, 13, 46, 47, 0, 0, 0, 0, 41, 0,
|
|
||||||
0, 0, 0, 40, 0, 38, 30, 32, 36, 42,
|
|
||||||
43, 0, 9, 23, 8, 7, 48, 28, 34, 38,
|
|
||||||
29, 0, 0, 0
|
|
||||||
]
|
|
||||||
YYDEFGOTO = [ 82,
|
|
||||||
7, 2, 3, 19, 8, 9, 10, 45, 11, 12,
|
|
||||||
13, 14, 15, 16, 59, 17, 26, 52, 71, 36,
|
|
||||||
37, 38
|
|
||||||
]
|
|
||||||
YYPACT = [ 10,
|
|
||||||
-32768, 30, 6, 11, 37, 39,-32768, 23,-32768,-32768,
|
|
||||||
23,-32768,-32768,-32768,-32768, 7, 23,-32768,-32768,-32768,
|
|
||||||
-32768, 19, 25, 40, 41,-32768,-32768, 36, 43, 44,
|
|
||||||
35, 45, 46,-32768,-32768,-32768,-32768, 47, 48, 49,
|
|
||||||
42, 38, 50, 14, 23, 51, 14,-32768, 55, 51,
|
|
||||||
19,-32768,-32768, 52, 57, 58, 59, 61, 60, 56,
|
|
||||||
44, 64, 64,-32768, 65, 66,-32768,-32768,-32768,-32768,
|
|
||||||
19, 67,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 66,
|
|
||||||
-32768, 70, 73,-32768
|
|
||||||
]
|
|
||||||
YYPGOTO = [ -32768,
|
|
||||||
-32768,-32768,-32768, -8, 24,-32768,-32768, -51,-32768,-32768,
|
|
||||||
-32768,-32768,-32768, -28,-32768,-32768, -61,-32768,-32768, -47,
|
|
||||||
-32768,-32768
|
|
||||||
]
|
|
||||||
YYLAST = 73
|
|
||||||
YYTABLE = [ 29,
|
|
||||||
46, 48, 30, 64, 78, -2, -6, 31, 32, -1,
|
|
||||||
75, 76, 1, 18, 18, 20, 21, 22, 81, 23,
|
|
||||||
22, 24, 25, 79, 33, 25, -17, 34, 39, 40,
|
|
||||||
18, 35, 73, 4, 5, 6, 61, 62, 49, 5,
|
|
||||||
27, 63, 28, 41, 42, 43, 44, 47, 51, 58,
|
|
||||||
54, 53, 57, 60, 50, 0, 55, 56, 18, 20,
|
|
||||||
66, 67, 68, 65, 69, 72, 70, 74, 77, 83,
|
|
||||||
80, 21, 84
|
|
||||||
]
|
|
||||||
YYCHECK = [ 8,
|
|
||||||
29, 30, 11, 51, 66, 0, 0, 16, 17, 0,
|
|
||||||
62, 63, 3, 8, 8, 5, 6, 7, 80, 9,
|
|
||||||
7, 11, 12, 71, 6, 12, 4, 9, 4, 5,
|
|
||||||
8, 13, 61, 4, 5, 6, 45, 46, 4, 5,
|
|
||||||
4, 50, 4, 4, 4, 10, 4, 4, 4, 12,
|
|
||||||
4, 6, 11, 4, 31, -1, 9, 9, 8, 5,
|
|
||||||
4, 4, 4, 12, 4, 10, 7, 4, 4, 0,
|
|
||||||
4, 6, 0
|
|
||||||
]
|
|
||||||
YYEMPTY = -2
|
|
||||||
YYEOF = 0
|
|
||||||
YYTERROR = 1
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@yydebug = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def yyparse(lexer)
|
|
||||||
yyerrstatus = 0
|
|
||||||
yychar = YYEMPTY
|
|
||||||
yystate = 0
|
|
||||||
yyss = []
|
|
||||||
yyvs = ["nil"]
|
|
||||||
yyval = 0
|
|
||||||
jump = :YYNEWSTATE
|
|
||||||
|
|
||||||
while true
|
|
||||||
|
|
||||||
case jump
|
|
||||||
|
|
||||||
when :YYNEWSTATE
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Entering state %d\n", yystate)
|
|
||||||
end
|
|
||||||
yyss.push(yystate)
|
|
||||||
jump = :YYBACKUP
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYBACKUP
|
|
||||||
yyn = YYPACT[yystate]
|
|
||||||
if yyn == YYFLAG
|
|
||||||
jump = :YYDEFAULT
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
## get a lookahead token if we don't already have one
|
|
||||||
if yychar == YYEMPTY
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Reading a token: ")
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
yychar, yylval = lexer.yylex
|
|
||||||
rescue LexError
|
|
||||||
raise ParseError, "lex error"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## if lookahead <= 0, end of input
|
|
||||||
if yychar <= 0
|
|
||||||
yychar1 = 0
|
|
||||||
yychar = YYEOF
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Now at end of input.\n")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
yychar1 = yychar < 0 || yychar > 261 ? 37 : YYTRANSLATE[yychar]
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Next token is %d (%s,%s)\n", yychar,
|
|
||||||
YYTNAME[yychar1], yylval)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## see if we know what to do with this token in this state
|
|
||||||
yyn += yychar1
|
|
||||||
if yyn < 0 || yyn > YYLAST || YYCHECK[yyn] != yychar1
|
|
||||||
jump = :YYDEFAULT
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
## yyn is what to do for this token type in this state
|
|
||||||
## negative -> reduce, - yyn is the rule number
|
|
||||||
## positive -> shift, yyn is the new state
|
|
||||||
## New state is final state, don't bother to shift, just
|
|
||||||
## return success
|
|
||||||
## 0, or most negative number -> error
|
|
||||||
yyn = YYTABLE[yyn]
|
|
||||||
if yyn < 0
|
|
||||||
if yyn == YYFLAG
|
|
||||||
jump = :YYERRLAB
|
|
||||||
next
|
|
||||||
end
|
|
||||||
yyn = - yyn
|
|
||||||
jump = :YYREDUCE
|
|
||||||
next
|
|
||||||
elsif yyn == 0
|
|
||||||
jump = :YYERRLAB
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
if yyn == YYFINAL
|
|
||||||
return ## accept
|
|
||||||
end
|
|
||||||
|
|
||||||
## shift the lookahead token
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Shifting token %d (%s), ", yychar,
|
|
||||||
YYTNAME[yychar1])
|
|
||||||
end
|
|
||||||
|
|
||||||
## discard the token being shifted unless it is eof
|
|
||||||
if yychar != YYEOF
|
|
||||||
yychar = YYEMPTY
|
|
||||||
end
|
|
||||||
yyvs.push(yylval)
|
|
||||||
|
|
||||||
## count tokens shifted since error; after, three turn off
|
|
||||||
## error status
|
|
||||||
yyerrstatus -= 1 if yyerrstatus > 0
|
|
||||||
|
|
||||||
yystate = yyn
|
|
||||||
jump = :YYNEWSTATE
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYDEFAULT
|
|
||||||
yyn = YYDEFACT[yystate]
|
|
||||||
if yyn == 0
|
|
||||||
jump = :YYERRLAB
|
|
||||||
next
|
|
||||||
else
|
|
||||||
jump = :YYREDUCE
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
## do a reduction. yyn is the number of the rule to reduce with
|
|
||||||
when :YYREDUCE
|
|
||||||
yylen = YYR2[yyn]
|
|
||||||
if yylen > 0
|
|
||||||
yyval = yyvs[yyvs.size - yylen]
|
|
||||||
end
|
|
||||||
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Reducing via rule %d (line %d), ", yyn,
|
|
||||||
YYRLINE[yyn])
|
|
||||||
i = YYPRHS[yyn]
|
|
||||||
while YYRHS[i] > 0
|
|
||||||
printf($stderr, "%s ", YYTNAME[YYRHS[i]])
|
|
||||||
i += 1
|
|
||||||
end
|
|
||||||
printf($stderr, " -> %s\n", YYTNAME[YYR1[yyn]])
|
|
||||||
end
|
|
||||||
|
|
||||||
case yyn
|
|
||||||
when 16
|
|
||||||
store(:wday, yyvs[-1].to_i)
|
|
||||||
when 21
|
|
||||||
store(:mday, yyvs[-2].to_i); store(:mon, yyvs[-1])
|
|
||||||
when 22
|
|
||||||
store(:mon, yyvs[-2]); store(:mday, yyvs[-1].to_i)
|
|
||||||
when 23
|
|
||||||
store(:year, yyvs[-1].to_i)
|
|
||||||
when 28
|
|
||||||
|
|
||||||
if yyvs[-1 + -1].size >= 4
|
|
||||||
store(:mday, yyvs[-1 + -5].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -3].to_i)
|
|
||||||
store(:year, yyvs[-1 + -1].to_i)
|
|
||||||
else
|
|
||||||
store(:year, yyvs[-1 + -5].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -3].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -1].to_i)
|
|
||||||
end
|
|
||||||
|
|
||||||
when 29
|
|
||||||
|
|
||||||
e = { 'M'=>1867,
|
|
||||||
'T'=>1911,
|
|
||||||
'S'=>1925,
|
|
||||||
'H'=>1988
|
|
||||||
}[yyvs[-1 + -6]]
|
|
||||||
raise ParseError, 'YYERROR' unless e
|
|
||||||
store(:year, yyvs[-1 + -5].to_i + e)
|
|
||||||
store(:mon, yyvs[-1 + -3].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -1].to_i)
|
|
||||||
|
|
||||||
when 30
|
|
||||||
|
|
||||||
if yyvs[-1 + -4].size >= 4
|
|
||||||
store(:year, yyvs[-1 + -4].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -2])
|
|
||||||
store(:mday, yyvs[-1 + 0].to_i)
|
|
||||||
else
|
|
||||||
store(:mday, yyvs[-1 + -4].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -2])
|
|
||||||
store(:year, yyvs[-1 + 0].to_i)
|
|
||||||
end
|
|
||||||
|
|
||||||
when 31
|
|
||||||
|
|
||||||
store(:mon, yyvs[-1 + -2].to_i)
|
|
||||||
store(:mday, yyvs[-1 + 0].to_i)
|
|
||||||
|
|
||||||
when 32
|
|
||||||
|
|
||||||
if yyvs[-1 + -4].size >= 4
|
|
||||||
store(:year, yyvs[-1 + -4].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -2].to_i)
|
|
||||||
store(:mday, yyvs[-1 + 0].to_i)
|
|
||||||
else
|
|
||||||
store(:mon, yyvs[-1 + -4].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -2].to_i)
|
|
||||||
store(:year, yyvs[-1 + 0].to_i)
|
|
||||||
end
|
|
||||||
|
|
||||||
when 33
|
|
||||||
|
|
||||||
store(:hour, yyvs[-1 + -2].to_i + yyvs[-1 + -1])
|
|
||||||
|
|
||||||
when 34
|
|
||||||
|
|
||||||
store(:hour, yyvs[-1 + -5].to_i + yyvs[-1 + -1])
|
|
||||||
store(:min, yyvs[-1 + -3].to_i)
|
|
||||||
|
|
||||||
when 36
|
|
||||||
store(:sec, yyvs[-1].to_i)
|
|
||||||
when 37
|
|
||||||
|
|
||||||
case yyvs[-1 + -1].size
|
|
||||||
when 4
|
|
||||||
store(:mon, yyvs[-1 + -1][ 0, 2].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -1][ 2, 2].to_i)
|
|
||||||
when 6
|
|
||||||
store(:year, yyvs[-1 + -1][ 0, 2].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -1][ 2, 2].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -1][ 4, 2].to_i)
|
|
||||||
when 8, 10, 12, 14
|
|
||||||
store(:year, yyvs[-1 + -1][ 0, 4].to_i)
|
|
||||||
store(:mon, yyvs[-1 + -1][ 4, 2].to_i)
|
|
||||||
store(:mday, yyvs[-1 + -1][ 6, 2].to_i)
|
|
||||||
store(:hour, yyvs[-1 + -1][ 8, 2].to_i) if yyvs[-1 + -1].size >= 10
|
|
||||||
store(:min, yyvs[-1 + -1][10, 2].to_i) if yyvs[-1 + -1].size >= 12
|
|
||||||
store(:sec, yyvs[-1 + -1][12, 2].to_i) if yyvs[-1 + -1].size >= 14
|
|
||||||
else
|
|
||||||
raise ParseError, 'YYERROR'
|
|
||||||
end
|
|
||||||
|
|
||||||
when 39
|
|
||||||
raise ParseError, 'YYERROR' unless yyvs[-1] == 'T'
|
|
||||||
when 40
|
|
||||||
|
|
||||||
case yyvs[-1 + -1].size
|
|
||||||
when 2, 4, 6
|
|
||||||
store(:hour, yyvs[-1 + -1][ 0, 2].to_i)
|
|
||||||
store(:min, yyvs[-1 + -1][ 2, 2].to_i) if yyvs[-1 + -1].size >= 4
|
|
||||||
store(:sec, yyvs[-1 + -1][ 4, 2].to_i) if yyvs[-1 + -1].size >= 6
|
|
||||||
else
|
|
||||||
raise ParseError, 'YYERROR'
|
|
||||||
end
|
|
||||||
|
|
||||||
when 41
|
|
||||||
yyval = 0
|
|
||||||
when 45
|
|
||||||
store(:zone, yyvs[-1])
|
|
||||||
when 46
|
|
||||||
|
|
||||||
raise ParseError, 'YYERROR' unless yyvs[-1 + 0] == 'DST'
|
|
||||||
store(:zone, yyvs[-1 + -1] + ' ' + yyvs[-1 + 0])
|
|
||||||
|
|
||||||
when 47
|
|
||||||
store(:zone, yyvs[-2] + yyvs[-1])
|
|
||||||
when 48
|
|
||||||
store(:zone, yyvs[-4] + yyvs[-3] + yyvs[-2] + yyvs[-1])
|
|
||||||
when -65536 ## never used, placeholder for ruby
|
|
||||||
end
|
|
||||||
|
|
||||||
if yylen > 0
|
|
||||||
yyss[(yyss.size - yylen) .. (yyss.size - 1)] = []
|
|
||||||
yyvs[(yyvs.size - yylen) .. (yyvs.size - 1)] = []
|
|
||||||
end
|
|
||||||
|
|
||||||
yyvs.push(yyval)
|
|
||||||
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "State stack now: %s\n", yyss.join(' '))
|
|
||||||
printf($stderr, "Value stack now: %s\n", yyvs.join(' '))
|
|
||||||
end
|
|
||||||
|
|
||||||
## "Shift" the result of the reduction.
|
|
||||||
yyn = YYR1[yyn]
|
|
||||||
yystate = YYPGOTO[yyn - YYNTBASE] + yyss[-1]
|
|
||||||
if yystate >=0 && yystate <= YYLAST &&
|
|
||||||
YYCHECK[yystate] == yyss[-1]
|
|
||||||
yystate = YYTABLE[yystate]
|
|
||||||
else
|
|
||||||
yystate = YYDEFGOTO[yyn - YYNTBASE]
|
|
||||||
end
|
|
||||||
jump = :YYNEWSTATE
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYERRLAB
|
|
||||||
if yyerrstatus == 0 && @yydebug
|
|
||||||
printf($stderr, "Parse error!\n")
|
|
||||||
end
|
|
||||||
jump = :YYERRLAB1
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYERRLAB1
|
|
||||||
if yyerrstatus == 3
|
|
||||||
if yychar == YYEOF
|
|
||||||
raise ParseError, "parse error"
|
|
||||||
end
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Discarding token %d (%s).\n", yychar,
|
|
||||||
YYTNAME[yychar1])
|
|
||||||
end
|
|
||||||
yychar = YYEMPTY
|
|
||||||
end
|
|
||||||
|
|
||||||
yyerrstatus = 3
|
|
||||||
jump = :YYERRHANDLE
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYERRPOP
|
|
||||||
if yyvs.empty?
|
|
||||||
raise ParseError, "parse error"
|
|
||||||
end
|
|
||||||
## don't pop if the state on top of the stack can handle
|
|
||||||
## the error token
|
|
||||||
yystate = yyss[-1]
|
|
||||||
if YYCHECK[YYPACT[yystate] + YYTERROR] != YYTERROR
|
|
||||||
yyvs.pop
|
|
||||||
yyss.pop
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Error: state stack now: %s\n",
|
|
||||||
yyss.join(' '))
|
|
||||||
printf($stderr, "Error: Value stack now: %s\n",
|
|
||||||
yyvs.join(' '))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
jump = :YYERRHANDLE
|
|
||||||
next
|
|
||||||
|
|
||||||
when :YYERRHANDLE
|
|
||||||
yyn = YYPACT[yystate]
|
|
||||||
if yyn == YYFLAG
|
|
||||||
jump = :YYERRPOP
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
yyn += YYTERROR
|
|
||||||
if yyn < 0 || yyn > YYLAST || YYCHECK[yyn] != YYTERROR
|
|
||||||
jump = :YYERRPOP
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
yyn = YYTABLE[yyn]
|
|
||||||
if yyn < 0
|
|
||||||
if yyn == YYFLAG
|
|
||||||
jump = :YYERRPOP
|
|
||||||
next
|
|
||||||
end
|
|
||||||
yyn = -yyn
|
|
||||||
jump = :YYREDUCE
|
|
||||||
next
|
|
||||||
elsif yyn == 0
|
|
||||||
jump = :YYERRPOP
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
if yyn == YYFINAL
|
|
||||||
return ## accept
|
|
||||||
end
|
|
||||||
|
|
||||||
if @yydebug
|
|
||||||
printf($stderr, "Shifting error token, ")
|
|
||||||
end
|
|
||||||
|
|
||||||
yyvs.push(yylval)
|
|
||||||
yystate = yyn
|
|
||||||
jump = :YYNEWSTATE
|
|
||||||
next
|
|
||||||
|
|
||||||
end ## case
|
|
||||||
|
|
||||||
end ## while true
|
|
||||||
|
|
||||||
end ## yyparse
|
|
||||||
|
|
||||||
end ## class
|
|
||||||
|
|
||||||
## Additional user code
|
|
||||||
class ParseDateLex
|
|
||||||
MONTHS = {
|
MONTHS = {
|
||||||
'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4,
|
'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4,
|
||||||
'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8,
|
'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8,
|
||||||
'sep' => 9, 'oct' =>10, 'nov' =>11, 'dec' =>12
|
'sep' => 9, 'oct' =>10, 'nov' =>11, 'dec' =>12
|
||||||
}
|
}
|
||||||
MONTHPAT = MONTHS.keys.sort.reverse.join('|')
|
MONTHPAT = MONTHS.keys.join('|')
|
||||||
|
|
||||||
DAYS = {
|
DAYS = {
|
||||||
'sun' => 0, 'mon' => 1, 'tue' => 2, 'wed' => 3,
|
'sun' => 0, 'mon' => 1, 'tue' => 2, 'wed' => 3,
|
||||||
'thu' => 4, 'fri' => 5, 'sat' => 6
|
'thu' => 4, 'fri' => 5, 'sat' => 6
|
||||||
}
|
}
|
||||||
DAYPAT = DAYS.keys.sort.reverse.join('|')
|
DAYPAT = DAYS.keys.join('|')
|
||||||
def initialize(str) @str = str end
|
|
||||||
def reset(str) @str = str end
|
def parsedate(date, cyear=false)
|
||||||
def yylex
|
date = date.dup
|
||||||
@str = @str.sub(/\A\s+/, '')
|
|
||||||
return [-1, nil] if @str.size == 0
|
# day
|
||||||
if /\A(#{DAYPAT})[a-z]*\.?/i =~ @str
|
if date.sub!(/(#{DAYPAT})\S*/ino, ' ')
|
||||||
@str = $'
|
wday = DAYS[$1.downcase]
|
||||||
return [ParseDatePar::DAY, DAYS[$1[0, 3].downcase]]
|
|
||||||
end
|
end
|
||||||
if /\A(\d+)(?:(?:th|st|nd|rd)\b)?/ =~ @str
|
|
||||||
@str = $'
|
# time
|
||||||
return [ParseDatePar::DIGITS, $1]
|
if date.sub!(
|
||||||
|
/(\d+):(\d+)(?::(\d+))?
|
||||||
|
(?:
|
||||||
|
\s*
|
||||||
|
([ap])\.?m\.?
|
||||||
|
\b
|
||||||
|
)?
|
||||||
|
(?:
|
||||||
|
\s*
|
||||||
|
(
|
||||||
|
[a-z]+(?:\s+dst)?
|
||||||
|
|
|
||||||
|
[-+]\d+(?::?\d+)
|
||||||
|
)
|
||||||
|
\b
|
||||||
|
)?
|
||||||
|
/inox,
|
||||||
|
' ')
|
||||||
|
hour = $1.to_i
|
||||||
|
min = $2.to_i
|
||||||
|
sec = $3.to_i if $3
|
||||||
|
hour += 12 if $4 and $4.downcase == 'p'
|
||||||
|
zone = $5
|
||||||
end
|
end
|
||||||
if /\A(#{MONTHPAT})[a-z]*\.?/i =~ @str
|
|
||||||
@str = $'
|
# eu
|
||||||
return [ParseDatePar::MON, MONTHS[$1[0, 3].downcase]]
|
if date.sub!(
|
||||||
|
/(\d+)\S*
|
||||||
|
\s+
|
||||||
|
(#{MONTHPAT})\S*
|
||||||
|
(?:
|
||||||
|
\s+
|
||||||
|
(\d+)
|
||||||
|
)?
|
||||||
|
/inox,
|
||||||
|
' ')
|
||||||
|
mday = $1.to_i
|
||||||
|
mon = MONTHS[$2.downcase]
|
||||||
|
year = $3.to_i if $3
|
||||||
|
|
||||||
|
# us
|
||||||
|
elsif date.sub!(
|
||||||
|
/(#{MONTHPAT})\S*
|
||||||
|
\s+
|
||||||
|
(\d+)\S*
|
||||||
|
(?:
|
||||||
|
\s+
|
||||||
|
(\d+)
|
||||||
|
)?
|
||||||
|
/inox,
|
||||||
|
' ')
|
||||||
|
mon = MONTHS[$1.downcase]
|
||||||
|
mday = $2.to_i
|
||||||
|
year = $3.to_i if $3
|
||||||
|
|
||||||
|
# iso
|
||||||
|
elsif date.sub!(/(\d+)-(\d+)-(\d+)/no, ' ')
|
||||||
|
year = $1.to_i
|
||||||
|
mon = $2.to_i
|
||||||
|
mday = $3.to_i
|
||||||
|
mday, mon, year = year, mon, mday if $3.size >= 4
|
||||||
|
|
||||||
|
# jis
|
||||||
|
elsif date.sub!(/([MTSH])(\d+)\.(\d+)\.(\d+)/no, ' ')
|
||||||
|
e = { 'M'=>1867,
|
||||||
|
'T'=>1911,
|
||||||
|
'S'=>1925,
|
||||||
|
'H'=>1988
|
||||||
|
}[$1]
|
||||||
|
year, mon, mday = $2.to_i + e, $3.to_i, $4.to_i
|
||||||
|
|
||||||
|
# vms
|
||||||
|
elsif date.sub!(/(\d+)-(#{MONTHPAT})\S*-(\d+)/ino, ' ')
|
||||||
|
mday = $1.to_i
|
||||||
|
mon = MONTHS[$2.downcase]
|
||||||
|
year = $3.to_i
|
||||||
|
year, mon, mday = mday, mon, year if $1.size >= 4
|
||||||
|
|
||||||
|
# sla
|
||||||
|
elsif date.sub!(%r|(\d+)/(\d+)(?:/(\d+))?|no, ' ')
|
||||||
|
mon = $1.to_i
|
||||||
|
mday = $2.to_i
|
||||||
|
year = $3.to_i if $3
|
||||||
|
year, mon, mday = mon, mday, year if $1.size >= 4
|
||||||
|
|
||||||
|
# ddd
|
||||||
|
elsif date.sub!(
|
||||||
|
/(\d{4,14})
|
||||||
|
(?:
|
||||||
|
\s*
|
||||||
|
T?
|
||||||
|
\s*
|
||||||
|
(\d{2,6})
|
||||||
|
)?
|
||||||
|
(?:
|
||||||
|
\s*
|
||||||
|
(
|
||||||
|
Z
|
||||||
|
|
|
||||||
|
[-+]\d{2,4}
|
||||||
|
)
|
||||||
|
\b
|
||||||
|
)?
|
||||||
|
/nox,
|
||||||
|
' ')
|
||||||
|
case $1.size
|
||||||
|
when 4
|
||||||
|
mon = $1[ 0, 2].to_i
|
||||||
|
mday = $1[ 2, 2].to_i
|
||||||
|
when 6
|
||||||
|
year = $1[ 0, 2].to_i
|
||||||
|
mon = $1[ 2, 2].to_i
|
||||||
|
mday = $1[ 4, 2].to_i
|
||||||
|
when 8, 10, 12, 14
|
||||||
|
year = $1[ 0, 4].to_i
|
||||||
|
mon = $1[ 4, 2].to_i
|
||||||
|
mday = $1[ 6, 2].to_i
|
||||||
|
hour = $1[ 8, 2].to_i if $1.size >= 10
|
||||||
|
min = $1[10, 2].to_i if $1.size >= 12
|
||||||
|
sec = $1[12, 2].to_i if $1.size >= 14
|
||||||
|
end
|
||||||
|
if $2
|
||||||
|
case $2.size
|
||||||
|
when 2, 4, 6
|
||||||
|
hour = $2[ 0, 2].to_i
|
||||||
|
min = $2[ 2, 2].to_i if $2.size >= 4
|
||||||
|
sec = $2[ 4, 2].to_i if $2.size >= 6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
zone = $3
|
||||||
end
|
end
|
||||||
if /\A([ap]\.?m\.?\b)/i =~ @str
|
|
||||||
@str = $'
|
|
||||||
return [ParseDatePar::MERID,
|
|
||||||
if $1[0, 1].downcase == 'a' then 0 else 12 end]
|
|
||||||
end
|
|
||||||
if /\A([a-z]+)/i =~ @str
|
|
||||||
@str = $'
|
|
||||||
return [ParseDatePar::LETTERS, $1]
|
|
||||||
end
|
|
||||||
if /\A(.)/ =~ @str
|
|
||||||
@str = $'
|
|
||||||
return [$1[0], $1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
class ParseDatePar
|
|
||||||
def clear() @values = {} end
|
|
||||||
def store(key, val) @values[key] = val end
|
|
||||||
def values(cyear)
|
|
||||||
year = @values[:year]
|
|
||||||
if cyear and year
|
if cyear and year
|
||||||
if year < 100
|
if year < 100
|
||||||
if year >= 69
|
if year >= 69
|
||||||
@ -593,18 +166,11 @@ class ParseDatePar
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@values[:year] = year
|
|
||||||
@values.indexes(:year, :mon, :mday,
|
return year, mon, mday, hour, min, sec, zone, wday
|
||||||
:hour, :min, :sec, :zone, :wday)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
module ParseDate
|
|
||||||
def parsedate(date, cyear=false)
|
|
||||||
lex = ParseDateLex.new(date)
|
|
||||||
par = ParseDatePar.new
|
|
||||||
par.clear
|
|
||||||
begin par.yyparse(lex); rescue; end
|
|
||||||
par.values(cyear)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :parsedate
|
module_function :parsedate
|
||||||
|
|
||||||
end
|
end
|
||||||
|
41
marshal.c
41
marshal.c
@ -254,7 +254,7 @@ w_object(obj, arg, limit)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (SYMBOL_P(obj)) {
|
else if (SYMBOL_P(obj)) {
|
||||||
w_symbol(obj, arg);
|
w_symbol(SYM2ID(obj), arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -597,20 +597,25 @@ r_bytes0(s, len, arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ID
|
static ID
|
||||||
r_symbol(arg)
|
r_symlink(arg)
|
||||||
|
struct load_arg *arg;
|
||||||
|
{
|
||||||
|
ID id;
|
||||||
|
int num = r_long(arg);
|
||||||
|
|
||||||
|
if (st_lookup(arg->symbol, num, &id)) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
rb_raise(rb_eTypeError, "bad symbol");
|
||||||
|
}
|
||||||
|
|
||||||
|
static ID
|
||||||
|
r_symreal(arg)
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
ID id;
|
ID id;
|
||||||
|
|
||||||
if (r_byte(arg) == TYPE_SYMLINK) {
|
|
||||||
int num = r_long(arg);
|
|
||||||
|
|
||||||
if (st_lookup(arg->symbol, num, &id)) {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
rb_raise(rb_eTypeError, "bad symbol");
|
|
||||||
}
|
|
||||||
r_bytes(buf, arg);
|
r_bytes(buf, arg);
|
||||||
id = rb_intern(buf);
|
id = rb_intern(buf);
|
||||||
st_insert(arg->symbol, arg->symbol->num_entries, id);
|
st_insert(arg->symbol, arg->symbol->num_entries, id);
|
||||||
@ -618,6 +623,16 @@ r_symbol(arg)
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ID
|
||||||
|
r_symbol(arg)
|
||||||
|
struct load_arg *arg;
|
||||||
|
{
|
||||||
|
if (r_byte(arg) == TYPE_SYMLINK) {
|
||||||
|
return r_symlink(arg);
|
||||||
|
}
|
||||||
|
return r_symreal(arg);
|
||||||
|
}
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
r_unique(arg)
|
r_unique(arg)
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
@ -881,8 +896,12 @@ r_object(arg)
|
|||||||
}
|
}
|
||||||
return r_regist(m, arg);
|
return r_regist(m, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_SYMBOL:
|
case TYPE_SYMBOL:
|
||||||
return ID2SYM(r_symbol(arg));
|
return ID2SYM(r_symreal(arg));
|
||||||
|
|
||||||
|
case TYPE_SYMLINK:
|
||||||
|
return ID2SYM(r_symlink(arg));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
|
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
|
||||||
|
21
object.c
21
object.c
@ -159,16 +159,16 @@ inspect_i(id, value, str)
|
|||||||
if (!rb_is_instance_id(id)) return ST_CONTINUE;
|
if (!rb_is_instance_id(id)) return ST_CONTINUE;
|
||||||
if (RSTRING(str)->ptr[0] == '-') {
|
if (RSTRING(str)->ptr[0] == '-') {
|
||||||
RSTRING(str)->ptr[0] = '#';
|
RSTRING(str)->ptr[0] = '#';
|
||||||
rb_str_cat(str, ": ", 2);
|
rb_str_cat2(str, ": ");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_cat(str, ", ", 2);
|
rb_str_cat2(str, ", ");
|
||||||
}
|
}
|
||||||
ivname = rb_id2name(id);
|
ivname = rb_id2name(id);
|
||||||
rb_str_cat(str, ivname, strlen(ivname));
|
rb_str_cat2(str, ivname);
|
||||||
rb_str_cat(str, "=", 1);
|
rb_str_cat2(str, "=");
|
||||||
str2 = rb_inspect(value);
|
str2 = rb_inspect(value);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
OBJ_INFECT(str, str2);
|
OBJ_INFECT(str, str2);
|
||||||
|
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
@ -179,7 +179,7 @@ inspect_obj(obj, str)
|
|||||||
VALUE obj, str;
|
VALUE obj, str;
|
||||||
{
|
{
|
||||||
st_foreach(ROBJECT(obj)->iv_tbl, inspect_i, str);
|
st_foreach(ROBJECT(obj)->iv_tbl, inspect_i, str);
|
||||||
rb_str_cat(str, ">", 1);
|
rb_str_cat2(str, ">");
|
||||||
OBJ_INFECT(str, obj);
|
OBJ_INFECT(str, obj);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@ -202,7 +202,7 @@ rb_obj_inspect(obj)
|
|||||||
return rb_str_new2(buf);
|
return rb_str_new2(buf);
|
||||||
}
|
}
|
||||||
str = rb_str_new2("-<");
|
str = rb_str_new2("-<");
|
||||||
rb_str_cat(str, b, strlen(b));
|
rb_str_cat2(str, b);
|
||||||
return rb_protect_inspect(inspect_obj, obj, str);
|
return rb_protect_inspect(inspect_obj, obj, str);
|
||||||
}
|
}
|
||||||
return rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
return rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
||||||
@ -494,7 +494,7 @@ sym_to_i(sym)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sym_to_s(sym)
|
sym_inspect(sym)
|
||||||
VALUE sym;
|
VALUE sym;
|
||||||
{
|
{
|
||||||
char *name, *buf;
|
char *name, *buf;
|
||||||
@ -507,7 +507,7 @@ sym_to_s(sym)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sym_id2name(sym)
|
sym_to_s(sym)
|
||||||
VALUE sym;
|
VALUE sym;
|
||||||
{
|
{
|
||||||
return rb_str_new2(rb_id2name(SYM2ID(sym)));
|
return rb_str_new2(rb_id2name(SYM2ID(sym)));
|
||||||
@ -1117,8 +1117,9 @@ Init_Object()
|
|||||||
rb_undef_method(CLASS_OF(rb_cSymbol), "new");
|
rb_undef_method(CLASS_OF(rb_cSymbol), "new");
|
||||||
rb_define_method(rb_cSymbol, "type", sym_type, 0);
|
rb_define_method(rb_cSymbol, "type", sym_type, 0);
|
||||||
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
||||||
|
rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0);
|
||||||
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
|
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
|
||||||
rb_define_method(rb_cSymbol, "id2name", sym_id2name, 0);
|
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
|
||||||
|
|
||||||
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
|
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
|
||||||
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
|
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
|
||||||
|
5
pack.c
5
pack.c
@ -1565,8 +1565,9 @@ pack_unpack(str, fmt)
|
|||||||
VALUE str = rb_str_new(0, 0);
|
VALUE str = rb_str_new(0, 0);
|
||||||
memcpy(&t, s, sizeof(char *));
|
memcpy(&t, s, sizeof(char *));
|
||||||
s += sizeof(char *);
|
s += sizeof(char *);
|
||||||
if (t)
|
if (t) {
|
||||||
rb_str_cat(str, t, strlen(t));
|
rb_str_cat2(str, t);
|
||||||
|
}
|
||||||
rb_ary_push(ary, str);
|
rb_ary_push(ary, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
parse.y
15
parse.y
@ -2573,9 +2573,9 @@ here_document(term, indent)
|
|||||||
switch (parse_string(term, '\n', '\n')) {
|
switch (parse_string(term, '\n', '\n')) {
|
||||||
case tSTRING:
|
case tSTRING:
|
||||||
case tXSTRING:
|
case tXSTRING:
|
||||||
rb_str_cat(yylval.val, "\n", 1);
|
rb_str_cat2(yylval.val, "\n");
|
||||||
if (!list) {
|
if (!list) {
|
||||||
rb_str_cat(str, RSTRING(yylval.val)->ptr, RSTRING(yylval.val)->len);
|
rb_str_append(str, yylval.val);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
list_append(list, NEW_STR(yylval.val));
|
list_append(list, NEW_STR(yylval.val));
|
||||||
@ -3167,11 +3167,8 @@ yylex()
|
|||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lex_state == EXPR_ARG) {
|
if (lex_state == EXPR_ARG && space_seen) {
|
||||||
if (space_seen) {
|
rb_warning("%s (...) interpreted as function", tok());
|
||||||
arg_ambiguous();
|
|
||||||
c = tLPAREN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
}
|
}
|
||||||
@ -3549,6 +3546,10 @@ str_extend(list, term)
|
|||||||
case '@':
|
case '@':
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
c = nextc();
|
c = nextc();
|
||||||
|
if (c == '@') {
|
||||||
|
tokadd(c);
|
||||||
|
c = nextc();
|
||||||
|
}
|
||||||
while (is_identchar(c)) {
|
while (is_identchar(c)) {
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
if (ismbchar(c)) {
|
if (ismbchar(c)) {
|
||||||
|
8
range.c
8
range.c
@ -256,8 +256,10 @@ range_to_s(range)
|
|||||||
|
|
||||||
str = rb_obj_as_string(rb_ivar_get(range, id_beg));
|
str = rb_obj_as_string(rb_ivar_get(range, id_beg));
|
||||||
str2 = rb_obj_as_string(rb_ivar_get(range, id_end));
|
str2 = rb_obj_as_string(rb_ivar_get(range, id_end));
|
||||||
|
str = rb_str_dup(str);
|
||||||
rb_str_cat(str, "...", EXCL(range)?3:2);
|
rb_str_cat(str, "...", EXCL(range)?3:2);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
|
OBJ_INFECT(str, str2);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -270,8 +272,10 @@ range_inspect(range)
|
|||||||
|
|
||||||
str = rb_inspect(rb_ivar_get(range, id_beg));
|
str = rb_inspect(rb_ivar_get(range, id_beg));
|
||||||
str2 = rb_inspect(rb_ivar_get(range, id_end));
|
str2 = rb_inspect(rb_ivar_get(range, id_end));
|
||||||
|
str = rb_str_dup(str);
|
||||||
rb_str_cat(str, "...", EXCL(range)?3:2);
|
rb_str_cat(str, "...", EXCL(range)?3:2);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
|
OBJ_INFECT(str, str2);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
16
re.c
16
re.c
@ -243,27 +243,27 @@ rb_reg_desc(s, len, re)
|
|||||||
{
|
{
|
||||||
VALUE str = rb_str_new2("/");
|
VALUE str = rb_str_new2("/");
|
||||||
rb_reg_expr_str(str, s, len);
|
rb_reg_expr_str(str, s, len);
|
||||||
rb_str_cat(str, "/", 1);
|
rb_str_cat2(str, "/");
|
||||||
if (re) {
|
if (re) {
|
||||||
if (FL_TEST(re, REG_IGNORECASE))
|
if (FL_TEST(re, REG_IGNORECASE))
|
||||||
rb_str_cat(str, "i", 1);
|
rb_str_cat2(str, "i");
|
||||||
if (FL_TEST(re, REG_EXTENDED))
|
if (FL_TEST(re, REG_EXTENDED))
|
||||||
rb_str_cat(str, "x", 1);
|
rb_str_cat2(str, "x");
|
||||||
if (FL_TEST(re, REG_POSIXLINE))
|
if (FL_TEST(re, REG_POSIXLINE))
|
||||||
rb_str_cat(str, "p", 1);
|
rb_str_cat2(str, "p");
|
||||||
if (FL_TEST(re, KCODE_FIXED)) {
|
if (FL_TEST(re, KCODE_FIXED)) {
|
||||||
switch ((RBASIC(re)->flags & KCODE_MASK)) {
|
switch ((RBASIC(re)->flags & KCODE_MASK)) {
|
||||||
case KCODE_NONE:
|
case KCODE_NONE:
|
||||||
rb_str_cat(str, "n", 1);
|
rb_str_cat2(str, "n");
|
||||||
break;
|
break;
|
||||||
case KCODE_EUC:
|
case KCODE_EUC:
|
||||||
rb_str_cat(str, "e", 1);
|
rb_str_cat2(str, "e");
|
||||||
break;
|
break;
|
||||||
case KCODE_SJIS:
|
case KCODE_SJIS:
|
||||||
rb_str_cat(str, "s", 1);
|
rb_str_cat2(str, "s");
|
||||||
break;
|
break;
|
||||||
case KCODE_UTF8:
|
case KCODE_UTF8:
|
||||||
rb_str_cat(str, "u", 1);
|
rb_str_cat2(str, "u");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
ruby.c
4
ruby.c
@ -403,8 +403,8 @@ proc_options(argc, argv)
|
|||||||
e_script = rb_str_new(0,0);
|
e_script = rb_str_new(0,0);
|
||||||
if (script == 0) script = "-e";
|
if (script == 0) script = "-e";
|
||||||
}
|
}
|
||||||
rb_str_cat(e_script, s, strlen(s));
|
rb_str_cat2(e_script, s);
|
||||||
rb_str_cat(e_script, "\n", 1);
|
rb_str_cat2(e_script, "\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
|
20
signal.c
20
signal.c
@ -429,6 +429,7 @@ trap(arg)
|
|||||||
RETSIGTYPE (*func)();
|
RETSIGTYPE (*func)();
|
||||||
VALUE command, old;
|
VALUE command, old;
|
||||||
int sig;
|
int sig;
|
||||||
|
char *s;
|
||||||
|
|
||||||
func = sighandle;
|
func = sighandle;
|
||||||
command = arg->cmd;
|
command = arg->cmd;
|
||||||
@ -466,18 +467,27 @@ trap(arg)
|
|||||||
command = 0;
|
command = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TYPE(arg->sig) == T_STRING) {
|
switch (TYPE(arg->sig)) {
|
||||||
char *s = RSTRING(arg->sig)->ptr;
|
case T_FIXNUM:
|
||||||
|
sig = NUM2INT(arg->sig);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_SYMBOL:
|
||||||
|
s = rb_id2name(SYM2ID(arg->sig));
|
||||||
|
if (!s) rb_raise(rb_eArgError, "bad signal");
|
||||||
|
goto str_signal;
|
||||||
|
|
||||||
|
case T_STRING:
|
||||||
|
s = RSTRING(arg->sig)->ptr;
|
||||||
|
|
||||||
|
str_signal:
|
||||||
if (strncmp("SIG", s, 3) == 0)
|
if (strncmp("SIG", s, 3) == 0)
|
||||||
s += 3;
|
s += 3;
|
||||||
sig = signm2signo(s);
|
sig = signm2signo(s);
|
||||||
if (sig == 0 && strcmp(s, "EXIT") != 0)
|
if (sig == 0 && strcmp(s, "EXIT") != 0)
|
||||||
rb_raise(rb_eArgError, "invalid signal SIG%s", s);
|
rb_raise(rb_eArgError, "invalid signal SIG%s", s);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
sig = NUM2INT(arg->sig);
|
|
||||||
}
|
|
||||||
if (sig < 0 || sig > NSIG) {
|
if (sig < 0 || sig > NSIG) {
|
||||||
rb_raise(rb_eArgError, "invalid signal number (%d)", sig);
|
rb_raise(rb_eArgError, "invalid signal number (%d)", sig);
|
||||||
}
|
}
|
||||||
|
25
string.c
25
string.c
@ -413,11 +413,29 @@ rb_str_cat(str, ptr, len)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_str_cat2(str, ptr)
|
||||||
|
VALUE str;
|
||||||
|
const char *ptr;
|
||||||
|
{
|
||||||
|
return rb_str_cat(str, ptr, strlen(ptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_str_append(str1, str2)
|
||||||
|
VALUE str1, str2;
|
||||||
|
{
|
||||||
|
if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2);
|
||||||
|
str1 = rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
||||||
|
OBJ_INFECT(str1, str2);
|
||||||
|
|
||||||
|
return str1;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_str_concat(str1, str2)
|
rb_str_concat(str1, str2)
|
||||||
VALUE str1, str2;
|
VALUE str1, str2;
|
||||||
{
|
{
|
||||||
rb_str_modify(str1);
|
|
||||||
if (FIXNUM_P(str2)) {
|
if (FIXNUM_P(str2)) {
|
||||||
int i = FIX2INT(str2);
|
int i = FIX2INT(str2);
|
||||||
if (0 <= i && i <= 0xff) { /* byte */
|
if (0 <= i && i <= 0xff) { /* byte */
|
||||||
@ -425,9 +443,8 @@ rb_str_concat(str1, str2)
|
|||||||
return rb_str_cat(str1, &c, 1);
|
return rb_str_cat(str1, &c, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2);
|
str1 = rb_str_append(str1, str2);
|
||||||
str1 = rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
|
||||||
if (OBJ_TAINTED(str2)) OBJ_TAINT(str1);
|
|
||||||
return str1;
|
return str1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
struct.c
35
struct.c
@ -55,7 +55,7 @@ rb_struct_s_members(obj)
|
|||||||
ary = rb_ary_new2(RARRAY(member)->len);
|
ary = rb_ary_new2(RARRAY(member)->len);
|
||||||
p = RARRAY(member)->ptr; pend = p + RARRAY(member)->len;
|
p = RARRAY(member)->ptr; pend = p + RARRAY(member)->len;
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
rb_ary_push(ary, rb_str_new2(rb_id2name(FIX2INT(*p))));
|
rb_ary_push(ary, rb_str_new2(rb_id2name(SYM2ID(*p))));
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ rb_struct_set(obj, val)
|
|||||||
}
|
}
|
||||||
for (i=0; i<RARRAY(member)->len; i++) {
|
for (i=0; i<RARRAY(member)->len; i++) {
|
||||||
slot = RARRAY(member)->ptr[i];
|
slot = RARRAY(member)->ptr[i];
|
||||||
if (rb_id_attrset(FIX2INT(slot)) == rb_frame_last_func()) {
|
if (rb_id_attrset(SYM2ID(slot)) == rb_frame_last_func()) {
|
||||||
return RSTRUCT(obj)->ptr[i] = val;
|
return RSTRUCT(obj)->ptr[i] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ make_struct(name, member, klass)
|
|||||||
rb_define_singleton_method(nstr, "[]", struct_alloc, -1);
|
rb_define_singleton_method(nstr, "[]", struct_alloc, -1);
|
||||||
rb_define_singleton_method(nstr, "members", rb_struct_s_members, 0);
|
rb_define_singleton_method(nstr, "members", rb_struct_s_members, 0);
|
||||||
for (i=0; i< RARRAY(member)->len; i++) {
|
for (i=0; i< RARRAY(member)->len; i++) {
|
||||||
ID id = FIX2INT(RARRAY(member)->ptr[i]);
|
ID id = SYM2ID(RARRAY(member)->ptr[i]);
|
||||||
if (i<10) {
|
if (i<10) {
|
||||||
rb_define_method_id(nstr, id, ref_func[i], 0);
|
rb_define_method_id(nstr, id, ref_func[i], 0);
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ rb_struct_define(name, va_alist)
|
|||||||
va_init_list(ar, name);
|
va_init_list(ar, name);
|
||||||
while (mem = va_arg(ar, char*)) {
|
while (mem = va_arg(ar, char*)) {
|
||||||
ID slot = rb_intern(mem);
|
ID slot = rb_intern(mem);
|
||||||
rb_ary_push(ary, INT2FIX(slot));
|
rb_ary_push(ary, ID2SYM(slot));
|
||||||
}
|
}
|
||||||
va_end(ar);
|
va_end(ar);
|
||||||
|
|
||||||
@ -231,11 +231,11 @@ rb_struct_s_def(argc, argv, klass)
|
|||||||
rb_scan_args(argc, argv, "1*", &name, &rest);
|
rb_scan_args(argc, argv, "1*", &name, &rest);
|
||||||
for (i=0; i<RARRAY(rest)->len; i++) {
|
for (i=0; i<RARRAY(rest)->len; i++) {
|
||||||
id = rb_to_id(RARRAY(rest)->ptr[i]);
|
id = rb_to_id(RARRAY(rest)->ptr[i]);
|
||||||
RARRAY(rest)->ptr[i] = INT2FIX(id);
|
RARRAY(rest)->ptr[i] = ID2SYM(id);
|
||||||
}
|
}
|
||||||
if (TYPE(name) != T_STRING) {
|
if (TYPE(name) != T_STRING) {
|
||||||
id = rb_to_id(name);
|
id = rb_to_id(name);
|
||||||
rb_ary_unshift(rest, INT2FIX(id));
|
rb_ary_unshift(rest, ID2SYM(id));
|
||||||
name = Qnil;
|
name = Qnil;
|
||||||
}
|
}
|
||||||
st = make_struct(name, rest, klass);
|
st = make_struct(name, rest, klass);
|
||||||
@ -252,7 +252,7 @@ rb_struct_initialize(self, values)
|
|||||||
long n;
|
long n;
|
||||||
|
|
||||||
size = iv_get(klass, "__size__");
|
size = iv_get(klass, "__size__");
|
||||||
n = FIX2INT(size);
|
n = FIX2LONG(size);
|
||||||
if (n < RARRAY(values)->len) {
|
if (n < RARRAY(values)->len) {
|
||||||
rb_raise(rb_eArgError, "struct size differs");
|
rb_raise(rb_eArgError, "struct size differs");
|
||||||
}
|
}
|
||||||
@ -357,24 +357,23 @@ inspect_struct(s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
str = rb_str_new2("#<");
|
str = rb_str_new2("#<");
|
||||||
rb_str_cat(str, cname, strlen(cname));
|
rb_str_cat2(str, cname);
|
||||||
rb_str_cat(str, " ", 1);
|
rb_str_cat2(str, " ");
|
||||||
for (i=0; i<RSTRUCT(s)->len; i++) {
|
for (i=0; i<RSTRUCT(s)->len; i++) {
|
||||||
VALUE str2, slot;
|
VALUE str2, slot;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
rb_str_cat(str, ", ", 2);
|
rb_str_cat2(str, ", ");
|
||||||
}
|
}
|
||||||
slot = RARRAY(member)->ptr[i];
|
slot = RARRAY(member)->ptr[i];
|
||||||
p = rb_id2name(FIX2LONG(slot));
|
p = rb_id2name(SYM2ID(slot));
|
||||||
rb_str_cat(str, p, strlen(p));
|
rb_str_cat2(str, p);
|
||||||
rb_str_cat(str, "=", 1);
|
rb_str_cat2(str, "=");
|
||||||
str2 = rb_inspect(RSTRUCT(s)->ptr[i]);
|
str2 = rb_inspect(RSTRUCT(s)->ptr[i]);
|
||||||
rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
|
rb_str_append(str, str2);
|
||||||
OBJ_INFECT(str, str2);
|
|
||||||
}
|
}
|
||||||
rb_str_cat(str, ">", 1);
|
rb_str_cat2(str, ">");
|
||||||
OBJ_INFECT(str, s);
|
OBJ_INFECT(str, s);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@ -430,7 +429,7 @@ rb_struct_aref_id(s, id)
|
|||||||
|
|
||||||
len = RARRAY(member)->len;
|
len = RARRAY(member)->len;
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
if (FIX2UINT(RARRAY(member)->ptr[i]) == id) {
|
if (SYM2ID(RARRAY(member)->ptr[i]) == id) {
|
||||||
return RSTRUCT(s)->ptr[i];
|
return RSTRUCT(s)->ptr[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -475,7 +474,7 @@ rb_struct_aset_id(s, id, val)
|
|||||||
if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
|
if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
|
||||||
len = RARRAY(member)->len;
|
len = RARRAY(member)->len;
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
if (FIX2UINT(RARRAY(member)->ptr[i]) == id) {
|
if (SYM2ID(RARRAY(member)->ptr[i]) == id) {
|
||||||
RSTRUCT(s)->ptr[i] = val;
|
RSTRUCT(s)->ptr[i] = val;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
12
variable.c
12
variable.c
@ -49,8 +49,8 @@ fc_i(key, value, res)
|
|||||||
name = rb_id2name(key);
|
name = rb_id2name(key);
|
||||||
if (res->path) {
|
if (res->path) {
|
||||||
path = rb_str_dup(res->path);
|
path = rb_str_dup(res->path);
|
||||||
rb_str_cat(path, "::", 2);
|
rb_str_cat2(path, "::");
|
||||||
rb_str_cat(path, name, strlen(name));
|
rb_str_cat2(path, name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
path = rb_str_new2(name);
|
path = rb_str_new2(name);
|
||||||
@ -129,7 +129,7 @@ classname(klass)
|
|||||||
ID classid = rb_intern("__classid__");
|
ID classid = rb_intern("__classid__");
|
||||||
|
|
||||||
if (st_lookup(ROBJECT(klass)->iv_tbl, classid, &path)) {
|
if (st_lookup(ROBJECT(klass)->iv_tbl, classid, &path)) {
|
||||||
path = rb_str_new2(rb_id2name(FIX2INT(path)));
|
path = rb_str_new2(rb_id2name(SYM2ID(path)));
|
||||||
st_insert(ROBJECT(klass)->iv_tbl, classpath, path);
|
st_insert(ROBJECT(klass)->iv_tbl, classpath, path);
|
||||||
st_delete(RCLASS(klass)->iv_tbl, &classid, 0);
|
st_delete(RCLASS(klass)->iv_tbl, &classid, 0);
|
||||||
}
|
}
|
||||||
@ -185,8 +185,8 @@ rb_set_class_path(klass, under, name)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = rb_str_dup(rb_class_path(under));
|
str = rb_str_dup(rb_class_path(under));
|
||||||
rb_str_cat(str, "::", 2);
|
rb_str_cat2(str, "::");
|
||||||
rb_str_cat(str, name, strlen(name));
|
rb_str_cat2(str, name);
|
||||||
}
|
}
|
||||||
rb_iv_set(klass, "__classpath__", str);
|
rb_iv_set(klass, "__classpath__", str);
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ rb_name_class(klass, id)
|
|||||||
VALUE klass;
|
VALUE klass;
|
||||||
ID id;
|
ID id;
|
||||||
{
|
{
|
||||||
rb_iv_set(klass, "__classid__", INT2FIX(id));
|
rb_iv_set(klass, "__classid__", ID2SYM(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static st_table *autoload_tbl = 0;
|
static st_table *autoload_tbl = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define RUBY_VERSION "1.5.3"
|
#define RUBY_VERSION "1.5.3"
|
||||||
#define RUBY_RELEASE_DATE "2000-03-23"
|
#define RUBY_RELEASE_DATE "2000-04-10"
|
||||||
#define RUBY_VERSION_CODE 153
|
#define RUBY_VERSION_CODE 153
|
||||||
#define RUBY_RELEASE_CODE 20000323
|
#define RUBY_RELEASE_CODE 20000410
|
||||||
|
Loading…
x
Reference in New Issue
Block a user