git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-02-17 07:11:22 +00:00
Родитель 7dd3853eac
Коммит 96b40dff45
27 изменённых файлов: 286 добавлений и 171 удалений

Просмотреть файл

@ -1,3 +1,58 @@
Wed Feb 16 00:32:49 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (method_arity): nd_rest is -1 for no rest argument.
* process.c (proc_waitpid): returns nil when waitpid(2) returns 0.
Tue Feb 15 01:47:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* process.c (rb_f_waitpid): pid_t should be signed.
Mon Feb 14 13:59:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (yylex): yylex yields wrong token for `:foo=~expr'.
* ruby.c (load_file): exit if reading file is empty.
Mon Feb 14 03:34:52 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (yylex): `foo.bar=' should be <foo><.><bar><=>.
* eval.c (rb_thread_restore_context): process according to
RESTORE_* is moved after longjmp().
* eval.c (thread_switch): new function to process RESTORE_*.
Sun Feb 13 16:19:49 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* ruby.c (require_libraries): don't access freed memory.
* ruby.c (add_modules): ditto.
Fri Feb 11 12:06:22 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (parse_quotedwords): %w() need to split not only by mere
spaces, but by all whitespaces.
Thu Feb 10 02:12:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* string.c (rb_str_index_m): did not support negative offset.
Wed Feb 9 21:54:26 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* ext/socket/getaddrinfo.c: gcc --traditional support.
Rearrange headers to work AC_C_CONST.
* ext/socket/getnameinfo.c: ditto.
* ext/socket/socket.c: mswin32: use double instead of long long.
Wed Feb 9 16:30:41 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* numeric.c (num_coerce): should return [y, x].
Wed Feb 9 11:07:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* ruby.c (ruby_prog_init): loadpath structure changed.
Tue Feb 8 02:07:33 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* regex.c (re_search): optimize for \G at top.

Просмотреть файл

@ -51,6 +51,13 @@ rb_ary_modify(ary)
rb_raise(rb_eSecurityError, "Insecure: can't modify array");
}
VALUE
rb_ary_freeze(ary)
VALUE ary;
{
return rb_obj_freeze(ary);
}
static VALUE
rb_ary_frozen_p(ary)
VALUE ary;

15
configure поставляемый
Просмотреть файл

@ -4966,16 +4966,24 @@ test "$program_suffix" != NONE &&
ri_suffix=$program_suffix
RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
RUBY_LIB_PATH="${prefix}/lib/ruby/${MAJOR}.${MINOR}"
RUBY_LIB_PREFIX="${prefix}/lib/ruby"
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
RUBY_SITE_LIB_PATH="${RUBY_LIB_PREFIX}/site_ruby"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
cat >> confdefs.h <<EOF
#define RUBY_LIB "${RUBY_LIB_PATH}"
EOF
RUBY_SITE_LIB_PATH="${RUBY_LIB_PATH}/site_ruby"
cat >> confdefs.h <<EOF
#define RUBY_SITE_LIB "${RUBY_SITE_LIB_PATH}"
EOF
cat >> confdefs.h <<EOF
#define RUBY_SITE_LIB2 "${RUBY_SITE_LIB_PATH2}"
EOF
configure_args=$ac_configure_args
@ -5002,12 +5010,13 @@ else
EOF
fi
cat >> confdefs.h <<EOF
#define RUBY_ARCHLIB "${RUBY_LIB_PATH}/${arch}"
EOF
cat >> confdefs.h <<EOF
#define RUBY_SITE_ARCHLIB "${RUBY_SITE_LIB_PATH}/${arch}"
#define RUBY_SITE_ARCHLIB "${RUBY_SITE_LIB_PATH2}/${arch}"
EOF

Просмотреть файл

