summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-27 03:55:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-08-27 03:55:54 +0000
commit707a0a946d55df772012b282c594df790371ec23 (patch)
tree84dec9dacaafa14ca3507be443a228137fea9a03
parent39ac1d7c22072f2d520738098692bdbce2f380df (diff)
1.1c3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog24
-rw-r--r--MANIFEST4
-rw-r--r--dln.c4
-rw-r--r--eval.c6
-rw-r--r--ext/dbm/extconf.rb4
-rw-r--r--gc.c4
-rw-r--r--hash.c4
-rw-r--r--instruby.rb2
-rw-r--r--io.c18
-rw-r--r--lib/e2mmap.rb45
-rw-r--r--lib/finalize.rb52
-rw-r--r--lib/matrix.rb93
-rw-r--r--lib/shell.rb38
-rw-r--r--lib/shellwords.rb16
-rw-r--r--lib/telnet.rb27
-rw-r--r--lib/thwait.rb88
-rw-r--r--missing/snprintf.c21
-rw-r--r--object.c11
-rw-r--r--parse.y6
-rw-r--r--re.c8
-rw-r--r--regex.c2
-rw-r--r--ruby.h6
-rw-r--r--string.c2
-rw-r--r--struct.c9
-rw-r--r--version.h4
25 files changed, 288 insertions, 210 deletions
diff --git a/ChangeLog b/ChangeLog
index 58cbacb61fa..a5c1d0ac015 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Thu Aug 27 12:54:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c3 released.
+
+Wed Aug 26 11:47:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): pop non-greedy stack elements on success.
+
+Wed Aug 26 09:25:35 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.h: add #define environ for cygwin32.
+
+Mon Aug 24 18:46:44 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dln.c (dln_find_1): path check was too strict.
+
+Mon Aug 24 15:28:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * parse.y (f_arglist): opt_nl added after f_args.
+
+Wed Aug 19 00:31:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_ctl): forgot to place TRAP_END at right position.
+
Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (call_trace_func): save __FILE__, __LINE__ before
diff --git a/MANIFEST b/MANIFEST
index 266becd23a5..cedd15f6dd6 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -116,6 +116,7 @@ lib/ping.rb
lib/pstore.rb
lib/rational.rb
lib/readbytes.rb
+lib/shell.rb
lib/shellwords.rb
lib/singleton.rb
lib/sync.rb
@@ -186,9 +187,10 @@ sample/less.rb
sample/list.rb
sample/list2.rb
sample/list3.rb
-sample/mrshtest.rb
+sample/mine.rb
sample/mkproto.rb
sample/mpart.rb
+sample/mrshtest.rb
sample/observ.rb
sample/occur.pl
sample/occur.rb
diff --git a/dln.c b/dln.c
index 24d9c2659dc..95d82709c98 100644
--- a/dln.c
+++ b/dln.c
@@ -78,7 +78,7 @@ int eaccess();
#endif
#ifndef FUNCNAME_PATTERN
-# if defined(__hp9000s300) || defined(__NetBSD__) || defined(__BORLANDC__) || defined(__FreeBSD__) || defined(NeXT)
+# if defined(__hp9000s300) || defined(__NetBSD__) || defined(__BORLANDC__) || defined(__FreeBSD__) || defined(NeXT) || defined(__WATCOMC__)
# define FUNCNAME_PATTERN "_Init_%.200s"
# else
# define FUNCNAME_PATTERN "Init_%.200s"
@@ -1565,11 +1565,13 @@ dln_find_1(fname, path, exe_flag)
if (fname[0] == '/') return fname;
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
return fname;
+ if (exe_flag && strchr(fname, '/')) return fname;
#if defined(MSDOS) || defined(NT) || defined(__human68k__)
if (fname[0] == '\\') return fname;
if (strlen(fname) > 2 && fname[1] == ':') return fname;
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
return fname;
+ if (exe_flag && strchr(fname, '\\')) return fname;
#endif
#endif /* __MACOS__ */
diff --git a/eval.c b/eval.c
index 114dd2079ac..6c114103271 100644
--- a/eval.c
+++ b/eval.c
@@ -1453,7 +1453,7 @@ is_defined(self, node, buf)
break;
case NODE_CVAR:
- if (ev_const_defined(the_frame->cbase, node->nd_vid)) {
+ if (ev_const_defined((NODE*)the_frame->cbase, node->nd_vid)) {
return "constant";
}
break;
@@ -2175,7 +2175,7 @@ rb_eval(self, node)
val = rb_eval(self, node->nd_value);
/* check for static scope constants */
if (RTEST(verbose) &&
- ev_const_defined(the_frame->cbase, node->nd_vid)) {
+ ev_const_defined((NODE*)the_frame->cbase, node->nd_vid)) {
Warning("already initialized constant %s",
rb_id2name(node->nd_vid));
}
@@ -2204,7 +2204,7 @@ rb_eval(self, node)
break;
case NODE_CVAR:
- result = ev_const_get(the_frame->cbase, node->nd_vid);
+ result = ev_const_get((NODE*)the_frame->cbase, node->nd_vid);
break;
case NODE_BLOCK_ARG:
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 38a0efbf195..3a96cee12f8 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -1,6 +1,8 @@
require 'mkmf'
$LDFLAGS = "-L/usr/local/lib"
-have_library("gdbm", "dbm_open") or have_library("dbm", "dbm_open")
+have_library("gdbm", "dbm_open") or
+ have_library("db", "dbm_open") or
+ have_library("dbm", "dbm_open")
if have_func("dbm_open")
have_func("dbm_clearerr")
create_makefile("dbm")
diff --git a/gc.c b/gc.c
index 62ce13b785c..e21f221d26c 100644
--- a/gc.c
+++ b/gc.c
@@ -608,7 +608,7 @@ gc_sweep()
while (p < pend) {
if (!(p->as.basic.flags & FL_MARK)) {
- if (p->as.basic.flags) obj_free(p);
+ if (p->as.basic.flags) obj_free((VALUE)p);
p->as.free.flag = 0;
p->as.free.next = nfreelist;
nfreelist = p;
@@ -1017,7 +1017,7 @@ gc_call_finalizer_at_exit()
for (i = 0; i < heaps_used; i++) {
p = heaps[i]; pend = p + HEAP_SLOTS;
while (p < pend) {
- run_final(p);
+ run_final((VALUE)p);
p++;
}
}
diff --git a/hash.c b/hash.c
index 811452bfb08..56256ea3fef 100644
--- a/hash.c
+++ b/hash.c
@@ -535,7 +535,7 @@ static VALUE
hash_each_value(hash)
VALUE hash;
{
- hash_foreach(hash, each_value_i);
+ hash_foreach(hash, each_value_i, 0);
return hash;
}
@@ -552,7 +552,7 @@ static VALUE
hash_each_key(hash)
VALUE hash;
{
- hash_foreach(hash, each_key_i);
+ hash_foreach(hash, each_key_i, 0);
return hash;
}
diff --git a/instruby.rb b/instruby.rb
index a673dec0c4b..d6324425ae2 100644
--- a/instruby.rb
+++ b/instruby.rb
@@ -16,7 +16,7 @@ ruby_install_name = CONFIG["ruby_install_name"]
bindir = prefix + "/bin"
libdir = prefix + "/lib/" + ruby_install_name
archdir = libdir+"/"+CONFIG["arch"]
-mandir = CONFIG["mandir"] + "/man1"
+mandir = prefix + "/man/man1"
File.makedirs bindir, TRUE
File.install "ruby#{binsuffix}",
diff --git a/io.c b/io.c
index a9fdf97b2b4..c86409d0ea2 100644
--- a/io.c
+++ b/io.c
@@ -1841,7 +1841,7 @@ f_gets()
static VALUE
f_readline(argc, argv)
int argc;
- VALUE argv;
+ VALUE *argv;
{
VALUE line = f_gets_method(argc, argv);
@@ -1929,7 +1929,7 @@ f_readchar()
static VALUE
f_readlines(argc, argv)
int argc;
- VALUE argv;
+ VALUE *argv;
{
VALUE line, ary;
@@ -1988,7 +1988,7 @@ f_select(argc, argv, obj)
struct timeval *tp, timerec;
OpenFile *fptr;
int i, max = 0, n;
- int interrupt = 0;
+ int interrupt_flag = 0;
int pending = 0;
rb_scan_args(argc, argv, "13", &read, &write, &except, &timeout);
@@ -2079,7 +2079,7 @@ f_select(argc, argv, obj)
rb_sys_fail(0);
}
if (tp == NULL) goto retry;
- interrupt = 1;
+ interrupt_flag = 1;
}
#endif
if (!pending && n == 0) return Qnil; /* returns nil on timeout */
@@ -2089,7 +2089,7 @@ f_select(argc, argv, obj)
ary_push(res, wp?ary_new():ary_new2(0));
ary_push(res, ep?ary_new():ary_new2(0));
- if (interrupt == 0) {
+ if (interrupt_flag == 0) {
if (rp) {
list = RARRAY(res)->ptr[0];
for (i=0; i< RARRAY(read)->len; i++) {
@@ -2181,19 +2181,21 @@ io_ctl(io, req, arg, io_p)
narg = (long)RSTRING(arg)->ptr;
}
fd = fileno(fptr->f);
- TRAP_BEG;
#ifdef HAVE_FCNTL
+ TRAP_BEG;
# ifdef USE_CWGUSI
retval = io_p?ioctl(fd, cmd, (void*) narg):fcntl(fd, cmd, narg);
# else
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
# endif
-#else
TRAP_END;
+#else
if (!io_p) {
rb_notimplement();
}
+ TRAP_BEG;
retval = ioctl(fd, cmd, narg);
+ TRAP_END;
#endif
if (retval < 0) rb_sys_fail(fptr->path);
if (TYPE(arg) == T_STRING && RSTRING(arg)->ptr[len] != 17) {
@@ -2500,7 +2502,7 @@ arg_readchar()
static VALUE
arg_each_line(argc, argv)
int argc;
- VALUE argv;
+ VALUE *argv;
{
VALUE str;
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index fa10d485d8c..bf860dc5c13 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -1,11 +1,22 @@
#
# e2mmap.rb - for ruby 1.1
-# $Release Version: 1.1$
-# $Revision: 1.7 $
-# $Date: 1998/05/19 04:38:33 $
+# $Release Version: 1.2$
+# $Revision: 1.8 $
+# $Date: 1998/08/19 15:22:22 $
# by Keiju ISHITSUKA
#
# --
+# Usage:
+#
+# class Foo
+# extend Exception2MassageMapper
+# def_exception :NewExceptionClass, "message..."[, superclass]
+# def_e2meggage ExistingExceptionClass, "message..."
+# ...
+# end
+#
+# Foo.Fail NewExceptionClass, arg...
+# Foo.Fail ExistingExceptionClass, arg...
#
#
if VERSION < "1.1"
@@ -13,7 +24,7 @@ if VERSION < "1.1"
else
module Exception2MessageMapper
- RCS_ID='-$Header: /home/keiju/var/src/var.lib/ruby/RCS/e2mmap.rb,v 1.7 1998/05/19 04:38:33 keiju Exp keiju $-'
+ @RCS_ID='-$Id: e2mmap.rb,v 1.8 1998/08/19 15:22:22 keiju Exp keiju $-'
E2MM = Exception2MessageMapper
@@ -29,10 +40,14 @@ else
end
# public :fail
- # alias e2mm_fail fail
+ alias fail! fail
+
+ #def fail(err = nil, *rest)
+ # super
+ #end
- def fail(err = nil, *rest)
- Exception2MessageMapper.fail Exception2MessageMapper::ErrNotRegisteredException, err.to_s
+ def Fail(err = nil, *rest)
+ Exception2MessageMapper.Fail Exception2MessageMapper::ErrNotRegisteredException, err.inspect
end
def bind(cl)
@@ -42,6 +57,22 @@ else
# err: Exception
# rest: Parameter accompanied with the exception
#
+ def self.Fail(err = nil, *rest)
+ if form = E2MM_ErrorMSG[err]
+ $! = err.new(sprintf(form, *rest))
+ $@ = caller(0) if $@.nil?
+ $@.shift
+ # e2mm_fail()
+ raise()
+# elsif self == Exception2MessageMapper
+# fail Exception2MessageMapper::ErrNotRegisteredException, err.to_s
+ else
+# print "super\n"
+ super
+ end
+ end
+
+ # 過去の互換性のため
def self.fail(err = nil, *rest)
if form = E2MM_ErrorMSG[err]
$! = err.new(sprintf(form, *rest))
diff --git a/lib/finalize.rb b/lib/finalize.rb
index acbaf0e66f0..a07e67d0937 100644
--- a/lib/finalize.rb
+++ b/lib/finalize.rb
@@ -11,36 +11,34 @@
#
# add(obj, dependant, method = :finalize, *opt)
# add_dependency(obj, dependant, method = :finalize, *opt)
-# 依存関係 R_method(obj, dependant) の追加
+# add dependency R_method(obj, dependant)
#
# delete(obj_or_id, dependant, method = :finalize)
# delete_dependency(obj_or_id, dependant, method = :finalize)
-# 依存関係 R_method(obj, dependant) の削除
+# delete dependency R_method(obj, dependant)
# delete_all_dependency(obj_or_id, dependant)
-# 依存関係 R_*(obj, dependant) の削除
+# delete dependency R_*(obj, dependant)
# delete_by_dependant(dependant, method = :finalize)
-# 依存関係 R_method(*, dependant) の削除
+# delete dependency R_method(*, dependant)
# delete_all_by_dependant(dependant)
-# 依存関係 R_*(*, dependant) の削除
+# delete dependency R_*(*, dependant)
# delete_all
-# 全ての依存関係の削除.
+# delete all dependency R_*(*, *)
#
# finalize(obj_or_id, dependant, method = :finalize)
# finalize_dependency(obj_or_id, dependant, method = :finalize)
-# 依存関連 R_method(obj, dependtant) で結ばれるdependantを
-# finalizeする.
+# finalize the dependant connected by dependency R_method(obj, dependtant).
# finalize_all_dependency(obj_or_id, dependant)
-# 依存関連 R_*(obj, dependtant) で結ばれるdependantをfinalizeする.
+# finalize all dependants connected by dependency R_*(obj, dependtant).
# finalize_by_dependant(dependant, method = :finalize)
-# 依存関連 R_method(*, dependtant) で結ばれるdependantをfinalizeする.
+# finalize the dependant connected by dependency R_method(*, dependtant).
# fainalize_all_by_dependant(dependant)
-# 依存関連 R_*(*, dependtant) で結ばれるdependantをfinalizeする.
+# finalize all dependants connected by dependency R_*(*, dependant).
# finalize_all
-# Finalizerに登録される全てのdependantをfinalizeする
+# finalize all dependency registered to the Finalizer.
#
# safe{..}
-# gc時にFinalizerが起動するのを止める.
-#
+# stop invoking Finalizer on GC.
#
module Finalizer
@@ -48,7 +46,7 @@ module Finalizer
# @dependency: {id => [[dependant, method, *opt], ...], ...}
- # 依存関係 R_method(obj, dependant) の追加
+ # add dependency R_method(obj, dependant)
def add_dependency(obj, dependant, method = :finalize, *opt)
ObjectSpace.call_finalizer(obj)
method = method.intern unless method.kind_of?(Integer)
@@ -61,7 +59,7 @@ module Finalizer
end
alias add add_dependency
- # 依存関係 R_method(obj, dependant) の削除
+ # delete dependency R_method(obj, dependant)
def delete_dependency(id, dependant, method = :finalize)
id = id.id unless id.kind_of?(Integer)
method = method.intern unless method.kind_of?(Integer)
@@ -75,7 +73,7 @@ module Finalizer
end
alias delete delete_dependency
- # 依存関係 R_*(obj, dependant) の削除
+ # delete dependency R_*(obj, dependant)
def delete_all_dependency(id, dependant)
id = id.id unless id.kind_of?(Integer)
method = method.intern unless method.kind_of?(Integer)
@@ -88,7 +86,7 @@ module Finalizer
end
end
- # 依存関係 R_method(*, dependant) の削除
+ # delete dependency R_method(*, dependant)
def delete_by_dependant(dependant, method = :finalize)
method = method.intern unless method.kind_of?(Integer)
for id in @dependency.keys
@@ -96,15 +94,14 @@ module Finalizer
end
end
- # 依存関係 R_*(*, dependant) の削除
+ # delete dependency R_*(*, dependant)
def delete_all_by_dependant(dependant)
for id in @dependency.keys
delete_all_dependency(id, dependant)
end
end
- # 依存関連 R_method(obj, dependtant) で結ばれるdependantをfinalizeす
- # る.
+ # finalize the depandant connected by dependency R_method(obj, dependtant)
def finalize_dependency(id, dependant, method = :finalize)
id = id.id unless id.kind_of?(Integer)
method = method.intern unless method.kind_of?(Integer)
@@ -119,7 +116,7 @@ module Finalizer
end
alias finalize finalize_dependency
- # 依存関連 R_*(obj, dependtant) で結ばれるdependantをfinalizeする.
+ # finalize all dependants connected by dependency R_*(obj, dependtant)
def finalize_all_dependency(id, dependant)
id = id.id unless id.kind_of?(Integer)
method = method.intern unless method.kind_of?(Integer)
@@ -132,7 +129,7 @@ module Finalizer
end
end
- # 依存関連 R_method(*, dependtant) で結ばれるdependantをfinalizeする.
+ # finalize the dependant connected by dependency R_method(*, dependtant)
def finalize_by_dependant(dependant, method = :finalize)
method = method.intern unless method.kind_of?(Integer)
for id in @dependency.keys
@@ -140,14 +137,14 @@ module Finalizer
end
end
- # 依存関連 R_*(*, dependtant) で結ばれるdependantをfinalizeする.
+ # finalize all dependants connected by dependency R_*(*, dependtant)
def fainalize_all_by_dependant(dependant)
for id in @dependency.keys
finalize_all_dependency(id, dependant)
end
end
- # Finalizerに登録されている全てのdependantをfinalizeする
+ # finalize all dependants registered to the Finalizer.
def finalize_all
for id, assocs in @dependency
for dependant, method, *opt in assocs
@@ -157,7 +154,7 @@ module Finalizer
end
end
- # finalize_* を安全に呼び出すためのイテレータ
+ # method to call finalize_* safely.
def safe
old_status = Thread.critical
Thread.critical = TRUE
@@ -167,7 +164,7 @@ module Finalizer
Thread.critical = old_status
end
- # ObjectSpace#add_finalizerへの登録関数
+ # registering function to ObjectSpace#add_finalizer
def final_of(id)
if assocs = @dependency.delete(id)
for dependant, method, *opt in assocs
@@ -202,4 +199,3 @@ module Finalizer
private_class_method :final_of
end
-
diff --git a/lib/matrix.rb b/lib/matrix.rb
index fcb0b29eb50..fcecbe541a1 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -33,101 +33,108 @@
# Methods:
# class methods:
# Matrix.[](*rows)
-# rowsで渡された行列を生成する. rowsは配列の配列
-# Matrix[[11, 12], [21, 22]]
+# creates a matrix where `rows' indicates rows.
+# `rows' is an array of arrays,
+# e.g, Matrix[[11, 12], [21, 22]]
# Matrix.rows(rows, copy = TRUE)
-# rowsを行ベクトルの集合として行列を生成する. copy=FALSE の
-# 時はその配列をそのまま用いる.
+# creates a matrix where `rows' indicates rows.
+# if optional argument `copy' is false, use the array as
+# internal structure of the metrix without copying.
# Matrix.columns(columns)
-# rowsを列ベクトルの集合として行列を生成する.
+# creates a new matrix using `columns` as set of colums vectors.
# Matrix.diagonal(*values)
-# valuesを対角成分とした対角行列を生成する.
+# creates a matrix where `columns' indicates columns.
# Matrix.scalar(n, value)
-# valueを対角成分とするn次ののスカラー行列を生成する.
+# creates a diagonal matrix such that the diagal compornents is
+# given by `values'.
+# Matrix.scalar(n, value)
+# creates an n-by-n scalar matrix such that the diagal compornent is
+# given by `value'.
# Matrix.identity(n)
# Matrix.unit(n)
# Matrix.I(n)
-# n次の単位行列を生成する.
+# creates an n-by-n unit matrix.
# Matrix.zero(n)
-# n次の0-行列を生成する.
+# creates an n-by-n zero matrix.
# Matrix.row_vector(row)
-# rowを行ベクトルとする1-n行列を生成する. rowはVectorかArray
-# が可能.
+# creates a 1-by-n matrix such the row vector is `row'.
+# `row' is specifed as a Vector or an Array.
# Matrix.column_vector(column)
-# columnを列ベクトルとするn-1行列を生成する. rowはVectorかArray
-# が可能.
+# creates a 1-by-n matrix such that column vector is `column'.
+# `column' is specifed as a Vector or an Array.
# accessing:
# [](i, j)
-# 行列の(i, j)成分を返す.
+# returns (i,j) compornent
# row_size
-# 行数を返す.
+# returns the number of rows
# column_size
-# 列数を返す.
+# returns the number of columns
# row(i)
-# i番目の行ベクトルを返す. イテレータとして使われた時は, 行
-# ベクトルを順番にイテーレータブロックに渡す.
+# returns the i-th row vector.
+# when the block is supplied for the method, the block is iterated
+# over all row vectors.
# column(j)
-# j番目の列ベクトルを返す. 列ベクトルを順番にイテーレータブ
-# ロックに渡す.
+# returns the jth column vector.
+# when the block is supplied for the method, the block is iterated
+# over all column vectors.
# collect
# map
-# 全ての要素をイテレートしその戻り値を値とする行列を新たに生
-# 成する.
+# creates a matrix which is the result of iteration of given
+# block over all compornents.
# minor(*param)
-# マイナー行列を返す. パラメータとしては, 以下のパターンがあ
-# る:
+# returns sub matrix. parameter is specified as the following:
# 1. from_row, row_size, from_col, size_col
# 2. from_row..to_row, from_col..to_col
# TESTING:
# regular?
-# 正則かどうか?
+# Is regular?
# singular?
-# 正則ではないかどうか?
+# Is singular? i.e. Is non-regular?
# square?
-# 正方行列かどうか?
+# Is square?
# ARITHMETIC:
# *(m)
-# 乗法
+# times
# +(m)
-# 加法
+# plus
# -(m)
-# 減法
+# minus
# /(m)
# self * m.inv
# inverse
# inv
-# 逆行列
+# inverse
# **
-# 冪乗
+# power
# Matrix functions:
# determinant
# det
-# 行列式
+# returns the determinant
# rank
-# ランク
+# returns the rank
# trace
# tr
-# トレース
+# returns the trace
# transpose
# t
-# 転置行列
+# returns the transposed
# CONVERTING:
# coerce(other)
# row_vectors
-# rowベクトルの配列
+# array of row vectors
# column_vectors
-# columベクトルの配列
+# array of column vectors
# to_a
-# (2重)配列に変換
+# converts each element to Array
# to_f
-# 各要素をFloatに変換
+# converts each element to Float
# to_i
-# 各要素をIntegerに変換
+# converts each element to Integer
# to_r
-# 各要素をRationalに変換
+# converts each element to Rational
# PRINTING:
# to_s
-# 文字列としての表現
+# returns string representation
# inspect
#
# class Vector
diff --git a/lib/shell.rb b/lib/shell.rb
index a0ade9ab464..3d8dda04458 100644
--- a/lib/shell.rb
+++ b/lib/shell.rb
@@ -123,7 +123,6 @@ class Shell
end
end
- # Dir関連メソッド
def [](pattern)
Thread.critical=TRUE
back = Dir.pwd
@@ -196,7 +195,7 @@ class Shell
end
#
- # modeはpathがファイルの時だけ有効
+ # `mode' is effective iff `path' is specifying a file.
#
def open(path, mode)
path = expand_path(path)
@@ -224,7 +223,7 @@ class Shell
end
#
- # コマンド拡張
+ # command extension
# command_specs = [[command_name, [arguments,...]]]
# FILENAME* -> expand_path(filename*)
# \*FILENAME* -> filename*.collect{|fn| expand_path(fn)}.join(", ")
@@ -259,8 +258,8 @@ class Shell
end
#
- # File関連メソッド
- # open/foreach/unlinkは別定義
+ # File methods
+ # open/foreach/unlink are defined elsewhere.
#
normal_delegation_file_methods = [
["atime", ["FILENAME"]],
@@ -287,11 +286,11 @@ class Shell
normal_delegation_file_methods)
alias rm delete
- # FileTest関連メソッド
+ # FileTest method
def_commands(FileTest,
FileTest.singleton_methods.collect{|m| [m, ["FILENAME"]]})
- # ftools関連メソッド
+ # ftools methods
normal_delegation_ftools_methods = [
["syscopy", ["FILENAME_FROM", "FILENAME_TO"]],
["copy", ["FILENAME_FROM", "FILENAME_TO"]],
@@ -310,7 +309,7 @@ class Shell
alias rm_f safe_unlink
alias mkpath makedirs
- # testコマンド
+ # test function
alias top_level_test test
def test(command, file1, file2 = nil)
if file2
@@ -320,7 +319,7 @@ class Shell
end
end
- # shell拡張
+ # shell functions
def echo(*strings)
Echo.new(self, *strings)
end
@@ -342,7 +341,7 @@ class Shell
end
#
- # コマンドを検索する. もし存在しなけば例外を返す.
+ # search for command, raise exception if not found.
#
def find_system_command(command)
return command if /^\// =~ command
@@ -369,8 +368,7 @@ class Shell
end
#
- # コマンドを特異メソッドとして定義する.
- # 定義できない時は例外が発生する.
+ # define command as singleton method.
#
def def_system_command(command, path = command)
d = "
@@ -392,8 +390,7 @@ class Shell
end
#
- # コマンドをShellのメソッドとして定義する.
- # 定義できない時は例外が発生する.
+ # define command as Shell method.
#
def Shell.def_system_command(command, path = command)
d = "
@@ -415,12 +412,9 @@ class Shell
end
#
- # default_path上にのるコマンドを定義する. すでに同名のメソッドが存在
- # する時は, 定義を行なわない.
- # デフォルトでは, 全てのメソッドには接頭子"sys_"をつける.
- # メソッド名として許されないキャラクタ(英数時以外とメソッド名の
- # 先頭が数値になる場合)は, 強制的に``_''に変換する.
- # 定義エラーは無視する.
+ # defines commands on default_path. if the method is already defined,
+ # do nothing. as default, methods are prefixed by "sys_".
+ # invalid characters as method name are converted into "_".
#
def Shell.install_system_command(pre = "sys_")
defined_meth = {}
@@ -449,8 +443,8 @@ class Shell
end
#
- # Filterクラス
- # 必要なメソッド:
+ # Filter
+ # required method:
# each()
class Filter
include Enumerable
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index 9632f1222a4..9154cd84c16 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -18,21 +18,19 @@ module Shellwords
while line != ''
field = ''
while TRUE
- if line.sub! /^"(([^"\\]|\\.)*)"/, '' then
+ if line.sub! /^"(([^"\\]|\\.)*)"/, '' then #"
snippet = $1
snippet.gsub! /\\(.)/, '\1'
- elsif line =~ /^"/ then
- STDOUT.print "Unmatched double quote: $_\n"
- exit
- elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then
+ elsif line =~ /^"/ then #"
+ raise ArgError, "Unmatched double quote: #{line}"
+ elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then #'
snippet = $1
snippet.gsub! /\\(.)/, '\1'
- elsif line =~ /^'/ then
- STDOUT.print "Unmatched single quote: $_\n"
- exit
+ elsif line =~ /^'/ then #'
+ raise ArgError, "Unmatched single quote: #{line}"
elsif line.sub! /^\\(.)/, '' then
snippet = $1
- elsif line.sub! /^([^\s\\'"]+)/, '' then
+ elsif line.sub! /^([^\s\\'"]+)/, '' then #'
snippet = $1
else
line.sub! /^\s+/, ''
diff --git a/lib/telnet.rb b/lib/telnet.rb
index 4e690b9aa80..ca68e1b3e53 100644
--- a/lib/telnet.rb
+++ b/lib/telnet.rb
@@ -1,8 +1,11 @@
#
# telnet.rb
-# ver0.122 1998/08/05
+# ver0.13 1998/08/25
# Wakou Aoyama <wakou@fsinet.or.jp>
#
+# ver0.13 1998/08/25
+# add print method.
+#
# ver0.122 1998/08/05
# support for HP-UX 10.20 thanks to WATANABE Tetsuya <tetsu@jpn.hp.com>
# socket.<< --> socket.write
@@ -59,6 +62,9 @@
# "Prompt" => /[$%#>] $//,
# "Timeout" => 10}){|c| print c }
#
+# == send string
+# host.print("string")
+#
# == login
# host.login("username", "password")
# host.login({"Name" => "username",
@@ -82,6 +88,17 @@
# localhost.login("username", "password"){|c| print c }
# localhost.cmd("command"){|c| print c }
# localhost.close
+#
+# == sample 2
+# checks a POP server to see if you have mail.
+#
+# pop = Telnet.new({"Host" => "your_destination_host_here",
+# "Port" => 110,
+# "Telnetmode" => FALSE,
+# "Prompt" => /^\+OK/})
+# pop.cmd("user " + "your_username_here"){|c| print c}
+# pop.cmd("pass " + "your_password_here"){|c| print c}
+# pop.cmd("list"){|c| print c}
require "socket"
require "delegate"
@@ -191,7 +208,7 @@ class Telnet < SimpleDelegator
# respond to "IAC AYT" (are you there)
str.gsub!(/([^#{IAC}])?#{IAC}#{AYT}/no){
- @sock.write("nobody here but us pigeons" + CR)
+ @sock.write("nobody here but us pigeons" + EOL)
$1
}
@@ -234,6 +251,10 @@ class Telnet < SimpleDelegator
line
end
+ def print(string)
+ @sock.write(string.gsub(/\n/, EOL) + EOL)
+ end
+
def cmd(options)
match = @options["Prompt"]
timeout = @options["Timeout"]
@@ -247,7 +268,7 @@ class Telnet < SimpleDelegator
end
select(nil, [@sock])
- @sock.write(string.gsub(/\n/, CR) + CR)
+ @sock.write(string.gsub(/\n/, EOL) + EOL)
if iterator?
waitfor({"Prompt" => match, "Timeout" => timeout}){|c| yield c }
else
diff --git a/lib/thwait.rb b/lib/thwait.rb
index 84ba2c87495..d3b329911ff 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -1,38 +1,39 @@
#
-# thwait.rb - スレッド同期クラス
+# thwait.rb - thread synchronization class
# $Release Version: 0.9 $
# $Revision: 1.3 $
# $Date: 1998/06/26 03:19:34 $
# by Keiju ISHITSUKA(Nihpon Rational Software Co.,Ltd.)
#
# --
-# 機能:
-# 複数のスレッドを関しそれらのスレッドが終了するまでwaitする機能を提
-# 供する.
+# feature:
+# provides synchronization for multiple threads.
#
-# クラスメソッド:
+# class methods:
# * ThreadsWait.all_waits(thread1,...)
-# 全てのスレッドが終了するまで待つ. イテレータとして呼ばれた時には,
-# スレッドが終了する度にイテレータを実行する.
+# waits until all of specified threads are terminated.
+# if a block is supplied for the method, evaluates it for
+# each thread termination.
# * th = ThreadsWait.new(thread1,...)
-# 同期するスレッドを指定し同期オブジェクトを生成.
+# creates synchronization object, specifying thread(s) to wait.
#
-# メソッド:
+# methods:
# * th.threads
-# 同期すべきスレッドの一覧
+# list threads to be synchronized
# * th.empty?
-# 同期すべきスレッドがあるかどうか
+# is there any thread to be synchronized.
# * th.finished?
-# すでに終了したスレッドがあるかどうか
+# is there already terminated thread.
# * th.join(thread1,...)
-# 同期するスレッドを指定し, いずれかのスレッドが終了するまで待ちにはいる.
+# wait for specified thread(s).
# * th.join_nowait(threa1,...)
-# 同期するスレッドを指定する. 待ちには入らない.
+# specifies thread(s) to wait. non-blocking.
# * th.next_wait
-# いずれかのスレッドが終了するまで待ちにはいる.
+# waits until any of specified threads is terminated.
# * th.all_waits
-# 全てのスレッドが終了するまで待つ. イテレータとして呼ばれた時には,
-# スレッドが終了する度にイテレータを実行する.
+# waits until all of specified threads are terminated.
+# if a block is supplied for the method, evaluates it for
+# each thread termination.
#
require "thread.rb"
@@ -45,14 +46,6 @@ class ThreadsWait
def_exception("ErrNoWaitingThread", "No threads for waiting.")
def_exception("ErrNoFinshedThread", "No finished threads.")
- # class mthods
- # all_waits
-
- #
- # 指定したスレッドが全て終了するまで待つ. イテレータとして呼ばれると
- # 指定したスレッドが終了するとその終了したスレッドを引数としてイテレー
- # タを呼び出す.
- #
def ThreadsWait.all_waits(*threads)
tw = ThreadsWait.new(*threads)
if iterator?
@@ -65,12 +58,6 @@ class ThreadsWait
end
end
- # initialize and terminating:
- # initialize
-
- #
- # 初期化. 待つスレッドの指定ができる.
- #
def initialize(*threads)
@threads = []
@wait_queue = Queue.new
@@ -78,24 +65,19 @@ class ThreadsWait
end
# accessing
- # threads
-
- # 待ちスレッドの一覧を返す.
+ # threads - list threads to be synchronized
attr :threads
# testing
# empty?
# finished?
- #
-
- #
- # 待ちスレッドが存在するかどうかを返す.
+
+ # is there any thread to be synchronized.
def empty?
@threads.empty?
end
- #
- # すでに終了したスレッドがあるかどうか返す
+ # is there already terminated thread.
def finished?
!@wait_queue.empty?
end
@@ -106,18 +88,13 @@ class ThreadsWait
# next_wait
# all_wait
- #
- # 待っているスレッドを追加し. いずれかのスレッドが1つ終了するまで待
- # ちにはいる.
- #
+ # adds thread(s) to join, waits for any of waiting threads to terminate.
def join(*threads)
join_nowait(*threads)
next_wait
end
- #
- # 待っているスレッドを追加する. 待ちには入らない.
- #
+ # adds thread(s) to join, no wait.
def join_nowait(*threads)
@threads.concat threads
for th in threads
@@ -128,12 +105,10 @@ class ThreadsWait
end
end
- #
- # いずれかのスレッドが終了するまで待ちにはいる.
- # 待つべきスレッドがなければ, 例外ErrNoWaitingThreadを返す.
- # nonnlockが真の時には, nonblockingで調べる. 存在しなければ, 例外
- # ErrNoFinishedThreadを返す.
- #
+ # waits for any of waiting threads to terminate
+ # if there is no thread to wait, raises ErrNoWaitingThread.
+ # if `nonblock' is true, and there is no terminated thread,
+ # raises ErrNoFinishedThread.
def next_wait(nonblock = nil)
ThreadsWait.fail ErrNoWaitingThread if @threads.empty?
begin
@@ -144,10 +119,9 @@ class ThreadsWait
end
end
- #
- # 全てのスレッドが終了するまで待つ. イテレータとして呼ばれた時は, ス
- # レッドが終了する度に, イテレータを呼び出す.
- #
+ # waits until all of specified threads are terminated.
+ # if a block is supplied for the method, evaluates it for
+ # each thread termination.
def all_waits
until @threads.empty?
th = next_wait
diff --git a/missing/snprintf.c b/missing/snprintf.c
index 804fb1bd8bd..68951c3d876 100644
--- a/missing/snprintf.c
+++ b/missing/snprintf.c
@@ -64,6 +64,9 @@
#if defined(__STDC__)
# define __P(x) x
# include <stdarg.h>
+# if !defined(__P)
+# define __P(x) x
+# endif
#else
# undef __P
# define __P(x) ()
@@ -74,6 +77,10 @@
#define _BSD_VA_LIST_ va_list
#endif
+#if defined(__hpux) && !defined(__GNUC__)
+#define const
+#endif
+
#if defined(sgi)
#undef __const
#define __const
@@ -96,7 +103,9 @@
* boundaries. THIS IS A CROCK, but for now there is no way around it.
*/
#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)
+#if !defined(__hpux)
typedef off_t fpos_t;
+#endif
#else
typedef struct __sfpos {
char _pos[8];
@@ -241,9 +250,9 @@ static __inline int __sputc(int _c, FILE *_p) {
#endif /* lint */
-
-
+#if defined(__hpux) && !defined(__GNUC__)
#include <string.h>
+#endif
/*
* I/O descriptors for __sfvwrite().
@@ -277,8 +286,9 @@ static BSD__sfvwrite(fp, uio)
if ((len = uio->uio_resid) == 0)
return (0);
-
+#ifndef __hpux
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
#define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n))
iov = uio->uio_iov;
@@ -349,11 +359,12 @@ err:
#define u_short unsigned short
#define u_int unsigned int
-#include <limits.h>
-#if !defined(__CYGWIN32__)
+#if !defined(__CYGWIN32__) && (defined(__hpux) && !defined(__GNUC__))
#include <stdlib.h>
#endif
+#if defined(__hpux) && !defined(__GNUC__)
#include <string.h>
+#endif
#if defined(__STDC__)
# include <stdarg.h>
diff --git a/object.c b/object.c
index 3dc12431412..7253baa3762 100644
--- a/object.c
+++ b/object.c
@@ -69,10 +69,17 @@ any_to_a(obj)
}
static VALUE
+obj_hash(obj)
+ VALUE obj;
+{
+ return (long)obj|FIXNUM_FLAG;
+}
+
+static VALUE
obj_id(obj)
VALUE obj;
{
- return INT2NUM((int)obj);
+ return INT2NUM((long)obj);
}
static VALUE
@@ -963,7 +970,7 @@ Init_Object()
rb_define_method(mKernel, "eql?", obj_equal, 1);
- rb_define_method(mKernel, "hash", obj_id, 0);
+ rb_define_method(mKernel, "hash", obj_hash, 0);
rb_define_method(mKernel, "id", obj_id, 0);
rb_define_method(mKernel, "__id__", obj_id, 0);
rb_define_method(mKernel, "type", obj_type, 0);
diff --git a/parse.y b/parse.y
index 71d2f3787df..50087c577da 100644
--- a/parse.y
+++ b/parse.y
@@ -1385,7 +1385,7 @@ superclass : term
}
| error term {yyerrok; $$ = 0;}
-f_arglist : '(' f_args ')'
+f_arglist : '(' f_args opt_nl ')'
{
$$ = $2;
lex_state = EXPR_BEG;
@@ -3056,7 +3056,9 @@ retry:
pushback(c);
}
}
- else if (lex_state == EXPR_BEG || lex_state == EXPR_DOT){
+ else if (lex_state == EXPR_BEG ||
+ lex_state == EXPR_DOT ||
+ lex_state == EXPR_ARG){
lex_state = EXPR_ARG;
}
else {
diff --git a/re.c b/re.c
index 43bc6328bcc..fe84ca99283 100644
--- a/re.c
+++ b/re.c
@@ -110,7 +110,7 @@ static int reg_kcode =
static void
kcode_euc(reg)
- VALUE reg;
+ struct RRegexp *reg;
{
FL_UNSET(reg, KCODE_MASK);
FL_SET(reg, KCODE_EUC);
@@ -119,7 +119,7 @@ kcode_euc(reg)
static void
kcode_sjis(reg)
- VALUE reg;
+ struct RRegexp *reg;
{
FL_UNSET(reg, KCODE_MASK);
FL_SET(reg, KCODE_SJIS);
@@ -128,7 +128,7 @@ kcode_sjis(reg)
static void
kcode_none(reg)
- VALUE reg;
+ struct RRegexp *reg;
{
FL_UNSET(reg, KCODE_MASK);
FL_SET(reg, KCODE_FIXED);
@@ -241,7 +241,7 @@ reg_source(re)
VALUE re;
{
VALUE str = str_new(0,0);
- reg_expr_str(str, RREGEXP(re)->str,RREGEXP(re)->len,re);
+ reg_expr_str(str, RREGEXP(re)->str, RREGEXP(re)->len);
return str;
}
diff --git a/regex.c b/regex.c
index f870a5203e7..66707af19b7 100644
--- a/regex.c
+++ b/regex.c
@@ -3688,6 +3688,8 @@ re_match(bufp, string_arg, size, pos, regs)
SET_REGS_MATCHED;
break;
}
+ while (stackp != stackb && (int)stackp[-1] == 1)
+ POP_FAILURE_POINT();
continue; /* Successfully executed one pattern command; keep going. */
/* Jump here if any matching operation fails. */
diff --git a/ruby.h b/ruby.h
index 0cfd8f61506..4d7ee52c885 100644
--- a/ruby.h
+++ b/ruby.h
@@ -74,8 +74,12 @@ extern "C" {
#include <alloca.h>
#endif
-#if defined(__CYGWIN32__) && defined(DLLIMPORT)
+#if defined(__CYGWIN32__)
+#if defined(DLLIMPORT)
#include "import.h"
+#else
+#define environ (*__imp___cygwin_environ)
+#endif
#endif
#ifdef _AIX
diff --git a/string.c b/string.c
index 24361717776..d85a9dfdd52 100644
--- a/string.c
+++ b/string.c
@@ -862,7 +862,7 @@ str_replace(str, beg, len, val)
/* str_replace2() understands negatice offset */
static void
str_replace2(str, beg, end, val)
- VALUE str, *val;
+ VALUE str, val;
int beg, end;
{
int len;
diff --git a/struct.c b/struct.c
index f09c6972737..c9aa1c589df 100644
--- a/struct.c
+++ b/struct.c
@@ -206,15 +206,14 @@ struct_s_def(argc, argv, klass)
int argc;
VALUE *argv;
{
- struct RString *name;
- struct RArray *rest;
+ VALUE name, rest;
int i;
VALUE st;
rb_scan_args(argc, argv, "1*", &name, &rest);
- for (i=0; i<rest->len; i++) {
- ID id = rb_to_id(rest->ptr[i]);
- rest->ptr[i] = INT2FIX(id);
+ for (i=0; i<RARRAY(rest)->len; i++) {
+ ID id = rb_to_id(RARRAY(rest)->ptr[i]);
+ RARRAY(rest)->ptr[i] = INT2FIX(id);
}
st = make_struct(name, rest, klass);
obj_call_init(st);
diff --git a/version.h b/version.h
index 5f8d1a01678..f710f288ab2 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.1c2"
-#define VERSION_DATE "98/08/11"
+#define RUBY_VERSION "1.1c3"
+#define VERSION_DATE "98/08/27"