diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-25 08:26:20 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-25 08:26:20 +0000 |
commit | 1307f8d555235116f0f0c79b9902df9cfd4bff12 (patch) | |
tree | faf8962d1f1fcdb54db653b4a99b148fdecea7e6 | |
parent | 1aba398e29bd9134f83c165a2495883f72cbbb3d (diff) |
regexp null pattern
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 48 | ||||
-rw-r--r-- | array.c | 113 | ||||
-rw-r--r-- | bignum.c | 50 | ||||
-rw-r--r-- | configure | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | error.c | 2 | ||||
-rw-r--r-- | eval.c | 27 | ||||
-rw-r--r-- | ext/Win32API/Win32API.c | 4 | ||||
-rw-r--r-- | ext/extmk.rb.in | 18 | ||||
-rw-r--r-- | ext/pty/expect_sample.rb | 2 | ||||
-rw-r--r-- | ext/pty/extconf.rb | 1 | ||||
-rw-r--r-- | ext/pty/pty.c | 4 | ||||
-rw-r--r-- | ext/pty/script.rb | 2 | ||||
-rw-r--r-- | ext/socket/extconf.rb | 1 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 15 | ||||
-rw-r--r-- | ext/socket/socket.c | 31 | ||||
-rw-r--r-- | gc.c | 15 | ||||
-rw-r--r-- | hash.c | 3 | ||||
-rw-r--r-- | intern.h | 28 | ||||
-rw-r--r-- | lib/debug.rb | 2 | ||||
-rw-r--r-- | lib/getoptlong.rb | 4 | ||||
-rw-r--r-- | lib/mkmf.rb | 6 | ||||
-rw-r--r-- | misc/ruby-mode.el | 1 | ||||
-rw-r--r-- | object.c | 2 | ||||
-rw-r--r-- | pack.c | 10 | ||||
-rw-r--r-- | parse.c | 1544 | ||||
-rw-r--r-- | parse.y | 23 | ||||
-rw-r--r-- | range.c | 25 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | regex.c | 527 | ||||
-rw-r--r-- | ruby.h | 10 | ||||
-rw-r--r-- | signal.c | 2 | ||||
-rw-r--r-- | string.c | 79 | ||||
-rw-r--r-- | struct.c | 47 | ||||
-rw-r--r-- | variable.c | 2 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | win32/Makefile | 10 | ||||
-rw-r--r-- | win32/config.status | 52 | ||||
-rwxr-xr-x | win32/ntsetup.bat | 1 | ||||
-rw-r--r-- | win32/sdbm.c | 981 | ||||
-rw-r--r-- | win32/sdbm.h | 84 | ||||
-rw-r--r-- | win32/win32.c | 3 |
42 files changed, 1321 insertions, 2466 deletions
@@ -1,3 +1,51 @@ +Tue May 25 16:45:11 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * io.c (rb_f_syscall): syscall may return values other than zero + on success. + + * regex.c (re_match): handle empty loop properly (hopefully). + + * regex.c (re_match): remove empty group check, because it does + not help non-grouping parentheses (?:..). + + * regex.c (re_compile_fastmap): treating try_next, finalize_push + wrong way. + + * regex.c: remove some obsolete functions such as + group_match_null_string_p(). + +Mon May 24 14:47:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * regex.c (read_backslash): read backslash by regex. + +Sun May 23 19:44:58 1999 WATANABE Hirofumi <eban@os.rim.or.jp> + + * ext/pty/pty.c (getDevice): portability patch. + +Fri May 21 23:01:26 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp> + + * ext/socket/getaddrinfo.c (GET_AI): should set error code. + +Thu May 20 03:43:44 1999 Jun-ichiro itojun Hagino <itojun@itojun.org> + + * ext/socket/socket.c: you should use sockaddr_storage to handle + IPv6 addresses. + + * ext/socket/getaddrinfo.c (getaddrinfo): prevent retrieving + AF_INET6 address if hints.ai_flags == AI_PASSIVE. + +Wed May 19 12:27:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * eval.c (exec_end_proc): should protect exceptions. + + * gc.c (run_final): ditto. + + * parse.y (f_rest_arg): allow just * for rest arg. + + * parse.y (mlhs_basic): allow * without formal argument. + + * regex.c (re_match): the variable `part' should be initialized. + Tue May 18 15:25:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * regex.c (re_search): a bug in range adjustment. @@ -72,7 +72,7 @@ rb_ary_frozen_p(ary) VALUE rb_ary_new2(len) - int len; + long len; { NEWOBJ(ary, struct RArray); OBJSETUP(ary, rb_cArray, T_ARRAY); @@ -107,16 +107,16 @@ rb_ary_new() VALUE #ifdef HAVE_STDARG_PROTOTYPES -rb_ary_new3(int n, ...) +rb_ary_new3(long n, ...) #else rb_ary_new3(n, va_alist) - int n; + long n; va_dcl #endif { va_list ar; VALUE ary; - int i; + long i; if (n < 0) { rb_raise(rb_eIndexError, "negative number of items(%d)", n); @@ -135,7 +135,7 @@ rb_ary_new3(n, va_alist) VALUE rb_ary_new4(n, elts) - int n; + long n; VALUE *elts; { VALUE ary; @@ -169,7 +169,7 @@ rb_ary_s_new(argc, argv, klass) VALUE *argv; VALUE klass; { - int len = 0; + long len = 0; VALUE size, val; NEWOBJ(ary, struct RArray); OBJSETUP(ary, klass, T_ARRAY); @@ -180,7 +180,7 @@ rb_ary_s_new(argc, argv, klass) ary->capa = ARY_DEFAULT_SIZE; } else { - int capa = NUM2INT(size); + long capa = NUM2LONG(size); if (capa < 0) { rb_raise(rb_eArgError, "negative array size"); @@ -224,7 +224,7 @@ rb_ary_s_create(argc, argv, klass) void rb_ary_store(ary, idx, val) VALUE ary; - int idx; + long idx; VALUE val; { rb_ary_modify(ary); @@ -237,7 +237,7 @@ rb_ary_store(ary, idx, val) } if (idx >= RARRAY(ary)->capa) { - int capa_inc = RARRAY(ary)->capa / 2; + long capa_inc = RARRAY(ary)->capa / 2; if (capa_inc < ARY_DEFAULT_SIZE) { capa_inc = ARY_DEFAULT_SIZE; } @@ -315,7 +315,7 @@ rb_ary_unshift(ary, item) { rb_ary_modify(ary); if (RARRAY(ary)->len >= RARRAY(ary)->capa) { - int capa_inc = RARRAY(ary)->capa / 2; + long capa_inc = RARRAY(ary)->capa / 2; if (capa_inc < ARY_DEFAULT_SIZE) { capa_inc = ARY_DEFAULT_SIZE; } @@ -335,7 +335,7 @@ rb_ary_unshift(ary, item) VALUE rb_ary_entry(ary, offset) VALUE ary; - int offset; + long offset; { if (RARRAY(ary)->len == 0) return Qnil; @@ -352,7 +352,7 @@ rb_ary_entry(ary, offset) static VALUE rb_ary_subary(ary, beg, len) VALUE ary; - int beg, len; + long beg, len; { VALUE ary2; @@ -381,11 +381,11 @@ rb_ary_aref(argc, argv, ary) VALUE ary; { VALUE arg1, arg2; - int beg, len; + long beg, len; if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) { - beg = NUM2INT(arg1); - len = NUM2INT(arg2); + beg = NUM2LONG(arg1); + len = NUM2LONG(arg2); if (beg < 0) { beg = RARRAY(ary)->len + beg; } @@ -394,7 +394,7 @@ rb_ary_aref(argc, argv, ary) /* special case - speeding up */ if (FIXNUM_P(arg1)) { - return rb_ary_entry(ary, FIX2INT(arg1)); + return rb_ary_entry(ary, FIX2LONG(arg1)); } else if (TYPE(arg1) == T_BIGNUM) { rb_raise(rb_eIndexError, "index too big"); @@ -410,7 +410,7 @@ rb_ary_aref(argc, argv, ary) return rb_ary_subary(ary, beg, len); } } - return rb_ary_entry(ary, NUM2INT(arg1)); + return rb_ary_entry(ary, NUM2LONG(arg1)); } static VALUE @@ -418,11 +418,11 @@ rb_ary_index(ary, val) VALUE ary; VALUE val; { - int i; + long i; for (i=0; i<RARRAY(ary)->len; i++) { if (rb_equal(RARRAY(ary)->ptr[i], val)) - return INT2FIX(i); + return INT2NUM(i); } return Qnil; } @@ -432,11 +432,11 @@ rb_ary_rindex(ary, val) VALUE ary; VALUE val; { - int i = RARRAY(ary)->len; + long i = RARRAY(ary)->len; while (i--) { if (rb_equal(RARRAY(ary)->ptr[i], val)) - return INT2FIX(i); + return INT2NUM(i); } return Qnil; } @@ -448,7 +448,7 @@ rb_ary_indexes(argc, argv, ary) VALUE ary; { VALUE new_ary; - int i; + long i; new_ary = rb_ary_new2(argc); for (i=0; i<argc; i++) { @@ -461,7 +461,7 @@ rb_ary_indexes(argc, argv, ary) static void rb_ary_replace(ary, beg, len, rpl) VALUE ary, rpl; - int beg, len; + long beg, len; { if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len); if (beg < 0) { @@ -491,7 +491,7 @@ rb_ary_replace(ary, beg, len, rpl) RARRAY(ary)->len = len; } else { - int alen; + long alen; if (beg + len > RARRAY(ary)->len) { len = RARRAY(ary)->len - beg; @@ -519,14 +519,14 @@ rb_ary_aset(argc, argv, ary) VALUE ary; { VALUE arg1, arg2, arg3; - int offset, beg, end, len; + long offset, beg, len; if (rb_scan_args(argc, argv, "21", &arg1, &arg2, &arg3) == 3) { - rb_ary_replace(ary, NUM2INT(arg1), NUM2INT(arg2), arg3); + rb_ary_replace(ary, NUM2LONG(arg1), NUM2LONG(arg2), arg3); return arg3; } else if (FIXNUM_P(arg1)) { - offset = FIX2INT(arg1); + offset = FIX2LONG(arg1); goto fixnum; } else if (rb_range_beg_len(arg1, &beg, &len, RARRAY(ary)->len, 1)) { @@ -538,7 +538,7 @@ rb_ary_aset(argc, argv, ary) rb_raise(rb_eIndexError, "index too big"); } - offset = NUM2INT(arg1); + offset = NUM2LONG(arg1); fixnum: rb_ary_store(ary, offset, arg2); return arg2; @@ -548,7 +548,7 @@ VALUE rb_ary_each(ary) VALUE ary; { - int i; + long i; for (i=0; i<RARRAY(ary)->len; i++) { rb_yield(RARRAY(ary)->ptr[i]); @@ -560,10 +560,10 @@ static VALUE rb_ary_each_index(ary) VALUE ary; { - int i; + long i; for (i=0; i<RARRAY(ary)->len; i++) { - rb_yield(INT2FIX(i)); + rb_yield(INT2NUM(i)); } return Qnil; } @@ -572,7 +572,7 @@ static VALUE rb_ary_reverse_each(ary) VALUE ary; { - int len = RARRAY(ary)->len; + long len = RARRAY(ary)->len; while (len--) { rb_yield(RARRAY(ary)->ptr[len]); @@ -584,7 +584,7 @@ static VALUE rb_ary_length(ary) VALUE ary; { - return INT2FIX(RARRAY(ary)->len); + return INT2NUM(RARRAY(ary)->len); } static VALUE @@ -636,7 +636,7 @@ VALUE rb_ary_join(ary, sep) VALUE ary, sep; { - int i; + long i; VALUE result, tmp; if (RARRAY(ary)->len == 0) return rb_str_new(0, 0); @@ -780,7 +780,7 @@ static VALUE inspect_ary(ary) VALUE ary; { - int i = 0; + long i = 0; VALUE s, str; str = rb_str_new2("["); @@ -909,7 +909,7 @@ rb_ary_delete(ary, item) VALUE ary; VALUE item; { - int i1, i2; + long i1, i2; rb_ary_modify(ary); for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) { @@ -937,11 +937,11 @@ rb_ary_delete_at(ary, at) VALUE ary; VALUE at; { - int i1, i2, pos; + long i1, i2, pos; VALUE del = Qnil; rb_ary_modify(ary); - pos = NUM2INT(at); + pos = NUM2LONG(at); for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) { if (i1 == pos) { del = RARRAY(ary)->ptr[i1]; @@ -961,7 +961,7 @@ static VALUE rb_ary_delete_if(ary) VALUE ary; { - int i1, i2; + long i1, i2; rb_ary_modify(ary); for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) { @@ -980,7 +980,7 @@ static VALUE rb_ary_filter(ary) VALUE ary; { - int i; + long i; rb_ary_modify(ary); for (i = 0; i < RARRAY(ary)->len; i++) { @@ -1017,7 +1017,7 @@ rb_ary_fill(argc, argv, ary) VALUE ary; { VALUE item, arg1, arg2; - int beg, end, len; + long beg, end, len; VALUE *p, *pend; rb_scan_args(argc, argv, "12", &item, &arg1, &arg2); @@ -1032,12 +1032,12 @@ rb_ary_fill(argc, argv, ary) } /* fall through */ case 3: - beg = NIL_P(arg1)?0:NUM2INT(arg1); + beg = NIL_P(arg1)?0:NUM2LONG(arg1); if (beg < 0) { beg = RARRAY(ary)->len + beg; if (beg < 0) beg = 0; } - len = NIL_P(arg2)?RARRAY(ary)->len - beg:NUM2INT(arg2); + len = NIL_P(arg2)?RARRAY(ary)->len - beg:NUM2LONG(arg2); break; } rb_ary_modify(ary); @@ -1102,13 +1102,13 @@ rb_ary_times(ary, times) VALUE times; { VALUE ary2; - int i, len; + long i, len; if (TYPE(times) == T_STRING) { return rb_ary_join(ary, times); } - len = NUM2INT(times); + len = NUM2LONG(times); if (len < 0) { rb_raise(rb_eArgError, "negative argument"); } @@ -1164,7 +1164,7 @@ static VALUE rb_ary_equal(ary1, ary2) VALUE ary1, ary2; { - int i; + long i; if (TYPE(ary2) != T_ARRAY) return Qfalse; if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; @@ -1179,7 +1179,7 @@ static VALUE rb_ary_eql(ary1, ary2) VALUE ary1, ary2; { - int i; + long i; if (TYPE(ary2) != T_ARRAY) return Qfalse; if (RARRAY(ary1)->len != RARRAY(ary2)->len) @@ -1195,7 +1195,8 @@ static VALUE rb_ary_hash(ary) VALUE ary; { - int i, h; + long i; + int h; h = RARRAY(ary)->len; for (i=0; i<RARRAY(ary)->len; i++) { @@ -1210,7 +1211,7 @@ rb_ary_includes(ary, item) VALUE ary; VALUE item; { - int i; + long i; for (i=0; i<RARRAY(ary)->len; i++) { if (rb_equal(RARRAY(ary)->ptr[i], item)) { return Qtrue; @@ -1224,7 +1225,7 @@ rb_ary_cmp(ary, ary2) VALUE ary; VALUE ary2; { - int i, len; + long i, len; ary2 = to_ary(ary2); len = RARRAY(ary)->len; @@ -1248,7 +1249,7 @@ rb_ary_diff(ary1, ary2) VALUE ary1, ary2; { VALUE ary3; - int i; + long i; ary2 = to_ary(ary2); ary3 = rb_ary_new(); @@ -1265,7 +1266,7 @@ rb_ary_and(ary1, ary2) VALUE ary1, ary2; { VALUE ary3; - int i; + long i; ary2 = to_ary(ary2); ary3 = rb_ary_new(); @@ -1283,7 +1284,7 @@ rb_ary_or(ary1, ary2) VALUE ary1, ary2; { VALUE ary3; - int i; + long i; if (TYPE(ary2) != T_ARRAY) { if (rb_ary_includes(ary1, ary2)) return ary1; @@ -1377,7 +1378,7 @@ static VALUE rb_ary_nitems(ary) VALUE ary; { - int n = 0; + long n = 0; VALUE *p, *pend; p = RARRAY(ary)->ptr; @@ -1386,14 +1387,14 @@ rb_ary_nitems(ary) if (!NIL_P(*p)) n++; p++; } - return INT2FIX(n); + return INT2NUM(n); } static VALUE rb_ary_flatten_bang(ary) VALUE ary; { - int i; + long i; int mod = 0; rb_ary_modify(ary); @@ -26,7 +26,7 @@ typedef unsigned short USHORT; static VALUE bignew_1(klass, len, sign) VALUE klass; - int len; + long len; char sign; { NEWOBJ(big, struct RBignum); @@ -54,7 +54,7 @@ void rb_big_2comp(x) /* get 2's complement */ VALUE x; { - int i = RBIGNUM(x)->len; + long i = RBIGNUM(x)->len; USHORT *ds = BDIGITS(x); long num; @@ -79,7 +79,7 @@ static VALUE bignorm(x) VALUE x; { - int len = RBIGNUM(x)->len; + long len = RBIGNUM(x)->len; USHORT *ds = BDIGITS(x); while (len-- && !ds[len]) ; @@ -170,8 +170,8 @@ rb_str2inum(str, base) { char sign = 1, c; unsigned long num; - int len, blen = 1; - int i; + long len, blen = 1; + long i; VALUE z; USHORT *zds; @@ -285,7 +285,7 @@ rb_big2str(x, base) { VALUE t; USHORT *ds; - unsigned int i, j, hbase; + unsigned long i, j, hbase; VALUE ss; char *s, c; @@ -323,7 +323,7 @@ rb_big2str(x, base) s[0] = RBIGNUM(x)->sign ? '+' : '-'; while (i && j) { - int k = i; + long k = i; unsigned long num = 0; while (k--) { num = BIGUP(num) + ds[k]; @@ -359,7 +359,7 @@ rb_big2ulong(x) VALUE x; { unsigned long num; - int len = RBIGNUM(x)->len; + long len = RBIGNUM(x)->len; USHORT *ds; if (len > sizeof(long)/sizeof(USHORT)) @@ -397,7 +397,7 @@ VALUE rb_dbl2big(d) double d; { - unsigned int i = 0; + unsigned long i = 0; long c; USHORT *digits; VALUE z; @@ -431,7 +431,7 @@ rb_big2dbl(x) VALUE x; { double d = 0.0; - int i = RBIGNUM(x)->len; + long i = RBIGNUM(x)->len; USHORT *ds = BDIGITS(x); while (i--) { @@ -452,7 +452,7 @@ static VALUE rb_big_cmp(x, y) VALUE x, y; { - int xlen = RBIGNUM(x)->len; + long xlen = RBIGNUM(x)->len; switch (TYPE(y)) { case T_FIXNUM: @@ -504,7 +504,7 @@ rb_big_neg(x) VALUE x; { VALUE z = rb_big_clone(x); - int i = RBIGNUM(x)->len; + long i = RBIGNUM(x)->len; USHORT *ds = BDIGITS(z); if (!RBIGNUM(x)->sign) rb_big_2comp(z); @@ -522,7 +522,7 @@ bigsub(x, y) VALUE z = 0; USHORT *zds; long num; - int i; + long i; i = RBIGNUM(x)->len; /* if x is larger than y, swap */ @@ -570,7 +570,7 @@ bigadd(x, y, sign) { VALUE z; long num; - int i, len; + long i, len; sign = (sign == RBIGNUM(y)->sign); if (RBIGNUM(x)->sign != sign) { @@ -650,7 +650,7 @@ VALUE rb_big_mul(x, y) VALUE x, y; { - int i, j; + long i, j; unsigned long n = 0; VALUE z; USHORT *zds; @@ -699,8 +699,8 @@ bigdivmod(x, y, div, mod, modulo) VALUE *div, *mod; int modulo; { - int nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len; - int i, j; + long nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len; + long i, j; VALUE yy, z; USHORT *xds, *yds, *zds, *tds; unsigned long t2; @@ -812,7 +812,7 @@ bigdivmod(x, y, div, mod, modulo) RBIGNUM(*mod)->len = ny; RBIGNUM(*mod)->sign = RBIGNUM(x)->sign; if (modulo && RBIGNUM(x)->sign != RBIGNUM(y)->sign) { - int len = ny; + long len = ny; zds = BDIGITS(*mod); while (len-- && !zds[len]); if (len > 0) { @@ -968,7 +968,7 @@ rb_big_and(x, y) { VALUE z; USHORT *ds1, *ds2, *zds; - int i, l1, l2; + long i, l1, l2; char sign; if (FIXNUM_P(y)) { @@ -1019,7 +1019,7 @@ rb_big_or(x, y) { VALUE z; USHORT *ds1, *ds2, *zds; - unsigned int i, l1, l2; + unsigned long i, l1, l2; char sign; if (FIXNUM_P(y)) { @@ -1131,7 +1131,7 @@ rb_big_lshift(x, y) int s2 = shift%BITSPERDIG; VALUE z; unsigned long num = 0; - int len, i; + long len, i; if (shift < 0) return rb_big_rshift(x, INT2FIX(-shift)); xds = BDIGITS(x); @@ -1160,8 +1160,8 @@ rb_big_rshift(x, y) int s2 = shift%BITSPERDIG; VALUE z; unsigned long num = 0; - int i = RBIGNUM(x)->len; - int j; + long i = RBIGNUM(x)->len; + long j; if (shift < 0) return rb_big_lshift(x, INT2FIX(-shift)); if (s1 > RBIGNUM(x)->len) { @@ -1212,7 +1212,7 @@ static VALUE rb_big_hash(x) VALUE x; { - int i, len; + long i, len; int key; USHORT *digits; @@ -1258,7 +1258,7 @@ rb_big_rand(max) VALUE max; { struct RBignum *v; - int len; + long len; len = RBIGNUM(max)->len; v = RBIGNUM(bignew(len,1)); @@ -4009,7 +4009,7 @@ echo "configure:3935: checking whether OS depend dynamic link works" >&5 rb_cv_dlopen=yes ;; aix*) LDSHARED='/usr/ccs/bin/ld' XLDFLAGS='-Wl,-bE:ruby.imp' - DLDFLAGS='-eInit_$(TARGET) -bI:$(ruby_inc)/ruby.imp -bM:SRE -T512 -H512 -lc' + DLDFLAGS='-eInit_$(TARGET) -bI:$(hdrdir)/ruby.imp -bM:SRE -T512 -H512 -lc' rb_cv_dlopen=yes ;; human*) DLDFLAGS='' diff --git a/configure.in b/configure.in index f3bf12b974..069dede97e 100644 --- a/configure.in +++ b/configure.in @@ -450,7 +450,7 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes ;; aix*) LDSHARED='/usr/ccs/bin/ld' XLDFLAGS='-Wl,-bE:ruby.imp' - DLDFLAGS='-eInit_$(TARGET) -bI:$(ruby_inc)/ruby.imp -bM:SRE -T512 -H512 -lc' + DLDFLAGS='-eInit_$(TARGET) -bI:$(hdrdir)/ruby.imp -bM:SRE -T512 -H512 -lc' rb_cv_dlopen=yes ;; human*) DLDFLAGS='' @@ -242,7 +242,7 @@ VALUE rb_exc_new(etype, ptr, len) VALUE etype; const char *ptr; - int len; + long len; { VALUE exc = rb_obj_alloc(etype); @@ -871,7 +871,7 @@ error_print() fprintf(stderr, "\tfrom %s\n", RSTRING(ep->ptr[i])->ptr); } if (i == TRACE_HEAD && ep->len > TRACE_MAX) { - fprintf(stderr, "\t ... %d levels...\n", + fprintf(stderr, "\t ... %ld levels...\n", ep->len - TRACE_HEAD - TRACE_TAIL); i = ep->len - TRACE_TAIL; } @@ -1052,11 +1052,12 @@ ruby_run() case TAG_RAISE: case TAG_FATAL: if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) { - exec_end_proc(); - exit(exit_status); + ex = exit_status; + } + else { + error_print(); + ex = 1; } - error_print(); - ex = 1; break; default: rb_bug("Unknown longjmp status %d", ex); @@ -3074,7 +3075,6 @@ rb_f_raise(argc, argv) VALUE *argv; { VALUE mesg; - int n; mesg = Qnil; switch (argc) { @@ -3255,7 +3255,10 @@ massign(self, node, val, check) } if (check && list) goto arg_error; if (node->nd_args) { - if (!list && i<len) { + if (node->nd_args == (NODE*)-1) { + /* ignore rest args */ + } + else if (!list && i<len) { assign(self, node->nd_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), check); } else { @@ -3264,7 +3267,7 @@ massign(self, node, val, check) } else if (check && i<len) goto arg_error; } - else if (node->nd_args) { + else if (node->nd_args && node->nd_args != (NODE*)-1) { assign(self, node->nd_args, Qnil, check); } @@ -4181,7 +4184,6 @@ eval(self, src, scope, file, line) volatile VALUE result = Qnil; struct SCOPE * volatile old_scope; struct BLOCK * volatile old_block; - struct BLOCK * volatile old_call_block; struct RVarmap * volatile old_d_vars; int volatile old_vmode; struct FRAME frame; @@ -5114,9 +5116,10 @@ static void exec_end_proc() { struct end_proc_data *link = end_proc_data; + int status; while (link) { - (*link->func)(link->data); + rb_protect((VALUE(*)())link->func, link->data, &status); link = link->next; } } @@ -5447,7 +5450,7 @@ proc_call(proc, args) struct BLOCK * volatile old_block; struct BLOCK *data; volatile VALUE result = Qnil; - int state, n; + int state; volatile int orphan; volatile int safe = safe_level; @@ -6357,7 +6360,7 @@ rb_thread_schedule() curr_thread->file = ruby_sourcefile; curr_thread->line = ruby_sourceline; FOREACH_THREAD_FROM(curr, th) { - fprintf(stderr, "%s:%d:deadlock 0x%x: %d:%d %s\n", + fprintf(stderr, "%s:%d:deadlock 0x%lx: %d:%d %s\n", th->file, th->line, th->thread, th->status, th->wait_for, th==main_thread?"(main)":""); if (th->status == THREAD_STOPPED) { diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c index b57cf8101f..9f75653132 100644 --- a/ext/Win32API/Win32API.c +++ b/ext/Win32API/Win32API.c @@ -111,8 +111,8 @@ Win32API_initialize(self, dllname, proc, import, export) static VALUE Win32API_Call(argc, argv, obj) - VALUE argc; - VALUE argv; + int argc; + VALUE *argv; VALUE obj; { VALUE args; diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index f98ca4dc2b..c564b59b70 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -14,6 +14,7 @@ elsif ARGV[0] == 'clean' ARGV.shift end +SRC_EXT = ["c", "cc", "cxx", "C"] $extlist = [] $cache_mod = FALSE; @@ -27,7 +28,6 @@ if $top_srcdir !~ "^/" end # get absolute path $topdir = File.expand_path("..") -$ruby_inc = $top_srcdir load "#{$top_srcdir}/lib/find.rb" @@ -355,7 +355,6 @@ libdir = @libdir@ #pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)/@MAJOR@.@MINOR@ pkglibdir = $(libdir)/ruby/@MAJOR@.@MINOR@ archdir = $(pkglibdir)/@arch@ -ruby_inc = #{$ruby_inc} @SET_MAKE@ #### End of system configuration section. #### @@ -366,7 +365,7 @@ ruby_inc = #{$ruby_inc} mfile.printf "OBJS = " if !$objs then $objs = [] - for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{c,cc}"] + for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{#{SRC_EXT.join(%q{,})}}"] f = File.basename(f) f.sub!(/\.(c|cc)$/, ".o") $objs.push f @@ -419,7 +418,7 @@ $(DLLIB): $(OBJS) $(DLLIB): $(OBJS) $(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS) " - elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc") + elsif not SRC_EXT.detect{|ext| File.exist?(target + ext)} if PLATFORM == "m68k-human" mfile.printf "\ $(DLLIB): $(OBJS) @@ -499,11 +498,11 @@ def extmake(target) $extlist.push [$static,target] end if $install - system "make install DESTDIR=#{$destdir}" + system "#{$make} install DESTDIR=#{$destdir}" elsif $clean - system "make clean" + system "#{$make} clean" else - system "make all" or exit + system "#{$make} all" or exit end end if $static @@ -518,6 +517,9 @@ def extmake(target) end end +$make = ENV["MAKE"] +$make ||= with_config("make-prog", "make") + # get static-link modules $static_ext = {} for setup in ["@setup@", "#{$top_srcdir}/ext/@setup@"] @@ -620,7 +622,7 @@ if $extlist.size > 0 if PLATFORM =~ /m68k-human|beos/ $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs end - system format(%[make #{ruby} EXTOBJS="%s" EXTLIBS="%s"], $extobjs, $extlibs) + system format(%[#{$make} #{ruby} EXTOBJS="%s" EXTLIBS="%s"], $extobjs, $extlibs) else Dir.chdir ".." if older(ruby, miniruby) diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb index c71adcb220..1311476c5d 100644 --- a/ext/pty/expect_sample.rb +++ b/ext/pty/expect_sample.rb @@ -11,7 +11,7 @@ require 'expect' fnames = [] PTY.spawn("ftp ftp.netlab.co.jp") do - |r_f,w_f| + |r_f,w_f,pid| w_f.sync = true $expect_verbose = true diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb index de9517ec0c..63383f7faf 100644 --- a/ext/pty/extconf.rb +++ b/ext/pty/extconf.rb @@ -2,6 +2,7 @@ require 'mkmf' have_header("sys/stropts.h") have_func("setresuid") +$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === PLATFORM if have_func("openpty") or have_func("_getpty") or have_func("ioctl") diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 8184b90185..0d3ba7f060 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -365,14 +365,18 @@ getDevice(master,slave) if(unlockpt(i) != -1) { if((pn = ptsname(i)) != NULL) { if((j = open(pn, O_RDWR, 0)) != -1) { +#if defined I_PUSH if(ioctl(j, I_PUSH, "ptem") != -1) { if(ioctl(j, I_PUSH, "ldterm") != -1) { +#endif *master = i; *slave = j; strcpy(SlaveName, pn); return; +#if defined I_PUSH } } +#endif } } } diff --git a/ext/pty/script.rb b/ext/pty/script.rb index 6c4027e6b3..6aaafec061 100644 --- a/ext/pty/script.rb +++ b/ext/pty/script.rb @@ -11,7 +11,7 @@ logfile = File.open(ofile,"a") system "stty -echo raw lnext ^_" PTY.spawn("/bin/csh") do - |r_pty,w_pty| + |r_pty,w_pty,pid| Thread.new do while true diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 0526e319ec..37d8de5cbb 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -251,7 +251,6 @@ end if have_getaddrinfo $CFLAGS="-DHAVE_GETADDRINFO "+$CFLAGS else - sockaddr_storage=true $CFLAGS="-I. "+$CFLAGS $objs += "getaddrinfo.o" $objs += "getnameinfo.o" diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index cdc3de52e4..e9ff9235e1 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -160,7 +160,10 @@ if (pai->ai_flags & AI_CANONNAME) {\ char *p;\ if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\ ((afd)->a_socklen)))\ - == NULL) goto free;\ + == NULL) {\ + error = EAI_MEMORY;\ + goto free;\ + }\ memcpy(ai, pai, sizeof(struct addrinfo));\ (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ memset((ai)->ai_addr, 0, (afd)->a_socklen);\ @@ -394,6 +397,7 @@ getaddrinfo(hostname, servname, hints, res) */ if (hostname == NULL) { struct afd *afd; + int s; for (afd = &afdl[0]; afd->a_af; afd++) { if (!(pai->ai_family == PF_UNSPEC @@ -401,6 +405,15 @@ getaddrinfo(hostname, servname, hints, res) continue; } + /* + * filter out AFs that are not supported by the kernel + * XXX errno? + */ + s = socket(afd->a_af, SOCK_DGRAM, 0); + if (s < 0) + continue; + close(s); + if (pai->ai_flags & AI_PASSIVE) { GET_AI(cur->ai_next, afd, afd->a_addrany, port); /* xxx meaningless? diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 1f19b05d26..980c00bb01 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -72,6 +72,12 @@ int Rconnect(); #define INET_SERVER 1 #define INET_SOCKS 2 +#ifndef INET6 +# undef ss_family +# define sockaddr_storage sockaddr +# define ss_family sa_family +#endif + #ifdef NT static void sock_finalize(fptr) @@ -692,7 +698,7 @@ static VALUE tcp_s_gethostbyname(obj, host) VALUE obj, host; { - struct sockaddr addr; + struct sockaddr_storage addr; struct hostent *h; char **pch; VALUE ary, names; @@ -709,7 +715,7 @@ tcp_s_gethostbyname(obj, host) else { setipaddr(STR2CSTR(host), (struct sockaddr *)&addr); } - switch (addr.sa_family) { + switch (addr.ss_family) { case AF_INET: { struct sockaddr_in *sin; @@ -752,7 +758,7 @@ tcp_s_gethostbyname(obj, host) rb_ary_push(ary, INT2NUM(h->h_addrtype)); #ifdef h_addr for (pch = h->h_addr_list; *pch; pch++) { - switch (addr.sa_family) { + switch (addr.ss_family) { case AF_INET: { struct sockaddr_in sin; @@ -787,7 +793,7 @@ tcp_s_gethostbyname(obj, host) } #else memcpy((char *)&addr.sin_addr, h->h_addr, h->h_length); - rb_ary_push(ary, mkipaddr(addr.sin_addr.s_addr)); + rb_ary_push(ary, mkipaddr((struct sockaddr *)&addr)); #endif return ary; @@ -844,7 +850,7 @@ tcp_accept(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr from; + struct sockaddr_storage from; int fromlen; GetOpenFile(sock, fptr); @@ -910,7 +916,7 @@ ip_addr(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr addr; + struct sockaddr_storage addr; int len = sizeof addr; GetOpenFile(sock, fptr); @@ -925,7 +931,7 @@ ip_peeraddr(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr addr; + struct sockaddr_storage addr; int len = sizeof addr; GetOpenFile(sock, fptr); @@ -939,7 +945,7 @@ static VALUE ip_s_getaddress(obj, host) VALUE obj, host; { - struct sockaddr addr; + struct sockaddr_storage addr; if (rb_obj_is_kind_of(host, rb_cInteger)) { long i = NUM2LONG(host); @@ -1049,7 +1055,6 @@ static VALUE udp_bind(sock, host, port) VALUE sock, host, port; { - struct sockaddr addr; OpenFile *fptr; struct addrinfo *res0, *res; @@ -1514,7 +1519,7 @@ static VALUE sock_s_gethostbyname(obj, host) VALUE obj, host; { - struct sockaddr addr; + struct sockaddr_storage addr; struct hostent *h; if (rb_obj_is_kind_of(host, rb_cInteger)) { @@ -1529,7 +1534,7 @@ sock_s_gethostbyname(obj, host) else { setipaddr(STR2CSTR(host), (struct sockaddr *)&addr); } - switch (addr.sa_family) { + switch (addr.ss_family) { case AF_INET: { struct sockaddr_in *sin; @@ -1685,7 +1690,7 @@ sock_s_getnameinfo(argc, argv) int fl; struct addrinfo hints, *res = NULL; int error; - struct sockaddr ss; + struct sockaddr_storage ss; struct sockaddr *sap; sa = flags = Qnil; @@ -1696,7 +1701,7 @@ sock_s_getnameinfo(argc, argv) rb_raise(rb_eTypeError, "sockaddr length too big"); } memcpy(&ss, RSTRING(sa)->ptr, RSTRING(sa)->len); - if (RSTRING(sa)->len != SA_LEN(&ss)) { + if (RSTRING(sa)->len != SA_LEN((struct sockaddr *)&ss)) { rb_raise(rb_eTypeError, "sockaddr size differs - should not happen"); } sap = (struct sockaddr *)&ss; @@ -1072,15 +1072,26 @@ call_final(os, obj) return obj; } +static VALUE +run_single_final(args) + VALUE *args; +{ + rb_eval_cmd(args[0], args[1]); + return Qnil; +} + static void run_final(obj) VALUE obj; { - int i; + int i, status; + VALUE args[2]; obj = rb_obj_id(obj); /* make obj into id */ + args[1] = rb_ary_new3(1, obj); for (i=0; i<RARRAY(finalizers)->len; i++) { - rb_eval_cmd(RARRAY(finalizers)->ptr[i], rb_ary_new3(1, obj)); + args[0] = RARRAY(finalizers)->ptr[i]; + rb_protect(run_single_final, (VALUE)args, &status); } } @@ -193,7 +193,6 @@ rb_hash_s_new(argc, argv, klass) VALUE klass; { VALUE ifnone; - int size; NEWOBJ(hash, struct RHash); OBJSETUP(hash, klass, T_HASH); @@ -857,7 +856,7 @@ static VALUE env_delete(obj, name) VALUE obj, name; { - int i, len; + int len; char *nam, *val; rb_secure(4); @@ -6,18 +6,18 @@ void rb_mem_clear _((register VALUE*, register size_t)); VALUE rb_assoc_new _((VALUE, VALUE)); VALUE rb_ary_new _((void)); -VALUE rb_ary_new2 _((int)); -VALUE rb_ary_new3 __((int,...)); -VALUE rb_ary_new4 _((int, VALUE *)); +VALUE rb_ary_new2 _((long)); +VALUE rb_ary_new3 __((long,...)); +VALUE rb_ary_new4 _((long, VALUE *)); VALUE rb_ary_freeze _((VALUE)); VALUE rb_ary_aref _((int, VALUE*, VALUE)); -void rb_ary_store _((VALUE, int, VALUE)); +void rb_ary_store _((VALUE, long, VALUE)); VALUE rb_ary_to_s _((VALUE)); VALUE rb_ary_push _((VALUE, VALUE)); VALUE rb_ary_pop _((VALUE)); VALUE rb_ary_shift _((VALUE)); VALUE rb_ary_unshift _((VALUE, VALUE)); -VALUE rb_ary_entry _((VALUE, int)); +VALUE rb_ary_entry _((VALUE, long)); VALUE rb_ary_each _((VALUE)); VALUE rb_ary_join _((VALUE, VALUE)); VALUE rb_ary_print_on _((VALUE, VALUE)); @@ -83,7 +83,7 @@ VALUE rb_singleton_class _((VALUE)); VALUE rb_enum_length _((VALUE)); /* error.c */ extern int ruby_nerrs; -VALUE rb_exc_new _((VALUE, const char*, int)); +VALUE rb_exc_new _((VALUE, const char*, long)); VALUE rb_exc_new2 _((VALUE, const char*)); VALUE rb_exc_new3 _((VALUE, VALUE)); void rb_loaderror __((const char*, ...)) NORETURN; @@ -127,6 +127,7 @@ void rb_thread_stop_timer _((void)); void rb_thread_schedule _((void)); void rb_thread_wait_fd _((int)); int rb_thread_fd_writable _((int)); +void rb_thread_fd_close _((int)); int rb_thread_alone _((void)); void rb_thread_sleep _((int)); void rb_thread_sleep_forever _((void)); @@ -221,7 +222,7 @@ int rb_proc_exec _((const char*)); void rb_syswait _((int)); /* range.c */ VALUE rb_range_new _((VALUE, VALUE, int)); -VALUE rb_range_beg_len _((VALUE, int*, int*, int, int)); +VALUE rb_range_beg_len _((VALUE, long*, long*, long, int)); /* re.c */ VALUE rb_reg_nth_defined _((int, VALUE)); VALUE rb_reg_nth_match _((int, VALUE)); @@ -229,13 +230,14 @@ VALUE rb_reg_last_match _((VALUE)); VALUE rb_reg_match_pre _((VALUE)); VALUE rb_reg_match_post _((VALUE)); VALUE rb_reg_match_last _((VALUE)); -VALUE rb_reg_new _((const char*, int, int)); +VALUE rb_reg_new _((const char*, long, int)); VALUE rb_reg_match _((VALUE, VALUE)); VALUE rb_reg_match2 _((VALUE)); int rb_reg_options _((VALUE)); const char* rb_get_kcode _((void)); void rb_set_kcode _((const char*)); int rb_ignorecase_p _((void)); +void rb_match_busy _((VALUE, int)); /* ruby.c */ extern VALUE rb_argv0; void rb_load_file _((char*)); @@ -257,22 +259,22 @@ void rb_trap_exec _((void)); /* sprintf.c */ VALUE rb_f_sprintf _((int, VALUE*)); /* string.c */ -VALUE rb_str_new _((const char*, int)); +VALUE rb_str_new _((const char*, long)); VALUE rb_str_new2 _((const char*)); VALUE rb_str_new3 _((VALUE)); VALUE rb_str_new4 _((VALUE)); -VALUE rb_tainted_str_new _((const char*, int)); +VALUE rb_tainted_str_new _((const char*, long)); VALUE rb_tainted_str_new2 _((const char*)); VALUE rb_obj_as_string _((VALUE)); VALUE rb_str_to_str _((VALUE)); VALUE rb_str_dup _((VALUE)); VALUE rb_str_plus _((VALUE, VALUE)); VALUE rb_str_times _((VALUE, VALUE)); -VALUE rb_str_substr _((VALUE, int, int)); +VALUE rb_str_substr _((VALUE, long, long)); void rb_str_modify _((VALUE)); VALUE rb_str_freeze _((VALUE)); -VALUE rb_str_resize _((VALUE, int)); -VALUE rb_str_cat _((VALUE, const char*, int)); +VALUE rb_str_resize _((VALUE, long)); +VALUE rb_str_cat _((VALUE, const char*, long)); VALUE rb_str_concat _((VALUE, VALUE)); int rb_str_hash _((VALUE)); int rb_str_cmp _((VALUE, VALUE)); diff --git a/lib/debug.rb b/lib/debug.rb index 430d6472f6..ada7170e62 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -267,6 +267,6 @@ class DEBUGGER__ CONTEXT = new end -set_trace_func proc{|event, file, line, id, binding| +set_trace_func proc{|event, file, line, id, binding,*rest| DEBUGGER__::CONTEXT.trace_func event, file, line, id, binding } diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb index 98a73ae3db..a37714cafd 100644 --- a/lib/getoptlong.rb +++ b/lib/getoptlong.rb @@ -75,7 +75,7 @@ class GetoptLong # # Whether error messages are output to stderr. # - @quiet_flag = FALSE + @quiet = FALSE # # Status code. @@ -259,7 +259,7 @@ class GetoptLong # Set an error (protected). # def set_error(type, message) - $stderr.print("#{$0}: #{message}\n") if !@quiet_flag + $stderr.print("#{$0}: #{message}\n") if !@quiet @error = type @error_message = message diff --git a/lib/mkmf.rb b/lib/mkmf.rb index ad9e8393aa..98ab7e4670 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -35,10 +35,9 @@ $libdir = CONFIG["libdir"]+"/ruby/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] $archdir = $libdir+"/"+CONFIG["arch"] $install = CONFIG["INSTALL_PROGRAM"] $install_data = CONFIG["INSTALL_DATA"] -$ruby_inc = $archdir if $install =~ %r!^[^\s/]+/! then - $install = CONFIG["srcdir"]+"/"+$install - $install_data = CONFIG["srcdir"]+"/"+$install_data + $install = CONFIG["compile_dir"]+"/"+$install + $install_data = CONFIG["compile_dir"]+"/"+$install_data end if File.exist? $archdir + "/ruby.h" @@ -361,7 +360,6 @@ prefix = #{CONFIG["prefix"]} exec_prefix = #{CONFIG["exec_prefix"]} libdir = #{$libdir} archdir = #{$archdir} -ruby_inc = #{$ruby_inc} #### End of system configuration section. #### diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index d017030d94..46b23be21c 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -235,6 +235,7 @@ The variable ruby-indent-level controls the amount of indentation. (narrow-to-region (point) end) (while (and (> indent-point (point)) (re-search-forward ruby-delimiter indent-point t)) + (or depth (setq depth 0)) (let ((pnt (point)) w) (goto-char (match-beginning 0)) (cond @@ -130,7 +130,7 @@ rb_any_to_s(obj) VALUE str; s = ALLOCA_N(char, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:eos */ - sprintf(s, "#<%s:0x%x>", cname, obj); + sprintf(s, "#<%s:0x%lx>", cname, obj); str = rb_str_new2(s); if (OBJ_TAINTED(obj)) OBJ_TAINT(str); @@ -1348,15 +1348,15 @@ pack_unpack(str, fmt) b64_xtable[i] = -1; } for (i = 0; i < 64; i++) { - b64_xtable[b64_table[i]] = i; + b64_xtable[(int)b64_table[i]] = i; } } for (;;) { while (s[0] == '\r' || s[0] == '\n') { s++; } - if ((a = b64_xtable[s[0]]) == -1) break; - if ((b = b64_xtable[s[1]]) == -1) break; - if ((c = b64_xtable[s[2]]) == -1) break; - if ((d = b64_xtable[s[3]]) == -1) break; + if ((a = b64_xtable[(int)s[0]]) == -1) break; + if ((b = b64_xtable[(int)s[1]]) == -1) break; + if ((c = b64_xtable[(int)s[2]]) == -1) break; + if ((d = b64_xtable[(int)s[3]]) == -1) break; *ptr++ = a << 2 | b >> 4; *ptr++ = b << 4 | c >> 2; *ptr++ = c << 6 | d; @@ -265,40 +265,40 @@ static const short yyprhs[] = { 0, 26, 30, 34, 38, 41, 45, 49, 53, 57, 58, 64, 69, 73, 75, 79, 82, 85, 87, 91, 95, 98, 101, 103, 106, 111, 116, 119, 121, 125, 127, - 131, 133, 137, 140, 146, 149, 151, 155, 158, 160, - 164, 166, 171, 175, 177, 179, 184, 188, 190, 192, - 194, 196, 198, 200, 202, 204, 206, 207, 212, 214, - 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, - 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, - 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, - 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, - 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, - 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, - 336, 338, 340, 342, 344, 346, 350, 351, 356, 363, - 369, 375, 379, 383, 387, 391, 395, 399, 403, 407, - 411, 414, 417, 421, 425, 429, 433, 437, 441, 445, - 449, 453, 457, 461, 465, 469, 472, 475, 479, 483, - 487, 491, 492, 497, 503, 505, 507, 509, 512, 514, - 517, 520, 526, 529, 532, 538, 543, 548, 556, 560, - 562, 565, 568, 570, 572, 574, 576, 580, 582, 587, - 590, 592, 594, 597, 599, 603, 606, 608, 610, 612, - 614, 616, 618, 620, 625, 629, 633, 638, 642, 644, - 649, 653, 655, 656, 663, 665, 668, 670, 673, 680, - 687, 693, 699, 704, 712, 719, 723, 724, 731, 732, - 740, 741, 747, 748, 755, 756, 757, 767, 769, 771, - 773, 775, 777, 779, 782, 784, 786, 788, 794, 796, - 799, 801, 803, 805, 808, 810, 814, 815, 821, 822, - 828, 830, 832, 834, 836, 838, 841, 846, 853, 857, - 864, 868, 873, 875, 877, 879, 885, 887, 892, 895, - 897, 899, 905, 907, 909, 912, 914, 917, 919, 921, - 923, 925, 927, 929, 931, 933, 935, 937, 939, 941, - 943, 945, 947, 949, 951, 953, 955, 957, 958, 963, - 966, 971, 974, 981, 986, 991, 994, 999, 1002, 1005, - 1007, 1008, 1010, 1014, 1018, 1020, 1024, 1027, 1030, 1033, - 1035, 1037, 1038, 1044, 1046, 1049, 1052, 1054, 1058, 1062, - 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, - 1084, 1086, 1087, 1089, 1090, 1092, 1093, 1095, 1097, 1099, - 1101, 1103, 1106 + 131, 133, 137, 140, 143, 149, 154, 157, 159, 161, + 165, 168, 170, 174, 176, 181, 185, 187, 189, 194, + 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, + 217, 222, 224, 226, 228, 230, 232, 234, 236, 238, + 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, + 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, + 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, + 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, + 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, + 340, 342, 344, 346, 348, 350, 352, 354, 356, 360, + 361, 366, 373, 379, 385, 389, 393, 397, 401, 405, + 409, 413, 417, 421, 424, 427, 431, 435, 439, 443, + 447, 451, 455, 459, 463, 467, 471, 475, 479, 482, + 485, 489, 493, 497, 501, 502, 507, 513, 515, 517, + 519, 522, 524, 527, 530, 536, 539, 542, 548, 553, + 558, 566, 570, 572, 575, 578, 580, 582, 584, 586, + 590, 592, 597, 600, 602, 604, 607, 609, 613, 616, + 618, 620, 622, 624, 626, 628, 630, 635, 639, 643, + 648, 652, 654, 659, 663, 665, 666, 673, 675, 678, + 680, 683, 690, 697, 703, 709, 714, 722, 729, 733, + 734, 741, 742, 750, 751, 757, 758, 765, 766, 767, + 777, 779, 781, 783, 785, 787, 789, 792, 794, 796, + 798, 804, 806, 809, 811, 813, 815, 818, 820, 824, + 825, 831, 832, 838, 840, 842, 844, 846, 848, 851, + 856, 863, 867, 874, 878, 883, 885, 887, 889, 895, + 897, 902, 905, 907, 909, 915, 917, 919, 922, 924, + 927, 929, 931, 933, 935, 937, 939, 941, 943, 945, + 947, 949, 951, 953, 955, 957, 959, 961, 963, 965, + 967, 968, 973, 976, 981, 984, 991, 996, 1001, 1004, + 1009, 1012, 1015, 1017, 1018, 1020, 1024, 1028, 1030, 1034, + 1037, 1039, 1042, 1045, 1047, 1049, 1050, 1056, 1058, 1061, + 1064, 1066, 1070, 1074, 1076, 1078, 1080, 1082, 1084, 1086, + 1088, 1090, 1092, 1094, 1096, 1098, 1099, 1101, 1102, 1104, + 1105, 1107, 1109, 1111, 1113, 1115, 1118 }; static const short yyrhs[] = { -1, @@ -315,8 +315,9 @@ static const short yyrhs[] = { -1, 141, 0, 202, 146, 0, 154, 109, 203, 146, 0, 154, 81, 203, 146, 0, 29, 146, 0, 129, 0, 85, 128, 110, 0, 129, 0, 85, 128, 110, 0, - 131, 0, 131, 88, 134, 0, 131, 132, 0, 131, - 132, 111, 88, 134, 0, 88, 133, 0, 133, 0, + 131, 0, 131, 88, 134, 0, 131, 88, 0, 131, + 132, 0, 131, 132, 111, 88, 134, 0, 131, 132, + 111, 88, 0, 88, 133, 0, 88, 0, 133, 0, 85, 128, 110, 0, 130, 111, 0, 130, 0, 132, 111, 130, 0, 184, 0, 154, 112, 144, 113, 0, 154, 109, 47, 0, 186, 0, 184, 0, 154, 112, @@ -404,15 +405,15 @@ static const short yyrhs[] = { -1, 191, 196, 0, 193, 111, 194, 196, 0, 193, 196, 0, 194, 196, 0, 195, 0, 0, 47, 0, 191, 111, 47, 0, 47, 91, 141, 0, 192, 0, 193, - 111, 192, 0, 88, 47, 0, 89, 47, 0, 111, - 195, 0, 211, 0, 185, 0, 0, 115, 198, 125, - 207, 110, 0, 211, 0, 200, 208, 0, 150, 208, - 0, 201, 0, 200, 111, 201, 0, 141, 84, 141, - 0, 47, 0, 51, 0, 48, 0, 47, 0, 51, - 0, 48, 0, 139, 0, 47, 0, 48, 0, 139, - 0, 109, 0, 81, 0, 0, 210, 0, 0, 116, - 0, 0, 116, 0, 111, 0, 117, 0, 116, 0, - 209, 0, 210, 117, 0, 0 + 111, 192, 0, 88, 47, 0, 88, 0, 89, 47, + 0, 111, 195, 0, 211, 0, 185, 0, 0, 115, + 198, 125, 207, 110, 0, 211, 0, 200, 208, 0, + 150, 208, 0, 201, 0, 200, 111, 201, 0, 141, + 84, 141, 0, 47, 0, 51, 0, 48, 0, 47, + 0, 51, 0, 48, 0, 139, 0, 47, 0, 48, + 0, 139, 0, 109, 0, 81, 0, 0, 210, 0, + 0, 116, 0, 0, 116, 0, 111, 0, 117, 0, + 116, 0, 209, 0, 210, 117, 0, 0 }; #endif @@ -423,40 +424,40 @@ static const short yyrline[] = { 0, 292, 298, 307, 312, 318, 324, 330, 340, 350, 357, 364, 372, 377, 379, 385, 392, 397, 398, 402, 406, 411, 416, 418, 423, 429, 435, 443, 444, 449, 450, - 455, 459, 463, 467, 471, 476, 477, 482, 487, 491, - 496, 500, 504, 508, 514, 518, 522, 526, 532, 536, - 538, 539, 540, 541, 546, 552, 556, 557, 561, 562, - 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, - 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, - 583, 584, 585, 586, 587, 589, 589, 589, 589, 590, - 590, 590, 590, 590, 590, 590, 591, 591, 591, 591, - 591, 591, 591, 592, 592, 592, 592, 592, 592, 592, - 593, 593, 593, 593, 593, 593, 593, 594, 594, 594, - 594, 594, 594, 595, 595, 597, 602, 603, 618, 633, - 644, 655, 660, 664, 668, 672, 676, 680, 684, 688, + 455, 459, 463, 467, 471, 475, 479, 483, 488, 489, + 494, 499, 503, 508, 512, 516, 520, 526, 530, 534, + 538, 544, 548, 550, 551, 552, 553, 558, 564, 568, + 569, 573, 574, 575, 576, 577, 578, 579, 580, 581, + 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + 592, 593, 594, 595, 596, 597, 598, 599, 601, 601, + 601, 601, 602, 602, 602, 602, 602, 602, 602, 603, + 603, 603, 603, 603, 603, 603, 604, 604, 604, 604, + 604, 604, 604, 605, 605, 605, 605, 605, 605, 605, + 606, 606, 606, 606, 606, 606, 607, 607, 609, 614, + 615, 630, 645, 656, 667, 672, 676, 680, 684, 688, 692, 696, 700, 704, 708, 712, 716, 720, 724, 728, - 732, 736, 740, 744, 748, 752, 757, 761, 765, 769, - 773, 777, 778, 782, 788, 793, 801, 802, 804, 809, - 813, 817, 822, 826, 831, 836, 841, 845, 850, 855, - 857, 863, 867, 869, 870, 872, 877, 883, 895, 900, - 906, 920, 921, 923, 927, 932, 936, 940, 941, 945, - 946, 947, 948, 949, 954, 962, 966, 973, 979, 985, - 990, 994, 998, 998, 1003, 1007, 1012, 1013, 1022, 1031, - 1040, 1048, 1056, 1064, 1072, 1092, 1096, 1106, 1114, 1121, - 1129, 1138, 1146, 1154, 1163, 1164, 1171, 1179, 1183, 1187, - 1191, 1196, 1197, 1198, 1200, 1201, 1203, 1204, 1213, 1214, - 1219, 1220, 1222, 1223, 1227, 1231, 1236, 1241, 1249, 1254, - 1261, 1265, 1269, 1273, 1274, 1276, 1286, 1291, 1297, 1303, - 1309, 1314, 1321, 1330, 1331, 1333, 1340, 1341, 1346, 1352, - 1353, 1355, 1362, 1364, 1365, 1370, 1371, 1376, 1378, 1379, - 1380, 1382, 1383, 1385, 1386, 1387, 1388, 1389, 1390, 1391, - 1392, 1393, 1394, 1396, 1401, 1402, 1404, 1408, 1412, 1416, - 1418, 1423, 1428, 1432, 1436, 1440, 1444, 1448, 1452, 1456, - 1460, 1465, 1472, 1480, 1487, 1492, 1497, 1504, 1509, 1513, - 1515, 1528, 1528, 1546, 1547, 1551, 1559, 1560, 1565, 1570, - 1571, 1572, 1574, 1575, 1576, 1577, 1579, 1580, 1581, 1583, - 1584, 1586, 1587, 1589, 1590, 1592, 1593, 1594, 1596, 1597, - 1599, 1600, 1602 + 732, 736, 740, 744, 748, 752, 756, 760, 764, 769, + 773, 777, 781, 785, 789, 790, 794, 800, 805, 813, + 814, 816, 821, 825, 829, 834, 838, 843, 848, 853, + 857, 862, 867, 869, 875, 879, 881, 882, 884, 889, + 895, 907, 912, 918, 932, 933, 935, 939, 944, 948, + 952, 953, 957, 958, 959, 960, 961, 966, 974, 978, + 985, 991, 997, 1002, 1006, 1010, 1010, 1015, 1019, 1024, + 1025, 1034, 1043, 1052, 1060, 1068, 1076, 1084, 1104, 1108, + 1118, 1126, 1133, 1141, 1150, 1158, 1166, 1175, 1176, 1183, + 1191, 1195, 1199, 1203, 1208, 1209, 1210, 1212, 1213, 1215, + 1216, 1225, 1226, 1231, 1232, 1234, 1235, 1239, 1243, 1248, + 1253, 1261, 1266, 1273, 1277, 1281, 1285, 1286, 1288, 1298, + 1303, 1309, 1315, 1321, 1326, 1333, 1342, 1343, 1345, 1352, + 1353, 1358, 1364, 1365, 1367, 1374, 1376, 1377, 1382, 1383, + 1388, 1390, 1391, 1392, 1394, 1395, 1397, 1398, 1399, 1400, + 1401, 1402, 1403, 1404, 1405, 1406, 1408, 1413, 1414, 1416, + 1420, 1424, 1428, 1430, 1435, 1440, 1444, 1448, 1452, 1456, + 1460, 1464, 1468, 1472, 1477, 1484, 1492, 1499, 1504, 1509, + 1515, 1520, 1525, 1529, 1531, 1544, 1544, 1562, 1563, 1567, + 1575, 1576, 1581, 1586, 1587, 1588, 1590, 1591, 1592, 1593, + 1595, 1596, 1597, 1599, 1600, 1602, 1603, 1605, 1606, 1608, + 1609, 1610, 1612, 1613, 1615, 1616, 1618 }; #endif @@ -496,40 +497,40 @@ static const short yyr1[] = { 0, 122, 122, 122, 122, 122, 122, 122, 122, 124, 122, 122, 122, 122, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 127, 127, 128, 128, - 129, 129, 129, 129, 129, 130, 130, 131, 132, 132, - 133, 133, 133, 133, 134, 134, 134, 134, 135, 135, - 136, 136, 136, 136, 136, 137, 138, 137, 139, 139, + 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, + 131, 132, 132, 133, 133, 133, 133, 134, 134, 134, + 134, 135, 135, 136, 136, 136, 136, 136, 137, 138, + 137, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, + 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 141, 142, 141, 141, 141, + 140, 140, 140, 140, 140, 140, 140, 140, 141, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, - 141, 143, 141, 141, 141, 144, 145, 145, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 147, 148, 148, 149, 149, 150, 150, 151, 151, 151, - 152, 153, 153, 154, 154, 154, 154, 154, 154, 154, + 141, 141, 141, 141, 143, 141, 141, 141, 144, 145, + 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 147, 148, 148, 149, 149, 150, 150, + 151, 151, 151, 152, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 155, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 156, 154, 157, 154, - 158, 154, 159, 154, 160, 161, 154, 154, 154, 154, - 154, 162, 162, 162, 163, 163, 164, 164, 165, 165, - 166, 166, 167, 167, 167, 167, 169, 168, 171, 170, - 172, 172, 172, 172, 172, 173, 174, 174, 174, 174, - 174, 174, 174, 175, 175, 176, 177, 177, 177, 178, - 178, 179, 179, 180, 180, 181, 181, 181, 182, 182, - 182, 183, 183, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 185, 186, 186, 187, 188, 187, 187, - 189, 189, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 191, 191, 192, 193, 193, 194, 195, 196, 196, - 197, 198, 197, 199, 199, 199, 200, 200, 201, 202, - 202, 202, 203, 203, 203, 203, 204, 204, 204, 205, - 205, 206, 206, 207, 207, 208, 208, 208, 209, 209, - 210, 210, 211 + 154, 154, 154, 154, 154, 155, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 154, 156, + 154, 157, 154, 158, 154, 159, 154, 160, 161, 154, + 154, 154, 154, 154, 162, 162, 162, 163, 163, 164, + 164, 165, 165, 166, 166, 167, 167, 167, 167, 169, + 168, 171, 170, 172, 172, 172, 172, 172, 173, 174, + 174, 174, 174, 174, 174, 174, 175, 175, 176, 177, + 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, + 181, 182, 182, 182, 183, 183, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 185, 186, 186, 187, + 188, 187, 187, 189, 189, 190, 190, 190, 190, 190, + 190, 190, 190, 190, 191, 191, 192, 193, 193, 194, + 194, 195, 196, 196, 197, 198, 197, 199, 199, 199, + 200, 200, 201, 202, 202, 202, 203, 203, 203, 203, + 204, 204, 204, 205, 205, 206, 206, 207, 207, 208, + 208, 208, 209, 209, 210, 210, 211 }; static const short yyr2[] = { 0, @@ -537,108 +538,108 @@ static const short yyr2[] = { 0, 3, 3, 3, 2, 3, 3, 3, 3, 0, 5, 4, 3, 1, 3, 2, 2, 1, 3, 3, 2, 2, 1, 2, 4, 4, 2, 1, 3, 1, 3, - 1, 3, 2, 5, 2, 1, 3, 2, 1, 3, - 1, 4, 3, 1, 1, 4, 3, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 4, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 2, 2, 5, 4, 2, 1, 1, 3, + 2, 1, 3, 1, 4, 3, 1, 1, 4, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 0, 4, 6, 5, - 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, - 3, 0, 4, 5, 1, 1, 1, 2, 1, 2, - 2, 5, 2, 2, 5, 4, 4, 7, 3, 1, - 2, 2, 1, 1, 1, 1, 3, 1, 4, 2, - 1, 1, 2, 1, 3, 2, 1, 1, 1, 1, - 1, 1, 1, 4, 3, 3, 4, 3, 1, 4, - 3, 1, 0, 6, 1, 2, 1, 2, 6, 6, - 5, 5, 4, 7, 6, 3, 0, 6, 0, 7, - 0, 5, 0, 6, 0, 0, 9, 1, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 5, 1, 2, - 1, 1, 1, 2, 1, 3, 0, 5, 0, 5, - 1, 1, 1, 1, 1, 2, 4, 6, 3, 6, - 3, 4, 1, 1, 1, 5, 1, 4, 2, 1, - 1, 5, 1, 1, 2, 1, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, + 4, 6, 5, 5, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, + 3, 3, 3, 3, 0, 4, 5, 1, 1, 1, + 2, 1, 2, 2, 5, 2, 2, 5, 4, 4, + 7, 3, 1, 2, 2, 1, 1, 1, 1, 3, + 1, 4, 2, 1, 1, 2, 1, 3, 2, 1, + 1, 1, 1, 1, 1, 1, 4, 3, 3, 4, + 3, 1, 4, 3, 1, 0, 6, 1, 2, 1, + 2, 6, 6, 5, 5, 4, 7, 6, 3, 0, + 6, 0, 7, 0, 5, 0, 6, 0, 0, 9, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, + 5, 1, 2, 1, 1, 1, 2, 1, 3, 0, + 5, 0, 5, 1, 1, 1, 1, 1, 2, 4, + 6, 3, 6, 3, 4, 1, 1, 1, 5, 1, + 4, 2, 1, 1, 5, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 4, 2, - 4, 2, 6, 4, 4, 2, 4, 2, 2, 1, - 0, 1, 3, 3, 1, 3, 2, 2, 2, 1, - 1, 0, 5, 1, 2, 2, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, - 1, 2, 0 + 0, 4, 2, 4, 2, 6, 4, 4, 2, 4, + 2, 2, 1, 0, 1, 3, 3, 1, 3, 2, + 1, 2, 2, 1, 1, 0, 5, 1, 2, 2, + 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1, 2, 0 }; static const short yydefact[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 248, 249, 250, 251, 219, 222, 283, - 309, 308, 310, 311, 0, 0, 364, 19, 0, 313, - 312, 350, 352, 306, 305, 351, 302, 303, 207, 209, - 298, 208, 210, 211, 315, 316, 0, 0, 0, 0, - 373, 373, 0, 0, 0, 0, 2, 362, 5, 23, - 27, 0, 37, 0, 41, 46, 0, 32, 175, 0, - 8, 227, 204, 296, 314, 212, 213, 0, 4, 7, - 59, 60, 0, 0, 241, 105, 117, 106, 130, 102, - 123, 112, 111, 128, 110, 109, 104, 133, 114, 103, - 118, 122, 124, 116, 108, 125, 135, 127, 126, 119, - 129, 113, 101, 121, 120, 115, 131, 134, 132, 100, - 107, 98, 99, 96, 97, 61, 63, 62, 91, 92, - 89, 73, 74, 75, 78, 80, 76, 69, 93, 94, - 81, 82, 86, 77, 79, 70, 71, 72, 83, 84, - 85, 87, 88, 90, 95, 342, 243, 64, 65, 314, - 341, 0, 126, 119, 129, 113, 96, 97, 61, 62, - 66, 14, 373, 304, 225, 307, 0, 27, 0, 227, - 0, 0, 0, 0, 219, 222, 283, 364, 262, 261, - 0, 0, 314, 213, 0, 0, 0, 0, 0, 0, - 179, 196, 201, 190, 373, 25, 175, 314, 213, 373, - 347, 0, 26, 373, 36, 30, 0, 9, 365, 172, - 0, 0, 151, 175, 152, 206, 0, 0, 0, 37, - 196, 366, 0, 202, 366, 0, 366, 344, 45, 0, - 51, 54, 301, 300, 299, 297, 31, 166, 167, 370, - 369, 3, 371, 363, 0, 0, 0, 0, 0, 0, - 0, 48, 0, 0, 49, 43, 0, 0, 0, 0, + 0, 0, 0, 251, 252, 253, 254, 222, 225, 286, + 312, 311, 313, 314, 0, 0, 368, 19, 0, 316, + 315, 354, 356, 309, 308, 355, 305, 306, 210, 212, + 301, 211, 213, 214, 318, 319, 0, 0, 0, 0, + 377, 377, 48, 0, 0, 0, 2, 366, 5, 23, + 27, 0, 37, 0, 41, 49, 0, 32, 178, 0, + 8, 230, 207, 299, 317, 215, 216, 0, 4, 7, + 62, 63, 0, 0, 244, 108, 120, 109, 133, 105, + 126, 115, 114, 131, 113, 112, 107, 136, 117, 106, + 121, 125, 127, 119, 111, 128, 138, 130, 129, 122, + 132, 116, 104, 124, 123, 118, 134, 137, 135, 103, + 110, 101, 102, 99, 100, 64, 66, 65, 94, 95, + 92, 76, 77, 78, 81, 83, 79, 72, 96, 97, + 84, 85, 89, 80, 82, 73, 74, 75, 86, 87, + 88, 90, 91, 93, 98, 346, 246, 67, 68, 317, + 345, 0, 129, 122, 132, 116, 99, 100, 64, 65, + 69, 14, 377, 307, 228, 310, 0, 27, 0, 230, + 0, 0, 0, 0, 222, 225, 286, 368, 265, 264, + 0, 0, 317, 216, 0, 0, 0, 0, 0, 0, + 182, 199, 204, 193, 377, 25, 178, 317, 216, 377, + 351, 0, 26, 377, 36, 30, 0, 9, 369, 175, + 0, 0, 154, 178, 155, 209, 0, 0, 0, 37, + 199, 370, 0, 205, 370, 0, 370, 348, 47, 0, + 54, 57, 304, 303, 302, 300, 31, 169, 170, 374, + 373, 3, 375, 367, 0, 0, 0, 0, 0, 0, + 0, 51, 0, 43, 52, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 373, 267, 276, 269, 228, - 137, 0, 373, 33, 226, 0, 0, 318, 237, 317, - 0, 0, 331, 361, 360, 245, 67, 373, 373, 293, - 253, 0, 252, 0, 0, 0, 0, 256, 0, 255, - 0, 0, 0, 0, 373, 0, 373, 191, 218, 0, - 0, 180, 181, 193, 0, 373, 183, 184, 221, 0, - 0, 364, 177, 11, 13, 12, 0, 223, 0, 0, - 0, 0, 0, 236, 38, 368, 367, 203, 215, 346, - 216, 368, 345, 0, 373, 372, 6, 15, 16, 17, - 18, 28, 29, 0, 198, 24, 0, 42, 0, 55, - 58, 0, 285, 136, 284, 22, 150, 156, 161, 162, - 163, 158, 160, 170, 171, 164, 165, 143, 144, 168, - 169, 0, 157, 159, 153, 154, 155, 145, 146, 147, - 148, 149, 357, 358, 205, 359, 0, 281, 353, 355, - 354, 356, 279, 0, 176, 373, 373, 0, 142, 0, - 239, 320, 0, 0, 0, 364, 332, 0, 0, 331, - 0, 0, 373, 335, 373, 373, 330, 0, 0, 0, - 194, 195, 0, 373, 259, 373, 254, 373, 0, 287, - 0, 233, 0, 0, 0, 353, 354, 279, 0, 0, - 0, 189, 217, 349, 0, 197, 192, 373, 353, 0, - 0, 0, 348, 220, 282, 178, 10, 0, 173, 0, - 21, 38, 197, 53, 0, 200, 0, 47, 0, 373, - 0, 50, 0, 373, 35, 0, 0, 373, 34, 214, - 265, 0, 0, 263, 0, 138, 277, 0, 0, 0, - 242, 0, 0, 337, 338, 364, 0, 322, 0, 326, - 340, 0, 328, 0, 329, 246, 68, 0, 0, 260, - 0, 0, 294, 0, 0, 257, 0, 289, 0, 0, - 231, 232, 214, 0, 373, 187, 186, 214, 373, 0, - 20, 52, 0, 353, 0, 44, 174, 0, 140, 141, - 0, 0, 264, 0, 0, 0, 0, 319, 238, 343, - 334, 0, 244, 333, 373, 373, 339, 0, 336, 373, - 331, 373, 295, 235, 0, 229, 230, 0, 373, 0, - 182, 0, 185, 224, 199, 56, 280, 278, 139, 266, - 268, 270, 240, 321, 0, 324, 325, 327, 0, 292, - 0, 288, 290, 291, 286, 234, 373, 373, 0, 373, - 188, 323, 247, 258, 0, 0, 0 + 0, 0, 0, 0, 0, 377, 270, 279, 272, 231, + 140, 0, 377, 33, 229, 0, 0, 321, 240, 320, + 0, 0, 334, 365, 364, 248, 70, 377, 377, 296, + 256, 0, 255, 0, 0, 0, 0, 259, 0, 258, + 0, 0, 0, 0, 377, 0, 377, 194, 221, 0, + 0, 183, 184, 196, 0, 377, 186, 187, 224, 0, + 0, 368, 180, 11, 13, 12, 0, 226, 0, 0, + 0, 0, 0, 239, 38, 372, 371, 206, 218, 350, + 219, 372, 349, 0, 377, 376, 6, 15, 16, 17, + 18, 28, 29, 0, 201, 24, 0, 42, 0, 58, + 61, 0, 288, 139, 287, 22, 153, 159, 164, 165, + 166, 161, 163, 173, 174, 167, 168, 146, 147, 171, + 172, 0, 160, 162, 156, 157, 158, 148, 149, 150, + 151, 152, 361, 362, 208, 363, 0, 284, 357, 359, + 358, 360, 282, 0, 179, 377, 377, 0, 145, 0, + 242, 323, 0, 0, 0, 368, 335, 341, 0, 334, + 0, 0, 377, 338, 377, 377, 333, 0, 0, 0, + 197, 198, 0, 377, 262, 377, 257, 377, 0, 290, + 0, 236, 0, 0, 0, 357, 358, 282, 0, 0, + 0, 192, 220, 353, 0, 200, 195, 377, 357, 0, + 0, 0, 352, 223, 285, 181, 10, 0, 176, 0, + 21, 38, 200, 56, 0, 203, 0, 50, 0, 377, + 46, 53, 0, 377, 35, 0, 0, 377, 34, 217, + 268, 0, 0, 266, 0, 141, 280, 0, 0, 0, + 245, 0, 0, 340, 342, 368, 0, 325, 0, 329, + 344, 0, 331, 0, 332, 249, 71, 0, 0, 263, + 0, 0, 297, 0, 0, 260, 0, 292, 0, 0, + 234, 235, 217, 0, 377, 190, 189, 217, 377, 0, + 20, 55, 0, 357, 0, 45, 177, 0, 143, 144, + 0, 0, 267, 0, 0, 0, 0, 322, 241, 347, + 337, 0, 247, 336, 377, 377, 343, 0, 339, 377, + 334, 377, 298, 238, 0, 232, 233, 0, 377, 0, + 185, 0, 188, 227, 202, 59, 283, 281, 142, 269, + 271, 273, 243, 324, 0, 327, 328, 330, 0, 295, + 0, 291, 293, 294, 289, 237, 377, 377, 0, 377, + 191, 326, 250, 261, 0, 0, 0 }; static const short yydefgoto[] = { 645, @@ -745,45 +746,45 @@ static const short yytable[] = { 69, 332, 331, 230, 69, 253, 203, 203, 215, 457, 493, 321, 351, 232, 235, 213, 487, 305, 321, 479, 218, 487, 543, 545, 307, 596, 259, 260, 600, 69, 490, - 310, 240, -55, 207, 328, 294, 426, 432, 259, 260, - 599, 328, 219, 240, 85, 521, 366, 245, -58, 259, - 260, 367, 447, 259, 260, -57, 207, -56, 505, -274, + 310, 240, -58, 207, 328, 294, 426, 432, 259, 260, + 599, 328, 219, 240, 85, 521, 366, 245, -61, 259, + 260, 367, 447, 259, 260, -60, 207, -59, 505, -277, 594, 69, 372, 295, 598, 304, 296, 367, 81, 522, - 259, 260, 82, 78, 78, 426, 432, 299, -57, 78, + 259, 260, 82, 78, 78, 426, 432, 299, -60, 78, 78, 78, 78, 78, 78, 303, 463, 432, 326, 226, 78, 78, 78, 448, 449, 177, 181, 78, 183, 184, - 440, 448, 449, -55, 432, 448, 449, 250, 251, 482, - 638, 261, 216, 250, 251, 447, 432, 308, -51, -58, - 250, 251, 78, 599, 250, 251, -57, 78, -56, 330, - 330, 250, 251, 305, -54, 219, 363, -275, 250, 251, - 299, -53, 557, -52, -57, 457, 614, 427, 433, -57, + 440, 448, 449, -58, 432, 448, 449, 250, 251, 482, + 638, 261, 216, 250, 251, 447, 432, 308, -54, -61, + 250, 251, 78, 599, 250, 251, -60, 78, -59, 330, + 330, 250, 251, 305, -57, 219, 363, -278, 250, 251, + 299, -56, 557, -55, -60, 457, 614, 427, 433, -60, 78, 370, 301, 373, 487, 78, 448, 449, 222, 301, - -55, 626, 627, -57, 496, 81, 628, -55, 302, 82, - 306, 262, 387, 268, 69, 267, -58, 297, 207, 230, - -51, 268, 318, 450, 317, -309, 475, 203, 281, 282, + -58, 626, 627, -60, 496, 81, 628, -58, 302, 82, + 306, 262, 387, 268, 69, 267, -61, 297, 207, 230, + -54, 268, 318, 450, 317, -312, 475, 203, 281, 282, 207, 324, 207, 575, 326, 340, 333, 83, 433, 203, - 69, 299, -308, 493, 642, 69, 516, 350, 289, 290, - 291, 292, 293, -309, -57, 230, 289, 290, 291, 292, - 293, 302, 385, 200, 334, 259, 260, 335, 268, -58, - -308, -310, 69, 69, 69, 69, 69, 69, 69, 487, - 212, 69, 389, 281, 282, 207, 377, 294, 516, -54, - 214, 432, 441, 442, 268, 336, -57, 342, 532, -310, - 567, 582, 288, 289, 290, 291, 292, 293, 78, -56, - 333, 347, 78, 358, 207, 345, -53, 548, 346, 461, - -311, 207, 560, 633, 78, 488, 78, 470, 333, 69, + 69, 299, -311, 493, 642, 69, 516, 350, 289, 290, + 291, 292, 293, -312, -60, 230, 289, 290, 291, 292, + 293, 302, 385, 200, 334, 259, 260, 335, 268, -61, + -311, -313, 69, 69, 69, 69, 69, 69, 69, 487, + 212, 69, 389, 281, 282, 207, 377, 294, 516, -57, + 214, 432, 441, 442, 268, 336, -60, 342, 532, -313, + 567, 582, 288, 289, 290, 291, 292, 293, 78, -59, + 333, 347, 78, 358, 207, 345, -56, 548, 346, 461, + -314, 207, 560, 633, 78, 488, 78, 470, 333, 69, 69, 291, 292, 293, 78, 360, 457, 564, 362, 78, - 69, 346, 268, 69, 364, -314, 354, 69, -311, 69, + 69, 346, 268, 69, 364, -317, 354, 69, -314, 69, 512, 578, 582, 207, 69, 581, 374, 355, 356, 375, - -56, 250, 251, -353, 207, 365, 78, 78, 78, 78, - 78, 78, 78, -314, -213, 78, -314, 611, 69, 78, - -52, 613, 378, 379, 380, 381, 382, 383, 592, -353, - 497, -353, -313, 207, -353, 554, 463, -353, 333, -214, - -312, -39, -213, -304, -307, -213, 371, 314, 78, 369, - 240, 255, 256, 257, 258, 78, -40, -47, 392, 463, - -313, 467, 472, 78, 78, 483, 509, -214, -312, 510, - -214, -304, -307, 501, 78, 315, 517, 78, 538, 446, + -59, 250, 251, -357, 207, 365, 78, 78, 78, 78, + 78, 78, 78, -317, -216, 78, -317, 611, 69, 78, + -55, 613, 378, 379, 380, 381, 382, 383, 592, -357, + 497, -357, -316, 207, -357, 554, 463, -357, 333, -217, + -315, -39, -216, -307, -310, -216, 371, 314, 78, 369, + 240, 255, 256, 257, 258, 78, -40, -50, 392, 463, + -316, 467, 472, 78, 78, 483, 509, -217, -315, 510, + -217, -307, -310, 501, 78, 315, 517, 78, 538, 446, 494, 78, 495, 78, 502, 207, 330, 78, 78, 641, - -47, 207, 507, 508, 515, 520, 631, 527, 78, 531, + -50, 207, 507, 508, 515, 520, 631, 527, 78, 531, 519, 69, 69, 480, 533, 534, 330, 535, 539, 69, 542, 544, 78, 67, 67, 549, 551, 559, 561, 67, 562, 69, 67, 514, 518, 190, 198, 78, 563, 566, @@ -920,7 +921,7 @@ static const short yytable[] = { 69, 0, 283, 178, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 178, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 201, 0, 0, -373, + 0, 0, 0, 0, 0, 0, 201, 0, 0, -377, 2, 0, 3, 4, 5, 6, 7, 0, 0, 0, 8, 9, 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 201, 18, 19, 20, 21, @@ -932,41 +933,41 @@ static const short yytable[] = { 69, 0, 49, 0, 201, 50, 51, 52, 53, 0, 54, 0, 0, 0, 178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -373, -373, -304, 0, 0, - 0, 0, 0, 0, 0, -304, -304, -304, 0, 0, - 0, -304, -304, 0, -304, 0, 0, 0, 0, 0, - 0, 0, 0, -271, 0, 0, 0, 0, 178, 0, - 0, -304, -304, 0, -304, -304, -304, -304, 0, 0, + 0, 0, 0, 0, 0, -377, -377, -307, 0, 0, + 0, 0, 0, 0, 0, -307, -307, -307, 0, 0, + 0, -307, -307, 0, -307, 0, 0, 0, 0, 0, + 0, 0, 0, -274, 0, 0, 0, 0, 178, 0, + 0, -307, -307, 0, -307, -307, -307, -307, 0, 0, 201, 0, 0, 0, 201, 0, 0, 0, 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -304, -304, -304, -304, -304, -304, -304, -304, -304, - -304, -304, -304, -304, 0, 0, -304, -304, -304, 0, - -304, 0, 0, 0, 178, 0, 0, 0, -304, -304, - 0, -304, -304, -304, -304, -304, -304, -304, -304, -304, - -304, 0, -307, 0, 0, -304, -304, -304, -304, -304, - -307, -307, -307, -304, -304, 0, -307, -307, 0, -307, - 0, 0, 0, 0, 0, 0, 0, 0, -272, 0, - 0, 0, 0, 0, 0, 0, -307, -307, 0, -307, - -307, -307, -307, 0, 0, 0, 0, 0, 0, 0, + 0, -307, -307, -307, -307, -307, -307, -307, -307, -307, + -307, -307, -307, -307, 0, 0, -307, -307, -307, 0, + -307, 0, 0, 0, 178, 0, 0, 0, -307, -307, + 0, -307, -307, -307, -307, -307, -307, -307, -307, -307, + -307, 0, -310, 0, 0, -307, -307, -307, -307, -307, + -310, -310, -310, -307, -307, 0, -310, -310, 0, -310, + 0, 0, 0, 0, 0, 0, 0, 0, -275, 0, + 0, 0, 0, 0, 0, 0, -310, -310, 0, -310, + -310, -310, -310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -307, -307, -307, -307, - -307, -307, -307, -307, -307, -307, -307, -307, -307, 0, - 0, -307, -307, -307, 0, -307, 0, 0, 0, 0, - 0, 0, 0, -307, -307, 0, -307, -307, -307, -307, - -307, -307, -307, -307, -307, -307, 0, -225, 0, 0, - -307, -307, -307, -307, -307, -225, -225, -225, -307, -307, - 0, -225, -225, 0, -225, 0, 0, 0, 0, 0, - 0, 0, 0, -273, 0, 0, 0, 0, 0, 0, - 0, -225, -225, 0, -225, -225, -225, -225, 0, 0, + 0, 0, 0, 0, 0, 0, -310, -310, -310, -310, + -310, -310, -310, -310, -310, -310, -310, -310, -310, 0, + 0, -310, -310, -310, 0, -310, 0, 0, 0, 0, + 0, 0, 0, -310, -310, 0, -310, -310, -310, -310, + -310, -310, -310, -310, -310, -310, 0, -228, 0, 0, + -310, -310, -310, -310, -310, -228, -228, -228, -310, -310, + 0, -228, -228, 0, -228, 0, 0, 0, 0, 0, + 0, 0, 0, -276, 0, 0, 0, 0, 0, 0, + 0, -228, -228, 0, -228, -228, -228, -228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -225, -225, -225, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, 0, 0, -225, -225, -225, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -225, - 0, -225, -225, -225, -225, -225, -225, -225, -225, -225, - -225, 0, 0, 0, 0, -225, -225, -225, 0, -225, - 0, 0, 0, -225, -225, 2, 0, 3, 4, 5, - 6, 7, -373, -373, -373, 8, 9, 0, 0, -373, + 0, -228, -228, -228, -228, -228, -228, -228, -228, -228, + -228, -228, -228, -228, 0, 0, -228, -228, -228, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -228, + 0, -228, -228, -228, -228, -228, -228, -228, -228, -228, + -228, 0, 0, 0, 0, -228, -228, -228, 0, -228, + 0, 0, 0, -228, -228, 2, 0, 3, 4, 5, + 6, 7, -377, -377, -377, 8, 9, 0, 0, -377, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, @@ -977,7 +978,7 @@ static const short yytable[] = { 69, 51, 52, 53, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, 0, 0, 0, 2, 0, 3, 4, 5, 6, 7, - -373, -373, -373, 8, 9, 0, -373, -373, 10, 0, + -377, -377, -377, 8, 9, 0, -377, -377, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, @@ -986,8 +987,8 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, 5, 6, - 7, 0, 0, -373, 8, 9, 55, 56, -373, 10, - -373, 11, 12, 13, 14, 15, 16, 17, -373, -373, + 7, 0, 0, -377, 8, 9, 55, 56, -377, 10, + -377, 11, 12, 13, 14, 15, 16, 17, -377, -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, @@ -995,18 +996,18 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, 5, - 6, 7, 0, 0, -373, 8, 9, 55, 56, -373, - 10, 0, 11, 12, 13, 14, 15, 16, 17, -373, - -373, 18, 19, 20, 21, 22, 23, 24, 0, 0, + 6, 7, 0, 0, -377, 8, 9, 55, 56, -377, + 10, 0, 11, 12, 13, 14, 15, 16, 17, -377, + -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, - 5, 6, 7, 0, -373, -373, 8, 9, 55, 56, + 5, 6, 7, 0, -377, -377, 8, 9, 55, 56, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, - -373, -373, 18, 19, 20, 21, 22, 23, 24, 0, + -377, -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, @@ -1014,8 +1015,8 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, 5, 6, 7, 0, 0, 0, 8, 9, 55, - 56, 0, 10, -373, 11, 12, 13, 14, 15, 16, - 17, -373, -373, 18, 19, 20, 21, 22, 23, 24, + 56, 0, 10, -377, 11, 12, 13, 14, 15, 16, + 17, -377, -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, @@ -1024,7 +1025,7 @@ static const short yytable[] = { 69, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, 5, 6, 7, 0, 0, 0, 8, 9, 55, 56, 0, 10, 0, 11, 12, 13, 14, 15, - 16, 17, -373, -373, 18, 19, 20, 21, 22, 23, + 16, 17, -377, -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -1032,8 +1033,8 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 227, 51, 52, 53, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 55, 56, 0, 0, 0, 2, -373, 3, 4, - 5, 6, 7, -373, -373, 0, 8, 9, 0, 0, + 0, 55, 56, 0, 0, 0, 2, -377, 3, 4, + 5, 6, 7, -377, -377, 0, 8, 9, 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, @@ -1043,8 +1044,8 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, - 56, 0, 0, 0, 2, -373, 3, 4, 5, 6, - 7, -373, -373, 0, 8, 9, 0, 0, 0, 10, + 56, 0, 0, 0, 2, -377, 3, 4, 5, 6, + 7, -377, -377, 0, 8, 9, 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, @@ -1053,9 +1054,9 @@ static const short yytable[] = { 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, 5, - 6, 7, 0, 0, -373, 8, 9, 55, 56, 0, - 10, -373, 11, 12, 13, 14, 15, 16, 17, -373, - -373, 18, 19, 20, 21, 22, 23, 24, 0, 0, + 6, 7, 0, 0, -377, 8, 9, 55, 56, 0, + 10, -377, 11, 12, 13, 14, 15, 16, 17, -377, + -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, @@ -1064,7 +1065,7 @@ static const short yytable[] = { 69, 51, 52, 53, 0, 54, 0, 0, 0, 3, 4, 5, 6, 7, 0, 0, 0, 8, 9, 55, 56, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, - -373, -373, 18, 19, 20, 21, 22, 23, 24, 0, + -377, -377, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, @@ -1091,37 +1092,37 @@ static const short yytable[] = { 69, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, - 196, 51, 52, 197, 198, 54, 0, 0, -350, -350, - -350, 0, -350, 0, 0, 0, -350, -350, 0, 199, - 56, -350, 299, -350, -350, -350, -350, -350, -350, -350, - 303, 0, -350, -350, -350, -350, -350, -350, -350, 0, - 0, 0, 0, 0, 0, 0, 0, -350, 0, 0, - -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, - -350, -350, -350, -350, -350, -350, -350, -350, -350, 0, + 196, 51, 52, 197, 198, 54, 0, 0, -354, -354, + -354, 0, -354, 0, 0, 0, -354, -354, 0, 199, + 56, -354, 299, -354, -354, -354, -354, -354, -354, -354, + 303, 0, -354, -354, -354, -354, -354, -354, -354, 0, + 0, 0, 0, 0, 0, 0, 0, -354, 0, 0, + -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, + -354, -354, -354, -354, -354, -354, -354, -354, -354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -350, 0, 0, - -350, -350, -350, -350, -350, -350, 0, 0, -352, -352, - -352, 0, -352, 0, 0, 0, -352, -352, 0, -350, - -350, -352, -350, -352, -352, -352, -352, -352, -352, -352, - -350, 0, -352, -352, -352, -352, -352, -352, -352, 0, - 0, 0, 0, 0, 0, 0, 0, -352, 0, 0, - -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, - -352, -352, -352, -352, -352, -352, -352, -352, -352, 0, + 0, 0, 0, 0, 0, 0, 0, -354, 0, 0, + -354, -354, -354, -354, -354, -354, 0, 0, -356, -356, + -356, 0, -356, 0, 0, 0, -356, -356, 0, -354, + -354, -356, -354, -356, -356, -356, -356, -356, -356, -356, + -354, 0, -356, -356, -356, -356, -356, -356, -356, 0, + 0, 0, 0, 0, 0, 0, 0, -356, 0, 0, + -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, + -356, -356, -356, -356, -356, -356, -356, -356, -356, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -352, 0, 0, - -352, -352, -352, -352, -352, -352, 0, 0, -351, -351, - -351, 0, -351, 0, 0, 0, -351, -351, 0, -352, - -352, -351, -352, -351, -351, -351, -351, -351, -351, -351, - -352, 0, -351, -351, -351, -351, -351, -351, -351, 0, - 0, 0, 0, 0, 0, 0, 0, -351, 0, 0, - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, 0, + 0, 0, 0, 0, 0, 0, 0, -356, 0, 0, + -356, -356, -356, -356, -356, -356, 0, 0, -355, -355, + -355, 0, -355, 0, 0, 0, -355, -355, 0, -356, + -356, -355, -356, -355, -355, -355, -355, -355, -355, -355, + -356, 0, -355, -355, -355, -355, -355, -355, -355, 0, + 0, 0, 0, 0, 0, 0, 0, -355, 0, 0, + -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, + -355, -355, -355, -355, -355, -355, -355, -355, -355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -351, 0, 0, - -351, -351, -351, -351, -351, -351, 0, 0, 3, 4, - 5, 0, 7, 0, 0, 0, 8, 9, 0, -351, - -351, 10, -351, 11, 12, 13, 14, 15, 16, 17, - -351, 0, 185, 186, 20, 21, 22, 23, 24, 0, + 0, 0, 0, 0, 0, 0, 0, -355, 0, 0, + -355, -355, -355, -355, -355, -355, 0, 0, 3, 4, + 5, 0, 7, 0, 0, 0, 8, 9, 0, -355, + -355, 10, -355, 11, 12, 13, 14, 15, 16, 17, + -355, 0, 185, 186, 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, 174, 175, 34, 35, 176, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, @@ -1145,46 +1146,46 @@ static const short yytable[] = { 69, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, - 196, 51, 52, 197, 198, 54, 0, 0, -353, -353, - -353, 0, -353, 0, 0, 0, -353, -353, 0, 199, - 56, -353, 0, -353, -353, -353, -353, -353, -353, -353, - 214, 0, -353, -353, -353, -353, -353, -353, -353, 0, - 0, 0, 0, 0, 0, 0, 0, -353, 0, 0, - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, 0, + 196, 51, 52, 197, 198, 54, 0, 0, -357, -357, + -357, 0, -357, 0, 0, 0, -357, -357, 0, 199, + 56, -357, 0, -357, -357, -357, -357, -357, -357, -357, + 214, 0, -357, -357, -357, -357, -357, -357, -357, 0, + 0, 0, 0, 0, 0, 0, 0, -357, 0, 0, + -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, + -357, -357, -357, -357, -357, -357, -357, -357, -357, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -353, 0, 0, - -353, -353, -353, -353, -353, -353, 0, 0, -355, -355, - -355, 0, -355, 0, 0, 0, -355, -355, 0, -353, - -353, -355, 0, -355, -355, -355, -355, -355, -355, -355, - -353, 0, -355, -355, -355, -355, -355, -355, -355, 0, - 0, 0, 0, 0, 0, 0, 0, -355, 0, 0, - -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, - -355, -355, -355, -355, -355, -355, -355, -355, -355, 0, + 0, 0, 0, 0, 0, 0, 0, -357, 0, 0, + -357, -357, -357, -357, -357, -357, 0, 0, -359, -359, + -359, 0, -359, 0, 0, 0, -359, -359, 0, -357, + -357, -359, 0, -359, -359, -359, -359, -359, -359, -359, + -357, 0, -359, -359, -359, -359, -359, -359, -359, 0, + 0, 0, 0, 0, 0, 0, 0, -359, 0, 0, + -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, + -359, -359, -359, -359, -359, -359, -359, -359, -359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -355, 0, 0, - -355, -355, -355, -355, -355, -355, 0, 0, -354, -354, - -354, 0, -354, 0, 0, 0, -354, -354, 0, -355, - -355, -354, 0, -354, -354, -354, -354, -354, -354, -354, - -355, 0, -354, -354, -354, -354, -354, -354, -354, 0, - 0, 0, 0, 0, 0, 0, 0, -354, 0, 0, - -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, - -354, -354, -354, -354, -354, -354, -354, -354, -354, 0, + 0, 0, 0, 0, 0, 0, 0, -359, 0, 0, + -359, -359, -359, -359, -359, -359, 0, 0, -358, -358, + -358, 0, -358, 0, 0, 0, -358, -358, 0, -359, + -359, -358, 0, -358, -358, -358, -358, -358, -358, -358, + -359, 0, -358, -358, -358, -358, -358, -358, -358, 0, + 0, 0, 0, 0, 0, 0, 0, -358, 0, 0, + -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, + -358, -358, -358, -358, -358, -358, -358, -358, -358, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -354, 0, 0, - -354, -354, -354, -354, -354, -354, 0, 0, -356, -356, - -356, 0, -356, 0, 0, 0, -356, -356, 0, -354, - -354, -356, 0, -356, -356, -356, -356, -356, -356, -356, - -354, 0, -356, -356, -356, -356, -356, -356, -356, 0, - 0, 0, 0, 0, 0, 0, 0, -356, 0, 0, - -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, - -356, -356, -356, -356, -356, -356, -356, -356, -356, 0, + 0, 0, 0, 0, 0, 0, 0, -358, 0, 0, + -358, -358, -358, -358, -358, -358, 0, 0, -360, -360, + -360, 0, -360, 0, 0, 0, -360, -360, 0, -358, + -358, -360, 0, -360, -360, -360, -360, -360, -360, -360, + -358, 0, -360, -360, -360, -360, -360, -360, -360, 0, + 0, 0, 0, 0, 0, 0, 0, -360, 0, 0, + -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, + -360, -360, -360, -360, -360, -360, -360, -360, -360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -356, 0, 0, - -356, -356, -356, -356, -356, -356, 0, 0, 3, 4, - 5, 0, 7, 0, 0, 0, 8, 9, 0, -356, - -356, 10, 0, 11, 12, 13, 14, 15, 16, 17, - -356, 0, 185, 186, 20, 21, 22, 23, 24, 0, + 0, 0, 0, 0, 0, 0, 0, -360, 0, 0, + -360, -360, -360, -360, -360, -360, 0, 0, 3, 4, + 5, 0, 7, 0, 0, 0, 8, 9, 0, -360, + -360, 10, 0, 11, 12, 13, 14, 15, 16, 17, + -360, 0, 185, 186, 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, 174, 175, 34, 35, 176, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, @@ -3009,252 +3010,270 @@ case 42: case 43: #line 464 "parse.y" { - yyval.node = NEW_MASGN(list_concat(NEW_LIST(yyvsp[-1].node),yyvsp[0].node), 0); + yyval.node = NEW_MASGN(NEW_LIST(yyvsp[-1].node), -1); ; break;} case 44: #line 468 "parse.y" { - yyval.node = NEW_MASGN(list_concat(NEW_LIST(yyvsp[-4].node),yyvsp[-3].node),yyvsp[0].node); + yyval.node = NEW_MASGN(list_concat(NEW_LIST(yyvsp[-1].node),yyvsp[0].node), 0); ; break;} case 45: #line 472 "parse.y" { - yyval.node = NEW_MASGN(0, yyvsp[0].node); + yyval.node = NEW_MASGN(list_concat(NEW_LIST(yyvsp[-4].node),yyvsp[-3].node),yyvsp[0].node); + ; + break;} +case 46: +#line 476 "parse.y" +{ + yyval.node = NEW_MASGN(list_concat(NEW_LIST(yyvsp[-3].node),yyvsp[-2].node),-1); ; break;} case 47: -#line 478 "parse.y" +#line 480 "parse.y" { - yyval.node = yyvsp[-1].node; + yyval.node = NEW_MASGN(0, yyvsp[0].node); ; break;} case 48: -#line 483 "parse.y" +#line 484 "parse.y" +{ + yyval.node = NEW_MASGN(0, -1); + ; + break;} +case 50: +#line 490 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 49: -#line 488 "parse.y" +case 51: +#line 495 "parse.y" +{ + yyval.node = yyvsp[-1].node; + ; + break;} +case 52: +#line 500 "parse.y" { yyval.node = NEW_LIST(yyvsp[0].node); ; break;} -case 50: -#line 492 "parse.y" +case 53: +#line 504 "parse.y" { yyval.node = list_append(yyvsp[-2].node, yyvsp[0].node); ; break;} -case 51: -#line 497 "parse.y" +case 54: +#line 509 "parse.y" { yyval.node = assignable(yyvsp[0].id, 0); ; break;} -case 52: -#line 501 "parse.y" +case 55: +#line 513 "parse.y" { yyval.node = aryset(yyvsp[-3].node, yyvsp[-1].node); ; break;} -case 53: -#line 505 "parse.y" +case 56: +#line 517 "parse.y" { yyval.node = attrset(yyvsp[-2].node, yyvsp[0].id); ; break;} -case 54: -#line 509 "parse.y" +case 57: +#line 521 "parse.y" { rb_backref_error(yyvsp[0].node); yyval.node = 0; ; break;} -case 55: -#line 515 "parse.y" +case 58: +#line 527 "parse.y" { yyval.node = assignable(yyvsp[0].id, 0); ; break;} -case 56: -#line 519 "parse.y" +case 59: +#line 531 "parse.y" { yyval.node = aryset(yyvsp[-3].node, yyvsp[-1].node); ; break;} -case 57: -#line 523 "parse.y" +case 60: +#line 535 "parse.y" { yyval.node = attrset(yyvsp[-2].node, yyvsp[0].id); ; break;} -case 58: -#line 527 "parse.y" +case 61: +#line 539 "parse.y" { rb_backref_error(yyvsp[0].node); yyval.node = 0; ; break;} -case 59: -#line 533 "parse.y" +case 62: +#line 545 "parse.y" { yyerror("class/module name must be CONSTANT"); ; break;} -case 64: -#line 542 "parse.y" +case 67: +#line 554 "parse.y" { lex_state = EXPR_END; yyval.id = yyvsp[0].id; ; break;} -case 65: -#line 547 "parse.y" +case 68: +#line 559 "parse.y" { lex_state = EXPR_END; yyval.id = yyvsp[0].id; ; break;} -case 66: -#line 553 "parse.y" +case 69: +#line 565 "parse.y" { yyval.node = NEW_UNDEF(yyvsp[0].id); ; break;} -case 67: -#line 556 "parse.y" +case 70: +#line 568 "parse.y" {lex_state = EXPR_FNAME;; break;} -case 68: -#line 557 "parse.y" +case 71: +#line 569 "parse.y" { yyval.node = block_append(yyvsp[-3].node, NEW_UNDEF(yyvsp[0].id)); ; break;} -case 69: -#line 561 "parse.y" +case 72: +#line 573 "parse.y" { yyval.id = tDOT2; ; break;} -case 70: -#line 562 "parse.y" +case 73: +#line 574 "parse.y" { yyval.id = '|'; ; break;} -case 71: -#line 563 "parse.y" +case 74: +#line 575 "parse.y" { yyval.id = '^'; ; break;} -case 72: -#line 564 "parse.y" +case 75: +#line 576 "parse.y" { yyval.id = '&'; ; break;} -case 73: -#line 565 "parse.y" +case 76: +#line 577 "parse.y" { yyval.id = tCMP; ; break;} -case 74: -#line 566 "parse.y" +case 77: +#line 578 "parse.y" { yyval.id = tEQ; ; break;} -case 75: -#line 567 "parse.y" +case 78: +#line 579 "parse.y" { yyval.id = tEQQ; ; break;} -case 76: -#line 568 "parse.y" +case 79: +#line 580 "parse.y" { yyval.id = tMATCH; ; break;} -case 77: -#line 569 "parse.y" +case 80: +#line 581 "parse.y" { yyval.id = '>'; ; break;} -case 78: -#line 570 "parse.y" +case 81: +#line 582 "parse.y" { yyval.id = tGEQ; ; break;} -case 79: -#line 571 "parse.y" +case 82: +#line 583 "parse.y" { yyval.id = '<'; ; break;} -case 80: -#line 572 "parse.y" +case 83: +#line 584 "parse.y" { yyval.id = tLEQ; ; break;} -case 81: -#line 573 "parse.y" +case 84: +#line 585 "parse.y" { yyval.id = tLSHFT; ; break;} -case 82: -#line 574 "parse.y" +case 85: +#line 586 "parse.y" { yyval.id = tRSHFT; ; break;} -case 83: -#line 575 "parse.y" +case 86: +#line 587 "parse.y" { yyval.id = '+'; ; break;} -case 84: -#line 576 "parse.y" +case 87: +#line 588 "parse.y" { yyval.id = '-'; ; break;} -case 85: -#line 577 "parse.y" +case 88: +#line 589 "parse.y" { yyval.id = '*'; ; break;} -case 86: -#line 578 "parse.y" +case 89: +#line 590 "parse.y" { yyval.id = '*'; ; break;} -case 87: -#line 579 "parse.y" +case 90: +#line 591 "parse.y" { yyval.id = '/'; ; break;} -case 88: -#line 580 "parse.y" +case 91: +#line 592 "parse.y" { yyval.id = '%'; ; break;} -case 89: -#line 581 "parse.y" +case 92: +#line 593 "parse.y" { yyval.id = tPOW; ; break;} -case 90: -#line 582 "parse.y" +case 93: +#line 594 "parse.y" { yyval.id = '~'; ; break;} -case 91: -#line 583 "parse.y" +case 94: +#line 595 "parse.y" { yyval.id = tUPLUS; ; break;} -case 92: -#line 584 "parse.y" +case 95: +#line 596 "parse.y" { yyval.id = tUMINUS; ; break;} -case 93: -#line 585 "parse.y" +case 96: +#line 597 "parse.y" { yyval.id = tAREF; ; break;} -case 94: -#line 586 "parse.y" +case 97: +#line 598 "parse.y" { yyval.id = tASET; ; break;} -case 95: -#line 587 "parse.y" +case 98: +#line 599 "parse.y" { yyval.id = '`'; ; break;} -case 136: -#line 598 "parse.y" +case 139: +#line 610 "parse.y" { value_expr(yyvsp[0].node); yyval.node = node_assign(yyvsp[-2].node, yyvsp[0].node); ; break;} -case 137: -#line 602 "parse.y" +case 140: +#line 614 "parse.y" {yyval.node = assignable(yyvsp[-1].id, 0);; break;} -case 138: -#line 603 "parse.y" +case 141: +#line 615 "parse.y" { if (yyvsp[-2].id == tOROP) { yyvsp[-1].node->nd_value = yyvsp[0].node; @@ -3271,8 +3290,8 @@ case 138: fixpos(yyval.node, yyvsp[0].node); ; break;} -case 139: -#line 619 "parse.y" +case 142: +#line 631 "parse.y" { NODE *args = NEW_LIST(yyvsp[0].node); @@ -3288,8 +3307,8 @@ case 139: fixpos(yyval.node, yyvsp[-5].node); ; break;} -case 140: -#line 634 "parse.y" +case 143: +#line 646 "parse.y" { if (yyvsp[-1].id == tOROP) { yyvsp[-1].id = 0; @@ -3301,8 +3320,8 @@ case 140: fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 141: -#line 645 "parse.y" +case 144: +#line 657 "parse.y" { if (yyvsp[-1].id == tOROP) { yyvsp[-1].id = 0; @@ -3314,215 +3333,215 @@ case 141: fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 142: -#line 656 "parse.y" +case 145: +#line 668 "parse.y" { rb_backref_error(yyvsp[-2].node); yyval.node = 0; ; break;} -case 143: -#line 661 "parse.y" -{ - yyval.node = NEW_DOT2(yyvsp[-2].node, yyvsp[0].node); - ; - break;} -case 144: -#line 665 "parse.y" -{ - yyval.node = NEW_DOT3(yyvsp[-2].node, yyvsp[0].node); - ; - break;} -case 145: -#line 669 "parse.y" -{ - yyval.node = call_op(yyvsp[-2].node, '+', 1, yyvsp[0].node); - ; - break;} case 146: #line 673 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '-', 1, yyvsp[0].node); + yyval.node = NEW_DOT2(yyvsp[-2].node, yyvsp[0].node); ; break;} case 147: #line 677 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '*', 1, yyvsp[0].node); + yyval.node = NEW_DOT3(yyvsp[-2].node, yyvsp[0].node); ; break;} case 148: #line 681 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '/', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '+', 1, yyvsp[0].node); ; break;} case 149: #line 685 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '%', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '-', 1, yyvsp[0].node); ; break;} case 150: #line 689 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tPOW, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '*', 1, yyvsp[0].node); ; break;} case 151: #line 693 "parse.y" { - yyval.node = call_op(yyvsp[0].node, tUPLUS, 0); + yyval.node = call_op(yyvsp[-2].node, '/', 1, yyvsp[0].node); ; break;} case 152: #line 697 "parse.y" { - yyval.node = call_op(yyvsp[0].node, tUMINUS, 0); + yyval.node = call_op(yyvsp[-2].node, '%', 1, yyvsp[0].node); ; break;} case 153: #line 701 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '|', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, tPOW, 1, yyvsp[0].node); ; break;} case 154: #line 705 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '^', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[0].node, tUPLUS, 0); ; break;} case 155: #line 709 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '&', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[0].node, tUMINUS, 0); ; break;} case 156: #line 713 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tCMP, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '|', 1, yyvsp[0].node); ; break;} case 157: #line 717 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '>', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '^', 1, yyvsp[0].node); ; break;} case 158: #line 721 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tGEQ, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '&', 1, yyvsp[0].node); ; break;} case 159: #line 725 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, '<', 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, tCMP, 1, yyvsp[0].node); ; break;} case 160: #line 729 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tLEQ, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '>', 1, yyvsp[0].node); ; break;} case 161: #line 733 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tEQ, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, tGEQ, 1, yyvsp[0].node); ; break;} case 162: #line 737 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tEQQ, 1, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, '<', 1, yyvsp[0].node); ; break;} case 163: #line 741 "parse.y" { - yyval.node = NEW_NOT(call_op(yyvsp[-2].node, tEQ, 1, yyvsp[0].node)); + yyval.node = call_op(yyvsp[-2].node, tLEQ, 1, yyvsp[0].node); ; break;} case 164: #line 745 "parse.y" { - yyval.node = match_gen(yyvsp[-2].node, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, tEQ, 1, yyvsp[0].node); ; break;} case 165: #line 749 "parse.y" { - yyval.node = NEW_NOT(match_gen(yyvsp[-2].node, yyvsp[0].node)); + yyval.node = call_op(yyvsp[-2].node, tEQQ, 1, yyvsp[0].node); ; break;} case 166: #line 753 "parse.y" { - value_expr(yyvsp[0].node); - yyval.node = NEW_NOT(cond(yyvsp[0].node)); + yyval.node = NEW_NOT(call_op(yyvsp[-2].node, tEQ, 1, yyvsp[0].node)); ; break;} case 167: -#line 758 "parse.y" +#line 757 "parse.y" { - yyval.node = call_op(yyvsp[0].node, '~', 0); + yyval.node = match_gen(yyvsp[-2].node, yyvsp[0].node); ; break;} case 168: -#line 762 "parse.y" +#line 761 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tLSHFT, 1, yyvsp[0].node); + yyval.node = NEW_NOT(match_gen(yyvsp[-2].node, yyvsp[0].node)); ; break;} case 169: -#line 766 "parse.y" +#line 765 "parse.y" { - yyval.node = call_op(yyvsp[-2].node, tRSHFT, 1, yyvsp[0].node); + value_expr(yyvsp[0].node); + yyval.node = NEW_NOT(cond(yyvsp[0].node)); ; break;} case 170: #line 770 "parse.y" { - yyval.node = logop(NODE_AND, yyvsp[-2].node, yyvsp[0].node); + yyval.node = call_op(yyvsp[0].node, '~', 0); ; break;} case 171: #line 774 "parse.y" { - yyval.node = logop(NODE_OR, yyvsp[-2].node, yyvsp[0].node); + yyval.node = call_op(yyvsp[-2].node, tLSHFT, 1, yyvsp[0].node); ; break;} case 172: -#line 777 "parse.y" -{in_defined = 1;; +#line 778 "parse.y" +{ + yyval.node = call_op(yyvsp[-2].node, tRSHFT, 1, yyvsp[0].node); + ; break;} case 173: -#line 778 "parse.y" +#line 782 "parse.y" +{ + yyval.node = logop(NODE_AND, yyvsp[-2].node, yyvsp[0].node); + ; + break;} +case 174: +#line 786 "parse.y" +{ + yyval.node = logop(NODE_OR, yyvsp[-2].node, yyvsp[0].node); + ; + break;} +case 175: +#line 789 "parse.y" +{in_defined = 1;; + break;} +case 176: +#line 790 "parse.y" { in_defined = 0; yyval.node = NEW_DEFINED(yyvsp[0].node); ; break;} -case 174: -#line 783 "parse.y" +case 177: +#line 795 "parse.y" { value_expr(yyvsp[-4].node); yyval.node = NEW_IF(cond(yyvsp[-4].node), yyvsp[-2].node, yyvsp[0].node); fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 175: -#line 789 "parse.y" +case 178: +#line 801 "parse.y" { yyval.node = yyvsp[0].node; ; break;} -case 176: -#line 794 "parse.y" +case 179: +#line 806 "parse.y" { if (yyvsp[0].node && nd_type(yyvsp[0].node) == NODE_BLOCK_PASS) { rb_compile_error("block argument should not be given"); @@ -3530,108 +3549,108 @@ case 176: yyval.node = yyvsp[0].node; ; break;} -case 179: -#line 805 "parse.y" +case 182: +#line 817 "parse.y" { value_expr(yyvsp[0].node); yyval.node = NEW_LIST(yyvsp[0].node); ; break;} -case 180: -#line 810 "parse.y" +case 183: +#line 822 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 181: -#line 814 "parse.y" +case 184: +#line 826 "parse.y" { yyval.node = arg_blk_pass(yyvsp[-1].node, yyvsp[0].node); ; break;} -case 182: -#line 818 "parse.y" +case 185: +#line 830 "parse.y" { yyval.node = arg_concat(yyvsp[-4].node, yyvsp[-1].node); yyval.node = arg_blk_pass(yyval.node, yyvsp[0].node); ; break;} -case 183: -#line 823 "parse.y" +case 186: +#line 835 "parse.y" { yyval.node = NEW_LIST(NEW_HASH(yyvsp[-1].node)); ; break;} -case 184: -#line 827 "parse.y" +case 187: +#line 839 "parse.y" { yyval.node = NEW_LIST(NEW_HASH(yyvsp[-1].node)); yyval.node = arg_blk_pass(yyval.node, yyvsp[0].node); ; break;} -case 185: -#line 832 "parse.y" +case 188: +#line 844 "parse.y" { yyval.node = arg_concat(NEW_LIST(NEW_HASH(yyvsp[-4].node)), yyvsp[-1].node); yyval.node = arg_blk_pass(yyval.node, yyvsp[0].node); ; break;} -case 186: -#line 837 "parse.y" +case 189: +#line 849 "parse.y" { yyval.node = list_append(yyvsp[-3].node, NEW_HASH(yyvsp[-1].node)); yyval.node = arg_blk_pass(yyval.node, yyvsp[0].node); ; break;} -case 187: -#line 842 "parse.y" +case 190: +#line 854 "parse.y" { yyval.node = list_append(yyvsp[-3].node, NEW_HASH(yyvsp[-1].node)); ; break;} -case 188: -#line 846 "parse.y" +case 191: +#line 858 "parse.y" { yyval.node = arg_concat(list_append(yyvsp[-6].node, NEW_HASH(yyvsp[-4].node)), yyvsp[-1].node); yyval.node = arg_blk_pass(yyval.node, yyvsp[0].node); ; break;} -case 189: -#line 851 "parse.y" +case 192: +#line 863 "parse.y" { value_expr(yyvsp[-1].node); yyval.node = arg_blk_pass(NEW_RESTARGS(yyvsp[-1].node), yyvsp[0].node); ; break;} -case 191: -#line 858 "parse.y" +case 194: +#line 870 "parse.y" { value_expr(yyvsp[0].node); yyval.node = NEW_BLOCK_PASS(yyvsp[0].node); ; break;} -case 192: -#line 864 "parse.y" +case 195: +#line 876 "parse.y" { yyval.node = yyvsp[0].node; ; break;} -case 196: -#line 873 "parse.y" +case 199: +#line 885 "parse.y" { value_expr(yyvsp[0].node); yyval.node = NEW_LIST(yyvsp[0].node); ; break;} -case 197: -#line 878 "parse.y" +case 200: +#line 890 "parse.y" { value_expr(yyvsp[0].node); yyval.node = list_append(yyvsp[-2].node, yyvsp[0].node); ; break;} -case 198: -#line 884 "parse.y" +case 201: +#line 896 "parse.y" { if (yyvsp[0].node && nd_type(yyvsp[0].node) == NODE_ARRAY && @@ -3644,22 +3663,22 @@ case 198: } ; break;} -case 199: -#line 896 "parse.y" +case 202: +#line 908 "parse.y" { value_expr(yyvsp[0].node); yyval.node = arg_concat(yyvsp[-3].node, yyvsp[0].node); ; break;} -case 200: -#line 901 "parse.y" +case 203: +#line 913 "parse.y" { value_expr(yyvsp[0].node); yyval.node = yyvsp[0].node; ; break;} -case 201: -#line 907 "parse.y" +case 204: +#line 919 "parse.y" { yyval.node = yyvsp[0].node; if (yyvsp[0].node) { @@ -3673,46 +3692,46 @@ case 201: } ; break;} -case 204: -#line 924 "parse.y" +case 207: +#line 936 "parse.y" { yyval.node = NEW_LIT(yyvsp[0].val); ; break;} -case 205: -#line 928 "parse.y" +case 208: +#line 940 "parse.y" { value_expr(yyvsp[-2].node); yyval.node = NEW_COLON2(yyvsp[-2].node, yyvsp[0].id); ; break;} -case 206: -#line 933 "parse.y" +case 209: +#line 945 "parse.y" { yyval.node = NEW_COLON3(yyvsp[0].id); ; break;} -case 207: -#line 937 "parse.y" +case 210: +#line 949 "parse.y" { yyval.node = NEW_STR(yyvsp[0].val); ; break;} -case 209: -#line 942 "parse.y" +case 212: +#line 954 "parse.y" { yyval.node = NEW_XSTR(yyvsp[0].val); ; break;} -case 214: -#line 950 "parse.y" +case 217: +#line 962 "parse.y" { value_expr(yyvsp[-3].node); yyval.node = NEW_CALL(yyvsp[-3].node, tAREF, yyvsp[-1].node); ; break;} -case 215: -#line 955 "parse.y" +case 218: +#line 967 "parse.y" { if (yyvsp[-1].node == 0) yyval.node = NEW_ZARRAY(); /* zero length array*/ @@ -3721,14 +3740,14 @@ case 215: } ; break;} -case 216: -#line 963 "parse.y" +case 219: +#line 975 "parse.y" { yyval.node = NEW_HASH(yyvsp[-1].node); ; break;} -case 217: -#line 967 "parse.y" +case 220: +#line 979 "parse.y" { if (!compile_for_eval && !cur_mid && !in_single) yyerror("return appeared outside of method"); @@ -3736,67 +3755,67 @@ case 217: yyval.node = NEW_RETURN(yyvsp[-1].node); ; break;} -case 218: -#line 974 "parse.y" +case 221: +#line 986 "parse.y" { if (!compile_for_eval && !cur_mid && !in_single) yyerror("return appeared outside of method"); yyval.node = NEW_RETURN(0); ; break;} -case 219: -#line 980 "parse.y" +case 222: +#line 992 "parse.y" { if (!compile_for_eval && !cur_mid && !in_single) yyerror("return appeared outside of method"); yyval.node = NEW_RETURN(0); ; break;} -case 220: -#line 986 "parse.y" +case 223: +#line 998 "parse.y" { value_expr(yyvsp[-1].node); yyval.node = NEW_YIELD(yyvsp[-1].node); ; break;} -case 221: -#line 991 "parse.y" +case 224: +#line 1003 "parse.y" { yyval.node = NEW_YIELD(0); ; break;} -case 222: -#line 995 "parse.y" +case 225: +#line 1007 "parse.y" { yyval.node = NEW_YIELD(0); ; break;} -case 223: -#line 998 "parse.y" +case 226: +#line 1010 "parse.y" {in_defined = 1;; break;} -case 224: -#line 999 "parse.y" +case 227: +#line 1011 "parse.y" { in_defined = 0; yyval.node = NEW_DEFINED(yyvsp[-1].node); ; break;} -case 225: -#line 1004 "parse.y" +case 228: +#line 1016 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 226: -#line 1008 "parse.y" +case 229: +#line 1020 "parse.y" { yyvsp[0].node->nd_iter = NEW_FCALL(yyvsp[-1].id, 0); yyval.node = yyvsp[0].node; ; break;} -case 228: -#line 1014 "parse.y" +case 231: +#line 1026 "parse.y" { if (yyvsp[-1].node && nd_type(yyvsp[-1].node) == NODE_BLOCK_PASS) { rb_compile_error("both block arg and actual block given"); @@ -3806,56 +3825,56 @@ case 228: fixpos(yyval.node, yyvsp[-1].node); ; break;} -case 229: -#line 1026 "parse.y" +case 232: +#line 1038 "parse.y" { value_expr(yyvsp[-4].node); yyval.node = NEW_IF(cond(yyvsp[-4].node), yyvsp[-2].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 230: -#line 1035 "parse.y" +case 233: +#line 1047 "parse.y" { value_expr(yyvsp[-4].node); yyval.node = NEW_UNLESS(cond(yyvsp[-4].node), yyvsp[-2].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 231: -#line 1043 "parse.y" +case 234: +#line 1055 "parse.y" { value_expr(yyvsp[-3].node); yyval.node = NEW_WHILE(cond(yyvsp[-3].node), yyvsp[-1].node, 1); fixpos(yyval.node, yyvsp[-3].node); ; break;} -case 232: -#line 1051 "parse.y" +case 235: +#line 1063 "parse.y" { value_expr(yyvsp[-3].node); yyval.node = NEW_UNTIL(cond(yyvsp[-3].node), yyvsp[-1].node, 1); fixpos(yyval.node, yyvsp[-3].node); ; break;} -case 233: -#line 1059 "parse.y" +case 236: +#line 1071 "parse.y" { value_expr(yyvsp[-2].node); yyval.node = NEW_CASE(yyvsp[-2].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-2].node); ; break;} -case 234: -#line 1067 "parse.y" +case 237: +#line 1079 "parse.y" { value_expr(yyvsp[-5].node); yyval.node = NEW_FOR(yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-5].node); ; break;} -case 235: -#line 1078 "parse.y" +case 238: +#line 1090 "parse.y" { if (!yyvsp[-3].node && !yyvsp[-2].node && !yyvsp[-1].node) yyval.node = NEW_BEGIN(yyvsp[-4].node); @@ -3871,14 +3890,14 @@ case 235: fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 236: -#line 1093 "parse.y" +case 239: +#line 1105 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 237: -#line 1097 "parse.y" +case 240: +#line 1109 "parse.y" { if (cur_mid || in_single) yyerror("class definition in method body"); @@ -3888,8 +3907,8 @@ case 237: local_push(); ; break;} -case 238: -#line 1107 "parse.y" +case 241: +#line 1119 "parse.y" { yyval.node = NEW_CLASS(yyvsp[-4].id, yyvsp[-1].node, yyvsp[-3].node); fixpos(yyval.node, yyvsp[-3].node); @@ -3898,16 +3917,16 @@ case 238: class_nest--; ; break;} -case 239: -#line 1115 "parse.y" +case 242: +#line 1127 "parse.y" { class_nest++; cref_push(); local_push(); ; break;} -case 240: -#line 1122 "parse.y" +case 243: +#line 1134 "parse.y" { yyval.node = NEW_SCLASS(yyvsp[-4].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-4].node); @@ -3916,8 +3935,8 @@ case 240: class_nest--; ; break;} -case 241: -#line 1130 "parse.y" +case 244: +#line 1142 "parse.y" { if (cur_mid || in_single) yyerror("module definition in method body"); @@ -3926,8 +3945,8 @@ case 241: local_push(); ; break;} -case 242: -#line 1139 "parse.y" +case 245: +#line 1151 "parse.y" { yyval.node = NEW_MODULE(yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-1].node); @@ -3936,8 +3955,8 @@ case 242: class_nest--; ; break;} -case 243: -#line 1147 "parse.y" +case 246: +#line 1159 "parse.y" { if (cur_mid || in_single) yyerror("nested method definition"); @@ -3945,8 +3964,8 @@ case 243: local_push(); ; break;} -case 244: -#line 1156 "parse.y" +case 247: +#line 1168 "parse.y" { /* NOEX_PRIVATE for toplevel */ yyval.node = NEW_DEFN(yyvsp[-4].id, yyvsp[-2].node, yyvsp[-1].node, class_nest?0:1); @@ -3955,12 +3974,12 @@ case 244: cur_mid = 0; ; break;} -case 245: -#line 1163 "parse.y" +case 248: +#line 1175 "parse.y" {lex_state = EXPR_FNAME;; break;} -case 246: -#line 1164 "parse.y" +case 249: +#line 1176 "parse.y" { value_expr(yyvsp[-3].node); in_single++; @@ -3968,8 +3987,8 @@ case 246: lex_state = EXPR_END; /* force for args */ ; break;} -case 247: -#line 1173 "parse.y" +case 250: +#line 1185 "parse.y" { yyval.node = NEW_DEFS(yyvsp[-7].node, yyvsp[-4].id, yyvsp[-2].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-7].node); @@ -3977,110 +3996,110 @@ case 247: in_single--; ; break;} -case 248: -#line 1180 "parse.y" +case 251: +#line 1192 "parse.y" { yyval.node = NEW_BREAK(); ; break;} -case 249: -#line 1184 "parse.y" +case 252: +#line 1196 "parse.y" { yyval.node = NEW_NEXT(); ; break;} -case 250: -#line 1188 "parse.y" +case 253: +#line 1200 "parse.y" { yyval.node = NEW_REDO(); ; break;} -case 251: -#line 1192 "parse.y" +case 254: +#line 1204 "parse.y" { yyval.node = NEW_RETRY(); ; break;} -case 258: -#line 1207 "parse.y" +case 261: +#line 1219 "parse.y" { value_expr(yyvsp[-3].node); yyval.node = NEW_IF(cond(yyvsp[-3].node), yyvsp[-1].node, yyvsp[0].node); fixpos(yyval.node, yyvsp[-3].node); ; break;} -case 260: -#line 1215 "parse.y" +case 263: +#line 1227 "parse.y" { yyval.node = yyvsp[0].node; ; break;} -case 264: -#line 1224 "parse.y" +case 267: +#line 1236 "parse.y" { yyval.node = 0; ; break;} -case 265: -#line 1228 "parse.y" +case 268: +#line 1240 "parse.y" { yyval.node = 0; ; break;} -case 266: -#line 1232 "parse.y" +case 269: +#line 1244 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 267: -#line 1237 "parse.y" +case 270: +#line 1249 "parse.y" { yyval.vars = dyna_push(); ; break;} -case 268: -#line 1243 "parse.y" +case 271: +#line 1255 "parse.y" { yyval.node = NEW_ITER(yyvsp[-2].node, 0, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-2].node?yyvsp[-2].node:yyvsp[-1].node); dyna_pop(yyvsp[-3].vars); ; break;} -case 269: -#line 1250 "parse.y" +case 272: +#line 1262 "parse.y" { yyval.vars = dyna_push(); ; break;} -case 270: -#line 1255 "parse.y" +case 273: +#line 1267 "parse.y" { yyval.node = NEW_ITER(yyvsp[-2].node, 0, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-2].node?yyvsp[-2].node:yyvsp[-1].node); dyna_pop(yyvsp[-3].vars); ; break;} -case 271: -#line 1262 "parse.y" +case 274: +#line 1274 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 272: -#line 1266 "parse.y" +case 275: +#line 1278 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 273: -#line 1270 "parse.y" +case 276: +#line 1282 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 276: -#line 1277 "parse.y" +case 279: +#line 1289 "parse.y" { if (yyvsp[-1].node && nd_type(yyvsp[-1].node) == NODE_BLOCK_PASS) { rb_compile_error("both block arg and actual block given"); @@ -4090,46 +4109,46 @@ case 276: fixpos(yyval.node, yyvsp[0].node); ; break;} -case 277: -#line 1287 "parse.y" +case 280: +#line 1299 "parse.y" { yyval.node = new_fcall(yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-1].node); ; break;} -case 278: -#line 1292 "parse.y" +case 281: +#line 1304 "parse.y" { value_expr(yyvsp[-5].node); yyval.node = new_call(yyvsp[-5].node, yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-5].node); ; break;} -case 279: -#line 1298 "parse.y" +case 282: +#line 1310 "parse.y" { value_expr(yyvsp[-2].node); yyval.node = new_call(yyvsp[-2].node, yyvsp[0].id, 0); fixpos(yyval.node, yyvsp[-2].node); ; break;} -case 280: -#line 1304 "parse.y" +case 283: +#line 1316 "parse.y" { value_expr(yyvsp[-5].node); yyval.node = new_call(yyvsp[-5].node, yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-5].node); ; break;} -case 281: -#line 1310 "parse.y" +case 284: +#line 1322 "parse.y" { value_expr(yyvsp[-2].node); yyval.node = new_call(yyvsp[-2].node, yyvsp[0].id, 0); ; break;} -case 282: -#line 1315 "parse.y" +case 285: +#line 1327 "parse.y" { if (!compile_for_eval && !cur_mid && !in_single && !in_defined) @@ -4137,8 +4156,8 @@ case 282: yyval.node = NEW_SUPER(yyvsp[-1].node); ; break;} -case 283: -#line 1322 "parse.y" +case 286: +#line 1334 "parse.y" { if (!compile_for_eval && !cur_mid && !in_single && !in_defined) @@ -4146,167 +4165,167 @@ case 283: yyval.node = NEW_ZSUPER(); ; break;} -case 286: -#line 1336 "parse.y" +case 289: +#line 1348 "parse.y" { yyval.node = NEW_WHEN(yyvsp[-3].node, yyvsp[-1].node, yyvsp[0].node); ; break;} -case 288: -#line 1342 "parse.y" +case 291: +#line 1354 "parse.y" { value_expr(yyvsp[0].node); yyval.node = list_append(yyvsp[-3].node, NEW_WHEN(yyvsp[0].node, 0, 0)); ; break;} -case 289: -#line 1347 "parse.y" +case 292: +#line 1359 "parse.y" { value_expr(yyvsp[0].node); yyval.node = NEW_LIST(NEW_WHEN(yyvsp[0].node, 0, 0)); ; break;} -case 292: -#line 1358 "parse.y" +case 295: +#line 1370 "parse.y" { yyval.node = NEW_RESBODY(yyvsp[-3].node, yyvsp[-1].node, yyvsp[0].node); fixpos(yyval.node, yyvsp[-3].node?yyvsp[-3].node:yyvsp[-1].node); ; break;} -case 295: -#line 1366 "parse.y" +case 298: +#line 1378 "parse.y" { yyval.node = yyvsp[0].node; ; break;} -case 297: -#line 1372 "parse.y" +case 300: +#line 1384 "parse.y" { lex_state = EXPR_END; yyval.val = INT2FIX(yyvsp[0].id); ; break;} -case 308: -#line 1389 "parse.y" +case 311: +#line 1401 "parse.y" {yyval.id = kNIL;; break;} -case 309: -#line 1390 "parse.y" +case 312: +#line 1402 "parse.y" {yyval.id = kSELF;; break;} -case 310: -#line 1391 "parse.y" +case 313: +#line 1403 "parse.y" {yyval.id = kTRUE;; break;} -case 311: -#line 1392 "parse.y" +case 314: +#line 1404 "parse.y" {yyval.id = kFALSE;; break;} -case 312: -#line 1393 "parse.y" +case 315: +#line 1405 "parse.y" {yyval.id = k__FILE__;; break;} -case 313: -#line 1394 "parse.y" +case 316: +#line 1406 "parse.y" {yyval.id = k__LINE__;; break;} -case 314: -#line 1397 "parse.y" +case 317: +#line 1409 "parse.y" { yyval.node = gettable(yyvsp[0].id); ; break;} -case 317: -#line 1405 "parse.y" +case 320: +#line 1417 "parse.y" { yyval.node = 0; ; break;} -case 318: -#line 1409 "parse.y" +case 321: +#line 1421 "parse.y" { lex_state = EXPR_BEG; ; break;} -case 319: -#line 1413 "parse.y" +case 322: +#line 1425 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 320: -#line 1416 "parse.y" +case 323: +#line 1428 "parse.y" {yyerrok; yyval.node = 0;; break;} -case 321: -#line 1419 "parse.y" +case 324: +#line 1431 "parse.y" { yyval.node = yyvsp[-2].node; lex_state = EXPR_BEG; ; break;} -case 322: -#line 1424 "parse.y" +case 325: +#line 1436 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 323: -#line 1429 "parse.y" +case 326: +#line 1441 "parse.y" { yyval.node = block_append(NEW_ARGS(yyvsp[-5].num, yyvsp[-3].node, yyvsp[-1].id), yyvsp[0].node); ; break;} -case 324: -#line 1433 "parse.y" +case 327: +#line 1445 "parse.y" { yyval.node = block_append(NEW_ARGS(yyvsp[-3].num, yyvsp[-1].node, -1), yyvsp[0].node); ; break;} -case 325: -#line 1437 "parse.y" +case 328: +#line 1449 "parse.y" { yyval.node = block_append(NEW_ARGS(yyvsp[-3].num, 0, yyvsp[-1].id), yyvsp[0].node); ; break;} -case 326: -#line 1441 "parse.y" +case 329: +#line 1453 "parse.y" { yyval.node = block_append(NEW_ARGS(yyvsp[-1].num, 0, -1), yyvsp[0].node); ; break;} -case 327: -#line 1445 "parse.y" +case 330: +#line 1457 "parse.y" { yyval.node = block_append(NEW_ARGS(0, yyvsp[-3].node, yyvsp[-1].id), yyvsp[0].node); ; break;} -case 328: -#line 1449 "parse.y" +case 331: +#line 1461 "parse.y" { yyval.node = block_append(NEW_ARGS(0, yyvsp[-1].node, -1), yyvsp[0].node); ; break;} -case 329: -#line 1453 "parse.y" +case 332: +#line 1465 "parse.y" { yyval.node = block_append(NEW_ARGS(0, 0, yyvsp[-1].id), yyvsp[0].node); ; break;} -case 330: -#line 1457 "parse.y" +case 333: +#line 1469 "parse.y" { yyval.node = block_append(NEW_ARGS(0, 0, -1), yyvsp[0].node); ; break;} -case 331: -#line 1461 "parse.y" +case 334: +#line 1473 "parse.y" { yyval.node = NEW_ARGS(0, 0, -1); ; break;} -case 332: -#line 1466 "parse.y" +case 335: +#line 1478 "parse.y" { if (!is_local_id(yyvsp[0].id)) yyerror("formal argument must be local variable"); @@ -4314,8 +4333,8 @@ case 332: yyval.num = 1; ; break;} -case 333: -#line 1473 "parse.y" +case 336: +#line 1485 "parse.y" { if (!is_local_id(yyvsp[0].id)) yyerror("formal argument must be local variable"); @@ -4323,49 +4342,55 @@ case 333: yyval.num += 1; ; break;} -case 334: -#line 1481 "parse.y" +case 337: +#line 1493 "parse.y" { if (!is_local_id(yyvsp[-2].id)) yyerror("formal argument must be local variable"); yyval.node = assignable(yyvsp[-2].id, yyvsp[0].node); ; break;} -case 335: -#line 1488 "parse.y" +case 338: +#line 1500 "parse.y" { yyval.node = NEW_BLOCK(yyvsp[0].node); yyval.node->nd_end = yyval.node; ; break;} -case 336: -#line 1493 "parse.y" +case 339: +#line 1505 "parse.y" { yyval.node = block_append(yyvsp[-2].node, yyvsp[0].node); ; break;} -case 337: -#line 1498 "parse.y" +case 340: +#line 1510 "parse.y" { if (!is_local_id(yyvsp[0].id)) yyerror("rest argument must be local variable"); yyval.id = local_cnt(yyvsp[0].id); ; break;} -case 338: -#line 1505 "parse.y" +case 341: +#line 1516 "parse.y" +{ + yyval.id = -2; + ; + break;} +case 342: +#line 1521 "parse.y" { yyval.node = NEW_BLOCK_ARG(yyvsp[0].id); ; break;} -case 339: -#line 1510 "parse.y" +case 343: +#line 1526 "parse.y" { yyval.node = yyvsp[0].node; ; break;} -case 341: -#line 1516 "parse.y" +case 345: +#line 1532 "parse.y" { if (nd_type(yyvsp[0].node) == NODE_SELF) { yyval.node = NEW_SELF(); @@ -4379,12 +4404,12 @@ case 341: } ; break;} -case 342: -#line 1528 "parse.y" +case 346: +#line 1544 "parse.y" {lex_state = EXPR_BEG;; break;} -case 343: -#line 1529 "parse.y" +case 347: +#line 1545 "parse.y" { switch (nd_type(yyvsp[-2].node)) { case NODE_STR: @@ -4402,14 +4427,14 @@ case 343: yyval.node = yyvsp[-2].node; ; break;} -case 345: -#line 1548 "parse.y" +case 349: +#line 1564 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 346: -#line 1552 "parse.y" +case 350: +#line 1568 "parse.y" { if (yyvsp[-1].node->nd_alen%2 != 0) { yyerror("odd number list for Hash"); @@ -4417,28 +4442,28 @@ case 346: yyval.node = yyvsp[-1].node; ; break;} -case 348: -#line 1561 "parse.y" +case 352: +#line 1577 "parse.y" { yyval.node = list_concat(yyvsp[-2].node, yyvsp[0].node); ; break;} -case 349: -#line 1566 "parse.y" +case 353: +#line 1582 "parse.y" { yyval.node = list_append(NEW_LIST(yyvsp[-2].node), yyvsp[0].node); ; break;} -case 369: -#line 1596 "parse.y" +case 373: +#line 1612 "parse.y" {yyerrok;; break;} -case 372: -#line 1600 "parse.y" +case 376: +#line 1616 "parse.y" {yyerrok;; break;} -case 373: -#line 1603 "parse.y" +case 377: +#line 1619 "parse.y" { yyval.node = 0; ; @@ -4665,14 +4690,14 @@ yyerrhandle: } return 1; } -#line 1606 "parse.y" +#line 1622 "parse.y" #include <ctype.h> #include <sys/types.h> #include "regex.h" #include "util.h" -#define is_identchar(c) ((c)!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) +#define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) static char *tokenbuf = NULL; static int tokidx, toksiz = 0; @@ -5076,6 +5101,7 @@ parse_regx(term, paren) tokadd(c); } else { +#if 0 int c1; pushback(c); c1 = read_escape(); @@ -5086,6 +5112,10 @@ parse_regx(term, paren) tokadd('\\'); tokadd(c); } +#else + tokadd('\\'); + tokadd(c); +#endif } } continue; @@ -460,6 +460,10 @@ mlhs_basic : mlhs_head { $$ = NEW_MASGN(NEW_LIST($1), $3); } + | mlhs_head tSTAR + { + $$ = NEW_MASGN(NEW_LIST($1), -1); + } | mlhs_head mlhs_tail { $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2), 0); @@ -468,10 +472,18 @@ mlhs_basic : mlhs_head { $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2),$5); } + | mlhs_head mlhs_tail ',' tSTAR + { + $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2),-1); + } | tSTAR mlhs_node { $$ = NEW_MASGN(0, $2); } + | tSTAR + { + $$ = NEW_MASGN(0, -1); + } mlhs_item : mlhs_node | tLPAREN mlhs_entry ')' @@ -1500,6 +1512,10 @@ f_rest_arg : tSTAR tIDENTIFIER yyerror("rest argument must be local variable"); $$ = local_cnt($2); } + | tSTAR + { + $$ = -2; + } f_block_arg : tAMPER tIDENTIFIER { @@ -1609,7 +1625,7 @@ none : /* none */ #include "regex.h" #include "util.h" -#define is_identchar(c) ((c)!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) +#define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) static char *tokenbuf = NULL; static int tokidx, toksiz = 0; @@ -2013,6 +2029,7 @@ parse_regx(term, paren) tokadd(c); } else { +#if 0 int c1; pushback(c); c1 = read_escape(); @@ -2023,6 +2040,10 @@ parse_regx(term, paren) tokadd('\\'); tokadd(c); } +#else + tokadd('\\'); + tokadd(c); +#endif } } continue; @@ -71,7 +71,7 @@ range_s_new(argc, argv, klass) VALUE *argv; VALUE klass; { - VALUE beg, end, flag, range; + VALUE beg, end, flag; rb_scan_args(argc, argv, "21", &beg, &end, &flag); return range_new(klass, beg, end, RTEST(flag)); @@ -94,12 +94,12 @@ range_eqq(range, obj) end = rb_ivar_get(range, id_end); if (FIXNUM_P(beg) && FIXNUM_P(obj) && FIXNUM_P(end)) { - if (FIX2INT(beg) <= FIX2INT(obj)) { + if (NUM2LONG(beg) <= NUM2LONG(obj)) { if (EXCL(range)) { - if (FIX2INT(obj) < FIX2INT(end)) return Qtrue; + if (NUM2LONG(obj) < NUM2LONG(end)) return Qtrue; } else { - if (FIX2INT(obj) <= FIX2INT(end)) return Qtrue; + if (NUM2LONG(obj) <= NUM2LONG(end)) return Qtrue; } } return Qfalse; @@ -132,7 +132,7 @@ range_each(range) if (!EXCL(range)) end += 1; for (i=FIX2LONG(b); i<end; i++) { - rb_yield(INT2FIX(i)); + rb_yield(INT2NUM(i)); } } else if (TYPE(b) == T_STRING) { @@ -175,15 +175,16 @@ range_last(obj) VALUE rb_range_beg_len(range, begp, lenp, len, err) VALUE range; - int *begp, *lenp; - int len, err; + long *begp, *lenp; + long len; + int err; { - int beg, end, b, e; + long beg, end, b, e; if (!rb_obj_is_kind_of(range, rb_cRange)) return Qfalse; - beg = b = NUM2INT(rb_ivar_get(range, id_beg)); - end = e = NUM2INT(rb_ivar_get(range, id_end)); + beg = b = NUM2LONG(rb_ivar_get(range, id_beg)); + end = e = NUM2LONG(rb_ivar_get(range, id_end)); if (beg < 0) { beg += len; @@ -265,10 +266,10 @@ range_length(range) } if (FIXNUM_P(beg) && FIXNUM_P(end)) { if (EXCL(range)) { - return INT2FIX(FIX2INT(end) - FIX2INT(beg)); + return INT2NUM(NUM2LONG(end) - NUM2LONG(beg)); } else { - return INT2FIX(FIX2INT(end) - FIX2INT(beg) + 1); + return INT2NUM(NUM2LONG(end) - NUM2LONG(beg) + 1); } } if (!rb_obj_is_kind_of(beg, rb_cNumeric)) { @@ -783,7 +783,7 @@ rb_reg_new_1(klass, s, len, options) VALUE rb_reg_new(s, len, options) const char *s; - int len; + long len; int options; { return rb_reg_new_1(rb_cRegexp, s, len, options); @@ -162,9 +162,6 @@ static void insert_jump_n _((int, char*, char*, char*, unsigned)); static void insert_op _((int, char*, char*)); static void insert_op_2 _((int, char*, char*, int, int)); static int memcmp_translate _((unsigned char*, unsigned char*, int)); -static int alt_match_null_string_p(); -static int common_op_match_null_string_p(); -static int group_match_null_string_p(); /* Define the syntax stuff, so we can do the \<, \>, etc. */ @@ -497,7 +494,7 @@ print_mbc(c) else if (c < 0x3ffffff) printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); else if (c < 0x7fffffff) - printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); + printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); } else { printf("%c%c", c>>BYTEWIDTH, c&0xff); @@ -1057,6 +1054,34 @@ calculate_must_string(start, end) return must; } +static int +read_backslash(c) + int c; +{ + switch (c) { + case 'n': + return '\n'; + + case 't': + return '\t'; + + case 'r': + return '\r'; + + case 'f': + return '\f'; + + case 'v': + return '\v'; + + case 'a': + return '\007'; + + case 'e': + return '\033'; + } + return c; +} /* re_compile_pattern takes a regular-expression string and converts it into a buffer full of byte commands for matching. @@ -1425,6 +1450,7 @@ re_compile_pattern(pattern, size, bufp) break; default: + c = read_backslash(c); if (ismbchar(c)) { PATFETCH_MBC(c); had_mbchar++; @@ -1705,6 +1731,7 @@ re_compile_pattern(pattern, size, bufp) to `fixup_alt_jump', in the `handle_alt' case below. */ store_jump(fixup_alt_jump, jump, b); } + p0 = b; options = *--stackp; switch (c = *--stackp) { case '(': @@ -2103,6 +2130,7 @@ re_compile_pattern(pattern, size, bufp) break; default: + c = read_backslash(c); goto normal_char; } break; @@ -2619,6 +2647,8 @@ re_compile_fastmap(bufp) case jump: case jump_past_alt: case dummy_failure_jump: + case finalize_push: + case finalize_push_n: EXTRACT_NUMBER_AND_INCR(j, p); p += j; if (j > 0) @@ -2632,9 +2662,7 @@ re_compile_fastmap(bufp) if ((enum regexpcode)*p != on_failure_jump && (enum regexpcode)*p != try_next - && (enum regexpcode)*p != succeed_n - && (enum regexpcode)*p != finalize_push - && (enum regexpcode)*p != finalize_push_n) + && (enum regexpcode)*p != succeed_n) continue; p++; EXTRACT_NUMBER_AND_INCR(j, p); @@ -2643,19 +2671,24 @@ re_compile_fastmap(bufp) stackp--; /* pop */ continue; + case try_next: case start_nowidth: case stop_nowidth: - case finalize_push: p += 2; continue; - case finalize_push_n: - p += 4; - continue; + case succeed_n: + is_a_succeed_n = 1; + /* Get to the number of times to succeed. */ + EXTRACT_NUMBER(k, p + 2); + /* Increment p past the n for when k != 0. */ + if (k != 0) { + p += 4; + continue; + } + /* fall through */ - case try_next: case on_failure_jump: - handle_on_failure_jump: EXTRACT_NUMBER_AND_INCR(j, p); if (p + j < pend) { if (stackp == stacke) { @@ -2673,19 +2706,6 @@ re_compile_fastmap(bufp) EXTRACT_NUMBER_AND_INCR(k, p); /* Skip the n. */ continue; - case succeed_n: - is_a_succeed_n = 1; - /* Get to the number of times to succeed. */ - EXTRACT_NUMBER(k, p + 2); - /* Increment p past the n for when k != 0. */ - if (k != 0) { - p += 4; - } - else { - goto handle_on_failure_jump; - } - continue; - case set_number_at: p += 4; continue; @@ -3095,20 +3115,13 @@ typedef union { unsigned char *word; struct { - /* This field is one if this group can match the empty string, - zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ -#define MATCH_NULL_UNSET_VALUE 3 - unsigned match_null_string_p : 2; unsigned is_active : 1; unsigned matched_something : 1; - unsigned ever_matched_something : 1; } bits; } register_info_type; -#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) #define IS_ACTIVE(R) ((R).bits.is_active) #define MATCHED_SOMETHING(R) ((R).bits.matched_something) -#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) /* Macros used by re_match: */ @@ -3196,7 +3209,6 @@ typedef union for (this_reg = 0; this_reg < num_regs; this_reg++) { \ if (IS_ACTIVE(reg_info[this_reg])) \ MATCHED_SOMETHING(reg_info[this_reg]) \ - = EVER_MATCHED_SOMETHING (reg_info[this_reg]) \ = 1; \ else \ MATCHED_SOMETHING(reg_info[this_reg]) = 0; \ @@ -3353,10 +3365,8 @@ re_match(bufp, string_arg, size, pos, regs) #ifdef __CHECKER__ reg_info[mcnt].word = 0; #endif - REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; IS_ACTIVE (reg_info[mcnt]) = 0; MATCHED_SOMETHING (reg_info[mcnt]) = 0; - EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; } /* Set up pointers to ends of strings. @@ -3453,20 +3463,7 @@ re_match(bufp, string_arg, size, pos, regs) a register number in the next byte. The text matched within the ( and ) is recorded under that number. */ case start_memory: - /* Find out if this group can match the empty string. */ - p1 = p; /* To send to group_match_null_string_p. */ - if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) - = group_match_null_string_p (&p1, pend, reg_info); - - /* Save the position in the string where we were the last time - we were at this open-group operator in case the group is - operated upon by a repetition operator, e.g., with `(a*)*b' - against `ab'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regstart[*p]) ? d : regstart[*p] - : regstart[*p]; + old_regstart[*p] = regstart[*p]; regstart[*p] = d; IS_ACTIVE(reg_info[*p]) = 1; MATCHED_SOMETHING(reg_info[*p]) = 0; @@ -3474,73 +3471,9 @@ re_match(bufp, string_arg, size, pos, regs) continue; case stop_memory: - /* We need to save the string position the last time we were at - this close-group operator in case the group is operated - upon by a repetition operator, e.g., with `((a*)*(b*)*)*' - against `aba'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regend[*p]) ? d : regend[*p] - : regend[*p]; - + old_regend[*p] = regend[*p]; regend[*p] = d; IS_ACTIVE(reg_info[*p]) = 0; - - /* If just failed to match something this time around with a sub- - expression that's in a loop, try to force exit from the loop. */ - if ((p + 1) != pend && - (! MATCHED_SOMETHING(reg_info[*p]) - || (enum regexpcode)p[-3] == start_memory)) { - p1 = p + 2; - mcnt = 0; - switch (*p1++) { - case jump_n: - case finalize_push_n: - case finalize_jump: - case maybe_finalize_jump: - case jump: - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - break; - } - p1 += mcnt; - - /* If the next operation is a jump backwards in the pattern - to an on_failure_jump, exit from the loop by forcing a - failure after pushing on the stack the on_failure_jump's - jump in the pattern, and d. */ - if (mcnt < 0 && (enum regexpcode)*p1 == on_failure_jump - && (enum regexpcode)p1[3] == start_memory && p1[4] == *p) { - /* If this group ever matched anything, then restore - what its registers were before trying this last - failed match, e.g., with `(a*)*b' against `ab' for - regstart[1], and, e.g., with `((a*)*(b*)*)*' - against `aba' for regend[3]. - - Also restore the registers for inner groups for, - e.g., `((a*)(b*))*' against `aba' (register 3 would - otherwise get trashed). */ - - if (EVER_MATCHED_SOMETHING (reg_info[*p])) { - unsigned r; - - EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; - - /* Restore this and inner groups' (if any) registers. */ - for (r = *p; r < *p + *(p + 1); r++) { - regstart[r] = old_regstart[r]; - - /* xx why this test? */ - if ((long)old_regend[r] >= (long)regstart[r]) - regend[r] = old_regend[r]; - } - } - p1++; - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - PUSH_FAILURE_POINT(p1 + mcnt, d); - goto fail; - } - } p += 2; continue; @@ -3651,7 +3584,7 @@ re_match(bufp, string_arg, size, pos, regs) case charset_not: { int not; /* Nonzero for charset_not. */ - int part; /* 2 if matched part of mbc */ + int part = 0; /* true if matched part of mbc */ unsigned char *dsave = d + 1; int cc, c; @@ -3666,7 +3599,8 @@ re_match(bufp, string_arg, size, pos, regs) cc = c = (unsigned char)translate[c]; not = is_in_list(c, p); - if (!not) { + if (!not && cc != c) { + part = 1; not = is_in_list(cc, p); } if (*(p - 1) == (unsigned char)charset_not) { @@ -3677,7 +3611,7 @@ re_match(bufp, string_arg, size, pos, regs) p += 1 + *p + 2 + EXTRACT_UNSIGNED(&p[1 + *p])*8; SET_REGS_MATCHED; - if (part == 2) d = dsave; + if (part) d = dsave; break; } @@ -3746,58 +3680,56 @@ re_match(bufp, string_arg, size, pos, regs) Change it either to a finalize_jump or an ordinary jump. */ case maybe_finalize_jump: EXTRACT_NUMBER_AND_INCR(mcnt, p); - { - register unsigned char *p2 = p; - - /* Compare the beginning of the repeat with what in the - pattern follows its end. If we can establish that there - is nothing that they would both match, i.e., that we - would have to backtrack because of (as in, e.g., `a*a') - then we can change to pop_failure_jump, because we'll - never have to backtrack. - - This is not true in the case of alternatives: in - `(a|ab)*' we do need to backtrack to the `ab' alternative - (e.g., if the string was `ab'). But instead of trying to - detect that here, the alternative has put on a dummy - failure point which is what we will end up popping. */ - - /* Skip over open/close-group commands. */ - while (p2 + 2 < pend) { - if ((enum regexpcode)*p2 == stop_memory || - (enum regexpcode)*p2 == start_memory) - p2 += 3; /* Skip over args, too. */ - else if ((enum regexpcode)*p2 == stop_paren) - p2 += 1; - else - break; - } + p1 = p; - if (p2 == pend) - p[-3] = (unsigned char)finalize_jump; - else if (*p2 == (unsigned char)exactn - || *p2 == (unsigned char)endline) { - register int c = *p2 == (unsigned char)endline ? '\n' : p2[2]; - register unsigned char *p1 = p + mcnt; - /* p1[0] ... p1[2] are an on_failure_jump. + /* Compare the beginning of the repeat with what in the + pattern follows its end. If we can establish that there + is nothing that they would both match, i.e., that we + would have to backtrack because of (as in, e.g., `a*a') + then we can change to pop_failure_jump, because we'll + never have to backtrack. + + This is not true in the case of alternatives: in + `(a|ab)*' we do need to backtrack to the `ab' alternative + (e.g., if the string was `ab'). But instead of trying to + detect that here, the alternative has put on a dummy + failure point which is what we will end up popping. */ + + /* Skip over open/close-group commands. */ + while (p1 + 2 < pend) { + if ((enum regexpcode)*p1 == stop_memory || + (enum regexpcode)*p1 == start_memory) + p1 += 3; /* Skip over args, too. */ + else if ((enum regexpcode)*p1 == stop_paren) + p1 += 1; + else + break; + } + + if (p1 == pend) + p[-3] = (unsigned char)finalize_jump; + else if (*p1 == (unsigned char)exactn || + *p1 == (unsigned char)endline) { + register int c = *p1 == (unsigned char)endline ? '\n' : p1[2]; + register unsigned char *p2 = p + mcnt; + /* p2[0] ... p2[2] are an on_failure_jump. Examine what follows that. */ - if (p1[3] == (unsigned char)exactn && p1[5] != c) - p[-3] = (unsigned char)finalize_jump; - else if (p1[3] == (unsigned char)charset - || p1[3] == (unsigned char)charset_not) { - int not; - if (ismbchar(c)) { - unsigned char *pp = p2+3; - MBC2WC(c, pp); - } - /* `is_in_list()' is TRUE if c would match */ - /* That means it is not safe to finalize. */ - not = is_in_list(c, p1 + 4); - if (p1[3] == (unsigned char)charset_not) - not = !not; - if (!not) - p[-3] = (unsigned char)finalize_jump; + if (p2[3] == (unsigned char)exactn && p2[5] != c) + p[-3] = (unsigned char)finalize_jump; + else if (p2[3] == (unsigned char)charset || + p2[3] == (unsigned char)charset_not) { + int not; + if (ismbchar(c)) { + unsigned char *pp = p1+3; + MBC2WC(c, pp); } + /* `is_in_list()' is TRUE if c would match */ + /* That means it is not safe to finalize. */ + not = is_in_list(c, p2 + 4); + if (p2[3] == (unsigned char)charset_not) + not = !not; + if (!not) + p[-3] = (unsigned char)finalize_jump; } } p -= 2; /* Point at relative address again. */ @@ -3823,18 +3755,20 @@ re_match(bufp, string_arg, size, pos, regs) POP_FAILURE_POINT(); /* Note fall through. */ + /* We need this opcode so we can detect where alternatives end + in `group_match_null_string_p' et al. */ + case jump_past_alt: + /* fall through */ + /* Jump without taking off any failure points. */ case jump: nofinalize: EXTRACT_NUMBER_AND_INCR(mcnt, p); + if (mcnt < 0 && stackp[-2] == d) /* avoid infinit loop */ + goto fail; p += mcnt; continue; - /* We need this opcode so we can detect where alternatives end - in `group_match_null_string_p' et al. */ - case jump_past_alt: - goto nofinalize; - case dummy_failure_jump: /* Normally, the on_failure_jump pushes a failure point, which then gets popped at finalize_jump. We will end up at @@ -3852,7 +3786,21 @@ re_match(bufp, string_arg, size, pos, regs) case push_dummy_failure: /* See comments just above at `dummy_failure_jump' about the two zeroes. */ - PUSH_FAILURE_POINT(0, 0); + p1 = p; + /* Skip over open/close-group commands. */ + while (p1 + 2 < pend) { + if ((enum regexpcode)*p1 == stop_memory || + (enum regexpcode)*p1 == start_memory) + p1 += 3; /* Skip over args, too. */ + else if ((enum regexpcode)*p1 == stop_paren) + p1 += 1; + else + break; + } + if ((enum regexpcode)*p1 == jump) + p[-1] = unused; + else + PUSH_FAILURE_POINT(0, 0); break; /* Have to succeed matching what follows at least n times. Then @@ -3906,6 +3854,8 @@ re_match(bufp, string_arg, size, pos, regs) case finalize_push: POP_FAILURE_POINT(); EXTRACT_NUMBER_AND_INCR(mcnt, p); + if (mcnt < 0 && stackp[-2] == d) /* avoid infinit loop */ + goto fail; PUSH_FAILURE_POINT(p + mcnt, d); stackp[-1] = NON_GREEDY; continue; @@ -4146,237 +4096,6 @@ re_match(bufp, string_arg, size, pos, regs) } -/* We are passed P pointing to a register number after a start_memory. - - Return true if the pattern up to the corresponding stop_memory can - match the empty string, and false otherwise. - - If we find the matching stop_memory, sets P to point to one past its number. - Otherwise, sets P to an undefined byte less than or equal to END. - - We don't handle duplicates properly (yet). */ - -static int -group_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - /* Point to after the args to the start_memory. */ - unsigned char *p1 = *p + 2; - - while (p1 < end) { - /* Skip over opcodes that can match nothing, and return true or - false, as appropriate, when we get to one that can't, or to the - matching stop_memory. */ - - switch ((enum regexpcode)*p1) { - /* Could be either a loop or a series of alternatives. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - /* If the next operation is not a jump backwards in the - pattern. */ - - if (mcnt >= 0) { - /* Go through the on_failure_jumps of the alternatives, - seeing if any of the alternatives cannot match nothing. - The last alternative starts with only a jump, - whereas the rest start with on_failure_jump and end - with a jump, e.g., here is the pattern for `a|b|c': - - /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 - /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 - /exactn/1/c - - So, we have to first go through the first (n-1) - alternatives and then deal with the last one separately. */ - - - /* Deal with the first (n-1) alternatives, which start - with an on_failure_jump (see above) that jumps to right - past a jump_past_alt. */ - - while ((enum regexpcode)p1[mcnt-3] == jump_past_alt) { - /* `mcnt' holds how many bytes long the alternative - is, including the ending `jump_past_alt' and - its number. */ - - if (!alt_match_null_string_p (p1, p1 + mcnt - 3, - reg_info)) - return 0; - - /* Move to right after this alternative, including the - jump_past_alt. */ - p1 += mcnt; - - /* Break if it's the beginning of an n-th alternative - that doesn't begin with an on_failure_jump. */ - if ((enum regexpcode)*p1 != on_failure_jump) - break; - - /* Still have to check that it's not an n-th - alternative that starts with an on_failure_jump. */ - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if ((enum regexpcode)p1[mcnt-3] != jump_past_alt) { - /* Get to the beginning of the n-th alternative. */ - p1 -= 3; - break; - } - } - - /* Deal with the last alternative: go back and get number - of the `jump_past_alt' just before it. `mcnt' contains - the length of the alternative. */ - EXTRACT_NUMBER (mcnt, p1 - 2); -#if 0 - if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) - return 0; -#endif - p1 += mcnt; /* Get past the n-th alternative. */ - } /* if mcnt > 0 */ - break; - - - case stop_memory: - *p = p1 + 2; - return 1; - - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return 0; - } - } /* while p1 < end */ - - return 0; -} /* group_match_null_string_p */ - - -/* Similar to group_match_null_string_p, but doesn't deal with alternatives: - It expects P to be the first byte of a single alternative and END one - byte past the last. The alternative can contain groups. */ - -static int -alt_match_null_string_p (p, end, reg_info) - unsigned char *p, *end; - register_info_type *reg_info; -{ - int mcnt; - unsigned char *p1 = p; - - while (p1 < end) { - /* Skip over opcodes that can match nothing, and break when we get - to one that can't. */ - - switch ((enum regexpcode)*p1) { - /* It's a loop. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - break; - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return 0; - } - } /* while p1 < end */ - - return 1; -} /* alt_match_null_string_p */ - - -/* Deals with the ops common to group_match_null_string_p and - alt_match_null_string_p. - - Sets P to one after the op and its arguments, if any. */ - -static int -common_op_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - int ret; - int reg_no; - unsigned char *p1 = *p; - - switch ((enum regexpcode)*p1++) { - case unused: - case begline: - case endline: - case begbuf: - case endbuf: - case endbuf2: - case wordbeg: - case wordend: - case wordbound: - case notwordbound: -#ifdef emacs - case before_dot: - case at_dot: - case after_dot: -#endif - break; - - case start_memory: - reg_no = *p1; - ret = group_match_null_string_p (&p1, end, reg_info); - - /* Have to set this here in case we're checking a group which - contains a group and a back reference to it. */ - - if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; - - if (!ret) - return 0; - break; - - /* If this is an optimized succeed_n for zero times, make the jump. */ - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (mcnt >= 0) - p1 += mcnt; - else - return 0; - break; - - case succeed_n: - /* Get to the number of times to succeed. */ - p1 += 2; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - if (mcnt == 0) { - p1 -= 4; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - } - else - return 0; - break; - - case duplicate: - if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) - return 0; - break; - - case set_number_at: - p1 += 4; - - default: - /* All other opcodes mean we cannot match the empty string. */ - return 0; - } - - *p = p1; - return 1; -} /* common_op_match_null_string_p */ - - static int memcmp_translate(s1, s2, len) unsigned char *s1, *s2; @@ -244,21 +244,21 @@ struct RFloat { struct RString { struct RBasic basic; - int len; + long len; char *ptr; VALUE orig; }; struct RArray { struct RBasic basic; - int len, capa; + long len, capa; VALUE *ptr; }; struct RRegexp { struct RBasic basic; struct re_pattern_buffer *ptr; - int len; + long len; char *str; }; @@ -303,14 +303,14 @@ VALUE rb_data_object_alloc _((VALUE,void*,void (*)(),void (*)())); struct RStruct { struct RBasic basic; - int len; + long len; VALUE *ptr; }; struct RBignum { struct RBasic basic; char sign; - int len; + long len; unsigned short *digits; }; @@ -301,7 +301,7 @@ posix_signal(signum, handler) #define ruby_signal(sig,handle) signal((sig),(handle)) #endif -static int +static void signal_exec(sig) int sig; { @@ -36,7 +36,7 @@ extern VALUE rb_rs; VALUE rb_str_new(ptr, len) const char *ptr; - int len; + long len; { NEWOBJ(str, struct RString); OBJSETUP(str, rb_cString, T_STRING); @@ -62,7 +62,7 @@ rb_str_new2(ptr) VALUE rb_tainted_str_new(ptr, len) const char *ptr; - int len; + long len; { VALUE str = rb_str_new(ptr, len); @@ -223,7 +223,7 @@ static VALUE rb_str_length(str) VALUE str; { - return INT2FIX(RSTRING(str)->len); + return INT2NUM(RSTRING(str)->len); } static VALUE @@ -259,9 +259,9 @@ rb_str_times(str, times) VALUE times; { VALUE str2; - int i, len; + long i, len; - len = NUM2INT(times); + len = NUM2LONG(times); if (len < 0) { rb_raise(rb_eArgError, "negative argument"); } @@ -302,7 +302,7 @@ rb_str_format(str, arg) VALUE rb_str_substr(str, beg, len) VALUE str; - int beg, len; + long beg, len; { VALUE str2; @@ -378,7 +378,7 @@ rb_str_dup_frozen(str) VALUE rb_str_resize(str, len) VALUE str; - int len; + long len; { rb_str_modify(str); @@ -396,7 +396,7 @@ VALUE rb_str_cat(str, ptr, len) VALUE str; const char *ptr; - int len; + long len; { if (len > 0) { rb_str_modify(str); @@ -429,7 +429,7 @@ int rb_str_hash(str) VALUE str; { - register int len = RSTRING(str)->len; + register long len = RSTRING(str)->len; register char *p = RSTRING(str)->ptr; register int key = 0; @@ -462,7 +462,8 @@ int rb_str_cmp(str1, str2) VALUE str1, str2; { - int len, retval; + long len; + int retval; if (ruby_ignorecase) { return rb_str_cicmp(str1, str2); @@ -510,7 +511,7 @@ rb_str_match(x, y) VALUE x, y; { VALUE reg; - int start; + long start; switch (TYPE(y)) { case T_REGEXP: @@ -522,7 +523,7 @@ rb_str_match(x, y) if (start == -1) { return Qfalse; } - return INT2FIX(start); + return INT2NUM(start); default: return rb_funcall(y, rb_intern("=~"), 1, x); @@ -536,13 +537,13 @@ rb_str_match2(str) return rb_reg_match2(rb_reg_regcomp(str)); } -static int +static long rb_str_index(str, sub, offset) VALUE str, sub; - int offset; + long offset; { char *s, *e, *p; - int len; + long len; if (offset < 0) { offset += RSTRING(str)->len; @@ -571,10 +572,10 @@ rb_str_index_method(argc, argv, str) { VALUE sub; VALUE initpos; - int pos; + long pos; if (rb_scan_args(argc, argv, "11", &sub, &initpos) == 2) { - pos = NUM2INT(initpos); + pos = NUM2LONG(initpos); } else { pos = 0; @@ -592,11 +593,11 @@ rb_str_index_method(argc, argv, str) case T_FIXNUM: { int c = FIX2INT(sub); - int len = RSTRING(str)->len; + long len = RSTRING(str)->len; char *p = RSTRING(str)->ptr; for (;pos<len;pos++) { - if (p[pos] == c) return INT2FIX(pos); + if (p[pos] == c) return INT2NUM(pos); } return Qnil; } @@ -607,7 +608,7 @@ rb_str_index_method(argc, argv, str) } if (pos == -1) return Qnil; - return INT2FIX(pos); + return INT2NUM(pos); } static VALUE @@ -632,7 +633,7 @@ rb_str_rindex(argc, argv, str) switch (TYPE(sub)) { case T_REGEXP: pos = rb_reg_search(sub, str, pos, 1); - if (pos >= 0) return INT2FIX(pos); + if (pos >= 0) return INT2NUM(pos); break; case T_STRING: @@ -644,7 +645,7 @@ rb_str_rindex(argc, argv, str) len = RSTRING(sub)->len; while (sbeg <= s) { if (*s == *t && memcmp(s, t, len) == 0) { - return INT2FIX(s - RSTRING(str)->ptr); + return INT2NUM(s - RSTRING(str)->ptr); } s--; } @@ -657,7 +658,7 @@ rb_str_rindex(argc, argv, str) char *pbeg = RSTRING(str)->ptr + pos; while (pbeg <= p) { - if (*p == c) return INT2FIX(p - RSTRING(str)->ptr); + if (*p == c) return INT2NUM(p - RSTRING(str)->ptr); p--; } return Qnil; @@ -774,11 +775,11 @@ rb_str_aref(str, indx) VALUE str; VALUE indx; { - int idx; + long idx; switch (TYPE(indx)) { case T_FIXNUM: - idx = FIX2INT(indx); + idx = FIX2LONG(indx); if (idx < 0) { idx = RSTRING(str)->len + idx; @@ -800,7 +801,7 @@ rb_str_aref(str, indx) default: /* check if indx is Range */ { - int beg, len; + long beg, len; switch (rb_range_beg_len(indx, &beg, &len, RSTRING(str)->len, 0)) { case Qfalse: break; @@ -861,7 +862,7 @@ rb_str_aset(str, indx, val) VALUE indx, val; { int idx; - int beg, end; + int beg; switch (TYPE(indx)) { case T_FIXNUM: @@ -905,7 +906,7 @@ rb_str_aset(str, indx, val) default: /* check if indx is Range */ { - int beg, len; + long beg, len; if (rb_range_beg_len(indx, &beg, &len, RSTRING(str)->len, 2)) { if (TYPE(val) != T_STRING) val = rb_str_to_str(val); rb_str_replace(str, beg, len, val); @@ -1256,16 +1257,16 @@ static VALUE rb_str_include(str, arg) VALUE str, arg; { - int i; + long i; if (FIXNUM_P(arg)) { int c = FIX2INT(arg); - int len = RSTRING(str)->len; + long len = RSTRING(str)->len; char *p = RSTRING(str)->ptr; for (i=0; i<len; i++) { if (p[i] == c) { - return INT2FIX(i); + return INT2NUM(i); } } return Qfalse; @@ -1275,7 +1276,7 @@ rb_str_include(str, arg) i = rb_str_index(str, arg, 0); if (i == -1) return Qfalse; - return INT2FIX(i); + return INT2NUM(i); } static VALUE @@ -2318,11 +2319,11 @@ rb_str_strip(str) static VALUE scan_once(str, pat, start) VALUE str, pat; - int *start; + long *start; { VALUE result, match; struct re_registers *regs; - int i; + long i; if (rb_reg_search(pat, str, *start, 0) >= 0) { match = rb_backref_get(); @@ -2354,7 +2355,7 @@ rb_str_scan(str, pat) VALUE str, pat; { VALUE result; - int start = 0; + long start = 0; pat = get_pat(pat); if (!rb_iterator_p()) { @@ -2467,7 +2468,7 @@ rb_str_ljust(str, w) VALUE str; VALUE w; { - int width = NUM2INT(w); + long width = NUM2LONG(w); VALUE res; char *p, *pend; @@ -2486,7 +2487,7 @@ rb_str_rjust(str, w) VALUE str; VALUE w; { - int width = NUM2INT(w); + long width = NUM2LONG(w); VALUE res; char *p, *pend; @@ -2505,10 +2506,10 @@ rb_str_center(str, w) VALUE str; VALUE w; { - int width = NUM2INT(w); + long width = NUM2LONG(w); VALUE res; char *p, *pend; - int n; + long n; if (width < 0 || RSTRING(str)->len >= width) return str; res = rb_str_new(0, width); @@ -79,13 +79,13 @@ rb_struct_getmember(obj, id) ID id; { VALUE member, slot; - int i; + long i; member = iv_get(class_of(obj), "__member__"); if (NIL_P(member)) { rb_bug("non-initialized struct"); } - slot = INT2FIX(id); + slot = INT2NUM(id); for (i=0; i<RARRAY(member)->len; i++) { if (RARRAY(member)->ptr[i] == slot) { return RSTRUCT(obj)->ptr[i]; @@ -131,7 +131,7 @@ rb_struct_set(obj, val) VALUE obj, val; { VALUE member, slot; - int i; + long i; member = iv_get(class_of(obj), "__member__"); if (NIL_P(member)) { @@ -153,7 +153,7 @@ make_struct(name, member, klass) { VALUE nstr; ID id; - int i; + long i; if (NIL_P(name)) { nstr = rb_class_new(klass); @@ -166,7 +166,7 @@ make_struct(name, member, klass) } nstr = rb_define_class_under(klass, cname, klass); } - rb_iv_set(nstr, "__size__", INT2FIX(RARRAY(member)->len)); + rb_iv_set(nstr, "__size__", INT2NUM(RARRAY(member)->len)); rb_iv_set(nstr, "__member__", member); rb_define_singleton_method(nstr, "new", struct_alloc, -1); @@ -226,7 +226,7 @@ rb_struct_s_def(argc, argv, klass) VALUE *argv; { VALUE name, rest; - int i; + long i; VALUE st; rb_scan_args(argc, argv, "1*", &name, &rest); @@ -246,7 +246,7 @@ rb_struct_initialize(self, values) { VALUE klass = CLASS_OF(self); VALUE size; - int n; + long n; size = iv_get(klass, "__size__"); n = FIX2INT(size); @@ -264,13 +264,13 @@ struct_alloc(argc, argv, klass) VALUE klass; { VALUE size; - int n; + long n; NEWOBJ(st, struct RStruct); OBJSETUP(st, klass, T_STRUCT); size = iv_get(klass, "__size__"); - n = FIX2INT(size); + n = FIX2LONG(size); st->len = 0; /* avoid GC crashing */ st->ptr = ALLOC_N(VALUE, n); @@ -298,11 +298,11 @@ rb_struct_new(klass, va_alist) #endif { VALUE sz, *mem; - int size, i; + long size, i; va_list args; sz = iv_get(klass, "__size__"); - size = FIX2INT(sz); + size = FIX2LONG(sz); mem = ALLOCA_N(VALUE, size); va_init_list(args, klass); for (i=0; i<size; i++) { @@ -317,7 +317,7 @@ static VALUE rb_struct_each(s) VALUE s; { - int i; + long i; for (i=0; i<RSTRUCT(s)->len; i++) { rb_yield(RSTRUCT(s)->ptr[i]); @@ -342,7 +342,7 @@ inspect_struct(s) { char *cname = rb_class2name(CLASS_OF(s)); VALUE str, member; - int i; + long i; member = iv_get(CLASS_OF(s), "__member__"); if (NIL_P(member)) { @@ -360,7 +360,7 @@ inspect_struct(s) rb_str_cat(str, ", ", 2); } slot = RARRAY(member)->ptr[i]; - p = rb_id2name(FIX2INT(slot)); + p = rb_id2name(FIX2LONG(slot)); rb_str_cat(str, p, strlen(p)); rb_str_cat(str, "=", 1); str2 = rb_inspect(RSTRUCT(s)->ptr[i]); @@ -412,7 +412,7 @@ rb_struct_aref_id(s, id) ID id; { VALUE member; - int i, len; + long i, len; member = iv_get(CLASS_OF(s), "__member__"); if (NIL_P(member)) { @@ -433,13 +433,13 @@ VALUE rb_struct_aref(s, idx) VALUE s, idx; { - int i; + long i; if (TYPE(idx) == T_STRING) { return rb_struct_aref_id(s, rb_to_id(idx)); } - i = NUM2INT(idx); + i = NUM2LONG(idx); if (i < 0) i = RSTRUCT(s)->len + i; if (i < 0) rb_raise(rb_eIndexError, "offset %d too small for struct(size:%d)", @@ -456,7 +456,7 @@ rb_struct_aset_id(s, id, val) ID id; { VALUE member; - int i, len; + long i, len; member = iv_get(CLASS_OF(s), "__member__"); if (NIL_P(member)) { @@ -477,13 +477,13 @@ VALUE rb_struct_aset(s, idx, val) VALUE s, idx, val; { - int i; + long i; if (TYPE(idx) == T_STRING) { return rb_struct_aset_id(s, rb_to_id(idx), val); } - i = NUM2INT(idx); + i = NUM2LONG(idx); if (i < 0) i = RSTRUCT(s)->len + i; if (i < 0) rb_raise(rb_eIndexError, "offset %d too small for struct(size:%d)", @@ -498,7 +498,7 @@ static VALUE rb_struct_equal(s, s2) VALUE s, s2; { - int i; + long i; if (TYPE(s2) != T_STRUCT) return Qfalse; if (CLASS_OF(s) != CLASS_OF(s2)) return Qfalse; @@ -516,7 +516,7 @@ static VALUE rb_struct_eql(s, s2) VALUE s, s2; { - int i; + long i; if (TYPE(s2) != T_STRUCT) return Qfalse; if (CLASS_OF(s) != CLASS_OF(s2)) return Qfalse; @@ -534,7 +534,8 @@ static VALUE rb_struct_hash(s) VALUE s; { - int i, h; + long i; + int h; h = CLASS_OF(s); for (i=0; i<RSTRUCT(s)->len; i++) { diff --git a/variable.c b/variable.c index 6d5659260c..8f07455848 100644 --- a/variable.c +++ b/variable.c @@ -168,7 +168,7 @@ rb_class_path(klass) char *s = "Class"; if (TYPE(klass) == T_MODULE) s = "Module"; - sprintf(buf, "#<%s 0x%x>", s, klass); + sprintf(buf, "#<%s 0lx%lx>", s, klass); return rb_str_new2(buf); } } @@ -1,2 +1,2 @@ #define RUBY_VERSION "1.3.3" -#define RUBY_RELEASE_DATE "1999-05-18" +#define RUBY_RELEASE_DATE "1999-05-25" diff --git a/win32/Makefile b/win32/Makefile index 4275d93a55..6fc60bb164 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -79,13 +79,13 @@ OBJS = array.obj \ all: miniruby$(binsuffix) rbconfig.rb ext/Setup $(MISCLIBS) set LIB=..\..\win32;$(ORGLIBPATH) - @./miniruby$(binsuffix) -Xext extmk.rb static + @.\miniruby$(binsuffix) -Xext extmk.rb static miniruby$(binsuffix): $(OBJS) $(MAINOBJ) $(EXTOBJS) @echo $(EXTOBJS) @echo $(LIBS) @rm -f miniruby$(binsuffix) - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBS) -o $@ + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(OBJS) $(LIBS) -o $@ $(PROGRAM): $(LIBRUBY) $(MAINOBJ) rubymw.dll @rm -f $(PROGRAM) @@ -120,6 +120,12 @@ realclean: distclean test: miniruby$(binsuffix) @.\miniruby$(binsuffix) $(srcdir)/rubytest.rb +rbconfig.rb: miniruby$(binsuffix) + @.\miniruby$(binsuffix) $(srcdir)/mkconfig.rb rbconfig.rb + +config.status: $(srcdir)/configure +# $(SHELL) ./config.status --recheck + .c.obj: $(CC) $(CFLAGS) $(CPPFLAGS) -c $< diff --git a/win32/config.status b/win32/config.status new file mode 100644 index 0000000000..3c5adfe823 --- /dev/null +++ b/win32/config.status @@ -0,0 +1,52 @@ +s%@CFLAGS@% -O%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@DEFS@% + -DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT= 4 -DSIZEOF_DOUBLE 8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 RSHIFT\(x,y\)\ \(\(x\)\>\>y\) FILE_COUNT _cnt DLEXT \".dll\" RUBY_LIB \";/usr/local/lib/ruby;.\" RUBY_ARCHLIB \"/usr/local/lib/ruby/i386-mswin32\" RUBY_PLATFORM \"i386-mswin32\" %g +s%@LDFLAGS@%%g +s%@LIBS@%advapi32.lib wsock32.lib%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@host@%i386-pc-mswin32%g +s%@host_alias@%i386-mswin32%g +s%@host_cpu@%i386%g +s%@host_vendor@%pc%g +s%@host_os@%i386-mswin32%g +s%@CC@%cl%g +s%@CPP@%cl -E%g +s%@YACC@%bison -y%g +s%@RANLIB@%ranlib%g +s%@AR@%lib%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@SET_MAKE@%%g +s%@LIBOBJS@% crypt.obj alloca.obj win32.obj fnmatch.obj isinf.obj isnan.obj%g +s%@ALLOCA@%%g +s%@DLDFLAGS@%%g +s%@STATIC@%%g +s%@CCDLFLAGS@%%g +s%@LDSHARED@%ld%g +s%@DLEXT@%dll%g +s%@STRIP@%%g +s%@EXTSTATIC@%%g +s%@binsuffix@%.exe%g +s%@setup@%Setup%g +s%@LIBRUBY@%libruby.lib%g +s%@LIBRUBYARG@%libruby.lib%g +s%@SOLIBS@%%g +s%@srcdir%.%g +s%@arch@%i386-mswin32%g +ac_given_srcdir=. diff --git a/win32/ntsetup.bat b/win32/ntsetup.bat index ee6294fada..5d0ca70643 100755 --- a/win32/ntsetup.bat +++ b/win32/ntsetup.bat @@ -2,6 +2,7 @@ copy config.h .. copy Makefile .. copy ruby.def .. +copy config.status .. cd ..\ext copy Setup.nt Setup copy extmk.rb.nt extmk.rb diff --git a/win32/sdbm.c b/win32/sdbm.c deleted file mode 100644 index d2d2171875..0000000000 --- a/win32/sdbm.c +++ /dev/null @@ -1,981 +0,0 @@ -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: public domain. - * - * core routines - */ - -#ifndef lint -/*char sdbm_rcsid[] = "$Id: sdbm.c,v 1.16 90/12/13 13:01:31 oz Exp $";*/ -#endif - -#include "sdbm.h" - -/*#include "tune.h"*/ -/* - * sdbm - ndbm work-alike hashed database library - * tuning and portability constructs [not nearly enough] - * author: oz@nexus.yorku.ca - */ - -#define BYTESIZ 8 - -#ifdef SVID -#include <unistd.h> -#endif - -#ifdef __GO32__ -#include <unistd.h> -#endif - -#ifdef BSD42 -#define SEEK_SET L_SET -#define memset(s,c,n) bzero(s, n) /* only when c is zero */ -#define memcpy(s1,s2,n) bcopy(s2, s1, n) -#define memcmp(s1,s2,n) bcmp(s1,s2,n) -#endif - -/* - * important tuning parms (hah) - */ - -#define SEEDUPS /* always detect duplicates */ -#define BADMESS /* generate a message for worst case: - cannot make room after SPLTMAX splits */ -/* - * misc - */ -#ifdef DEBUG -#define debug(x) printf x -#else -#define debug(x) -#endif - -#ifdef BIG_E -#define GET_SHORT(p, i) (((unsigned)((unsigned char *)(p))[(i)*2] << 8) + (((unsigned char *)(p))[(i)*2 + 1])) -#define PUT_SHORT(p, i, s) (((unsigned char *)(p))[(i)*2] = (unsigned char)((s) >> 8), ((unsigned char *)(p))[(i)*2 + 1] = (unsigned char)(s)) -#else -#define GET_SHORT(p, i) ((p)[i]) -#define PUT_SHORT(p, i, s) ((p)[i] = (s)) -#endif - -/*#include "pair.h"*/ -static int fitpair proto((char *, int)); -static void putpair proto((char *, datum, datum)); -static datum getpair proto((char *, datum)); -static int delpair proto((char *, datum)); -static int chkpage proto((char *)); -static datum getnkey proto((char *, int)); -static void splpage proto((char *, char *, long)); -#ifdef SEEDUPS -static int duppair proto((char *, datum)); -#endif - -#ifdef MSDOS -#include <stdio.h> -#include <stdlib.h> -#include <io.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> -#ifdef BSD42 -#include <sys/file.h> -#else -#include <fcntl.h> -/*#include <memory.h>*/ -#endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#include <errno.h> -#ifndef EPERM -#define EPERM EACCES -#endif -#include <string.h> - -#ifdef __STDC__ -#include <stddef.h> -#endif - -#ifndef NULL -#define NULL 0 -#endif - -/* - * externals - */ -#ifndef sun -#ifndef MSDOS -extern int errno; -#endif -#endif - -/* - * forward - */ -static int getdbit proto((DBM *, long)); -static int setdbit proto((DBM *, long)); -static int getpage proto((DBM *, long)); -static datum getnext proto((DBM *)); -static int makroom proto((DBM *, long, int)); - -/* - * useful macros - */ -#define bad(x) ((x).dptr == NULL || (x).dsize < 0) -#define exhash(item) dbm_hash((item).dptr, (item).dsize) -#define ioerr(db) ((db)->flags |= DBM_IOERR) - -#define OFF_PAG(off) (long) (off) * PBLKSIZ -#define OFF_DIR(off) (long) (off) * DBLKSIZ - -static long masks[] = { - 000000000000L, 000000000001L, 000000000003L, - 000000000007L, 000000000017L, 000000000037L, - 000000000077L, 000000000177L, 000000000377L, - 000000000777L, 000000001777L, 000000003777L, - 000000007777L, 000000017777L, 000000037777L, - 000000077777L, 000000177777L, 000000377777L, - 000000777777L, 000001777777L, 000003777777L, - 000007777777L, 000017777777L, 000037777777L, - 000077777777L, 000177777777L, 000377777777L, - 000777777777L, 001777777777L, 003777777777L, - 007777777777L, 017777777777L -}; - -datum nullitem = {NULL, 0}; - -DBM * -dbm_open(file, flags, mode) -register char *file; -register int flags; -register int mode; -{ - register DBM *db; - register char *dirname; - register char *pagname; - register int n; - - if (file == NULL || !*file) - return errno = EINVAL, (DBM *) NULL; -/* - * need space for two seperate filenames - */ - n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2; - - if ((dirname = malloc((unsigned) n)) == NULL) - return errno = ENOMEM, (DBM *) NULL; -/* - * build the file names - */ - dirname = strcat(strcpy(dirname, file), DIRFEXT); - pagname = strcpy(dirname + strlen(dirname) + 1, file); - pagname = strcat(pagname, PAGFEXT); - - db = dbm_prep(dirname, pagname, flags, mode); - free((char *) dirname); - return db; -} - -DBM * -dbm_prep(dirname, pagname, flags, mode) -char *dirname; -char *pagname; -int flags; -int mode; -{ - register DBM *db; - struct stat dstat; - - if ((db = (DBM *) malloc(sizeof(DBM))) == NULL) - return errno = ENOMEM, (DBM *) NULL; - - db->flags = 0; - db->hmask = 0; - db->blkptr = 0; - db->keyptr = 0; -/* - * adjust user flags so that WRONLY becomes RDWR, - * as required by this package. Also set our internal - * flag for RDONLY. - */ - if (flags & O_WRONLY) - flags = (flags & ~O_WRONLY) | O_RDWR; - if (flags & O_RDONLY) - db->flags = DBM_RDONLY; -/* - * open the files in sequence, and stat the dirfile. - * If we fail anywhere, undo everything, return NULL. - */ -#ifdef MSDOS - flags |= O_BINARY; -#endif - if ((db->pagf = open(pagname, flags, mode)) > -1) { - if ((db->dirf = open(dirname, flags, mode)) > -1) { -/* - * need the dirfile size to establish max bit number. - */ - if (fstat(db->dirf, &dstat) == 0) { -/* - * zero size: either a fresh database, or one with a single, - * unsplit data page: dirpage is all zeros. - */ - db->dirbno = (!dstat.st_size) ? 0 : -1; - db->pagbno = -1; - db->maxbno = dstat.st_size * (long) BYTESIZ; - - (void) memset(db->pagbuf, 0, PBLKSIZ); - (void) memset(db->dirbuf, 0, DBLKSIZ); - /* - * success - */ - return db; - } - (void) close(db->dirf); - } - (void) close(db->pagf); - } - free((char *) db); - return (DBM *) NULL; -} - -void -dbm_close(db) -register DBM *db; -{ - if (db == NULL) - errno = EINVAL; - else { - (void) close(db->dirf); - (void) close(db->pagf); - free((char *) db); - } -} - -datum -dbm_fetch(db, key) -register DBM *db; -datum key; -{ - if (db == NULL || bad(key)) - return errno = EINVAL, nullitem; - - if (getpage(db, exhash(key))) - return getpair(db->pagbuf, key); - - return ioerr(db), nullitem; -} - -int -dbm_delete(db, key) -register DBM *db; -datum key; -{ - if (db == NULL || bad(key)) - return errno = EINVAL, -1; - if (dbm_rdonly(db)) - return errno = EPERM, -1; - - if (getpage(db, exhash(key))) { - if (!delpair(db->pagbuf, key)) - return -1; -/* - * update the page file - */ - if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 - || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return ioerr(db), -1; - - return 0; - } - - return ioerr(db), -1; -} - -int -dbm_store(db, key, val, flags) -register DBM *db; -datum key; -datum val; -int flags; -{ - int need; - register long hash; - - if (db == NULL || bad(key)) - return errno = EINVAL, -1; - if (dbm_rdonly(db)) - return errno = EPERM, -1; - - need = key.dsize + val.dsize; -/* - * is the pair too big (or too small) for this database ?? - */ - if (need < 0 || need > PAIRMAX) - return errno = EINVAL, -1; - - if (getpage(db, (hash = exhash(key)))) { -/* - * if we need to replace, delete the key/data pair - * first. If it is not there, ignore. - */ - if (flags == DBM_REPLACE) - (void) delpair(db->pagbuf, key); -#ifdef SEEDUPS - else if (duppair(db->pagbuf, key)) - return 1; -#endif -/* - * if we do not have enough room, we have to split. - */ - if (!fitpair(db->pagbuf, need)) - if (!makroom(db, hash, need)) - return ioerr(db), -1; -/* - * we have enough room or split is successful. insert the key, - * and update the page file. - */ - (void) putpair(db->pagbuf, key, val); - - if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 - || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return ioerr(db), -1; - /* - * success - */ - return 0; - } - - return ioerr(db), -1; -} - -/* - * makroom - make room by splitting the overfull page - * this routine will attempt to make room for SPLTMAX times before - * giving up. - */ -static int -makroom(db, hash, need) -register DBM *db; -long hash; -int need; -{ - long newp; - char twin[PBLKSIZ]; -#ifdef MSDOS - char zer[PBLKSIZ]; -#endif - char *pag = db->pagbuf; - char *new = twin; - register int smax = SPLTMAX; - long oldtail; - - do { -/* - * split the current page - */ - (void) splpage(pag, new, db->hmask + 1); -/* - * address of the new page - */ - newp = (hash & db->hmask) | (db->hmask + 1); - debug(("newp: %ld\n", newp)); -/* - * write delay, read avoidence/cache shuffle: - * select the page for incoming pair: if key is to go to the new page, - * write out the previous one, and copy the new one over, thus making - * it the current page. If not, simply write the new page, and we are - * still looking at the page of interest. current page is not updated - * here, as dbm_store will do so, after it inserts the incoming pair. - */ - -#ifdef MSDOS - /* - * Fill hole with 0 if made it. - * (hole is NOT read as 0) - */ - oldtail = lseek(db->pagf, 0L, SEEK_END); - memset(zer, 0, PBLKSIZ); - while (OFF_PAG(newp) > oldtail) { - if (lseek(db->pagf, 0L, SEEK_END) < 0 || - write(db->pagf, zer, PBLKSIZ) < 0) { - - return 0; - } - oldtail += PBLKSIZ; - } -#endif - - if (hash & (db->hmask + 1)) { - if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 - || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return 0; - db->pagbno = newp; - (void) memcpy(pag, new, PBLKSIZ); - } - else if (lseek(db->pagf, OFF_PAG(newp), SEEK_SET) < 0 - || write(db->pagf, new, PBLKSIZ) < 0) - return 0; - - if (!setdbit(db, db->curbit)) - return 0; -/* - * see if we have enough room now - */ - if (fitpair(pag, need)) - return 1; -/* - * try again... update curbit and hmask as getpage would have - * done. because of our update of the current page, we do not - * need to read in anything. BUT we have to write the current - * [deferred] page out, as the window of failure is too great. - */ - db->curbit = 2 * db->curbit + - ((hash & (db->hmask + 1)) ? 2 : 1); - db->hmask |= (db->hmask + 1); - - if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0 - || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return 0; - - } while (--smax); -/* - * if we are here, this is real bad news. After SPLTMAX splits, - * we still cannot fit the key. say goodnight. - */ -#ifdef BADMESS - (void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44); -#endif - return 0; - -} - -/* - * the following two routines will break if - * deletions aren't taken into account. (ndbm bug) - */ -datum -dbm_firstkey(db) -register DBM *db; -{ - if (db == NULL) - return errno = EINVAL, nullitem; -/* - * start at page 0 - */ - (void) memset(db->pagbuf, 0, PBLKSIZ); - if (lseek(db->pagf, OFF_PAG(0), SEEK_SET) < 0 - || read(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return ioerr(db), nullitem; - db->pagbno = 0; - db->blkptr = 0; - db->keyptr = 0; - - return getnext(db); -} - -datum -dbm_nextkey(db) -register DBM *db; -{ - if (db == NULL) - return errno = EINVAL, nullitem; - return getnext(db); -} - -/* - * all important binary trie traversal - */ -static int -getpage(db, hash) -register DBM *db; -register long hash; -{ - register int hbit; - register long dbit; - register long pagb; - - dbit = 0; - hbit = 0; - while (dbit < db->maxbno && getdbit(db, dbit)) - dbit = 2 * dbit + ((hash & ((long) 1 << hbit++)) ? 2 : 1); - - debug(("dbit: %d...", dbit)); - - db->curbit = dbit; - db->hmask = masks[hbit]; - - pagb = hash & db->hmask; -/* - * see if the block we need is already in memory. - * note: this lookaside cache has about 10% hit rate. - */ - if (pagb != db->pagbno) { -/* - * note: here, we assume a "hole" is read as 0s. - * if not, must zero pagbuf first. - */ - (void) memset(db->pagbuf, 0, PBLKSIZ); - - if (lseek(db->pagf, OFF_PAG(pagb), SEEK_SET) < 0 - || read(db->pagf, db->pagbuf, PBLKSIZ) < 0) - return 0; - if (!chkpage(db->pagbuf)) { - return 0; - } - db->pagbno = pagb; - - debug(("pag read: %d\n", pagb)); - } - return 1; -} - -static int -getdbit(db, dbit) -register DBM *db; -register long dbit; -{ - register long c; - register long dirb; - - c = dbit / BYTESIZ; - dirb = c / DBLKSIZ; - - if (dirb != db->dirbno) { - if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 - || read(db->dirf, db->dirbuf, DBLKSIZ) < 0) - return 0; - db->dirbno = dirb; - - debug(("dir read: %d\n", dirb)); - } - - return db->dirbuf[c % DBLKSIZ] & (1 << (dbit % BYTESIZ)); -} - -static int -setdbit(db, dbit) -register DBM *db; -register long dbit; -{ - register long c; - register long dirb; - - c = dbit / BYTESIZ; - dirb = c / DBLKSIZ; - - if (dirb != db->dirbno) { - if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 - || read(db->dirf, db->dirbuf, DBLKSIZ) < 0) - return 0; - db->dirbno = dirb; - - debug(("dir read: %d\n", dirb)); - } - - db->dirbuf[c % DBLKSIZ] |= (1 << (dbit % BYTESIZ)); - - if (dbit >= db->maxbno) - db->maxbno += (long) DBLKSIZ * BYTESIZ; - - if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 - || write(db->dirf, db->dirbuf, DBLKSIZ) < 0) - return 0; - - return 1; -} - -/* - * getnext - get the next key in the page, and if done with - * the page, try the next page in sequence - */ -static datum -getnext(db) -register DBM *db; -{ - datum key; - - for (;;) { - db->keyptr++; - key = getnkey(db->pagbuf, db->keyptr); - if (key.dptr != NULL) - return key; -/* - * we either run out, or there is nothing on this page.. - * try the next one... If we lost our position on the - * file, we will have to seek. - */ - db->keyptr = 0; - if (db->pagbno != db->blkptr++) - if (lseek(db->pagf, OFF_PAG(db->blkptr), SEEK_SET) < 0) - break; - db->pagbno = db->blkptr; - if (read(db->pagf, db->pagbuf, PBLKSIZ) <= 0) - break; - if (!chkpage(db->pagbuf)) { - break; - } - } - - return ioerr(db), nullitem; -} - -/* pair.c */ -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: public domain. - * - * page-level routines - */ - -#ifndef lint -/*char pair_rcsid[] = "$Id: sdbm.c,v 1.1.1.1.2.1 1998/01/16 12:36:12 matz Exp $";*/ -#endif - -#ifndef BSD42 -/*#include <memory.h>*/ -#endif - -#define exhash(item) dbm_hash((item).dptr, (item).dsize) - -/* - * forward - */ -static int seepair proto((char *, int, char *, int)); - -/* - * page format: - * +------------------------------+ - * ino | n | keyoff | datoff | keyoff | - * +------------+--------+--------+ - * | datoff | - - - ----> | - * +--------+---------------------+ - * | F R E E A R E A | - * +--------------+---------------+ - * | <---- - - - | data | - * +--------+-----+----+----------+ - * | key | data | key | - * +--------+----------+----------+ - * - * calculating the offsets for free area: if the number - * of entries (ino[0]) is zero, the offset to the END of - * the free area is the block size. Otherwise, it is the - * nth (ino[ino[0]]) entry's offset. - */ - -static int -fitpair(pag, need) -char *pag; -int need; -{ - register int n; - register int off; - register int free; - register short *ino = (short *) pag; - - off = ((n = GET_SHORT(ino,0)) > 0) ? GET_SHORT(ino,n) : PBLKSIZ; - free = off - (n + 1) * sizeof(short); - need += 2 * sizeof(short); - - debug(("free %d need %d\n", free, need)); - - return need <= free; -} - -static void -putpair(pag, key, val) -char *pag; -datum key; -datum val; -{ - register int n; - register int off; - register short *ino = (short *) pag; - - off = ((n = GET_SHORT(ino,0)) > 0) ? GET_SHORT(ino,n) : PBLKSIZ; -/* - * enter the key first - */ - off -= key.dsize; - if (key.dsize) - (void) memcpy(pag + off, key.dptr, key.dsize); - PUT_SHORT(ino,n + 1,off); -/* - * now the data - */ - off -= val.dsize; - if (val.dsize) - (void) memcpy(pag + off, val.dptr, val.dsize); - PUT_SHORT(ino,n + 2,off); -/* - * adjust item count - */ - PUT_SHORT(ino,0,GET_SHORT(ino,0) + 2); -} - -static datum -getpair(pag, key) -char *pag; -datum key; -{ - register int i; - register int n; - datum val; - register short *ino = (short *) pag; - - if ((n = GET_SHORT(ino,0)) == 0) - return nullitem; - - if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) - return nullitem; - - val.dptr = pag + GET_SHORT(ino,i + 1); - val.dsize = GET_SHORT(ino,i) - GET_SHORT(ino,i + 1); - return val; -} - -#ifdef SEEDUPS -static int -duppair(pag, key) -char *pag; -datum key; -{ - register short *ino = (short *) pag; - return GET_SHORT(ino,0) > 0 && - seepair(pag, GET_SHORT(ino,0), key.dptr, key.dsize) > 0; -} -#endif - -static datum -getnkey(pag, num) -char *pag; -int num; -{ - datum key; - register int off; - register short *ino = (short *) pag; - - num = num * 2 - 1; - if (GET_SHORT(ino,0) == 0 || num > GET_SHORT(ino,0)) - return nullitem; - - off = (num > 1) ? GET_SHORT(ino,num - 1) : PBLKSIZ; - - key.dptr = pag + GET_SHORT(ino,num); - key.dsize = off - GET_SHORT(ino,num); - - return key; -} - -static int -delpair(pag, key) -char *pag; -datum key; -{ - register int n; - register int i; - register short *ino = (short *) pag; - - if ((n = GET_SHORT(ino,0)) == 0) - return 0; - - if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) - return 0; -/* - * found the key. if it is the last entry - * [i.e. i == n - 1] we just adjust the entry count. - * hard case: move all data down onto the deleted pair, - * shift offsets onto deleted offsets, and adjust them. - * [note: 0 < i < n] - */ - if (i < n - 1) { - register int m; - register char *dst = pag + (i == 1 ? PBLKSIZ : GET_SHORT(ino,i - 1)); - register char *src = pag + GET_SHORT(ino,i + 1); - register int zoo = dst - src; - - debug(("free-up %d ", zoo)); -/* - * shift data/keys down - */ - m = GET_SHORT(ino,i + 1) - GET_SHORT(ino,n); -#ifdef DUFF -#define MOVB *--dst = *--src - - if (m > 0) { - register int loop = (m + 8 - 1) >> 3; - - switch (m & (8 - 1)) { - case 0: do { - MOVB; case 7: MOVB; - case 6: MOVB; case 5: MOVB; - case 4: MOVB; case 3: MOVB; - case 2: MOVB; case 1: MOVB; - } while (--loop); - } - } -#else -#ifdef MEMMOVE - memmove(dst, src, m); -#else - while (m--) - *--dst = *--src; -#endif -#endif -/* - * adjust offset index up - */ - while (i < n - 1) { - PUT_SHORT(ino,i, GET_SHORT(ino,i + 2) + zoo); - i++; - } - } - PUT_SHORT(ino, 0, GET_SHORT(ino, 0) - 2); - return 1; -} - -/* - * search for the key in the page. - * return offset index in the range 0 < i < n. - * return 0 if not found. - */ -static int -seepair(pag, n, key, siz) -char *pag; -register int n; -register char *key; -register int siz; -{ - register int i; - register int off = PBLKSIZ; - register short *ino = (short *) pag; - - for (i = 1; i < n; i += 2) { - if (siz == off - GET_SHORT(ino,i) && - memcmp(key, pag + GET_SHORT(ino,i), siz) == 0) - return i; - off = GET_SHORT(ino,i + 1); - } - return 0; -} - -static void -splpage(pag, new, sbit) -char *pag; -char *new; -long sbit; -{ - datum key; - datum val; - - register int n; - register int off = PBLKSIZ; - char cur[PBLKSIZ]; - register short *ino = (short *) cur; - - (void) memcpy(cur, pag, PBLKSIZ); - (void) memset(pag, 0, PBLKSIZ); - (void) memset(new, 0, PBLKSIZ); - - n = GET_SHORT(ino,0); - for (ino++; n > 0; ino += 2) { - key.dptr = cur + GET_SHORT(ino,0); - key.dsize = off - GET_SHORT(ino,0); - val.dptr = cur + GET_SHORT(ino,1); - val.dsize = GET_SHORT(ino,0) - GET_SHORT(ino,1); -/* - * select the page pointer (by looking at sbit) and insert - */ - (void) putpair((exhash(key) & sbit) ? new : pag, key, val); - - off = GET_SHORT(ino,1); - n -= 2; - } - - debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, - ((short *) new)[0] / 2, - ((short *) pag)[0] / 2)); -} - -/* - * check page sanity: - * number of entries should be something - * reasonable, and all offsets in the index should be in order. - * this could be made more rigorous. - */ -static int -chkpage(pag) -char *pag; -{ - register int n; - register int off; - register short *ino = (short *) pag; - - if ((n = GET_SHORT(ino,0)) < 0 || n > PBLKSIZ / sizeof(short)) - return 0; - - if (n > 0) { - off = PBLKSIZ; - for (ino++; n > 0; ino += 2) { - if (GET_SHORT(ino,0) > off || GET_SHORT(ino,1) > off || - GET_SHORT(ino,1) > GET_SHORT(ino,0)) - return 0; - off = GET_SHORT(ino,1); - n -= 2; - } - } - return 1; -} - -/* hash.c */ -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: public domain. keep it that way. - * - * hashing routine - */ - -/* - * polynomial conversion ignoring overflows - * [this seems to work remarkably well, in fact better - * then the ndbm hash function. Replace at your own risk] - * use: 65599 nice. - * 65587 even better. - */ -long -dbm_hash(str, len) -register char *str; -register int len; -{ - register unsigned long n = 0; - -#ifdef DUFF - -#define HASHC n = *str++ + 65599 * n - - if (len > 0) { - register int loop = (len + 8 - 1) >> 3; - - switch(len & (8 - 1)) { - case 0: do { - HASHC; case 7: HASHC; - case 6: HASHC; case 5: HASHC; - case 4: HASHC; case 3: HASHC; - case 2: HASHC; case 1: HASHC; - } while (--loop); - } - - } -#else - while (len--) - n = ((*str++) & 255) + 65587L * n; -#endif - return n; -} diff --git a/win32/sdbm.h b/win32/sdbm.h deleted file mode 100644 index 4b731c6574..0000000000 --- a/win32/sdbm.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: public domain. - */ -#ifndef _NDBM_H_ -#define _NDBM_H_ - -#define DBLKSIZ 4096 -#define PBLKSIZ 1024 -#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */ -#define SPLTMAX 10 /* maximum allowed splits */ - /* for a single insertion */ -#define DIRFEXT ".dir" -#define PAGFEXT ".pag" - -typedef struct { - int dirf; /* directory file descriptor */ - int pagf; /* page file descriptor */ - int flags; /* status/error flags, see below */ - long maxbno; /* size of dirfile in bits */ - long curbit; /* current bit number */ - long hmask; /* current hash mask */ - long blkptr; /* current block for nextkey */ - int keyptr; /* current key for nextkey */ - long blkno; /* current page to read/write */ - long pagbno; /* current page in pagbuf */ - char pagbuf[PBLKSIZ]; /* page file block buffer */ - long dirbno; /* current block in dirbuf */ - char dirbuf[DBLKSIZ]; /* directory file block buffer */ -} DBM; - -#define DBM_RDONLY 0x1 /* data base open read-only */ -#define DBM_IOERR 0x2 /* data base I/O error */ - -/* - * utility macros - */ -#define dbm_rdonly(db) ((db)->flags & DBM_RDONLY) -#define dbm_error(db) ((db)->flags & DBM_IOERR) - -#define dbm_clearerr(db) ((db)->flags &= ~DBM_IOERR) /* ouch */ - -#define dbm_dirfno(db) ((db)->dirf) -#define dbm_pagfno(db) ((db)->pagf) - -typedef struct { - char *dptr; - int dsize; -} datum; - -extern datum nullitem; - -#if defined(__STDC__) || defined(MSDOS) -#define proto(p) p -#else -#define proto(p) () -#endif - -/* - * flags to dbm_store - */ -#define DBM_INSERT 0 -#define DBM_REPLACE 1 - -/* - * ndbm interface - */ -extern DBM *dbm_open proto((char *, int, int)); -extern void dbm_close proto((DBM *)); -extern datum dbm_fetch proto((DBM *, datum)); -extern int dbm_delete proto((DBM *, datum)); -extern int dbm_store proto((DBM *, datum, datum, int)); -extern datum dbm_firstkey proto((DBM *)); -extern datum dbm_nextkey proto((DBM *)); - -/* - * other - */ -extern DBM *dbm_prep proto((char *, char *, int, int)); -extern long dbm_hash proto((char *, int)); - -#endif /* _NDBM_H_ */ diff --git a/win32/win32.c b/win32/win32.c index 54e7e7f7af..5353802f73 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1593,13 +1593,14 @@ myfdopen (int fd, const char *mode) //fprintf(stderr, "myfdopen()\n"); + optlen = sizeof(sockbuf); retval = getsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, sockbuf, &optlen); if (retval == SOCKET_ERROR) { int iRet; iRet = WSAGetLastError(); if (iRet == WSAENOTSOCK || iRet == WSANOTINITIALISED) - return (_fdopen(fd, mode)); + return (_fdopen(fd, mode)); } // |