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/trunk@858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-07-27 09:49:34 +00:00
parent f0ba57341a
commit 77e876615d
21 changed files with 89 additions and 101 deletions

View file

@ -5,6 +5,13 @@ Wed Jul 26 10:09:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* configure.in: LIBRUBY_SO='$(RUBY_INSTALL_NAME)'.$target_os.dll * configure.in: LIBRUBY_SO='$(RUBY_INSTALL_NAME)'.$target_os.dll
on cygwin and mingw32. ruby-cygwin.dll is bad. why? on cygwin and mingw32. ruby-cygwin.dll is bad. why?
Wed Jul 26 10:04:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* gc.c (gc_sweep): avoid full scan during compilation.
* gc.c (rb_gc): add heap during no gc period (including
compilation).
Tue Jul 25 19:03:04 2000 WATANABE Hirofumi <eban@os.rim.or.jp> Tue Jul 25 19:03:04 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* cygwin/GNUmakefile: use puts instead of print, because * cygwin/GNUmakefile: use puts instead of print, because

View file

@ -201,9 +201,6 @@ strncasecmp.@OBJEXT@: @srcdir@/missing/strncasecmp.c
strchr.@OBJEXT@: @srcdir@/missing/strchr.c strchr.@OBJEXT@: @srcdir@/missing/strchr.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strchr.c $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strchr.c
strdup.@OBJEXT@: @srcdir@/missing/strdup.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strdup.c
strerror.@OBJEXT@: @srcdir@/missing/strerror.c strerror.@OBJEXT@: @srcdir@/missing/strerror.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strerror.c $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strerror.c

View file

@ -11,6 +11,7 @@
**********************************************************************/ **********************************************************************/
#include "ruby.h" #include "ruby.h"
#include "rubysig.h"
#include "node.h" #include "node.h"
#include "st.h" #include "st.h"
#include <ctype.h> #include <ctype.h>
@ -526,6 +527,7 @@ rb_singleton_class(obj)
rb_bug("unknown immediate %d", obj); rb_bug("unknown immediate %d", obj);
} }
DEFER_INTS;
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) { if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) {
klass = RBASIC(obj)->klass; klass = RBASIC(obj)->klass;
} }
@ -541,6 +543,7 @@ rb_singleton_class(obj)
FL_UNSET(klass, FL_TAINT); FL_UNSET(klass, FL_TAINT);
} }
if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass); if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass);
ALLOW_INTS;
return klass; return klass;
} }

View file

@ -217,7 +217,7 @@ AC_FUNC_ALLOCA
AC_FUNC_VFORK AC_FUNC_VFORK
AC_FUNC_MEMCMP AC_FUNC_MEMCMP
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul strdup crypt flock vsnprintf\ strchr strstr strtoul crypt flock vsnprintf\
isinf isnan finite) isinf isnan finite)
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd\ AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd\
truncate chsize times utimes fcntl lockf setitimer pause\ truncate chsize times utimes fcntl lockf setitimer pause\

View file

@ -28,6 +28,8 @@
#endif #endif
#define S_IXGRP 0000010 /* execute/search permission, group */ #define S_IXGRP 0000010 /* execute/search permission, group */
#define S_IXOTH 0000001 /* execute/search permission, other */ #define S_IXOTH 0000001 /* execute/search permission, other */
#define HAVE_SYS_WAIT_H /* configure fails to find this */
#endif /* NeXT */ #endif /* NeXT */
#ifdef NT #ifdef NT

16
dln.c
View file

@ -122,16 +122,15 @@ init_funcname(buf, file)
static int dln_errno; static int dln_errno;
#define DLN_ENOEXEC ENOEXEC /* Exec format error */ #define DLN_ENOEXEC ENOEXEC /* Exec format error */
#define DLN_ECONFL 201 /* Symbol name conflict */ #define DLN_ECONFL 1201 /* Symbol name conflict */
#define DLN_ENOINIT 202 /* No inititalizer given */ #define DLN_ENOINIT 1202 /* No inititalizer given */
#define DLN_EUNDEF 203 /* Undefine symbol remains */ #define DLN_EUNDEF 1203 /* Undefine symbol remains */
#define DLN_ENOTLIB 204 /* Not a library file */ #define DLN_ENOTLIB 1204 /* Not a library file */
#define DLN_EBADLIB 205 /* Malformed library file */ #define DLN_EBADLIB 1205 /* Malformed library file */
#define DLN_EINIT 206 /* Not initialized */ #define DLN_EINIT 1206 /* Not initialized */
static int dln_init_p = 0; static int dln_init_p = 0;
#include "st.h"
#include <ar.h> #include <ar.h>
#include <a.out.h> #include <a.out.h>
#ifndef N_COMM #ifndef N_COMM
@ -143,6 +142,9 @@ static int dln_init_p = 0;
#define INVALID_OBJECT(h) (N_MAGIC(h) != OMAGIC) #define INVALID_OBJECT(h) (N_MAGIC(h) != OMAGIC)
#include "util.h"
#include "st.h"
static st_table *sym_tbl; static st_table *sym_tbl;
static st_table *undef_tbl; static st_table *undef_tbl;

