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@890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-08-15 06:22:49 +00:00
parent 37282fa5b0
commit c345257ff6
9 changed files with 77 additions and 36 deletions

View file

@ -1,3 +1,17 @@
Tue Aug 15 01:45:28 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (argf_eof): should return true at the end of ARGF without
checking stdout if arguments are given.
Mon Aug 14 10:34:32 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_status): status should return false for normal
termination, nil for termination by exception.
Fri Aug 11 15:43:46 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_undef): give warning for undefining __id__, __send__.
Thu Aug 10 08:05:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_callcc): returned current thread instaed of

12
eval.c
View file

@ -1460,6 +1460,10 @@ rb_undef(klass, id)
rb_raise(rb_eSecurityError, "Insecure: can't undef");
}
frozen_class_p(klass);
if (id == __id__ || id == __send__) {
rb_warn("undefining `%s' may cause serious problem",
rb_id2name(id));
}
body = search_method(ruby_class, id, &origin);
if (!body || !body->nd_body) {
char *s0 = " class";
@ -2784,7 +2788,7 @@ rb_eval(self, n)
rb_raise(rb_eTypeError, "no class to add method");
}
if (ruby_class == rb_cObject && node->nd_mid == init) {
rb_warn("re-defining Object#initialize may cause infinite loop");
rb_warn("redefining Object#initialize may cause infinite loop");
}
if (node->nd_mid == __id__ || node->nd_mid == __send__) {
rb_warn("redefining `%s' may cause serious problem",
@ -2856,7 +2860,7 @@ rb_eval(self, n)
klass = rb_singleton_class(recv);
if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)) {
if (rb_safe_level() >= 4) {
rb_raise(rb_eSecurityError, "re-defining method prohibited");
rb_raise(rb_eSecurityError, "redefining method prohibited");
}
if (RTEST(ruby_verbose)) {
rb_warning("redefine %s", rb_id2name(node->nd_mid));
@ -7778,8 +7782,8 @@ rb_thread_status(thread)
if (rb_thread_dead(th)) {
if (NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
return Qfalse;
return Qnil;
return Qnil;
return Qfalse;
}
if (th->status == THREAD_STOPPED)

9
io.c
View file

@ -89,7 +89,7 @@ struct timeval rb_time_interval _((VALUE));
static VALUE filename, current_file;
static int gets_lineno;
static int init_p = 0, next_p = 0;
static int init_p = 0, next_p = 0, first_p = 1;
static VALUE lineno;
#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
@ -2362,6 +2362,7 @@ next_argv()
current_file = rb_stdin;
}
init_p = 1;
first_p = 0;
gets_lineno = 0;
}
@ -3168,8 +3169,12 @@ argf_readchar()
static VALUE
argf_eof()
{
if (init_p == 0 && !next_argv())
int first = first_p;
if (!next_argv()) return Qtrue;
if (!first && next_p == -1) {
return Qtrue;
}
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}

View file

@ -452,7 +452,8 @@ class DEBUGGER__
print <<EOHELP
Debugger help v.-0.002b
Commands
b[reak] [file or method:]<line> set breakpoint to some position
b[reak] [file|method:]<line|method>
set breakpoint to some position
wat[ch] <expression> set watchpoint to some expression
b[reak] list breakpoints
del[ele][ nnn] delete some or all breakpoints
@ -475,7 +476,7 @@ Commands
v[ar] i[nstance] <object> show instance variables of object
v[ar] c[onst] <object> show constants of object
m[ethod] i[nstance] <obj> show methods of object
m[ethod] <class or module> show instance methods of class or module
m[ethod] <class|module> show instance methods of class or module
th[read] l[ist] list all threads
th[read] c[ur[rent]] show current threads
th[read] <nnn> stop thread nnn

5
ruby.c
View file

@ -93,14 +93,13 @@ usage(name)
"-x[directory] strip off text before #!ruby line and perhaps cd to directory",
"--copyright print the copyright",
"--version print the version",
"\n",
NULL
};
char **p = usage_msg;
printf("\nUsage: %s [switches] [--] [programfile] [arguments]", name);
printf("Usage: %s [switches] [--] [programfile] [arguments]\n", name);
while (*p)
printf("\n %s", *p++);
printf(" %s\n", *p++);
}
extern VALUE rb_load_path;

13
time.c
View file

@ -956,22 +956,9 @@ time_s_times(obj)
rb_float_new((double)buf.tms_stime / HZ),
rb_float_new((double)buf.tms_cutime / HZ),
rb_float_new((double)buf.tms_cstime / HZ));
#else
#ifdef NT
FILETIME create, exit, kernel, user;
HANDLE hProc;
hProc = GetCurrentProcess();
GetProcessTimes(hProc,&create, &exit, &kernel, &user);
return rb_struct_new(S_Tms,
rb_float_new((double)(kernel.dwHighDateTime*2e32+kernel.dwLowDateTime)/2e6),
rb_float_new((double)(user.dwHighDateTime*2e32+user.dwLowDateTime)/2e6),
rb_float_new((double)0),
rb_float_new((double)0));
#else
rb_notimplement();
#endif
#endif
}
static VALUE

View file

@ -28,7 +28,7 @@
#define HAVE_GETCWD 1
/* #define HAVE_TRUNCATE 1 */
#define HAVE_CHSIZE 1
/* #define HAVE_TIMES 1 */
#define HAVE_TIMES 1
/* #define HAVE_UTIMES 1 */
/* #define HAVE_FCNTL 1 */
/* #define HAVE_SETITIMER 1 */

View file

@ -155,17 +155,6 @@ flock(int fd, int oper)
//#undef const
//FILE *fdopen(int, const char *);
#if 0
void
sleep(unsigned int len)
{
time_t end;
end = time((time_t *)0) + len;
while (time((time_t *)0) < end)
;
}
#endif
//
// Initialization stuff
@ -2480,3 +2469,33 @@ done:
return res;
}
static long
filetime_to_clock(FILETIME *ft)
{
__int64 qw = ft->dwHighDateTime;
qw <<= 32;
qw |= ft->dwLowDateTime;
qw /= 10000; /* File time ticks at 0.1uS, clock at 1mS */
return (long) qw;
}
int
mytimes(struct tms *tmbuf)
{
FILETIME create, exit, kernel, user;
if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
tmbuf->tms_utime = filetime_to_clock(&user);
tmbuf->tms_stime = filetime_to_clock(&kernel);
tmbuf->cutime = 0;
tmbuf->cstime = 0;
}
else {
tmbuf->utime = clock();
tmbuf->stime = 0;
tmbuf->cutime = 0;
tmbuf->cstime = 0;
}
return 0;
}

View file

@ -414,4 +414,16 @@ extern char *mystrerror(int);
#endif
#define rename myrename
struct tms {
long tms_utime;
long tms_stime;
long tms_cutime;
long tms_cstime;
};
#ifdef times
#undef times
#endif
#define times mytimes
#endif