@ -798,10 +798,15 @@ test "$program_suffix" != NONE &&
ri_suffix=$program_suffix
RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
RUBY_LIB_PATH="${prefix}/lib/ruby/${MAJOR}.${MINOR}"
RUBY_LIB_PREFIX="${prefix}/lib/ruby"
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
RUBY_SITE_LIB_PATH="${RUBY_LIB_PREFIX}/site_ruby"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
RUBY_SITE_LIB_PATH="${RUBY_LIB_PATH}/site_ruby"
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
AC_SUBST(arch)dnl
configure_args=$ac_configure_args
@ -820,8 +825,9 @@ else
arch="${target_cpu}-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}")
AC_ARG_WITH(search-path,
[--with-search-path specify the additional search path],

Просмотреть файл

@ -50,6 +50,8 @@
#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(OS2)
#define PATH_SEP ";"
#elif defined(riscos)
#define PATH_SEP ","
#else
#define PATH_SEP ":"
#endif

2
dir.c
Просмотреть файл

@ -412,7 +412,7 @@ static VALUE
dir_s_chroot(dir, path)
VALUE dir, path;
{
#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(USE_CWGUSI) && !defined(__BEOS__) && !defined(__EMX__)
#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(USE_CWGUSI) && !defined(__BEOS__) && !defined(__EMX__) && !defined(riscos)
rb_secure(2);
Check_SafeStr(path);

154
eval.c
Просмотреть файл

@ -3359,7 +3359,7 @@ rb_yield_0(val, self, klass, acheck)
rb_gc_force_recycle((VALUE)vars);
vars = vars->next;
}
if (ruby_dyna_vars->id == 0) {
if (ruby_dyna_vars && ruby_dyna_vars->id == 0) {
rb_gc_force_recycle((VALUE)ruby_dyna_vars);
}
}
@ -3720,7 +3720,7 @@ rb_f_missing(argc, argv, obj)
if (argc == 0) rb_raise(rb_eArgError, "no id given");
id = FIX2INT(argv[0]);
id = NUM2INT(argv[0]);
argc--; argv++;
switch (TYPE(obj)) {
@ -5789,7 +5789,7 @@ proc_arity(proc)
int n;
Data_Get_Struct(proc, struct BLOCK, data);
if (data->var == 0) return FIX2INT(-1);
if (data->var == 0) return INT2FIX(-1);
switch (nd_type(data->var)) {
default:
return INT2FIX(-2);
@ -5986,7 +5986,7 @@ method_arity(method)
body = body->nd_head;
if (!body) return INT2FIX(0);
n = body->nd_cnt;
if (body->nd_rest) n = -n-1;
if (body->nd_rest >= 0) n = -n-1;
return INT2FIX(n);
}
}
@ -6261,13 +6261,30 @@ rb_thread_check(data)
return (thread_t)RDATA(data)->data;
}
static int th_raise_argc;
static VALUE th_raise_argv[2];
static char *th_raise_file;
static int th_raise_line;
static VALUE th_cmd;
static int th_sig;
static char *th_signm;
#define RESTORE_NORMAL 1
#define RESTORE_FATAL 2
#define RESTORE_INTERRUPT 3
#define RESTORE_TRAP 4
#define RESTORE_RAISE 5
#define RESTORE_SIGNAL 6
static void
rb_thread_save_context(th)
thread_t th;
{
VALUE v;
int len = stack_length();
int len;
len = stack_length();
th->stk_len = 0;
th->stk_pos = (rb_gc_stack_start<(VALUE*)&v)?rb_gc_stack_start
:rb_gc_stack_start - len;
@ -6299,6 +6316,41 @@ rb_thread_save_context(th)
th->line = ruby_sourceline;
}
static int
thread_switch(n)
int n;
{
switch (n) {
case 0:
return 0;
case RESTORE_FATAL:
JUMP_TAG(TAG_FATAL);
break;
case RESTORE_INTERRUPT:
rb_interrupt();
break;
case RESTORE_TRAP:
rb_trap_eval(th_cmd, th_sig);
errno = EINTR;
break;
case RESTORE_RAISE:
ruby_frame->last_func = 0;
ruby_sourcefile = th_raise_file;
ruby_sourceline = th_raise_line;
rb_f_raise(th_raise_argc, th_raise_argv);
break;
case RESTORE_SIGNAL:
rb_raise(rb_eSignal, "SIG%s", th_signm);
break;
case RESTORE_NORMAL:
default:
return 1;
}
}
#define THREAD_SAVE_CONTEXT(th) \
(rb_thread_save_context(th),thread_switch(setjmp((th)->context)))
static void rb_thread_restore_context _((thread_t,int));
static void
@ -6312,21 +6364,6 @@ stack_extend(th, exit)
rb_thread_restore_context(th, exit);
}
static int th_raise_argc;
static VALUE th_raise_argv[2];
static char *th_raise_file;
static int th_raise_line;
static VALUE th_cmd;
static int th_sig;
static char *th_signm;
#define RESTORE_NORMAL 0
#define RESTORE_FATAL 1
#define RESTORE_INTERRUPT 2
#define RESTORE_TRAP 3
#define RESTORE_RAISE 4
#define RESTORE_SIGNAL 5
static void
rb_thread_restore_context(th, exit)
thread_t th;
@ -6373,35 +6410,7 @@ rb_thread_restore_context(th, exit)
rb_lastline_set(tmp->last_line);
rb_backref_set(tmp->last_match);
switch (ex) {
case RESTORE_FATAL:
JUMP_TAG(TAG_FATAL);
break;
case RESTORE_INTERRUPT:
rb_interrupt();
break;
case RESTORE_TRAP:
rb_trap_eval(th_cmd, th_sig);
errno = EINTR;
break;
case RESTORE_SIGNAL:
rb_raise(rb_eSignal, "SIG%s", th_signm);
break;
case RESTORE_RAISE:
ruby_frame->last_func = 0;
ruby_sourcefile = th_raise_file;
ruby_sourceline = th_raise_line;
rb_f_raise(th_raise_argc, th_raise_argv);
break;
case RESTORE_NORMAL:
default:
longjmp(tmp->context, 1);
}
longjmp(tmp->context, ex);
}
static void
@ -6639,8 +6648,7 @@ rb_thread_schedule()
/* context switch */
if (curr == curr_thread) {
rb_thread_save_context(curr);
if (setjmp(curr->context)) {
if (THREAD_SAVE_CONTEXT(curr)) {
return;
}
}
@ -7209,15 +7217,13 @@ rb_thread_create_0(fn, arg, klass)
scope_dup(ruby_scope);
FL_SET(ruby_scope, SCOPE_SHARED);
rb_thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return thread;
}
PUSH_TAG(PROT_THREAD);
if ((state = EXEC_TAG()) == 0) {
rb_thread_save_context(th);
if (setjmp(th->context) == 0) {
if (THREAD_SAVE_CONTEXT(th) == 0) {
curr_thread = th;
th->result = (*fn)(arg, th);
}
@ -7384,8 +7390,7 @@ rb_thread_interrupt()
if (curr_thread == main_thread) {
rb_interrupt();
}
rb_thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return;
}
curr_thread = main_thread;
@ -7403,8 +7408,7 @@ rb_thread_signal_raise(sig)
rb_raise(rb_eSignal, "SIG%s", sig);
}
rb_thread_ready(main_thread);
rb_thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return;
}
th_signm = sig;
@ -7417,6 +7421,7 @@ rb_thread_trap_eval(cmd, sig)
VALUE cmd;
int sig;
{
#if 0
rb_thread_critical = 0;
if (!rb_thread_dead(curr_thread)) {
rb_thread_ready(curr_thread);
@ -7424,14 +7429,26 @@ rb_thread_trap_eval(cmd, sig)
return;
}
rb_thread_ready(main_thread);
rb_thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return;
}
th_cmd = cmd;
th_sig = sig;
curr_thread = main_thread;
rb_thread_restore_context(curr_thread, RESTORE_TRAP);
#else
rb_thread_critical = 0;
if (!rb_thread_dead(curr_thread)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return;
}
}
rb_thread_ready(main_thread);
th_cmd = cmd;
th_sig = sig;
curr_thread = main_thread;
rb_thread_restore_context(curr_thread, RESTORE_TRAP);
#endif
}
static VALUE
@ -7442,17 +7459,15 @@ rb_thread_raise(argc, argv, thread)
{
thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) return thread;
if (rb_thread_dead(th)) return Qnil;
if (curr_thread == th) {
rb_f_raise(argc, argv);
}
if (th->safe < 4) {
if (ruby_safe_level > th->safe) {
rb_secure(4);
}
if (curr_thread->status != THREAD_KILLED)
rb_thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return thread;
}
@ -7613,8 +7628,7 @@ rb_callcc(self)
for (tag=prot_tag; tag; tag=tag->prev) {
scope_dup(tag->scope);
}
rb_thread_save_context(th);
if (setjmp(th->context)) {
if (THREAD_SAVE_CONTEXT(th)) {
return th->result;
}
else {
@ -7793,7 +7807,7 @@ static VALUE
catch_i(tag)
ID tag;
{
return rb_funcall(Qnil, rb_intern("catch"), 0, FIX2INT(tag));
return rb_funcall(Qnil, rb_intern("catch"), 0, INT2FIX(tag));
}
VALUE
@ -7846,7 +7860,7 @@ rb_throw(tag, val)
VALUE argv[2];
ID t = rb_intern(tag);
argv[0] = FIX2INT(t);
argv[0] = INT2FIX(t);
argv[1] = val;
rb_f_throw(2, argv);
}

Просмотреть файл

@ -38,6 +38,7 @@
* - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag.
*/
#include "config.h"
#include <sys/types.h>
#ifndef NT
#include <sys/param.h>
@ -66,7 +67,6 @@
#include <socks.h>
#endif
#include "config.h"
#include "addrinfo.h"
#include "sockport.h"

Просмотреть файл

@ -34,6 +34,7 @@
* but INRIA implementation returns EAI_xxx defined for getaddrinfo().
*/
#include "config.h"
#include <sys/types.h>
#ifndef NT
#include <sys/socket.h>
@ -60,7 +61,6 @@
#include <socks.h>
#endif
#include "config.h"
#include "addrinfo.h"
#include "sockport.h"

Просмотреть файл

@ -86,7 +86,7 @@ int Rconnect();
* RFC 2553: protocol-independent placeholder for socket addresses
*/
#define _SS_MAXSIZE 128
#define _SS_ALIGNSIZE (sizeof(long long))
#define _SS_ALIGNSIZE (sizeof(double))
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
_SS_PAD1SIZE - _SS_ALIGNSIZE)
@ -99,7 +99,7 @@ struct sockaddr_storage {
unsigned short ss_family;
#endif
char __ss_pad1[_SS_PAD1SIZE];
long long __ss_align; /* force desired structure storage alignment */
double __ss_align; /* force desired structure storage alignment */
char __ss_pad2[_SS_PAD2SIZE];
};
#endif

