summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1997-10-21 04:31:29 (GMT)
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 13:09:33 (GMT)
commit9b01ce69546380c57cb602e045be4fc012cd81b7 (patch)
treee6580f3b54cf894cbd9226a573f315965fe8d164
parent2a4ba10e2d68c09ddb2e3f5751f5161c00a13bf5 (diff)
version 1.0-971021v1_0_971021
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971021.tar.gz Tue Oct 21 13:31:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * version 1.0-971021 Mon Oct 20 12:18:29 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> * ruby.c (load_file): wrong condition for #! check with -x. * file.c (file_s_dirname): did return "" for "/a". Fri Oct 17 14:29:09 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * bignum.c (bigadd): some undefined side effect order assumed. Co-authored-by: WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-rw-r--r--ChangeLog14
-rw-r--r--bignum.c13
-rw-r--r--ext/marshal/marshal.c52
-rw-r--r--file.c2
-rw-r--r--ruby.c7
-rw-r--r--sample/export.rb4
-rw-r--r--sample/exyacc.rb2
-rw-r--r--version.h4
8 files changed, 72 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 27cd886..8ad1fb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue Oct 21 13:31:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.0-971021
+
+Mon Oct 20 12:18:29 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.c (load_file): wrong condition for #! check with -x.
+
+ * file.c (file_s_dirname): did return "" for "/a".
+
+Fri Oct 17 14:29:09 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (bigadd): some undefined side effect order assumed.
+
Wed Oct 15 18:08:37 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.0-971015
diff --git a/bignum.c b/bignum.c
index 8af40d6..4bdcb6b 100644
--- a/bignum.c
+++ b/bignum.c
@@ -101,6 +101,13 @@ bignorm(x)
}
VALUE
+big_norm(x)
+ VALUE x;
+{
+ return bignorm(x);
+}
+
+VALUE
uint2big(n)
UINT n;
{
@@ -514,7 +521,8 @@ bigsub(x, y)
num = BIGDN(num);
}
while (i < x->len) {
- zds[i++] = BDIGITS(x)[i];
+ zds[i] = BDIGITS(x)[i];
+ i++;
}
return bignorm(z);
@@ -555,7 +563,8 @@ bigadd(x, y, sign)
num = BIGDN(num);
}
while (i < y->len) {
- BDIGITS(z)[i++] = BDIGITS(y)[i];
+ BDIGITS(z)[i] = BDIGITS(y)[i];
+ i++;
}
BDIGITS(z)[i] = num;
diff --git a/ext/marshal/marshal.c b/ext/marshal/marshal.c
index a74ecd7..99e87d0 100644
--- a/ext/marshal/marshal.c
+++ b/ext/marshal/marshal.c
@@ -50,7 +50,7 @@ static ID s_dump, s_load;
struct dump_arg {
VALUE obj;
FILE *fp;
- struct RString *str;
+ VALUE str;
st_table *symbol;
st_table *data;
};
@@ -69,7 +69,7 @@ w_byte(c, arg)
struct dump_arg *arg;
{
if (arg->fp) putc(c, arg->fp);
- else str_cat(arg->str, &c, 1);
+ else str_cat(arg->str, (UCHAR*)&c, 1);
}
static void
@@ -92,8 +92,11 @@ w_short(x, arg)
int x;
struct dump_arg *arg;
{
- w_byte( x & 0xff, arg);
- w_byte((x>> 8) & 0xff, arg);
+ int i;
+
+ for (i=0; i<sizeof(USHORT); i++) {
+ w_byte((x >> (i*8)) & 0xff, arg);
+ }
}
static void
@@ -225,10 +228,19 @@ w_object(obj, arg, limit)
w_byte(TYPE_FALSE, arg);
}
else if (FIXNUM_P(obj)) {
- if (sizeof(long) == 4) {
+#if SIZEOF_LONG <= 4
+ w_byte(TYPE_FIXNUM, arg);
+ w_long(FIX2INT(obj), arg);
+#else
+ if (RSHIFT(obj, 32) == 0 || RSHIFT(obj, 32) == -1) {
w_byte(TYPE_FIXNUM, arg);
w_long(FIX2INT(obj), arg);
}
+ else {
+ obj = int2big(FIX2INT(obj));
+ goto write_bignum;
+ }
+#endif
}
else {
int num;
@@ -268,6 +280,7 @@ w_object(obj, arg, limit)
return;
case T_BIGNUM:
+ write_bignum:
w_byte(TYPE_BIGNUM, arg);
{
char sign = RBIGNUM(obj)->sign?'+':'-';
@@ -419,7 +432,7 @@ marshal_dump(argc, argv)
else {
arg.fp = 0;
port = str_new(0, 0);
- arg.str = RSTRING(port);
+ arg.str = port;
}
arg.symbol = st_init_numtable();
@@ -452,14 +465,18 @@ r_byte(arg)
return EOF;
}
-static int
+static USHORT
r_short(arg)
struct load_arg *arg;
{
- register short x;
- x = r_byte(arg);
- x |= r_byte(arg) << 8;
- /* XXX If your short is > 16 bits, add sign-extension here!!! */
+ USHORT x;
+ int i;
+
+ x = 0;
+ for (i=0; i<sizeof(USHORT); i++) {
+ x |= r_byte(arg)<<(i*8);
+ }
+
return x;
}
@@ -475,7 +492,7 @@ static long
r_long(arg)
struct load_arg *arg;
{
- char c = r_byte(arg), i;
+ int c = r_byte(arg), i;
register long x;
if (c == 0) return 0;
@@ -499,7 +516,7 @@ r_long(arg)
}
#define r_bytes(s, arg) \
- (s = (char*)r_long(arg), r_bytes0(&s,ALLOCA_N(char,(int)s),(int)s,arg))
+ (s = (char*)r_long(arg), r_bytes0(&s,ALLOCA_N(char,(long)s),(long)s,arg))
static int
r_bytes0(sp, s, len, arg)
@@ -582,7 +599,7 @@ r_object(arg)
switch (type) {
case EOF:
- eof_error("EOF read where object expected");
+ eof_error();
return Qnil;
case TYPE_LINK:
@@ -643,7 +660,11 @@ r_object(arg)
while (len--) {
*digits++ = r_short(arg);
}
- return r_regist(big, arg);
+ big = RBIGNUM(big_norm((VALUE)big));
+ if (TYPE(big) == T_BIGNUM) {
+ r_regist(big, arg);
+ }
+ return (VALUE)big;
}
case TYPE_STRING:
@@ -688,7 +709,6 @@ r_object(arg)
int i, len;
int num = arg->data->num_entries;
- st_insert(arg->data, num, 15); /* temp reg. */
class = rb_path2class(r_unique(arg));
mem = rb_ivar_get(class, rb_intern("__member__"));
if (mem == Qnil) {
diff --git a/file.c b/file.c
index 0894c72..db21a35 100644
--- a/file.c
+++ b/file.c
@@ -1375,6 +1375,8 @@ file_s_dirname(obj, fname)
if (!p) {
return str_new2(".");
}
+ if (p == fname->ptr)
+ p++;
return str_taint(str_new(fname->ptr, p - fname->ptr));
}
diff --git a/ruby.c b/ruby.c
index ab08fd8..1bc89ad 100644
--- a/ruby.c
+++ b/ruby.c
@@ -436,8 +436,8 @@ load_file(fname, script)
while (!NIL_P(line = io_gets(f))) {
line_start++;
if (RSTRING(line)->len > 2
- || RSTRING(line)->ptr[0] != '#'
- || RSTRING(line)->ptr[1] != '!') {
+ && RSTRING(line)->ptr[0] == '#'
+ && RSTRING(line)->ptr[1] == '!') {
if (strstr(RSTRING(line)->ptr, "ruby")) {
goto start_read;
}
@@ -453,8 +453,7 @@ load_file(fname, script)
line_start++;
if (RSTRING(line)->len > 2
- || RSTRING(line)->ptr[0] != '#'
- || RSTRING(line)->ptr[1] != '!') {
+ && RSTRING(line)->ptr[0] == '!') {
char *p;
diff --git a/sample/export.rb b/sample/export.rb
index 750b5c1..949e5b1 100644
--- a/sample/export.rb
+++ b/sample/export.rb
@@ -22,7 +22,9 @@ end
f = Foo.new
#Foo.private :printf
-Foo.public :foobar
+class Foo # redefines foobar's scope
+ public :foobar
+end
f.foobar
f.printf "%s\n", Foo
diff --git a/sample/exyacc.rb b/sample/exyacc.rb
index dafcb03..dbe0dee 100644
--- a/sample/exyacc.rb
+++ b/sample/exyacc.rb
@@ -13,7 +13,7 @@ while gets()
gsub!(/'}'/, "'\002'")
gsub!('\*/', "\003\003")
gsub!("/\\*[^\003]*\003\003", '')
- while gsub!(/{[^}{]*}/, ''); end
+ while gsub!(/\{[^{}]*}/, ''); end
gsub!(/'\001'/, "'{'")
gsub!(/'\002'/, "'}'")
while gsub!(/^[ \t]*\n(\s)/, '\1'); end
diff --git a/version.h b/version.h
index 37f5eac..f098bf8 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.0-971015"
-#define VERSION_DATE "97/10/15"
+#define RUBY_VERSION "1.0-971021"
+#define VERSION_DATE "97/10/21"