40
eval.c
View file

@ -1003,22 +1003,19 @@ ruby_init()
} }
static VALUE static VALUE
eval_node(self) eval_node(self, node)
VALUE self; VALUE self;
NODE *node;
{ {
NODE *beg_tree, *tree; NODE *beg_tree = ruby_eval_tree_begin;
beg_tree = ruby_eval_tree_begin; ruby_eval_tree_begin = 0;
tree = ruby_eval_tree;
if (beg_tree) { if (beg_tree) {
ruby_eval_tree_begin = 0;
rb_eval(self, beg_tree); rb_eval(self, beg_tree);
} }
if (!tree) return Qnil; if (!node) return Qnil;
ruby_eval_tree = 0; return rb_eval(self, node);
return rb_eval(self, tree);
} }
int ruby_in_eval; int ruby_in_eval;
@ -1111,7 +1108,7 @@ ruby_run()
PUSH_TAG(PROT_NONE); PUSH_TAG(PROT_NONE);
PUSH_ITER(ITER_NOT); PUSH_ITER(ITER_NOT);
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
eval_node(ruby_top_self); eval_node(ruby_top_self, ruby_eval_tree);
} }
POP_ITER(); POP_ITER();
POP_TAG(); POP_TAG();
@ -4496,6 +4493,7 @@ compile(src, file, line)
{ {
NODE *node; NODE *node;
ruby_nerrs = 0;
Check_Type(src, T_STRING); Check_Type(src, T_STRING);
node = rb_compile_string(file, src, line); node = rb_compile_string(file, src, line);
@ -4563,11 +4561,11 @@ eval(self, src, scope, file, line)
} }
PUSH_TAG(PROT_NONE); PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
compile(src, file, line); NODE *node = compile(src, file, line);
if (ruby_nerrs > 0) { if (ruby_nerrs > 0) {
compile_error(0); compile_error(0);
} }
result = eval_node(self); result = eval_node(self, node);
} }
POP_TAG(); POP_TAG();
POP_CLASS(); POP_CLASS();
@ -4889,11 +4887,16 @@ rb_load(fname, wrap)
state = EXEC_TAG(); state = EXEC_TAG();
last_func = ruby_frame->last_func; last_func = ruby_frame->last_func;
if (state == 0) { if (state == 0) {
NODE *node;
DEFER_INTS;
ruby_in_eval++; ruby_in_eval++;
rb_load_file(file); rb_load_file(file);
ruby_in_eval--; ruby_in_eval--;
node = ruby_eval_tree;
ALLOW_INTS;
if (ruby_nerrs == 0) { if (ruby_nerrs == 0) {
eval_node(self); eval_node(self, node);
} }
} }
ruby_frame->last_func = last_func; ruby_frame->last_func = last_func;
@ -6312,7 +6315,10 @@ method_inspect(method)
rb_str_cat2(str, ": "); rb_str_cat2(str, ": ");
s = rb_class2name(data->oklass); s = rb_class2name(data->oklass);
rb_str_cat2(str, s); rb_str_cat2(str, s);
rb_str_cat2(str, "#"); rb_str_cat2(str, "(");
s = rb_class2name(data->klass);
rb_str_cat2(str, s);
rb_str_cat2(str, ")#");
s = rb_id2name(data->oid); s = rb_id2name(data->oid);
rb_str_cat2(str, s); rb_str_cat2(str, s);
rb_str_cat2(str, ">"); rb_str_cat2(str, ">");
@ -6884,6 +6890,7 @@ find_bad_fds(dst, src, max)
void void
rb_thread_schedule() rb_thread_schedule()
{ {
extern int ruby_in_compile;
rb_thread_t next; /* OK */ rb_thread_t next; /* OK */
rb_thread_t th; rb_thread_t th;
rb_thread_t curr; rb_thread_t curr;
@ -6897,6 +6904,11 @@ rb_thread_schedule()
int n, max; int n, max;
int need_select = 0; int need_select = 0;
if (ruby_in_compile) {
printf("switch during compilation.\n");
abort();
}
rb_thread_pending = 0; rb_thread_pending = 0;
if (curr_thread == curr_thread->next if (curr_thread == curr_thread->next
&& curr_thread->status == THREAD_RUNNABLE) && curr_thread->status == THREAD_RUNNABLE)

20
gc.c
View file

@ -284,8 +284,7 @@ rb_newobj()
freelist = freelist->as.free.next; freelist = freelist->as.free.next;
return obj; return obj;
} }
if (dont_gc || during_gc || rb_prohibit_interrupt) add_heap(); rb_gc();
else rb_gc();
goto retry; goto retry;
} }
@ -661,18 +660,6 @@ gc_sweep()
int freed = 0; int freed = 0;
int i, used = heaps_used; int i, used = heaps_used;
if (ruby_in_compile) {
/* sould not reclaim nodes during compilation */
for (i = 0; i < used; i++) {
p = heaps[i]; pend = p + HEAP_SLOTS;
while (p < pend) {
if (!(p->as.basic.flags&FL_MARK) && BUILTIN_TYPE(p) == T_NODE)
rb_gc_mark(p);
p++;
}
}
}
freelist = 0; freelist = 0;
final_list = 0; final_list = 0;
for (i = 0; i < used; i++) { for (i = 0; i < used; i++) {
@ -913,6 +900,11 @@ rb_gc()
# define STACK_END (stack_end) # define STACK_END (stack_end)
#endif #endif
if (dont_gc || during_gc || rb_prohibit_interrupt || ruby_in_compile) {
add_heap();
return;
}
malloc_memories = 0; malloc_memories = 0;
if (during_gc) return; if (during_gc) return;

5
hash.c
View file

@ -17,11 +17,6 @@
#include "util.h" #include "util.h"
#include "rubysig.h" #include "rubysig.h"
#ifndef HAVE_STRING_H
char *strchr _((char*,char));
char *strdup _((const char*));
#endif
#define HASH_DELETED FL_USER1 #define HASH_DELETED FL_USER1
static void static void

4
io.c
View file

@ -56,10 +56,6 @@ struct timeval {
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifndef strdup
char *strdup();
#endif
extern void Init_File _((void)); extern void Init_File _((void));
#ifdef __BEOS__ #ifdef __BEOS__

View file

@ -39,7 +39,7 @@ class Delegator
raise raise
end end
end end
EOS EOS
end end
end end

View file

@ -45,7 +45,13 @@ class WeakRef<Delegator
@__id = orig.__id__ @__id = orig.__id__
ObjectSpace.define_finalizer orig, @@final ObjectSpace.define_finalizer orig, @@final
ObjectSpace.define_finalizer self, @@final ObjectSpace.define_finalizer self, @@final
ID_MAP[@__id] = [] unless ID_MAP[@__id] __old_status = Thread.critical
begin
Thread.critical = true
ID_MAP[@__id] = [] unless ID_MAP[@__id]
ensure
Thread.critical = __old_status
end
ID_MAP[@__id].push self.__id__ ID_MAP[@__id].push self.__id__
ID_REV_MAP[self.id] = @__id ID_REV_MAP[self.id] = @__id
end end

View file

@ -1,25 +0,0 @@
/************************************************
strdup.c -
$Author$
$Date$
created at: Wed Dec 7 15:34:01 JST 1994
************************************************/
#include <stdio.h>
char *
strdup(str)
char *str;
{
extern char *xmalloc();
char *tmp;
int len = strlen(str) + 1;
tmp = xmalloc(len);
if (tmp == NULL) return NULL;
memcpy(tmp, str, len);
return tmp;
}

8
pack.c
View file

@ -333,7 +333,7 @@ pack_pack(ary, fmt)
#endif #endif
if (ISSPACE(type)) continue; if (ISSPACE(type)) continue;
if (*p == '_') { if (*p == '_' || *p == '!') {
char *natstr = "sSiIlL"; char *natstr = "sSiIlL";
if (strchr(natstr, type)) { if (strchr(natstr, type)) {
@ -343,7 +343,7 @@ pack_pack(ary, fmt)
p++; p++;
} }
else { else {
rb_raise(rb_eArgError, "'_' allowed only after types %s", natstr); rb_raise(rb_eArgError, "'%c' allowed only after types %s", *p, natstr);
} }
} }
if (*p == '*') { /* set data length */ if (*p == '*') { /* set data length */
@ -1077,7 +1077,7 @@ pack_unpack(str, fmt)
#endif #endif
star = 0; star = 0;
type = *p++; type = *p++;
if (*p == '_') { if (*p == '_' || *p == '!') {
char *natstr = "sSiIlL"; char *natstr = "sSiIlL";
if (strchr(natstr, type)) { if (strchr(natstr, type)) {
@ -1087,7 +1087,7 @@ pack_unpack(str, fmt)
p++; p++;
} }
else { else {
rb_raise(rb_eArgError, "'_' allowed only after types %s", natstr); rb_raise(rb_eArgError, "'%c' allowed only after types %s", *p, natstr);
} }
} }
if (p >= pend) if (p >= pend)

View file

@ -1786,9 +1786,6 @@ none : /* none */
#include <sys/types.h> #include <sys/types.h>
#include "regex.h" #include "regex.h"
#include "util.h" #include "util.h"
#ifndef strdup
char *strdup();
#endif
#define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) #define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c)))
@ -1862,6 +1859,7 @@ yycompile(f, line)
int line; int line;
{ {
int n; int n;
NODE *node = 0;
if (!compile_for_eval && rb_safe_level() == 0 && if (!compile_for_eval && rb_safe_level() == 0 &&
rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) { rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) {
@ -1898,9 +1896,9 @@ yycompile(f, line)
class_nest = 0; class_nest = 0;
in_single = 0; in_single = 0;
cur_mid = 0; cur_mid = 0;
if (n == 0) return ruby_eval_tree;
return 0; if (n == 0) node = ruby_eval_tree;
return node;
} }
static int lex_gets_ptr; static int lex_gets_ptr;

View file

@ -189,10 +189,6 @@ typedef struct
} regmatch_t; } regmatch_t;
#ifdef NeXT
#define re_match rre_match
#endif
#ifdef __STDC__ #ifdef __STDC__
extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *); extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);

3
ruby.c
View file

@ -49,9 +49,6 @@ static int xflag = 0;
extern int yydebug; extern int yydebug;
char *ruby_inplace_mode = Qfalse; char *ruby_inplace_mode = Qfalse;
# ifndef strdup
char *strdup();
# endif
static void load_stdin _((void)); static void load_stdin _((void));
static void load_file _((char *, int)); static void load_file _((char *, int));

16
util.c
View file

@ -300,7 +300,6 @@ valid_filename(char *s)
#endif #endif
#ifdef DJGPP #ifdef DJGPP
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h> #include <libc/stubs.h>
#include <stdio.h> /* For FILENAME_MAX */ #include <stdio.h> /* For FILENAME_MAX */
#include <errno.h> /* For errno */ #include <errno.h> /* For errno */
@ -379,7 +378,7 @@ is_sjis1(int c)
7. Converting all slashes to '/' 7. Converting all slashes to '/'
*/ */
void void
_fixpath(const char *in, char *out) fixpath(const char *in, char *out)
{ {
int drive_number; int drive_number;
const char *ip = in; const char *ip = in;
@ -758,3 +757,16 @@ void ruby_qsort (base, nel, size, cmp) void* base; int nel; int size; int (*cmp)
} }
} }
char *
ruby_strdup(str)
const char *str;
{
char *tmp;
int len = strlen(str) + 1;
tmp = xmalloc(len);
if (tmp == NULL) return NULL;
memcpy(tmp, str, len);
return tmp;
}

6
util.h
View file

@ -36,8 +36,6 @@ void ruby_add_suffix();
#define add_suffix ruby_add_suffix #define add_suffix ruby_add_suffix
#endif #endif
char *ruby_mktemp _((void));
void ruby_qsort _((void*, int, int, int (*)())); void ruby_qsort _((void*, int, int, int (*)()));
#define qsort(b,n,s,c) ruby_qsort(b,n,s,c) #define qsort(b,n,s,c) ruby_qsort(b,n,s,c)
@ -48,4 +46,8 @@ void ruby_unsetenv _((const char*));
#define setenv(name,val) ruby_setenv((name),(val)) #define setenv(name,val) ruby_setenv((name),(val))
#define unsetenv(name,val) ruby_unsetenv((name)); #define unsetenv(name,val) ruby_unsetenv((name));
char *ruby_strdup _((const char*));
#undef strdup
#define strdup(s) ruby_strdup((s))
#endif /* UTIL_H */ #endif /* UTIL_H */

View file

@ -17,10 +17,6 @@
#include "node.h" #include "node.h"
#include "st.h" #include "st.h"
#ifndef strdup
char *strdup();
#endif
static st_table *rb_global_tbl; static st_table *rb_global_tbl;
st_table *rb_class_tbl; st_table *rb_class_tbl;

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.5" #define RUBY_VERSION "1.5.5"
#define RUBY_RELEASE_DATE "2000-07-25" #define RUBY_RELEASE_DATE "2000-07-27"
#define RUBY_VERSION_CODE 155 #define RUBY_VERSION_CODE 155
#define RUBY_RELEASE_CODE 20000725 #define RUBY_RELEASE_CODE 20000727