8
file.c
Просмотреть файл

@ -1077,7 +1077,7 @@ static VALUE
rb_file_s_symlink(obj, from, to)
VALUE obj, from, to;
{
#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__)
#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__) && !defined(riscos)
Check_SafeStr(from);
Check_SafeStr(to);
@ -1094,7 +1094,7 @@ static VALUE
rb_file_s_readlink(obj, path)
VALUE obj, path;
{
#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__)
#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__) && !defined(riscos)
char buf[MAXPATHLEN];
int cc;
@ -2026,7 +2026,7 @@ rb_path_check(path)
return 1;
}
#ifdef __MACOS__
#if defined(__MACOS__) || defined(riscos)
static int
is_macos_native_path(path)
const char *path;
@ -2045,7 +2045,7 @@ rb_find_file(file)
VALUE fname;
char *path;
#ifdef __MACOS__
#if defined(__MACOS__) || defined(riscos)
if (is_macos_native_path(file)) {
FILE *f;

7
hash.c
Просмотреть файл

@ -34,6 +34,13 @@ rb_hash_modify(hash)
rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
}
VALUE
rb_hash_freeze(hash)
VALUE hash;
{
return rb_obj_freeze(hash);
}
VALUE rb_cHash;
static VALUE envtbl;

Просмотреть файл

@ -15,12 +15,17 @@ if ENV["prefix"]
else
prefix = CONFIG["prefix"]
end
ruby_install_name = CONFIG["ruby_install_name"]
version = "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
arch = version+"/"+CONFIG["arch"]
bindir = destdir+CONFIG["bindir"]
libdir = destdir+CONFIG["libdir"]
#pkglibdir = libdir + "/" + ruby_install_name+"/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
pkglibdir = libdir + "/ruby/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
archdir = pkglibdir + "/" + CONFIG["arch"]
rubydir = libdir+"/ruby"
rubylibdir = rubydir+version
archlibdir = rubydir+arch
sitelibdir = rubydir+"/site_ruby"+version
mandir = destdir+CONFIG["mandir"] + "/man1"
wdir = Dir.getwd
@ -47,17 +52,16 @@ if File.exist? CONFIG["LIBRUBY_SO"]
end
end
Dir.chdir wdir
File.makedirs pkglibdir, true
File.makedirs archdir, true
File.makedirs pkglibdir+"/site_ruby", true
File.makedirs pkglibdir+"/site_ruby/"+CONFIG["arch"], true
File.makedirs rubylibdir, true
File.makedirs archlibdir, true
File.makedirs sitelibdir, true
if RUBY_PLATFORM =~ /cygwin/ and File.exist? "import.h"
File.install "import.h", archdir, 0644, true
File.install "import.h", archlibdir, 0644, true
end
if RUBY_PLATFORM =~ /-aix/
File.install "ruby.imp", archdir, 0644, true
File.install "ruby.imp", archlibdir, 0644, true
end
Dir.chdir "ext"
@ -72,20 +76,20 @@ Find.find("lib") do |f|
end
for f in Dir["*.h"]
File.install f, archdir, 0644, true
File.install f, archlibdir, 0644, true
end
if RUBY_PLATFORM =~ /mswin32/
File.makedirs archdir + "/win32", true
File.install "win32/win32.h", archdir + "/win32", 0644, true
File.makedirs archlibdir + "/win32", true
File.install "win32/win32.h", archlibdir + "/win32", 0644, true
if File.exist? wdir+'/rubymw.lib'
File.install wdir+'/rubymw.lib', archdir, 0644, true
File.install wdir+'/rubymw.lib', archlibdir, 0644, true
end
end
File.install wdir+'/'+CONFIG['LIBRUBY_A'], archdir, 0644, true
File.install wdir+'/'+CONFIG['LIBRUBY_A'], archlibdir, 0644, true
File.makedirs mandir, true
File.install "ruby.1", mandir, 0644, true
Dir.chdir wdir
File.install "config.h", archdir, 0644, true
File.install "rbconfig.rb", archdir, 0644, true
File.install "config.h", archlibdir, 0644, true
File.install "rbconfig.rb", archlibdir, 0644, true
# vi:set sw=2:

10
io.c
Просмотреть файл

@ -1608,8 +1608,8 @@ rb_file_s_open(argc, argv, klass)
path = RSTRING(fname)->ptr;
if (FIXNUM_P(vmode)) {
int flags = FIX2INT(vmode);
int fmode = NIL_P(perm) ? 0666 : FIX2INT(perm);
int flags = NUM2INT(vmode);
int fmode = NIL_P(perm) ? 0666 : NUM2INT(perm);
file = rb_file_sysopen_internal(klass, path, flags, fmode);
}
@ -1649,7 +1649,7 @@ rb_f_open(argc, argv)
mode = "r";
}
else if (FIXNUM_P(pmode)) {
mode = rb_io_flags_mode(FIX2INT(pmode));
mode = rb_io_flags_mode(NUM2INT(pmode));
}
else {
int len;
@ -1661,6 +1661,7 @@ rb_f_open(argc, argv)
}
port = pipe_open(RSTRING(pname)->ptr+1, mode);
if (!rb_iterator_p()) return port;
if (NIL_P(port)) {
rb_yield(port);
}
@ -3396,4 +3397,7 @@ Init_IO()
#ifdef O_BINARY
rb_file_const("BINARY", INT2FIX(O_BINARY));
#endif
#ifdef O_SYNC
rb_file_const("BINARY", INT2FIX(O_SYNC));
#endif
}

