1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-06-11 06:30:01 +00:00
parent ecfa852566
commit be83b8be34
23 changed files with 90 additions and 54 deletions

View file

@ -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

6
ToDo
View file

@ -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

View file

@ -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;
}

2
config.guess vendored
View file

@ -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>

16
eval.c
View file

@ -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;
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

14
gc.c
View file

@ -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();
}

3
hash.c
View file

@ -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;
}

23
io.c
View file

@ -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;
}

View file

@ -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;
}

2
pack.c
View file

@ -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;

View file

@ -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;
}

1
re.c
View file

@ -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;
}

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}

1
time.c
View file

@ -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;
}

View file

@ -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