diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-06-11 06:30:01 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-06-11 06:30:01 +0000 |
commit | be83b8be34318b74544d435305cb98689eae8089 (patch) | |
tree | e83027e2d8b4a3ab3435eaf9eb345ced538d3ca8 | |
parent | ecfa8525662a6c9d0570c2ac53cfbeb809a62e8f (diff) | |
download | ruby-be83b8be34318b74544d435305cb98689eae8089.tar.gz |
990611
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | ToDo | 6 | ||||
-rw-r--r-- | array.c | 1 | ||||
-rw-r--r-- | config.guess | 2 | ||||
-rw-r--r-- | eval.c | 16 | ||||
-rw-r--r-- | ext/curses/curses.c | 7 | ||||
-rw-r--r-- | ext/etc/etc.c | 7 | ||||
-rw-r--r-- | ext/pty/pty.c | 2 | ||||
-rw-r--r-- | ext/sdbm/init.c | 1 | ||||
-rw-r--r-- | ext/socket/socket.c | 1 | ||||
-rw-r--r-- | ext/tk/tkutil.c | 7 | ||||
-rw-r--r-- | gc.c | 14 | ||||
-rw-r--r-- | hash.c | 3 | ||||
-rw-r--r-- | io.c | 23 | ||||
-rw-r--r-- | object.c | 2 | ||||
-rw-r--r-- | pack.c | 2 | ||||
-rw-r--r-- | range.c | 1 | ||||
-rw-r--r-- | re.c | 1 | ||||
-rw-r--r-- | rubyio.h | 2 | ||||
-rw-r--r-- | string.c | 1 | ||||
-rw-r--r-- | struct.c | 1 | ||||
-rw-r--r-- | time.c | 1 | ||||
-rw-r--r-- | version.h | 4 |
23 files changed, 90 insertions, 54 deletions
@@ -1,3 +1,37 @@ +Fri Jun 10 13:42:10 1999 Koji Arai <JCA02266@nifty.ne.jp> + + * pack.c (pack_pack): template `Z' should be allowed. + +Fri Jun 11 15:21:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * ext/etc/etc.c (etc_group): dumps core if there's no more group. + +Fri Jun 11 01:50:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * eval.c (ruby_run): Init_stack() was called too late; local + variables happend to be higher (or lower) than stack_start. + +Thu Jun 10 16:41:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * io.c: do not call `initialize' for IO objects. So with Array, + Hash, Range, and Time objects. + + * ext/curses/curses.c (curses_getch): made thread aware using + rb_read_check(). + + * ext/curses/curses.c (window_getch): ditto. + + * ext/curses/curses.c (curses_getstr): made (partially) thread + aware using rb_read_check(). + + * ext/curses/curses.c (window_getstr): ditto. + + * io.c (rb_read_check): new function to help making something + (like extension libraries) thread aware. + + * eval.c (is_defined): `defined? super' should be true even for + private superclass methods. + Wed Jun 9 13:26:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (rb_thread_loading): modified to avoid nested race @@ -6,7 +40,8 @@ Wed Jun 9 13:26:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * ext/tcltklib/tcltklib.c (ip_invoke): queue invocation on non main threads. - * ext/tcltklib/tcltklib.c (lib_mainloop): flush invoke queues. + * ext/tcltklib/tcltklib.c (lib_mainloop): flush invocation + queues periodically. * version.c (ruby_show_version): now print the message to stdout. @@ -105,7 +140,7 @@ Sat May 29 18:27:13 1999 Koji Arai <JCA02266@nifty.ne.jp> Sat May 29 12:27:00 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * ext/tcltklib/tcltklib.c (ip_invoke): proper ref count management - to avoid leak. + to avoid leak. I HATE REF COUNTING!! * eval.c (ruby_run): moved ruby_require_libraries() to handle `-r' from ruby_options() to avoid stack corruption for threads @@ -18,6 +18,7 @@ Hacking Interpreter Standard Libraries +* IO/File to call initialize * String#scanf(?) * Object#fmt(?) * Integer[num], Float[num] (String[str]?, Array[obj]??) @@ -25,13 +26,11 @@ Standard Libraries Extension Libraries -* mod_ruby, FastCGI ruby -* InterBase module +* FastCGI ruby * ptk.rb pTk wrapper that is compatible to tk.rb Ruby Libraries -* CGI.rb * httplib.rb, urllib.rb, nttplib.rb, etc. * format like perl's @@ -39,7 +38,6 @@ Tools * extension library maker like XS or SWIG * freeze or undump to bundle everything -* eruby - embedded ruby Misc @@ -194,7 +194,6 @@ rb_ary_s_new(argc, argv, klass) ary->ptr = ALLOC_N(VALUE, ary->capa); memfill(ary->ptr, len, val); ary->len = len; - rb_obj_call_init((VALUE)ary, argc, argv); return (VALUE)ary; } diff --git a/config.guess b/config.guess index 058230d7d4..7e23afe37b 100644 --- a/config.guess +++ b/config.guess @@ -382,7 +382,7 @@ EOF case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[13679] | 9000/892 ) + 9000/[678]?? ) sed 's/^ //' << EOF >dummy.c #include <stdlib.h> #include <unistd.h> @@ -321,7 +321,7 @@ rb_method_boundp(klass, id, ex) int noex; if (rb_get_method_body(&klass, &id, &noex)) { - if (ex && noex & NOEX_PRIVATE) + if (ex && (noex & NOEX_PRIVATE)) return Qfalse; return Qtrue; } @@ -879,7 +879,7 @@ extern char **environ; char **rb_origenviron; void rb_call_inits _((void)); -void Init_stack _((void)); +void Init_stack _((void*)); void Init_heap _((void)); void Init_ext _((void)); @@ -899,6 +899,7 @@ ruby_init() rb_origenviron = environ; #endif + Init_stack(0); Init_heap(); PUSH_SCOPE(); ruby_scope->local_vars = 0; @@ -978,16 +979,14 @@ ruby_run() { int state; static int ex; + NODE *save; if (ruby_nerrs > 0) exit(ruby_nerrs); - Init_stack(); - + Init_stack(&save); PUSH_TAG(PROT_NONE); PUSH_ITER(ITER_NOT); if ((state = EXEC_TAG()) == 0) { - NODE *save; - if (!ext_init) Init_ext(); save = ruby_eval_tree; ruby_require_libraries(); @@ -1464,7 +1463,7 @@ is_defined(self, node, buf) case NODE_ZSUPER: if (ruby_frame->last_func == 0) return 0; else if (rb_method_boundp(RCLASS(ruby_frame->last_class)->super, - ruby_frame->last_func, 1)) { + ruby_frame->last_func, 0)) { if (nd_type(node) == NODE_SUPER) { return arg_defined(self, node->nd_args, buf, "super"); } @@ -2739,7 +2738,6 @@ rb_eval(self, node) klass = rb_define_class_id(node->nd_cname, super); rb_const_set(ruby_class, node->nd_cname, klass); rb_set_class_path(klass,ruby_class,rb_id2name(node->nd_cname)); - rb_obj_call_init(klass, 0, 0); } if (ruby_wrapper) { rb_extend_object(klass, ruby_wrapper); @@ -2779,7 +2777,6 @@ rb_eval(self, node) module = rb_define_module_id(node->nd_cname); rb_const_set(ruby_class, node->nd_cname, module); rb_set_class_path(module,ruby_class,rb_id2name(node->nd_cname)); - rb_obj_call_init(module, 0, 0); } if (ruby_wrapper) { rb_extend_object(module, ruby_wrapper); @@ -5425,7 +5422,6 @@ proc_s_new(klass) scope_dup(data->scope); proc_save_safe_level(proc); - rb_obj_call_init(proc, 0, 0); return proc; } diff --git a/ext/curses/curses.c b/ext/curses/curses.c index 5a515275bc..202a0f9244 100644 --- a/ext/curses/curses.c +++ b/ext/curses/curses.c @@ -32,7 +32,9 @@ #endif #endif +#include "stdio.h" #include "ruby.h" +#include "rubyio.h" static VALUE mCurses; static VALUE cWindow; @@ -355,6 +357,7 @@ static VALUE curses_getch(obj) VALUE obj; { + rb_read_check(stdin); return CHR2FIX(getch()); } @@ -364,6 +367,8 @@ curses_getstr(obj) VALUE obj; { char rtn[1024]; /* This should be big enough.. I hope */ + + rb_read_check(stdin); getstr(rtn); return rb_tainted_str_new2(rtn); } @@ -730,6 +735,7 @@ window_getch(obj) { struct windata *winp; + rb_read_check(stdin); GetWINDOW(obj, winp); return CHR2FIX(wgetch(winp->window)); } @@ -743,6 +749,7 @@ window_getstr(obj) char rtn[1024]; /* This should be big enough.. I hope */ GetWINDOW(obj, winp); + rb_read_check(stdin); wgetstr(winp->window, rtn); return rb_tainted_str_new2(rtn); } diff --git a/ext/etc/etc.c b/ext/etc/etc.c index c10680c7d3..271602a294 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -214,10 +214,11 @@ etc_group(obj) endgrent(); return obj; } - return setup_group(getgrent()); -#else - return Qnil; + if (grp = getgrent()) { + return setup_group(grp); + } #endif + return Qnil; } static VALUE mEtc; diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 6462c3c7ca..0438ca7e9b 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -442,12 +442,10 @@ pty_getpty(self, shell) rfptr->mode = rb_io_mode_flags("r"); rfptr->f = fdopen(info.fd, "r"); rfptr->path = strdup(RSTRING(shell)->ptr); - rb_obj_call_init((VALUE)rport, 1, &shell); wfptr->mode = rb_io_mode_flags("w"); wfptr->f = fdopen(dup(info.fd), "w"); wfptr->path = strdup(RSTRING(shell)->ptr); - rb_obj_call_init((VALUE)wport, 1, &shell); res = rb_ary_new2(2); rb_ary_store(res,0,(VALUE)rport); diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c index 9ae216193b..5ebffcb9fd 100644 --- a/ext/sdbm/init.c +++ b/ext/sdbm/init.c @@ -85,7 +85,6 @@ fsdbm_s_open(argc, argv, klass) obj = Data_Make_Struct(klass,struct dbmdata,0,free_sdbm,dbmp); dbmp->di_dbm = dbm; dbmp->di_size = -1; - rb_obj_call_init(obj, argc, argv); return obj; } diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 0912ca9dd1..adf622c118 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -114,7 +114,6 @@ sock_new(class, fd) fp->f2 = rb_fdopen(fd, "w"); fp->mode = FMODE_READWRITE; rb_io_unbuffered(fp); - rb_obj_call_init((VALUE)sock, 0, 0); return (VALUE)sock; } diff --git a/ext/tk/tkutil.c b/ext/tk/tkutil.c index 990c81d724..efa3fd735d 100644 --- a/ext/tk/tkutil.c +++ b/ext/tk/tkutil.c @@ -22,14 +22,13 @@ tk_eval_cmd(argc, argv) } static VALUE -tk_s_new(argc, argv, class) +tk_s_new(argc, argv, klass) int argc; VALUE *argv; - VALUE class; + VALUE klass; { - VALUE obj = rb_obj_alloc(class); + VALUE obj = rb_class_new_instance(argc, argv, klass); - rb_obj_call_init(obj, argc, argv); if (rb_iterator_p()) rb_obj_instance_eval(0, 0, obj); return obj; } @@ -298,7 +298,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree) } extern st_table *rb_class_tbl; -VALUE *rb_gc_stack_start; +VALUE *rb_gc_stack_start = 0; #if defined(__GNUC__) && __GNUC__ >= 2 __inline__ @@ -950,22 +950,26 @@ gc_start() } void -Init_stack() +Init_stack(addr) + VALUE *addr; { #ifdef __human68k__ extern void *_SEND; - gc_stack_start = _SEND; + rb_gc_stack_start = _SEND; #else VALUE start; - rb_gc_stack_start = &start; + if (!addr) addr = &start; + rb_gc_stack_start = addr; #endif } void Init_heap() { - Init_stack(); + if (!rb_gc_stack_start) { + Init_stack(0); + } add_heap(); } @@ -205,7 +205,6 @@ rb_hash_s_new(argc, argv, klass) hash->ifnone = ifnone; hash->tbl = st_init_table(&objhash); - rb_obj_call_init((VALUE)hash, argc, argv); return (VALUE)hash; } @@ -249,7 +248,6 @@ rb_hash_s_create(argc, argv, klass) hash->ifnone = Qnil; hash->tbl = 0; /* avoid GC crashing */ hash->tbl = st_copy(RHASH(argv[0])->tbl); - rb_obj_call_init((VALUE)hash, argc, argv); return (VALUE)hash; } @@ -267,7 +265,6 @@ rb_hash_s_create(argc, argv, klass) for (i=0; i<argc; i+=2) { st_insert(RHASH(hash)->tbl, argv[i], argv[i+1]); } - rb_obj_call_init(hash, argc, argv); return hash; } @@ -132,6 +132,9 @@ void rb_io_check_closed(fptr) OpenFile *fptr; { + if (!fptr) { + rb_raise(rb_eIOError, "uninitialized stream"); + } if (fptr->f == NULL && fptr->f2 == NULL) rb_raise(rb_eIOError, "closed stream"); } @@ -154,6 +157,15 @@ rb_io_check_writable(fptr) } } +void +rb_read_check(fp) + FILE *fp; +{ + if (!READ_DATA_PENDING(fp)) { + rb_thread_wait_fd(fileno(fp)); + } +} + /* writing functions */ static VALUE io_write(io, str) @@ -1242,7 +1254,6 @@ rb_file_open_internal(klass, fname, mode) fptr->mode = rb_io_mode_flags(mode); fptr->f = rb_fopen(fname, mode); fptr->path = strdup(fname); - rb_obj_call_init((VALUE)port, 0, 0); return (VALUE)port; } @@ -1278,7 +1289,6 @@ rb_file_sysopen_internal(klass, fname, flags, mode) fptr->mode = rb_io_mode_flags2(flags); fptr->f = rb_fdopen(fd, m); fptr->path = strdup(fname); - rb_obj_call_init((VALUE)port, 0, 0); return (VALUE)port; #endif @@ -1401,7 +1411,6 @@ pipe_open(pname, mode) fptr->f2 = f; rb_io_unbuffered(fptr); } - rb_obj_call_init((VALUE)port, 0, 0); return (VALUE)port; } #else @@ -1483,7 +1492,6 @@ pipe_open(pname, mode) fptr->finalize = pipe_finalize; pipe_add_fptr(fptr); #endif - rb_obj_call_init((VALUE)port, 0, 0); return (VALUE)port; } } @@ -1501,7 +1509,7 @@ rb_io_s_popen(argc, argv, self) VALUE self; { char *mode; - VALUE pname, pmode; + VALUE pname, pmode, port; if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) { mode = "r"; @@ -1515,7 +1523,9 @@ rb_io_s_popen(argc, argv, self) rb_raise(rb_eArgError, "illegal access mode"); } Check_SafeStr(pname); - return pipe_open(RSTRING(pname)->ptr, mode); + port = pipe_open(RSTRING(pname)->ptr, mode); + if (NIL_P(port)) return Qnil; + return port; } static VALUE @@ -2061,7 +2071,6 @@ prep_stdio(f, mode, klass) MakeOpenFile(io, fp); fp->f = f; fp->mode = mode; - rb_obj_call_init((VALUE)io, 0, 0); return (VALUE)io; } @@ -565,7 +565,6 @@ rb_module_s_new(klass) VALUE mod = rb_module_new(); RBASIC(mod)->klass = klass; - rb_obj_call_init(mod, 0, 0); return mod; } @@ -587,7 +586,6 @@ rb_class_s_new(argc, argv) /* make metaclass */ RBASIC(klass)->klass = rb_singleton_class_new(RBASIC(super)->klass); rb_singleton_class_attached(RBASIC(klass)->klass, klass); - rb_obj_call_init(klass, argc, argv); return klass; } @@ -361,7 +361,7 @@ pack_pack(ary, fmt) } switch (type) { - case 'A': case 'a': + case 'A': case 'a': case 'Z': case 'B': case 'b': case 'H': case 'h': from = NEXTFROM; @@ -52,7 +52,6 @@ range_new(klass, beg, end, exclude_end) rb_ivar_set(obj, id_beg, beg); rb_ivar_set(obj, id_end, end); - rb_obj_call_init(obj, 2, args); return obj; } @@ -775,7 +775,6 @@ rb_reg_new_1(klass, s, len, options) if (options & ~0x7) { kcode_reset_option(); } - rb_obj_call_init((VALUE)re, 0, 0); return (VALUE)re; } @@ -59,4 +59,6 @@ void rb_io_unbuffered _((OpenFile*)); void rb_io_check_closed _((OpenFile*)); void rb_eof_error _((void)); +void rb_read_check _((FILE*)); /* thread aware check */ + #endif @@ -214,7 +214,6 @@ rb_str_s_new(klass, orig) if (rb_safe_level() >= 3) { FL_SET(str, FL_TAINT); } - rb_obj_call_init((VALUE)str, 1, &orig); return (VALUE)str; } @@ -235,7 +235,6 @@ rb_struct_s_def(argc, argv, klass) RARRAY(rest)->ptr[i] = INT2FIX(id); } st = make_struct(name, rest, klass); - rb_obj_call_init(st, argc, argv); return st; } @@ -69,7 +69,6 @@ time_s_now(klass) if (gettimeofday(&tobj->tv, 0) < 0) { rb_sys_fail("gettimeofday"); } - rb_obj_call_init(obj, 0, 0); return obj; } @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.3.4" -#define RUBY_RELEASE_DATE "1999-06-04" +#define RUBY_RELEASE_DATE "1999-06-11" #define RUBY_VERSION_CODE 134 -#define RUBY_RELEASE_CODE 19990604 +#define RUBY_RELEASE_CODE 19990611 |