Просмотреть файл

@ -16,7 +16,7 @@ module Find
d = Dir.open(file)
begin
for f in d
next if f =~ /^\.\.?$/
next if f =~ /\A\.\.?\z/
if File::ALT_SEPARATOR and file =~ /^([\/\\]|[A-Za-z]:[\/\\]?)$/ then
f = file + f
elsif file == "/" then

6
math.c
Просмотреть файл

@ -22,11 +22,11 @@ VALUE rb_mMath;
}
static VALUE
math_atan2(obj, x, y)
math_atan2(obj, y, x)
VALUE obj, x, y;
{
Need_Float2(x, y);
return rb_float_new(atan2(RFLOAT(x)->value, RFLOAT(y)->value));
Need_Float2(y, x);
return rb_float_new(atan2(RFLOAT(y)->value, RFLOAT(x)->value));
}
static VALUE

Просмотреть файл

@ -1,31 +1,23 @@
/* This is file FILE.H */
/*
** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
**
** This file is distributed under the terms listed in the document
** "copying.dj", available from DJ Delorie at the address above.
** A copy of "copying.dj" should accompany this file; if not, a copy
** should be available from where this file was obtained. This file
** may not be distributed without a verbatim copy of "copying.dj".
**
** This file is distributed WITHOUT ANY WARRANTY; without even the implied
** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _FILE_H_
#define _FILE_H_
#include <fcntl.h>
#define L_SET 0
#define L_CURR 1
#define L_INCR 1
#define L_XTND 2
#ifndef L_SET
# define L_SET 0 /* seek from beginning. */
# define L_CURR 1 /* seek from current position. */
# define L_INCR 1 /* ditto. */
# define L_XTND 2 /* seek from end. */
#endif
#define F_OK 0 /* does file exist */
#define X_OK 1 /* is it executable by caller */
#define W_OK 2 /* is it writable by caller */
#define R_OK 4 /* is it readable by caller */
# ifndef R_OK
# define R_OK 4 /* test whether readable. */
# define W_OK 2 /* test whether writable. */
# define X_OK 1 /* test whether execubale. */
# define F_OK 0 /* test whether exist. */
# endif
#endif
#endif

