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 58cbacb61f..a5c1d0ac01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Thu Aug 27 12:54:28 1998 Yukihiro Matsumoto <[email protected]>
+
+ * version 1.1c3 released.
+
+Wed Aug 26 11:47:00 1998 Yukihiro Matsumoto <[email protected]>
+
+ * regex.c (re_match): pop non-greedy stack elements on success.
+
+Wed Aug 26 09:25:35 1998 WATANABE Hirofumi <[email protected]>
+
+ * ruby.h: add #define environ for cygwin32.
+
+Mon Aug 24 18:46:44 1998 WATANABE Hirofumi <[email protected]>
+
+ * dln.c (dln_find_1): path check was too strict.
+
+Mon Aug 24 15:28:11 1998 WATANABE Hirofumi <[email protected]>
+
+ * parse.y (f_arglist): opt_nl added after f_args.
+
+Wed Aug 19 00:31:09 1998 Yukihiro Matsumoto <[email protected]>
+
+ * io.c (io_ctl): forgot to place TRAP_END at right position.
+
Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto <[email protected]>
* eval.c (call_trace_func): save __FILE__, __LINE__ before
diff --git a/MANIFEST b/MANIFEST
index 266becd23a..cedd15f6dd 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 24d9c2659d..95d82709c9 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 114dd2079a..6c11410327 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 38a0efbf19..3a96cee12f 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 62ce13b785..e21f221d26 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 811452bfb0..56256ea3fe 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 a673dec0c4..d6324425ae 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 a9fdf97b2b..c86409d0ea 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 fa10d485d8..bf860dc5c1 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 [email protected]?
+ # 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 acbaf0e66f..a07e67d093 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 fcb0b29eb5..fcecbe541a 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 a0ade9ab46..3d8dda0445 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 9632f1222a..9154cd84c1 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 4e690b9aa8..ca68e1b3e5 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 <[email protected]>
#
+# ver0.13 1998/08/25
+# add print method.
+#
# ver0.122 1998/08/05
# support for HP-UX 10.20 thanks to WATANABE Tetsuya <[email protected]>
# 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 84ba2c8749..d3b329911f 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 804fb1bd8b..68951c3d87 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 3dc1243141..7253baa376 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 71d2f3787d..50087c577d 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 43bc6328bc..fe84ca9928 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 f870a5203e..66707af19b 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 0cfd8f6150..4d7ee52c88 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 2436171777..d85a9dfdd5 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 f09c697273..c9aa1c589d 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 5f8d1a0167..f710f288ab 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"