Просмотреть файл

@ -6,8 +6,13 @@
* Copyright (c) 1988-1993 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*
* RCS: @(#) $Id$
*/

Просмотреть файл

@ -43,8 +43,8 @@ num_coerce(x, y)
VALUE x, y;
{
if (CLASS_OF(x) == CLASS_OF(y))
return rb_assoc_new(x, y);
return rb_assoc_new(rb_Float(x), rb_Float(y));
return rb_assoc_new(y, x);
return rb_assoc_new(rb_Float(y), rb_Float(x));
}
static VALUE

17
parse.y
Просмотреть файл

@ -2430,7 +2430,7 @@ parse_quotedwords(term, paren)
strstart = ruby_sourceline;
newtok();
while ((c = nextc()) == ' ')
while (c = nextc(),ISSPACE(c))
; /* skip preceding spaces */
pushback(c);
while ((c = nextc()) != term || nest > 0) {
@ -2455,14 +2455,13 @@ parse_quotedwords(term, paren)
case '\\':
c = '\\';
break;
case ' ':
tokadd(' ');
break;
default:
tokadd('\\');
if (ISSPACE(c))
tokadd('\\');
tokadd(c);
}
}
else if (c == ' ') {
else if (ISSPACE(c)) {
NODE *str;
tokfix();
@ -2470,7 +2469,7 @@ parse_quotedwords(term, paren)
newtok();
if (!qwords) qwords = NEW_LIST(str);
else list_append(qwords, str);
while ((c = nextc()) == ' ')
while (c = nextc(),ISSPACE(c))
; /* skip continuous spaces */
pushback(c);
continue;
@ -3414,8 +3413,8 @@ yylex()
result = tFID;
}
else {
if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
if ((c = nextc()) == '=' && !peek('=')) {
if (lex_state == EXPR_FNAME) {
if ((c = nextc()) == '=' && !peek('=') && !peek('~')) {
result = tIDENTIFIER;
tokadd(c);
}

Просмотреть файл

@ -160,7 +160,7 @@ wait_each(key, value, data)
#endif
static VALUE
rb_f_wait()
proc_wait()
{
int pid, state;
#ifdef NO_WAITPID
@ -189,16 +189,17 @@ rb_f_wait()
}
static VALUE
rb_f_waitpid(obj, vpid, vflags)
proc_waitpid(obj, vpid, vflags)
VALUE obj, vpid, vflags;
{
int pid, flags, status;
if (NIL_P(vflags)) flags = 0;
else flags = FIX2UINT(vflags);
else flags = NUM2UINT(vflags);
if ((pid = rb_waitpid(FIX2UINT(vpid), flags, &status)) < 0)
if ((pid = rb_waitpid(NUM2INT(vpid), flags, &status)) < 0)
rb_sys_fail(0);
if (pid == 0) return Qnil;
return INT2FIX(pid);
}
@ -1056,8 +1057,8 @@ Init_process()
rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1);
#endif
#ifndef NT
rb_define_module_function(rb_mProcess, "wait", rb_f_wait, 0);
rb_define_module_function(rb_mProcess, "waitpid", rb_f_waitpid, 2);
rb_define_module_function(rb_mProcess, "wait", proc_wait, 0);
rb_define_module_function(rb_mProcess, "waitpid", proc_waitpid, 2);
#ifndef USE_CWGUSI
rb_define_module_function(rb_mProcess, "pid", get_pid, 0);

Просмотреть файл

@ -3721,12 +3721,12 @@ re_match(bufp, string_arg, size, pos, regs)
cc = c = (unsigned char)translate[c];
not = is_in_list(c, p);
if (!not && cc != c) {
part = not = is_in_list(cc, p);
}
if (*(p - 1) == (unsigned char)charset_not) {
not = !not;
}
else if (!not && cc != c) {
part = not = is_in_list(cc, p);
}
if (!not) goto fail;
p += 1 + *p + 2 + EXTRACT_UNSIGNED(&p[1 + *p])*8;

24
ruby.c
Просмотреть файл

@ -108,13 +108,6 @@ NULL
printf("\n %s", *p++);
}
#ifndef RUBY_LIB
#define RUBY_LIB "/usr/local/lib/ruby"
#endif
#ifndef RUBY_SITE_LIB
#define RUBY_SITE_LIB "/usr/local/lib/site_ruby"
#endif
extern VALUE rb_load_path;
#define STATIC_FILE_LENGTH 255
@ -215,7 +208,7 @@ addpath(path)
}
struct req_list {
const char *name;
char *name;
struct req_list *next;
} req_list_head;
struct req_list *req_list_last = &req_list_head;
@ -227,7 +220,8 @@ add_modules(mod)
struct req_list *list;
list = ALLOC(struct req_list);
list->name = mod;
list->name = ALLOC_N(char, strlen(mod)+1);
strcpy(list->name, mod);
list->next = 0;
req_list_last->next = list;
req_list_last = list;
@ -248,6 +242,7 @@ require_libraries()
while (list) {
rb_require(list->name);
tmp = list->next;
free(list->name);
free(list);
list = tmp;
}
@ -745,7 +740,11 @@ load_file(fname, script)
}
}
}
else if (!NIL_P(c)) {
else if (NIL_P(c)) {
rb_io_close(f);
return;
}
else {
rb_io_ungetc(f, c);
}
}
@ -930,17 +929,14 @@ ruby_prog_init()
addpath(ruby_libpath());
#endif
#ifdef RUBY_ARCHLIB
addpath(RUBY_ARCHLIB);
#endif
#ifdef RUBY_THIN_ARCHLIB
addpath(RUBY_THIN_ARCHLIB);
#endif
addpath(RUBY_SITE_LIB);
#ifdef RUBY_SITE_ARCHLIB
addpath(RUBY_SITE_LIB2);
addpath(RUBY_SITE_ARCHLIB);
#endif
#ifdef RUBY_SITE_THIN_ARCHLIB
addpath(RUBY_SITE_THIN_ARCHLIB);
#endif

3
ruby.h
Просмотреть файл

@ -115,10 +115,13 @@ typedef unsigned long ID;
#define FIXNUM_FLAG 0x01
#define INT2FIX(i) (VALUE)(((long)(i))<<1 | FIXNUM_FLAG)
#define rb_fix_new(v) INT2FIX(v)
VALUE rb_int2inum _((long));
#define INT2NUM(v) rb_int2inum(v)
#define rb_int_new(v) rb_int2inum(v)
VALUE rb_uint2inum _((unsigned long));
#define UINT2NUM(v) rb_uint2inum(v)
#define rb_uint_new(v) rb_uint2inum(v)
#define FIX2LONG(x) RSHIFT((long)x,1)
#define FIX2ULONG(x) (((unsigned long)(x))>>1)

Просмотреть файл

@ -340,6 +340,13 @@ rb_str_modify(str)
RSTRING(str)->orig = 0;
}
VALUE
rb_str_freeze(str)
VALUE str;
{
return rb_obj_freeze(str);
}
VALUE
rb_str_dup_frozen(str)
VALUE str;
@ -561,6 +568,10 @@ rb_str_index_m(argc, argv, str)
else {
pos = 0;
}
if (pos < 0) {
pos += RSTRING(str)->len;
if (pos < 0) return Qnil;
}
switch (TYPE(sub)) {
case T_REGEXP:

8
time.c
Просмотреть файл

@ -394,7 +394,7 @@ time_cmp(time1, time2)
i = FIX2LONG(time2);
if (tobj1->tv.tv_sec == i) return INT2FIX(0);
if (tobj1->tv.tv_sec > i) return INT2FIX(1);
return FIX2INT(-1);
return INT2FIX(-1);
case T_FLOAT:
{
@ -414,15 +414,15 @@ time_cmp(time1, time2)
if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
if (tobj1->tv.tv_usec > tobj2->tv.tv_usec) return INT2FIX(1);
return FIX2INT(-1);
return INT2FIX(-1);
}
if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
return FIX2INT(-1);
return INT2FIX(-1);
}
i = NUM2LONG(time2);
if (tobj1->tv.tv_sec == i) return INT2FIX(0);
if (tobj1->tv.tv_sec > i) return INT2FIX(1);
return FIX2INT(-1);
return INT2FIX(-1);
}
static VALUE

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.2"
#define RUBY_RELEASE_DATE "2000-02-08"
#define RUBY_RELEASE_DATE "2000-02-17"
#define RUBY_VERSION_CODE 152
#define RUBY_RELEASE_CODE 20000208
#define RUBY_RELEASE_CODE 20000217