diff --git a/ChangeLog b/ChangeLog index c6f41e43f6..3eee11bdb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,254 @@ +Wed Mar 24 13:06:43 1999 Yukihiro Matsumoto + + * io.c (next_argv): need to check type for ARGV.shift. + + * eval.c (blk_copy_prev): need to preverse outer scope as well as + outer frames. + + * parse.y (rb_compile_string): return can appear within eval(). + +Tue Mar 23 10:15:07 1999 EGUCHI Osamu + + * configure.in: AC_C_CONST check added. + +Tue Mar 23 02:07:35 1999 Yukihiro Matsumoto + + * time.c (time_plus): preserve gmt-mode for result. + +Mon Mar 22 01:32:37 1999 Yukihiro Matsumoto + + * eval.c (rb_eval): adjust line numbers before expression + interpolation within strings. + + * eval.c (rb_eval): defined? returns nil for false condition. + + * numeric.c (num_nonzero_p): returns nil for false condition. + +Sat Mar 20 13:07:43 1999 Keiju Ishitsuka + + * lib/weakref.rb: avoid leak for two weakrefs for one object. + +Fri Mar 19 11:26:45 1999 WATANABE Hirofumi + + * eval.c (ruby_run): needed to eval END{} on exit. + + * eval.c (rb_exit): ditto. + +Fri Mar 19 02:17:27 1999 Yukihiro Matsumoto + + * signal.c (Init_signal): handles terminating signals HUP, TERM, + QUIT, PIPE, etc. + +Thu Mar 18 15:47:18 1999 Yukihiro Matsumoto + + * bignum.c (rb_big_and): bug in sign calculation. + + * bignum.c (rb_big_or): ditto. + + * io.c (rb_f_select): forgot to use to_io to retrieve IO, after + calling select(2). + +Tue Mar 16 19:54:31 1999 WATANABE Hirofumi + + * ext/extmk.rb.in: static linking cause infinite make loop. + +Tue Mar 16 18:50:04 1999 Yoshida Masato + + * ext/socket/socket.c (tcp_s_gethostbyname): typo, not NUM2INT(), + but INT2NUM(). + + * ext/socket/socket.c (mkhostent): ditto. + +Tue Mar 16 12:31:44 1999 Ryo HAYASAKA + + * file.c (utime_internal): suppress warning by const. + + * time.c (time_gmtime): ditto. + +Tue Mar 16 10:23:05 1999 Yukihiro Matsumoto + + * time.c (time_clone): Time object can be cloned. + +Tue Mar 16 03:13:10 1999 Koji Arai + + * ruby.c (load_file): argv[argc] should be NULL. + +Mon Mar 15 22:12:08 1999 Tadayoshi Funaba + + * sprintf.c (rb_f_sprintf): typo in arg_num check at exit. + +Mon Mar 15 16:42:22 1999 Yukihiro Matsumoto + + * array.c (rb_ary_dup): dup2 should copy class too. + +Mon Mar 15 15:12:53 1999 Yasuhiro Fukuma + + * lib/mkmf.rb: install program relative path check. + +Mon Mar 15 14:05:25 1999 Yukihiro Matsumoto + + * re.c (rb_reg_s_new): 2nd argument is now option. + Regexp::EXTENDED can be specified. + +Fri Mar 12 10:47:49 1999 Yukihiro Matsumoto + + * string.c (rb_str_index): str.index("") should always match at + offset point. + + * string.c (rb_str_upto): can specify end point exclusion. + + * string.c (rb_str_index): negative offset. + + * regex.c (re_match): begline should not match at the point + between a newline and end-of-string. endline neither. + + * regex.c (re_compile_pattern): context_indep_anchors . + + * parse.y (parse_regx): need not to push backslashes before + escaped characters. + + * eval.c (rb_thread_join): re-raises exception within target. + +Fri Mar 12 01:09:36 1999 Koji Arai + + * ext/readline/readline.c (readline_s_vi_editing_mode): wrong + number of arguments. + +Fri Mar 12 02:12:50 1999 Yukihiro Matsumoto + + * pack.c (PACK_ITEM_ADJUST): "a".unpack("C3") => [97, nil, nil] + +Thu Mar 11 18:23:50 1999 WATANABE Tetsuya + + * ext/socket/socket.c (Init_socket): UDPsocket was ommited. + +Thu Mar 11 16:43:30 1999 Yukihiro Matsumoto + + * pack.c (PACK_LENGTH_ADJUST): push fixed number of items per + template to result array. + + * pack.c (pack_unpack): I/N/C etc. push nil in the array for "". + +Tue Mar 9 00:19:21 1999 Yukihiro Matsumoto + + * hash.c (ruby_unsetenv): use ruby_setenv(name, 0). + + * hash.c (env_delete): ditto. + + * string.c (rb_str_upto): do not check `beg + + * string.c (rb_str_index): wrong end point calculation. + +Sat Mar 6 02:19:12 1999 Yukihiro Matsumoto + + * re.c (match_index): MatchingData#index(n) added. + + * array.c (rb_ary_subseq): ary[n..-1] returns an sub-array unless + n is too small negative index. + + * re.c (rb_reg_match_method): Regexp#match(str) added. + + * array.c (rb_ary_indexes): understands ranges as indexes. + + * re.c (match_size): MatchingData#size added. + +Fri Mar 5 01:04:57 1999 Yukihiro Matsumoto + + * array.c (rb_ary_fill): modified for range. + + * array.c (rb_ary_aset): a[n..m] revisited. + +Thu Mar 4 14:23:29 1999 Yukihiro Matsumoto + + * string.c (rb_str_subseq): a[n..m] revisited. + + * parse.y (method_call): allow Const::method{}. + + * array.c (rb_ary_replace_method): should replace original array. + +Thu Mar 4 02:30:22 1999 Yukihiro Matsumoto + + * configure.in: remove --disable-thread, thread feature is no + longer optional. + +Thu Mar 4 00:32:17 1999 Yasuhiro Fukuma + + * parse.y (read_escape): wrong arguments for scan_oct,scan_hex. + +Wed Mar 3 11:51:53 1999 Yukihiro Matsumoto + + * ext/socket/socket.c (Init_socket): rename class names as + TCPsocket -> TCPSocket etc. + +Tue Mar 2 19:46:42 1999 WATANABE Hirofumi + + * configure.in (LDSHARED): use gcc -Wl,-G for solaris with gcc. + +Tue Mar 2 17:04:19 1999 Yukihiro Matsumoto + + * parse.y (yylex): backslashes do not concatenate comment lines + anymore. + +Mon Mar 1 14:05:12 1999 Yukihiro Matsumoto + + * eval.c (rb_call0): adjust argv for optional arguments. super + without arguments emit superclasse method with the value from + optinal arguments. enabled as experiment. + +Sun Feb 28 14:04:07 1999 WATANABE Hirofumi + + * parse.y (nextc): backslash at the eof cause infinite loop + +Sun Feb 28 11:01:26 1999 Tadayoshi Funaba + + * time.c (make_time_t): month range check added. + +Sat Feb 27 02:36:05 1999 Yukihiro Matsumoto + + * re.c (Init_Regexp): add escape as alias of quote. + + * re.c (rb_reg_s_quote): char-code can be specified now. + +Fri Feb 26 18:45:36 1999 Yasuhiro Fukuma + + * eval.c (error_print): bug for error message with newlines. + +Fri Feb 26 12:00:04 1999 Yukihiro Matsumoto + + * time.c (make_time_t): future check modified to allow 1969-12-31 + at certain timezone. + + * time.c (time_arg): year >= 1000 should be past. + + * version.c (Init_version): constant RELEASE_DATE added. + +Fri Feb 26 01:08:30 1999 Yukihiro Matsumoto + + * string.c (rb_str_substr): returns nil for out-of-range access. + + * array.c (rb_ary_subseq): returns nil for out-of-range access. + + * array.c (rb_ary_store): negative index message has changed. + + * string.c (rb_str_aset): reallocation needed. + + * string.c (rb_str_aset): allow char append to the string. + +Thu Feb 25 23:30:17 1999 Tadayoshi Funaba + + * time.c (time_load): tm_year should be packed in 17 bits, not 18. + Thu Feb 25 12:50:25 1999 Yukihiro Matsumoto + * missing/dup2.c: replaced by public domain version. + * time.c (make_time_t): add `future check' in loops. * object.c (rb_num2dbl): forbid implicit conversion from nil, or diff --git a/Makefile.in b/Makefile.in index f399fca6b1..a9d84c8778 100644 --- a/Makefile.in +++ b/Makefile.in @@ -148,9 +148,18 @@ crypt.o: @srcdir@/missing/crypt.c dup2.o: @srcdir@/missing/dup2.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/dup2.c +finite.o: @srcdir@/missing/finite.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/finite.c + flock.o: @srcdir@/missing/flock.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/flock.c +isinf.o: @srcdir@/missing/isinf.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/isinf.c + +isnan.o: @srcdir@/missing/isnan.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/isnan.c + fnmatch.o: @srcdir@/missing/fnmatch.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/fnmatch.c diff --git a/README.EXT b/README.EXT index 9a56bd99e8..97b5b1d328 100644 --- a/README.EXT +++ b/README.EXT @@ -1,6 +1,6 @@ .\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995 -This document explains how to make extention modules for Ruby. +This document explains how to make extention libraries for Ruby. 1.Basic knowledge @@ -184,11 +184,6 @@ interpreter. Useful functions are listed below (not all): 2. Extend Ruby with C -原理的にRubyで書けることはCでも書けます.RubyそのものがCで記 -述されているんですから,当然といえば当然なんですけど.ここで -はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹 -介します. - 2.1 Add new features to Ruby You can add new features (classes, methods, etc.) to the Ruby @@ -422,7 +417,7 @@ The pointer to the structure will be assigned to the variable sval. See example below for detail. -4.Example - Create dbm module +4.Example - Creating dbm extension OK, here's the example to make extension library. This is the extension to access dbm. The full source is included in ext/ @@ -448,17 +443,17 @@ You need to design the library features, before making it. (4) write C code. -拡張ライブラリ本体となるC言語のソースを書きます.C言語のソー -スがひとつの時には「モジュール名.c」を選ぶと良いでしょう.C -言語のソースが複数の場合には逆に「モジュール名.c」というファ -イル名は避ける必要があります.オブジェクトファイルとモジュー -ル生成時に中間的に生成される「モジュール名.o」というファイル -とが衝突するからです. +You need to write C code for your extension library. If your library +has only one source file, choosing ``LIBRARY.c'' as a file name is +preferred. On the other hand, in case your library has prural source +files, avoid chooing ``LIBRARY.c'' for a file name. It may conflict +with intermediate file ``LIBRARY.o'' on some platforms. -Rubyは拡張ライブラリをロードする時に「Init_モジュール名」と -いう関数を自動的に実行します.dbmモジュールの場合「Init_dbm」 -です.この関数の中でクラス,モジュール,メソッド,定数などの -定義を行います.dbm.cから一部引用します. +Ruby will execute the initializing function named ``Init_LIBRARY'' in +the library. For exapmle, ``Init_dbm()'' will be executed when loading +the library. + +Here's the example of an initializing function. -- Init_dbm() @@ -480,11 +475,7 @@ Init_dbm() } -- -DBMモジュールはdbmのデータと対応するオブジェクトになるはずで -すから,Cの世界のdbmをRubyの世界に取り込む必要があります. - - -dbm.cではData_Make_Structを以下のように使っています. +The dbm extension wrap dbm struct in C world using Data_Make_Struct. -- struct dbmdata { @@ -593,23 +584,27 @@ If there exists the file named extconf.rb, it will be executed to generate Makefile. If not, compilation scheme try to generate Makefile anyway. -extconf.rbはモジュールのコンパイルに必要な条件のチェックなど -を行うことが目的です.extconf.rbの中では以下のRuby関数を使う -ことが出来ます. +The extconf.rb is the file to check compilation condition etc. You +need to put - have_library(lib, func): ライブラリの存在チェック - have_func(func): 関数の存在チェック - have_header(header): ヘッダファイルの存在チェック - create_makefile(target): Makefileの生成 + require 'mkmf' -以下の変数を使うことができます. +at the top of the file. You can use the funcitons below to check the +condition. - $CFLAGS: コンパイル時に追加的に指定するフラグ(-Iなど) - $LDFLAGS: リンク時に追加的に指定するフラグ(-Lなど) + have_library(lib, func): check whether library containing function exists. + have_func(func): check whether function exists + have_header(header): check whether header file exists + create_makefile(target): generate Makefile -モジュールをコンパイルする条件が揃わなず,そのモジュールはコ -ンパイルしない時にはcreate_makefileを呼ばなければMakefileは -生成されず,コンパイルも行われません. +The value of variables below will affect Makefile. + + $CFLAGS: included in CFLAGS make variable (such as -I) + $LDFLAGS: included in LDFLAGS make variable (such as -L) + +If compilation condition is not fulfilled, you do not call +``create_makefile''. Makefile will not generated, compilation will +not be done. (6) prepare depend (optional) @@ -620,7 +615,7 @@ check dependency. You can make this file by invoking It's no harm. Prepare it. -(7) MANIFESTファイルにファイル名を入れる +(7) put file names into MANIFEST (optional) % find * -type f -print > MANIFEST % vi MANIFEST @@ -629,18 +624,30 @@ Append file names into MANIFEST. The compilation scheme requires MANIFEST only to be exist. But, you'd better take this step to distinguish required files. -(8) make +(8) generate Makefile -Rubyのディレクトリでmakeを実行するとMakefileを生成からmake, -必要によってはそのモジュールのRubyへのリンクまで自動的に実行 -してくれます.extconf.rbを書き換えるなどしてMakefileの再生成 -が必要な時はまたRubyディレクトリでmakeしてください. +Try generate Makefile by: + + ruby extconf.rb + +You don't need this step, if you put extension library under ext +directory of the ruby source tree. In that case, compilation of the +interpreter will do this step for you. + +(9) make + +Type + + make + +to compile your extension. You don't need this step neither, if you +put extension library under ext directory of the ruby source tree. (9) debug -You may need to rb_debug the module. The modules can be linked -statically by adding directory name in the ext/Setup file, -so that you can inspect the module by the debugger. +You may need to rb_debug the extension. The extensions can be linked +statically by adding directory name in the ext/Setup file, so that you +can inspect the extension with the debugger. (10) done, now you have the extension library @@ -648,12 +655,7 @@ You can do anything you want with your library. The author of Ruby will not claim any restriction about your code depending Ruby API. Feel free to use, modify, distribute or sell your program. -Appendix A. Rubyのソースコードの分類 - -Rubyのソースはいくつかに分類することが出来ます.このうちクラ -スライブラリの部分は基本的に拡張ライブラリと同じ作り方になっ -ています.これらのソースは今までの説明でほとんど理解できると -思います. +Appendix A. Ruby source files overview ruby language core @@ -865,7 +867,7 @@ argc,argv 数に対応する引数が与えられていない場合は変数にQnilが代入され る. -** Rubyメソッド呼び出し +** Invoking Ruby method VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) diff --git a/README.EXT.jp b/README.EXT.jp index 1d56f25501..1cec213d1f 100644 --- a/README.EXT.jp +++ b/README.EXT.jp @@ -505,7 +505,7 @@ C 4.例題 - dbmパッケージを作る ここまでの説明でとりあえず拡張ライブラリは作れるはずです. -Rubyのextディレクトリにすでに含まれているdbmモジュールを例に +Rubyのextディレクトリにすでに含まれているdbmライブラリを例に して段階的に説明します. (1) ディレクトリを作る @@ -515,7 +515,7 @@ Ruby Ruby 1.1からは任意のディレクトリでダイナミックライブラリを作 ることができるようになりました.Rubyに静的にリンクする場合に はRubyを展開したディレクトリの下,extディレクトリの中に拡張 -モジュール用のディレクトリを作る必要があります.名前は適当に +ライブラリ用のディレクトリを作る必要があります.名前は適当に 選んで構いません. (2) MANIFESTファイルを作る @@ -542,14 +542,14 @@ MANIFEST (4) Cコードを書く 拡張ライブラリ本体となるC言語のソースを書きます.C言語のソー -スがひとつの時には「モジュール名.c」を選ぶと良いでしょう.C -言語のソースが複数の場合には逆に「モジュール名.c」というファ +スがひとつの時には「ライブラリ名.c」を選ぶと良いでしょう.C +言語のソースが複数の場合には逆に「ライブラリ名.c」というファ イル名は避ける必要があります.オブジェクトファイルとモジュー -ル生成時に中間的に生成される「モジュール名.o」というファイル +ル生成時に中間的に生成される「ライブラリ名.o」というファイル とが衝突するからです. -Rubyは拡張ライブラリをロードする時に「Init_モジュール名」と -いう関数を自動的に実行します.dbmモジュールの場合「Init_dbm」 +Rubyは拡張ライブラリをロードする時に「Init_ライブラリ名」と +いう関数を自動的に実行します.dbmライブラリの場合「Init_dbm」 です.この関数の中でクラス,モジュール,メソッド,定数などの 定義を行います.dbm.cから一部引用します. @@ -575,7 +575,7 @@ Init_dbm() } -- -DBMモジュールはdbmのデータと対応するオブジェクトになるはずで +DBMライブラリはdbmのデータと対応するオブジェクトになるはずで すから,Cの世界のdbmをRubyの世界に取り込む必要があります. @@ -627,7 +627,7 @@ fdbm_delete(obj, keystr) の引数となります. 引数の数が不定のものはCの配列で受けるものとRubyの配列で受け -るものとがあります.dbmモジュールの中で,Cの配列で受けるもの +るものとがあります.dbmライブラリの中で,Cの配列で受けるもの はDBMのクラスメソッドであるopen()です.これを実装している関 数fdbm_s_open()はこうなっています. @@ -685,9 +685,13 @@ C (5) extconf.rbを用意する Makefileを作る場合の雛型になるextconf.rbというファイルを作り -ます.extconf.rbはモジュールのコンパイルに必要な条件のチェッ -クなどを行うことが目的です.extconf.rbの中では以下のRuby関数 -を使うことが出来ます. +ます.extconf.rbはライブラリのコンパイルに必要な条件のチェッ +クなどを行うことが目的です.まず, + + require 'mkmf' + +をextconf.rbの先頭に置きます.extconf.rbの中では以下のRuby関 +数を使うことが出来ます. have_library(lib, func): ライブラリの存在チェック have_func(func): 関数の存在チェック @@ -699,15 +703,9 @@ Makefile $CFLAGS: コンパイル時に追加的に指定するフラグ(-Iなど) $LDFLAGS: リンク時に追加的に指定するフラグ(-Lなど) -モジュールをコンパイルする条件が揃わなず,そのモジュールはコ -ンパイルしない時にはcreate_makefileを呼ばなければMakefileは -生成されず,コンパイルも行われません. - -モジュールがRuby 1.1専用である場合には - - require 'mkmf' - -をextconf.rbの先頭に置くと便利でしょう. +ライブラリをコンパイルする条件が揃わず,そのライブラリをコン +パイルしない時にはcreate_makefileを呼ばなければMakefileは生 +成されず,コンパイルも行われません. (6) dependを用意する @@ -756,9 +754,9 @@ make extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま たRubyディレクトリでmakeしてください. -動的リンクライブラリはmake installでRubyライブラリのディレク -トリの下にコピーされます.もしモジュールと協調して使うRubyで -記述されたプログラムがあり,Rubyライブラリに置きたい場合には, +拡張ライブラリはmake installでRubyライブラリのディレクトリの +下にコピーされます.もし拡張ライブラリと協調して使うRubyで記 +述されたプログラムがあり,Rubyライブラリに置きたい場合には, 拡張ライブラリ用のディレクトリの下に lib というディレクトリ を作り,そこに 拡張子 .rb のファイルを置いておけば同時にイン ストールされます. @@ -1134,7 +1132,7 @@ extconf.rb create_makefile(target) 拡張ライブラリ用のMakefileを生成する.この関数を呼ばなければ -そのモジュールはコンパイルされない.targetはモジュール名を表 +そのライブラリはコンパイルされない.targetはモジュール名を表 す. /* diff --git a/ToDo b/ToDo index 84bc89c781..97fc29eb88 100644 --- a/ToDo +++ b/ToDo @@ -6,6 +6,7 @@ Language Spec. * multiple return values, yield values. maybe imcompatible * cascading method invocation. * def Class#method .. end +* exclusive range n...m (means n<=xlen + idx; + idx += RARRAY(ary)->len; if (idx < 0) { - rb_raise(rb_eIndexError, "negative index of array"); + rb_raise(rb_eIndexError, "index %d out of array", + idx - RARRAY(ary)->len); } } @@ -349,26 +350,22 @@ rb_ary_entry(ary, offset) } static VALUE -rb_ary_subseq(ary, beg, len) +rb_ary_subary(ary, beg, len) VALUE ary; int beg, len; { VALUE ary2; - if (len == 0) return rb_ary_new2(0); - if (len < 0) { - rb_raise(rb_eIndexError, "negative length %d", len); - } - if (beg < 0) { - len += beg; - beg = 0; - } + if (len < 0) return Qnil; + if (beg > RARRAY(ary)->len) return Qnil; + if (beg < 0) return Qnil; if (beg + len > RARRAY(ary)->len) { len = RARRAY(ary)->len - beg; } if (len < 0) { len = 0; } + if (len == 0) return rb_ary_new2(0); ary2 = rb_ary_new2(len); MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr+beg, VALUE, len); @@ -377,41 +374,6 @@ rb_ary_subseq(ary, beg, len) return ary2; } -static VALUE -beg_len(range, begp, lenp, len) - VALUE range; - int *begp, *lenp, len; -{ - int beg, end; - int b, e; - - if (!rb_range_beg_end(range, &beg, &end)) return Qfalse; - b = beg; e = end; - - if (beg < 0) { - beg = len + beg; - } - if (end < 0) { - end = len + end; - } - *begp = beg; - if (beg > end) { - if (e == -1) { - *lenp = 0; - return Qtrue; - } - rb_raise(rb_eIndexError, "end smaller than beg [%d..%d]", b, e); - } - - if (beg > len) { - *lenp = 0; - } - else { - *lenp = end - beg + 1; - } - return Qtrue; -} - VALUE rb_ary_aref(argc, argv, ary) int argc; @@ -427,7 +389,7 @@ rb_ary_aref(argc, argv, ary) if (beg < 0) { beg = RARRAY(ary)->len + beg; } - return rb_ary_subseq(ary, beg, len); + return rb_ary_subary(ary, beg, len); } /* special case - speeding up */ @@ -437,9 +399,16 @@ rb_ary_aref(argc, argv, ary) else if (TYPE(arg1) == T_BIGNUM) { rb_raise(rb_eIndexError, "index too big"); } - else if (beg_len(arg1, &beg, &len, RARRAY(ary)->len)) { + else { /* check if idx is Range */ - return rb_ary_subseq(ary, beg, len); + switch (rb_range_beg_len(arg1, &beg, &len, RARRAY(ary)->len, 0)) { + case Qfalse: + break; + case Qnil: + return Qnil; + default: + return rb_ary_subary(ary, beg, len); + } } return rb_ary_entry(ary, NUM2INT(arg1)); } @@ -483,7 +452,12 @@ rb_ary_indexes(argc, argv, ary) new_ary = rb_ary_new2(argc); for (i=0; ilen; + } + if (beg < 0) { + beg -= RARRAY(ary)->len; + rb_raise(rb_eIndexError, "index %d out of array", beg); + } + if (beg + len > RARRAY(ary)->len) { + len = RARRAY(ary)->len - beg; } if (TYPE(rpl) != T_ARRAY) { rpl = rb_Array(rpl); } - if (beg + len < 0 || (beg < 0 && beg <= -len)) { - rb_raise(rb_eIndexError, "index %d out of range", beg); - } - if (beg < 0) { - len += beg; - beg = 0; - } - rb_ary_modify(ary); if (beg >= RARRAY(ary)->len) { len = beg + RARRAY(rpl)->len; @@ -550,30 +524,18 @@ rb_ary_aset(argc, argv, ary) VALUE ary; { VALUE arg1, arg2, arg3; - int offset, beg, len; + int offset, beg, end, len; if (rb_scan_args(argc, argv, "21", &arg1, &arg2, &arg3) == 3) { - beg = NUM2INT(arg1); - len = NUM2INT(arg2); - - if (beg < 0) { - beg = RARRAY(ary)->len + beg; - } -#ifdef INABA - if (len < 0) return Qnil; -#endif - rb_ary_replace(ary, beg, len, arg3); + rb_ary_replace(ary, NUM2INT(arg1), NUM2INT(arg2), arg3); return arg3; } else if (FIXNUM_P(arg1)) { offset = FIX2INT(arg1); goto fixnum; } - else if (beg_len(arg1, &beg, &len, RARRAY(ary)->len)) { + else if (rb_range_beg_len(arg1, &beg, &len, RARRAY(ary)->len, 1)) { /* check if idx is Range */ -#ifdef INABA - if (len < 0) return Qnil; -#endif rb_ary_replace(ary, beg, len, arg2); return arg2; } @@ -655,7 +617,7 @@ static VALUE rb_ary_dup(ary) VALUE ary; { - return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr); + return rb_ary_s_create(RARRAY(ary)->len, RARRAY(ary)->ptr, CLASS_OF(ary)); } static VALUE @@ -758,11 +720,7 @@ rb_ary_to_s(ary) return str; } -#ifdef USE_THREAD static ID inspect_key; -#else -static VALUE inspect_tbl; -#endif struct inspect_arg { VALUE (*func)(); @@ -780,11 +738,9 @@ static VALUE inspect_ensure(obj) VALUE obj; { -#ifdef USE_THREAD VALUE inspect_tbl; inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key); -#endif rb_ary_pop(inspect_tbl); return 0; } @@ -796,7 +752,6 @@ rb_protect_inspect(func, obj, arg) { struct inspect_arg iarg; -#ifdef USE_THREAD VALUE inspect_tbl; if (!inspect_key) { @@ -807,12 +762,6 @@ rb_protect_inspect(func, obj, arg) inspect_tbl = rb_ary_new(); rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl); } -#else - if (!inspect_tbl) { - inspect_tbl = rb_ary_new(); - rb_global_variable(&inspect_tbl); - } -#endif rb_ary_push(inspect_tbl, obj); iarg.func = func; iarg.arg1 = obj; @@ -824,15 +773,11 @@ VALUE rb_inspecting_p(obj) VALUE obj; { -#ifdef USE_THREAD VALUE inspect_tbl; if (!inspect_key) return Qfalse; inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key); if (NIL_P(inspect_tbl)) return Qfalse; -#else - if (!inspect_tbl) return Qfalse; -#endif return rb_ary_includes(inspect_tbl, obj); } @@ -1054,7 +999,7 @@ rb_ary_replace_method(ary, ary2) VALUE ary, ary2; { ary2 = to_ary(ary2); - rb_ary_replace(ary, 0, RARRAY(ary2)->len, ary2); + rb_ary_replace(ary, 0, RARRAY(ary)->len, ary2); return ary; } @@ -1080,17 +1025,25 @@ rb_ary_fill(argc, argv, ary) int beg, end, len; VALUE *p, *pend; - if (rb_scan_args(argc, argv, "12", &item, &arg1, &arg2) == 2 && - beg_len(arg1, &beg, &len, RARRAY(ary)->len)) { - /* beg and len set already */ - } - else { + rb_scan_args(argc, argv, "12", &item, &arg1, &arg2); + switch (argc) { + case 1: + beg = 0; + len = RARRAY(ary)->len - beg; + break; + case 2: + if (rb_range_beg_len(arg1, &beg, &len, RARRAY(ary)->len, 1)) { + break; + } + /* fall through */ + case 3: beg = NIL_P(arg1)?0:NUM2INT(arg1); if (beg < 0) { beg = RARRAY(ary)->len + beg; if (beg < 0) beg = 0; } len = NIL_P(arg2)?RARRAY(ary)->len - beg:NUM2INT(arg2); + break; } rb_ary_modify(ary); end = beg + len; diff --git a/bignum.c b/bignum.c index 5050b50218..c9300b8d6c 100644 --- a/bignum.c +++ b/bignum.c @@ -165,7 +165,7 @@ rb_int2inum(n) VALUE rb_str2inum(str, base) - char *str; + const char *str; int base; { char sign = 1, c; @@ -1000,7 +1000,7 @@ rb_big_and(x, y) ds2 = BDIGITS(y); sign = RBIGNUM(x)->sign; } - z = bignew(l2, RBIGNUM(x)->sign && RBIGNUM(y)->sign); + z = bignew(l2, RBIGNUM(x)->sign || RBIGNUM(y)->sign); zds = BDIGITS(z); for (i=0; isign; } - z = bignew(l2, RBIGNUM(x)->sign || RBIGNUM(y)->sign); + z = bignew(l2, RBIGNUM(x)->sign && RBIGNUM(y)->sign); zds = BDIGITS(z); for (i=0; i&2; exit 1; } fi -rb_thread=yes -# Check whether --enable-thread or --disable-thread was given. -if test "${enable_thread+set}" = set; then - enableval="$enable_thread" - - rb_thread=$enableval - -fi - -if test $rb_thread = yes; then - cat >> confdefs.h <<\EOF -#define USE_THREAD 1 -EOF - -fi - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -603,7 +585,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:607: checking host system type" >&5 +echo "configure:589: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -634,7 +616,7 @@ fi if test "$fat_binary" = yes ; then echo $ac_n "checking target architecture""... $ac_c" 1>&6 -echo "configure:638: checking target architecture" >&5 +echo "configure:620: checking target architecture" >&5 case "$host_os" in rhapsody*) @@ -699,7 +681,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:703: checking for $ac_word" >&5 +echo "configure:685: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -729,7 +711,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:733: checking for $ac_word" >&5 +echo "configure:715: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -780,7 +762,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:784: checking for $ac_word" >&5 +echo "configure:766: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -812,7 +794,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -823,12 +805,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 827 "configure" +#line 809 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -854,12 +836,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:858: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:840: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:863: checking whether we are using GNU C" >&5 +echo "configure:845: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -868,7 +850,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -887,7 +869,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:891: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:873: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -919,7 +901,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:923: checking how to run the C preprocessor" >&5 +echo "configure:905: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -934,13 +916,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:926: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -951,13 +933,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -968,13 +950,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1000,13 +982,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1004: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:986: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1024,7 +1006,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1050,7 +1032,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1054: checking for $ac_word" >&5 +echo "configure:1036: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1083,7 +1065,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1087: checking for $ac_word" >&5 +echo "configure:1069: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1116,7 +1098,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1120: checking for $ac_word" >&5 +echo "configure:1102: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1158,7 +1140,7 @@ test -n "$AR" || AR="ar" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1162: checking for a BSD compatible install" >&5 +echo "configure:1144: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1211,7 +1193,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1215: checking whether ln -s works" >&5 +echo "configure:1197: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1232,7 +1214,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1236: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1218: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1262,17 +1244,17 @@ fi # checks for UNIX variants that set C preprocessor variables ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1266: checking for minix/config.h" >&5 +echo "configure:1248: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1311,7 +1293,7 @@ fi echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1315: checking size of int" >&5 +echo "configure:1297: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1319,7 +1301,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1330,7 +1312,7 @@ main() exit(0); } EOF -if { (eval echo configure:1334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1350,7 +1332,7 @@ EOF echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1354: checking size of short" >&5 +echo "configure:1336: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1358,7 +1340,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1369,7 +1351,7 @@ main() exit(0); } EOF -if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1389,7 +1371,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1393: checking size of long" >&5 +echo "configure:1375: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1397,7 +1379,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1408,7 +1390,7 @@ main() exit(0); } EOF -if { (eval echo configure:1412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1428,7 +1410,7 @@ EOF echo $ac_n "checking size of void*""... $ac_c" 1>&6 -echo "configure:1432: checking size of void*" >&5 +echo "configure:1414: checking size of void*" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1436,7 +1418,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1447,7 +1429,7 @@ main() exit(0); } EOF -if { (eval echo configure:1451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_voidp=`cat conftestval` else @@ -1467,7 +1449,7 @@ EOF echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:1471: checking size of float" >&5 +echo "configure:1453: checking size of float" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1475,7 +1457,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1486,7 +1468,7 @@ main() exit(0); } EOF -if { (eval echo configure:1490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -1506,7 +1488,7 @@ EOF echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:1510: checking size of double" >&5 +echo "configure:1492: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1514,7 +1496,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1525,7 +1507,7 @@ main() exit(0); } EOF -if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -1546,19 +1528,19 @@ EOF echo $ac_n "checking for prototypes""... $ac_c" 1>&6 -echo "configure:1550: checking for prototypes" >&5 +echo "configure:1532: checking for prototypes" >&5 if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_prototypes=yes else @@ -1579,19 +1561,19 @@ EOF fi echo $ac_n "checking token paste string""... $ac_c" 1>&6 -echo "configure:1583: checking token paste string" >&5 +echo "configure:1565: checking token paste string" >&5 if eval "test \"`echo '$''{'rb_cv_tokenpaste'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_tokenpaste=ansi else @@ -1617,12 +1599,12 @@ EOF fi echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6 -echo "configure:1621: checking for variable length prototypes and stdarg.h" >&5 +echo "configure:1603: checking for variable length prototypes and stdarg.h" >&5 if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1639,7 +1621,7 @@ int main() { return foo(10, "", 3.14); ; return 0; } EOF -if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_stdarg=yes else @@ -1660,19 +1642,19 @@ EOF fi echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6 -echo "configure:1664: checking for gcc attribute noreturn" >&5 +echo "configure:1646: checking for gcc attribute noreturn" >&5 if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_attr_noreturn=yes else @@ -1701,7 +1683,7 @@ beos*) ;; *) LIBS="-lm $LIBS";; esac echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1705: checking for crypt in -lcrypt" >&5 +echo "configure:1687: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1709,7 +1691,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1748,7 +1730,7 @@ else fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:1752: checking for dlopen in -ldl" >&5 +echo "configure:1734: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1756,7 +1738,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1795,7 +1777,7 @@ else fi # Dynamic linking for SunOS/Solaris and SYSV echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:1799: checking for shl_load in -ldld" >&5 +echo "configure:1781: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1803,7 +1785,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1842,7 +1824,7 @@ else fi # Dynamic linking for HP-UX echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 -echo "configure:1846: checking for setlocale in -lxpg4" >&5 +echo "configure:1828: checking for setlocale in -lxpg4" >&5 ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1850,7 +1832,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxpg4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1894,12 +1876,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1898: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1880: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1907,7 +1889,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1932,7 +1914,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1936: checking for opendir in -ldir" >&5 +echo "configure:1918: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1940,7 +1922,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1973,7 +1955,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1977: checking for opendir in -lx" >&5 +echo "configure:1959: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1981,7 +1963,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2015,12 +1997,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2019: checking for ANSI C header files" >&5 +echo "configure:2001: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2028,7 +2010,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2045,7 +2027,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2063,7 +2045,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2084,7 +2066,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2095,7 +2077,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2124,17 +2106,17 @@ for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2128: checking for $ac_hdr" >&5 +echo "configure:2110: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2162,12 +2144,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2166: checking for uid_t in sys/types.h" >&5 +echo "configure:2148: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -2196,12 +2178,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2200: checking for size_t" >&5 +echo "configure:2182: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2229,12 +2211,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:2233: checking for st_blksize in struct stat" >&5 +echo "configure:2215: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2242,7 +2224,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:2246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -2264,12 +2246,12 @@ fi save_LIBOJBS="$LIBOBJS" echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:2268: checking for st_blocks in struct stat" >&5 +echo "configure:2250: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2277,7 +2259,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:2281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2263: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -2301,12 +2283,12 @@ fi LIBOBJS="$save_LIBOBJS" echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:2305: checking for st_rdev in struct stat" >&5 +echo "configure:2287: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2314,7 +2296,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:2318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -2336,7 +2318,7 @@ fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:2340: checking type of array argument to getgroups" >&5 +echo "configure:2322: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2344,7 +2326,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2383,7 +2365,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -2407,12 +2389,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2411: checking return type of signal handlers" >&5 +echo "configure:2393: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2429,7 +2411,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2415: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2450,19 +2432,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2454: checking for working alloca.h" >&5 +echo "configure:2436: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2483,12 +2465,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2487: checking for alloca" >&5 +echo "configure:2469: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2548,12 +2530,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2552: checking whether alloca needs Cray hooks" >&5 +echo "configure:2534: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2582: checking for $ac_func" >&5 +echo "configure:2564: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2633,7 +2615,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2637: checking stack direction for C alloca" >&5 +echo "configure:2619: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2641,7 +2623,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2682,12 +2664,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2686: checking for pid_t" >&5 +echo "configure:2668: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2716,17 +2698,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2720: checking for vfork.h" >&5 +echo "configure:2702: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2751,18 +2733,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2755: checking for working vfork" >&5 +echo "configure:2737: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2761: checking for vfork" >&5 +echo "configure:2743: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2807,7 +2789,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -2902,7 +2884,7 @@ main() { } } EOF -if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2925,7 +2907,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2929: checking for 8-bit clean memcmp" >&5 +echo "configure:2911: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2933,7 +2915,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2965,12 +2947,12 @@ for ac_func in dup2 memmove mkdir strcasecmp strerror strftime\ fnmatch isinf isnan finite do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2969: checking for $ac_func" >&5 +echo "configure:2951: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3026,12 +3008,12 @@ for ac_func in fmod killpg drand48 random wait4 waitpid syscall getcwd\ dlopen sigprocmask sigaction _setjmp setsid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3030: checking for $ac_func" >&5 +echo "configure:3012: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3078,14 +3060,13 @@ else fi done -if test "$ac_cv_func_strftime" = no; then - echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3084: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:3065: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3093,7 +3074,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:3097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -3114,12 +3095,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:3118: checking for tm_zone in struct tm" >&5 +echo "configure:3099: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -3127,7 +3108,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:3131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -3147,12 +3128,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:3151: checking for tzname" >&5 +echo "configure:3132: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -3162,7 +3143,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -3183,15 +3164,16 @@ EOF fi fi +if test "$ac_cv_func_strftime" = no; then cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_DAYLIGHT 1 @@ -3211,7 +3193,7 @@ EOF else echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 -echo "configure:3215: checking for BSD signal semantics" >&5 +echo "configure:3197: checking for BSD signal semantics" >&5 if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3219,7 +3201,7 @@ else rb_cv_bsd_signal=no else cat > conftest.$ac_ext < @@ -3241,7 +3223,7 @@ main() } EOF -if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_bsd_signal=yes else @@ -3265,7 +3247,7 @@ EOF fi echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3269: checking whether getpgrp takes no argument" >&5 +echo "configure:3251: checking whether getpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3273,7 +3255,7 @@ else { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_getpgrp_void=yes else @@ -3352,7 +3334,7 @@ EOF fi echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3356: checking whether setpgrp takes no argument" >&5 +echo "configure:3338: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3360,7 +3342,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -3405,7 +3387,7 @@ fi echo $ac_n "checking for working strtod""... $ac_c" 1>&6 -echo "configure:3409: checking for working strtod" >&5 +echo "configure:3391: checking for working strtod" >&5 if eval "test \"`echo '$''{'rb_cv_func_strtod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3413,7 +3395,7 @@ else rb_cv_func_strtod=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_func_strtod=yes else @@ -3461,14 +3443,14 @@ echo "$ac_t""$rb_cv_func_strtod" 1>&6 test $rb_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3465: checking whether byte ordering is bigendian" >&5 +echo "configure:3447: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -3479,11 +3461,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -3494,7 +3476,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3480: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3514,7 +3496,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3550,15 +3532,90 @@ EOF fi +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:3537: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:3591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3555: checking whether char is unsigned" >&5 +echo "configure:3612: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -3615,7 +3672,7 @@ fi echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6 -echo "configure:3619: checking whether right shift preserve sign bit" >&5 +echo "configure:3676: checking whether right shift preserve sign bit" >&5 if eval "test \"`echo '$''{'rb_cv_rshift_sign'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3623,7 +3680,7 @@ else rb_cv_rshift_sign=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_rshift_sign=yes else @@ -3663,19 +3720,19 @@ EOF fi echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 -echo "configure:3667: checking count field in FILE structures" >&5 +echo "configure:3724: checking count field in FILE structures" >&5 if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { FILE *f = stdin; f->_cnt = 0; ; return 0; } EOF -if { (eval echo configure:3679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_cnt" else @@ -3685,14 +3742,14 @@ fi rm -f conftest* if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext < int main() { FILE *f = stdin; f->__cnt = 0; ; return 0; } EOF -if { (eval echo configure:3696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="__cnt" else @@ -3703,14 +3760,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext < int main() { FILE *f = stdin; f->_r = 0; ; return 0; } EOF -if { (eval echo configure:3714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_r" else @@ -3721,14 +3778,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext < int main() { FILE *f = stdin; f->readCount = 0; ; return 0; } EOF -if { (eval echo configure:3732: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="readCount" else @@ -3767,7 +3824,7 @@ fi case "$host_os" in linux*) echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 -echo "configure:3771: checking whether ELF binaries are produced" >&5 +echo "configure:3828: checking whether ELF binaries are produced" >&5 if eval "test \"`echo '$''{'rb_cv_binary_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3775,7 +3832,7 @@ else rb_cv_binary_elf=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_binary_elf=yes else @@ -3825,7 +3882,7 @@ STATIC= if test "$with_dln_a_out" != yes; then rb_cv_dlopen=unknown echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 -echo "configure:3829: checking whether OS depend dynamic link works" >&5 +echo "configure:3886: checking whether OS depend dynamic link works" >&5 if test "$GCC" = yes; then case "$host_os" in nextstep*) ;; @@ -3850,8 +3907,12 @@ echo "configure:3829: checking whether OS depend dynamic link works" >&5 LDSHARED='ld -b' LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; - solaris*) LDSHARED='ld -G' - test "$GCC" = yes && `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" + solaris*) if test "$GCC" = yes; then + LDSHARED='gcc -Wl,-G' + `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" + else + LDSHARED='ld -G' + fi rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; @@ -3861,6 +3922,8 @@ echo "configure:3829: checking whether OS depend dynamic link works" >&5 rb_cv_dlopen=yes;; esix*|uxpds*) LDSHARED="ld -G" rb_cv_dlopen=yes ;; + osf*) LDSHARED="gcc -shared" + rb_cv_dlopen=yes ;; linux*) LDSHARED="gcc -shared" rb_cv_dlopen=yes ;; freebsd*) LDSHARED="gcc -shared" @@ -3899,7 +3962,8 @@ echo "configure:3829: checking whether OS depend dynamic link works" >&5 rb_cv_dlopen=yes ;; human*) DLDFLAGS='' LDSHARED='' - LDFLAGS='' ;; + LDFLAGS='' + rb_cv_dlopen=yes ;; beos*) case "$host_cpu" in powerpc*) LDSHARED="ld -xms" @@ -3911,10 +3975,10 @@ echo "configure:3829: checking whether OS depend dynamic link works" >&5 ;; *) DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o" - ;; esac rb_cv_dlopen=yes ;; - cygwin*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;; + cygwin*) LDSHARED='../../miniruby ../cygwin32_ld.rb' + rb_cv_dlopen=yes ;; *) LDSHARED='ld' ;; esac echo "$ac_t""$rb_cv_dlopen" 1>&6 @@ -3925,12 +3989,12 @@ if test "$ac_cv_header_a_out_h" = yes; then if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then cat confdefs.h > config.h echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 -echo "configure:3929: checking whether matz's dln works" >&5 +echo "configure:3993: checking whether matz's dln works" >&5 if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -4042,7 +4106,7 @@ fi case "$host_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:4046: checking for _harderr in -lsignal" >&5 +echo "configure:4110: checking for _harderr in -lsignal" >&5 ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4050,7 +4114,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4089,7 +4153,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:4093: checking for hmemset in -lhmem" >&5 +echo "configure:4157: checking for hmemset in -lhmem" >&5 ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4097,7 +4161,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4138,12 +4202,12 @@ fi for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4142: checking for $ac_func" >&5 +echo "configure:4206: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4191,7 +4255,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:4195: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:4259: checking whether PD libc _dtos18 fail to convert big number" >&5 if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4199,7 +4263,7 @@ else rb_cv_missing__dtos18=no else cat > conftest.$ac_ext < @@ -4211,7 +4275,7 @@ main () } EOF -if { (eval echo configure:4215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_missing__dtos18=yes else @@ -4233,7 +4297,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:4237: checking whether PD libc fconvert fail to round" >&5 +echo "configure:4301: checking whether PD libc fconvert fail to round" >&5 if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4241,7 +4305,7 @@ else rb_cv_missing_fconvert=no else cat > conftest.$ac_ext < @@ -4254,7 +4318,7 @@ main () } EOF -if { (eval echo configure:4258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_missing_fconvert=yes else @@ -4384,14 +4448,14 @@ test "$program_suffix" != NONE && ri_suffix=$program_suffix RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}" -#RUBY_LIB_PATH="${prefix}/lib/${RUBY_INSTALL_NAME}/${MAJOR}.${MINOR}" RUBY_LIB_PATH="${prefix}/lib/ruby/${MAJOR}.${MINOR}" cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" + solaris*) if test "$GCC" = yes; then + LDSHARED='gcc -Wl,-G' + `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" + else + LDSHARED='ld -G' + fi rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; @@ -395,6 +391,8 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes;; esix*|uxpds*) LDSHARED="ld -G" rb_cv_dlopen=yes ;; + osf*) LDSHARED="gcc -shared" + rb_cv_dlopen=yes ;; linux*) LDSHARED="gcc -shared" rb_cv_dlopen=yes ;; freebsd*) LDSHARED="gcc -shared" @@ -433,7 +431,8 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes ;; human*) DLDFLAGS='' LDSHARED='' - LDFLAGS='' ;; + LDFLAGS='' + rb_cv_dlopen=yes ;; beos*) case "$host_cpu" in powerpc*) LDSHARED="ld -xms" @@ -445,10 +444,10 @@ if test "$with_dln_a_out" != yes; then ;; *) DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o" - ;; esac rb_cv_dlopen=yes ;; - cygwin*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;; + cygwin*) LDSHARED='../../miniruby ../cygwin32_ld.rb' + rb_cv_dlopen=yes ;; *) LDSHARED='ld' ;; esac AC_MSG_RESULT($rb_cv_dlopen) @@ -678,26 +677,27 @@ test "$program_suffix" != NONE && ri_suffix=$program_suffix RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}" -#RUBY_LIB_PATH="${prefix}/lib/${RUBY_INSTALL_NAME}/${MAJOR}.${MINOR}" RUBY_LIB_PATH="${prefix}/lib/ruby/${MAJOR}.${MINOR}" AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}") -AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_LIB_PATH}/site_ruby") +RUBY_SITE_LIB_PATH="${RUBY_LIB_PATH}/site_ruby" +AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}") AC_SUBST(arch)dnl if test "$fat_binary" = yes ; then arch="fat-${host_os}" AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB, - "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}" ) + "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}") AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB, - "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}" ) + "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}") + AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${host_os}") else arch="${host_cpu}-${host_os}" + AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}") fi AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}") -AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_LIB_PATH}/site_ruby/${arch}") -AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}") +AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH}/${arch}") echo "creating config.h" cat confdefs.h > config.h diff --git a/dln.c b/dln.c index d8f6ec6995..936dc7a98d 100644 --- a/dln.c +++ b/dln.c @@ -56,7 +56,9 @@ void *xrealloc(); #endif #ifndef NT +# ifndef strdup char *strdup(); +# endif char *getenv(); #endif @@ -88,7 +90,8 @@ int eaccess(); static void init_funcname(buf, file) - char *buf, *file; + char *buf; + char *file; { char *p, *slash; @@ -316,7 +319,7 @@ sym_hash(hdrp, syms) static int dln_init(prog) - char *prog; + const char *prog; { char *file; int fd; @@ -424,7 +427,7 @@ load_text_data(fd, hdrp, bss, disp) } static int -underb_f_print(key, value) +undef_print(key, value) char *key, *value; { fprintf(stderr, " %s\n", key); @@ -435,7 +438,7 @@ static void dln_print_undef() { fprintf(stderr, " Undefined symbols:\n"); - st_foreach(undef_tbl, underb_f_print, NULL); + st_foreach(undef_tbl, undef_print, NULL); } static void @@ -463,7 +466,7 @@ struct undef { static st_table *reloc_tbl = NULL; static void link_undef(name, base, reloc) - char *name; + const char *name; long base; struct relocation_info *reloc; { @@ -563,7 +566,7 @@ reloc_undef(no, undef, arg) static void unlink_undef(name, value) - char *name; + const char *name; long value; { struct reloc_arg arg; @@ -596,7 +599,7 @@ static int load_1(fd, disp, need_init) int fd; long disp; - char *need_init; + const char *need_init; { static char *libc = LIBC_NAME; struct exec hdr; @@ -874,7 +877,7 @@ load_1(fd, disp, need_init) static int target_offset; static int search_undef(key, value, lib_tbl) - char *key; + const char *key; int value; st_table *lib_tbl; { @@ -894,7 +897,7 @@ char *dln_librrb_ary_path = DLN_DEFAULT_LIB_PATH; static int load_lib(lib) - char *lib; + const char *lib; { char *path, *file; char armagic[SARMAG]; @@ -1031,7 +1034,7 @@ load_lib(lib) static int load(file) - char *file; + const char *file; { int fd; int result; @@ -1057,7 +1060,7 @@ load(file) void* dln_sym(name) - char *name; + const char *name; { struct nlist *sym; @@ -1100,7 +1103,7 @@ dln_sym(name) #include #endif -static char * +static const char * dln_strerror() { #ifdef USE_DLN_A_OUT @@ -1153,7 +1156,7 @@ dln_strerror() #if defined(_AIX) static void -aix_loaderror(char *pathname) +aix_loaderror(const char *pathname) { char *message[8], errbuf[1024]; int i,j; @@ -1201,7 +1204,7 @@ aix_loaderror(char *pathname) void dln_load(file) - char *file; + const char *file; { #ifdef _WIN32 HINSTANCE handle; @@ -1497,8 +1500,8 @@ static char *dln_find_1(); char * dln_find_exe(fname, path) - char *fname; - char *path; + const char *fname; + const char *path; { if (!path) { #if defined(__human68k__) @@ -1520,8 +1523,8 @@ dln_find_exe(fname, path) char * dln_find_file(fname, path) - char *fname; - char *path; + const char *fname; + const char *path; { #ifndef __MACOS__ if (!path) path = "."; @@ -1533,10 +1536,10 @@ dln_find_file(fname, path) } #if defined(__CYGWIN32__) -char * +const char * conv_to_posix_path(win32, posix) - char *win32; - char *posix; + const char *win32; + const char *posix; { char *first = win32; char *p = win32; diff --git a/dln.h b/dln.h index 7af1f63a9d..b9b7a67eab 100644 --- a/dln.h +++ b/dln.h @@ -14,17 +14,18 @@ #ifndef _ #ifndef __STDC__ # define _(args) () +# define const #else # define _(args) args #endif #endif -char *dln_find_exe _((char*,char*)); -char *dln_find_file _((char*,char*)); +char *dln_find_exe _((const char*,const char*)); +char *dln_find_file _((const char*,const char*)); #ifdef USE_DLN_A_OUT extern char *dln_argv0; #endif -void dln_load _((char*)); +void dln_load _((const char*)); #endif diff --git a/error.c b/error.c index 71a6ea622e..2d76a625e4 100644 --- a/error.c +++ b/error.c @@ -45,10 +45,10 @@ err_snprintf(buf, len, fmt, args) } } -static void err_append _((char*)); +static void err_append _((const char*)); static void err_print(fmt, args) - char *fmt; + const char *fmt; va_list args; { char buf[BUFSIZ]; @@ -59,10 +59,10 @@ err_print(fmt, args) void #ifdef HAVE_STDARG_PROTOTYPES -rb_compile_error(char *fmt, ...) +rb_compile_error(const char *fmt, ...) #else rb_compile_error(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -76,10 +76,10 @@ rb_compile_error(fmt, va_alist) void #ifdef HAVE_STDARG_PROTOTYPES -rb_compile_error_append(char *fmt, ...) +rb_compile_error_append(const char *fmt, ...) #else rb_compile_error_append(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -94,10 +94,10 @@ rb_compile_error_append(fmt, va_alist) void #ifdef HAVE_STDARG_PROTOTYPES -rb_warn(char *fmt, ...) +rb_warn(const char *fmt, ...) #else rb_warn(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -114,10 +114,10 @@ rb_warn(fmt, va_alist) /* rb_warning() reports only in verbose mode */ void #ifdef HAVE_STDARG_PROTOTYPES -rb_warning(char *fmt, ...) +rb_warning(const char *fmt, ...) #else rb_warning(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -135,10 +135,10 @@ rb_warning(fmt, va_alist) void #ifdef HAVE_STDARG_PROTOTYPES -rb_bug(char *fmt, ...) +rb_bug(const char *fmt, ...) #else rb_bug(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -156,7 +156,7 @@ rb_bug(fmt, va_alist) static struct types { int type; - char *name; + const char *name; } builtin_types[] = { T_NIL, "nil", T_OBJECT, "Object", @@ -220,7 +220,10 @@ rb_check_type(x, t) #include VALUE rb_eException; -VALUE rb_eSystemExit, rb_eInterrupt, rb_eFatal; +VALUE rb_eSystemExit; +VALUE rb_eInterrupt; +VALUE rb_eSignal; +VALUE rb_eFatal; VALUE rb_eStandardError; VALUE rb_eRuntimeError; VALUE rb_eSyntaxError; @@ -238,7 +241,7 @@ VALUE rb_mErrno; VALUE rb_exc_new(etype, ptr, len) VALUE etype; - char *ptr; + const char *ptr; int len; { VALUE exc = rb_obj_alloc(etype); @@ -250,7 +253,7 @@ rb_exc_new(etype, ptr, len) VALUE rb_exc_new2(etype, s) VALUE etype; - char *s; + const char *s; { return rb_exc_new(etype, s, strlen(s)); } @@ -436,7 +439,7 @@ extern int sys_nerr; static VALUE set_syserr(i, name) int i; - char *name; + const char *name; { #ifdef __BEOS__ VALUE *list; @@ -509,8 +512,10 @@ Init_Exception() rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1); rb_eSystemExit = rb_define_class("SystemExit", rb_eException); - rb_eFatal = rb_define_class("fatal", rb_eException); + rb_eFatal = rb_define_class("fatal", rb_eException); rb_eInterrupt = rb_define_class("Interrupt", rb_eException); + rb_eInterrupt = rb_define_class("Interrupt", rb_eException); + rb_eSignal = rb_define_class("SignalException", rb_eException); rb_eStandardError = rb_define_class("StandardError", rb_eException); rb_eSyntaxError = rb_define_class("SyntaxError", rb_eStandardError); @@ -529,11 +534,11 @@ Init_Exception() void #ifdef HAVE_STDARG_PROTOTYPES -rb_raise(VALUE exc, char *fmt, ...) +rb_raise(VALUE exc, const char *fmt, ...) #else rb_raise(exc, fmt, va_alist) VALUE exc; - char *fmt; + const char *fmt; va_dcl #endif { @@ -548,10 +553,10 @@ rb_raise(exc, fmt, va_alist) void #ifdef HAVE_STDARG_PROTOTYPES -rb_loaderror(char *fmt, ...) +rb_loaderror(const char *fmt, ...) #else rb_loaderror(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -574,10 +579,10 @@ rb_notimplement() void #ifdef HAVE_STDARG_PROTOTYPES -rb_fatal(char *fmt, ...) +rb_fatal(const char *fmt, ...) #else rb_fatal(fmt, va_alist) - char *fmt; + const char *fmt; va_dcl #endif { @@ -594,7 +599,7 @@ rb_fatal(fmt, va_alist) void rb_sys_fail(mesg) - char *mesg; + const char *mesg; { #ifndef NT char *strerror(); @@ -1043,7 +1048,7 @@ init_syserr() static void err_append(s) - char *s; + const char *s; { extern VALUE ruby_errinfo; diff --git a/eval.c b/eval.c index afdcb6f3c5..578b119864 100644 --- a/eval.c +++ b/eval.c @@ -21,7 +21,7 @@ #include "dln.h" #ifndef HAVE_STRING_H -char *strrchr _((char*,char)); +char *strrchr _((const char*,const char)); #endif #ifdef HAVE_UNISTD_H @@ -236,7 +236,7 @@ remove_method(klass, mid) void rb_remove_method(klass, name) VALUE klass; - char *name; + const char *name; { remove_method(klass, rb_intern(name)); } @@ -244,7 +244,7 @@ rb_remove_method(klass, name) void rb_disable_super(klass, name) VALUE klass; - char *name; + const char *name; { VALUE origin; NODE *body; @@ -267,7 +267,7 @@ rb_disable_super(klass, name) void rb_enable_super(klass, name) VALUE klass; - char *name; + const char *name; { VALUE origin; NODE *body; @@ -334,7 +334,7 @@ rb_attr(klass, id, read, write, ex) ID id; int read, write, ex; { - char *name; + const char *name; char *buf; ID attriv; int noex; @@ -412,9 +412,7 @@ struct BLOCK { int iter; int vmode; struct RVarmap *d_vars; -#ifdef USE_THREAD VALUE orig_thread; -#endif struct BLOCK *prev; }; static struct BLOCK *ruby_block; @@ -633,7 +631,6 @@ static VALUE ruby_wrapper; /* security wrapper */ ruby_scope = _scope; \ scope_vmode = SCOPE_PUBLIC; -#ifdef USE_THREAD #define SCOPE_DONT_RECYCLE FL_USER2 #define POP_SCOPE() \ if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) {\ @@ -653,25 +650,10 @@ static VALUE ruby_wrapper; /* security wrapper */ ruby_scope = _old;\ scope_vmode = _vmode;\ } -#else /* not USE_THREAD */ -#define POP_SCOPE() \ - if (ruby_scope->flag == SCOPE_ALLOCA) {\ - ruby_scope->local_vars = 0;\ - ruby_scope->local_tbl = 0;\ - if (ruby_scope != top_scope)\ - rb_gc_force_recycle((VALUE)ruby_scope);\ - }\ - else {\ - ruby_scope->flag |= SCOPE_NOSTACK;\ - }\ - ruby_scope = _old;\ - scope_vmode = _vmode;\ -} -#endif /* USE_THREAD */ static VALUE rb_eval _((VALUE,NODE*)); static VALUE eval _((VALUE,VALUE,VALUE,char*,int)); -static NODE *compile _((VALUE,char*)); +static NODE *compile _((VALUE)); static VALUE rb_yield_0 _((VALUE, VALUE, VALUE)); static VALUE rb_call _((VALUE,VALUE,ID,int,VALUE*,int)); @@ -840,7 +822,7 @@ error_print() tail++; /* skip newline */ } fprintf(stderr, ": "); - fwrite(einfo, 1, elen, stderr); + fwrite(einfo, 1, len, stderr); if (epath) { fprintf(stderr, " ("); fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, stderr); @@ -978,10 +960,8 @@ eval_node(self) int ruby_in_eval; -#ifdef USE_THREAD static void rb_thread_cleanup _((void)); static void rb_thread_wait_other_threads _((void)); -#endif static int exit_status; @@ -1011,10 +991,8 @@ ruby_run() PUSH_ITER(ITER_NOT); if ((state = EXEC_TAG()) == 0) { rb_trap_exit(); -#ifdef USE_THREAD rb_thread_cleanup(); rb_thread_wait_other_threads(); -#endif } else { ex = state; @@ -1055,6 +1033,7 @@ ruby_run() case TAG_RAISE: case TAG_FATAL: if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) { + exec_end_proc(); exit(exit_status); } error_print(); @@ -1071,7 +1050,7 @@ ruby_run() static void compile_error(at) - char *at; + const char *at; { VALUE str; char *mesg; @@ -1091,7 +1070,7 @@ compile_error(at) VALUE rb_eval_string(str) - char *str; + const char *str; { VALUE v; char *oldsrc = ruby_sourcefile; @@ -1105,7 +1084,7 @@ rb_eval_string(str) VALUE rb_eval_string_protect(str, state) - char *str; + const char *str; int *state; { VALUE result; /* OK */ @@ -1154,10 +1133,8 @@ rb_eval_cmd(cmd, arg) val = eval(ruby_top_self, cmd, Qnil, 0, 0); } -#ifdef USE_THREAD if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) FL_SET(saved_scope, SCOPE_DONT_RECYCLE); -#endif ruby_scope = saved_scope; safe_level = safe; POP_TAG(); @@ -1188,7 +1165,7 @@ rb_eval_cmd(cmd, arg) return val; } -VALUE +static VALUE rb_trap_eval(cmd, sig) VALUE cmd; int sig; @@ -1341,11 +1318,11 @@ rb_mod_alias_method(mod, newname, oldname) } #ifdef C_ALLOCA -# define TMP_PROTECT NODE * volatile __protect_tmp=0 -# define TMP_ALLOC(n) \ - (__protect_tmp = rb_node_newnode(NODE_ALLOCA, \ - ALLOC_N(VALUE,n),__protect_tmp,n), \ - (void*)__protect_tmp->nd_head) +# define TMP_PROTECT NODE * volatile tmp__protect_tmp=0 +# define TMP_ALLOC(n) \ + (tmp__protect_tmp = rb_node_newnode(NODE_ALLOCA, \ + ALLOC_N(VALUE,n),tmp__protect_tmp,n), \ + (void*)tmp__protect_tmp->nd_head) #else # define TMP_PROTECT typedef int foobazzz # define TMP_ALLOC(n) ALLOCA_N(VALUE,n) @@ -1639,9 +1616,7 @@ call_trace_func(event, file, line, self, id, klass) trace = trace_func; trace_func = 0; -#ifdef USE_THREAD rb_thread_critical++; -#endif prev = ruby_frame; PUSH_FRAME(); @@ -1669,9 +1644,7 @@ call_trace_func(event, file, line, self, id, klass) POP_TAG(); POP_FRAME(); -#ifdef USE_THREAD rb_thread_critical--; -#endif if (!trace_func) trace_func = trace; ruby_sourceline = line_save; ruby_sourcefile = file_save; @@ -2067,8 +2040,9 @@ rb_eval(self, node) case NODE_DOT2: case NODE_DOT3: - result = rb_range_new(rb_eval(self, node->nd_beg), rb_eval(self, node->nd_end)); - result = rb_range_new(rb_eval(self, node->nd_beg), rb_eval(self, node->nd_end)); + result = rb_range_new(rb_eval(self, node->nd_beg), + rb_eval(self, node->nd_end), + nd_type(node) == NODE_DOT3); if (node->nd_state) break; if (nd_type(node->nd_beg) == NODE_LIT && FIXNUM_P(node->nd_beg->nd_lit) && nd_type(node->nd_end) == NODE_LIT && FIXNUM_P(node->nd_end->nd_lit)) @@ -2478,8 +2452,9 @@ rb_eval(self, node) str2 = list->nd_head->nd_lit; break; case NODE_EVSTR: + ruby_sourceline = nd_line(node); ruby_in_eval++; - list->nd_head = compile(list->nd_head->nd_lit,0); + list->nd_head = compile(list->nd_head->nd_lit); ruby_eval_tree = 0; ruby_in_eval--; if (ruby_nerrs > 0) { @@ -2801,7 +2776,7 @@ rb_eval(self, node) char *desc = is_defined(self, node->nd_head, buf); if (desc) result = rb_str_new2(desc); - else result = Qfalse; + else result = Qnil; } break; @@ -2935,6 +2910,7 @@ rb_exit(status) exit_status = status; rb_exc_raise(rb_exc_new(rb_eSystemExit, 0, 0)); } + exec_end_proc(); exit(status); } @@ -3182,10 +3158,8 @@ rb_yield_0(val, self, klass) POP_VARS(); ruby_block = block; ruby_frame = ruby_frame->prev; -#ifdef USE_THREAD if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) FL_SET(old_scope, SCOPE_DONT_RECYCLE); -#endif ruby_scope = old_scope; if (state) JUMP_TAG(state); return result; @@ -3518,7 +3492,7 @@ rb_f_missing(argc, argv, obj) format = "undefined iterator `%s' for %s"; } else if (last_call_status & CSTAT_VCALL) { - char *mname = rb_id2name(id); + const char *mname = rb_id2name(id); if (('a' <= mname[0] && mname[0] <= 'z') || mname[0] == '_') { format = "undefined local variable or method `%s' for %s"; @@ -3803,17 +3777,21 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper) argc, i); } if (node->nd_rest == -1) { - int opt = argc - i; + int opt = i; NODE *optnode = node->nd_opt; while (optnode) { - opt--; + opt++; optnode = optnode->nd_next; } - if (opt > 0) { + if (opt < argc) { rb_raise(rb_eArgError, "wrong # of arguments(%d for %d)", - argc, argc-opt); + argc, opt); } +#if 1 + ruby_frame->argc = opt; + ruby_frame->argv = local_vars+2; +#endif } if (local_vars) { @@ -4111,15 +4089,13 @@ rb_frame_last_func() } static NODE* -compile(src, place) +compile(src) VALUE src; - char *place; { NODE *node; Check_Type(src, T_STRING); - if (place == 0) place = ruby_sourcefile; - node = rb_compile_string(place, src); + node = rb_compile_string(ruby_sourcefile, src); if (ruby_nerrs == 0) return node; return 0; @@ -4190,7 +4166,7 @@ eval(self, src, scope, file, line) if ((state = EXEC_TAG()) == 0) { ruby_sourcefile = file; ruby_sourceline = line; - compile(src, file); + compile(src); if (ruby_nerrs > 0) { compile_error(0); } @@ -4201,10 +4177,8 @@ eval(self, src, scope, file, line) ruby_in_eval--; if (!NIL_P(scope)) { ruby_frame = ruby_frame->prev; -#ifdef USE_THREAD if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) FL_SET(old_scope, SCOPE_DONT_RECYCLE); -#endif ruby_scope = old_scope; ruby_block = old_block; ruby_calling_block = old_call_block; @@ -4252,7 +4226,7 @@ rb_f_eval(argc, argv, self) { VALUE src, scope, vfile, vline; char *file = "(eval)"; - int line = 0; + int line = 1; rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline); if (argc >= 3) { @@ -4311,7 +4285,7 @@ eval_under_i(args) static VALUE eval_under(under, self, src, file, line) VALUE under, self, src; - char *file; + const char *file; int line; { VALUE args[4]; @@ -4340,44 +4314,54 @@ yield_under(under, self) return exec_under(yield_under_i, under, self); } +static VALUE +specific_eval(argc, argv, klass, self) + int argc; + VALUE *argv; + VALUE klass, self; +{ + char *file = 0; + int line = 1; + int iter = rb_iterator_p(); + + if (argc > 0) { + Check_SafeStr(argv[0]); + if (argc > 3) { + rb_raise(rb_eArgError, "wrong # of arguments: %s(src) or %s{..}", + rb_id2name(ruby_frame->last_func), + rb_id2name(ruby_frame->last_func)); + } + if (argc > 1) file = STR2CSTR(argv[1]); + if (argc > 2) line = NUM2INT(argv[2]); + } + else if (!iter) { + rb_raise(rb_eArgError, "block not supplied"); + } + + if (iter) { + return yield_under(klass, self); + } + else { + return eval_under(klass, self, argv[0], file, line); + } +} + VALUE rb_obj_instance_eval(argc, argv, self) int argc; VALUE *argv; VALUE self; { - char *file = 0; - int line = 0; VALUE klass; - if (argc == 0) { - if (!rb_iterator_p()) { - rb_raise(rb_eArgError, "block not supplied"); - } - } - else if (argc < 4) { - Check_SafeStr(argv[0]); - if (argc > 1) file = STR2CSTR(argv[1]); - if (argc > 2) line = NUM2INT(argv[2]); - } - else { - rb_raise(rb_eArgError, "wrong # of arguments: %s(src) or %s{..}", - rb_id2name(ruby_frame->last_func), - rb_id2name(ruby_frame->last_func)); - } - if (rb_special_const_p(self)) { klass = Qnil; } else { klass = rb_singleton_class(self); } - if (argc == 0) { - return yield_under(klass, self); - } - else { - return eval_under(klass, self, argv[0], file, line); - } + + return specific_eval(argc, argv, klass, self); } static VALUE @@ -4386,38 +4370,14 @@ rb_mod_module_eval(argc, argv, mod) VALUE *argv; VALUE mod; { - char *file = 0; - int line = 0; - - if (argc == 0) { - if (!rb_iterator_p()) { - rb_raise(rb_eArgError, "block not supplied"); - } - } - else if (argc < 4) { - Check_SafeStr(argv[0]); - if (argc > 1) file = STR2CSTR(argv[1]); - if (argc > 2) line = NUM2INT(argv[2]); - } - else { - rb_raise(rb_eArgError, "wrong # of arguments: %s(src) or %s{..}", - rb_id2name(ruby_frame->last_func), - rb_id2name(ruby_frame->last_func)); - } - - if (argc == 0) { - return yield_under(mod, mod); - } - else { - return eval_under(mod, mod, argv[0], file, line); - } + return specific_eval(argc, argv, mod, mod); } VALUE rb_load_path; static int is_absolute_path(path) - char *path; + const char *path; { if (path[0] == '/') return 1; # if defined(MSDOS) || defined(NT) || defined(__human68k__) @@ -4430,7 +4390,7 @@ is_absolute_path(path) #ifdef __MACOS__ static int is_macos_native_path(path) - char *path; + const char *path; { if (strchr(path, ':')) return 1; return 0; @@ -4601,7 +4561,7 @@ static VALUE rb_features; static int rb_provided(feature) - char *feature; + const char *feature; { VALUE *p, *pend; char *f; @@ -4622,14 +4582,12 @@ rb_provided(feature) return Qfalse; } -#ifdef USE_THREAD -static int rb_thread_loading _((char*)); +static int rb_thread_loading _((const char*)); static void rb_thread_loading_done _((void)); -#endif void rb_provide(feature) - char *feature; + const char *feature; { char *buf, *ext; @@ -4703,43 +4661,35 @@ rb_f_require(obj, fname) RSTRING(fname)->ptr); load_dyna: -#ifdef USE_THREAD if (rb_thread_loading(feature)) return Qfalse; else { int state; PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { -#endif load = rb_str_new2(file); file = RSTRING(load)->ptr; dln_load(file); rb_provide(feature); -#ifdef USE_THREAD } POP_TAG(); rb_thread_loading_done(); if (state) JUMP_TAG(state); } -#endif return Qtrue; load_rb: -#ifdef USE_THREAD if (rb_thread_loading(feature)) return Qfalse; else { int state; PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { -#endif rb_load(fname, 0); rb_provide(feature); -#ifdef USE_THREAD } POP_TAG(); rb_thread_loading_done(); if (state) JUMP_TAG(state); } -#endif return Qtrue; } @@ -5268,6 +5218,7 @@ blk_copy_prev(block) tmp = ALLOC_N(struct BLOCK, 1); MEMCPY(tmp, block->prev, struct BLOCK, 1); tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc); + scope_dup(tmp->scope); MEMCPY(tmp->frame.argv, block->frame.argv, VALUE, tmp->frame.argc); block->prev = tmp; block = tmp; @@ -5309,9 +5260,7 @@ rb_f_binding(self) bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data); *data = *ruby_block; -#ifdef USE_THREAD data->orig_thread = rb_thread_current(); -#endif data->iter = rb_f_iterator_p(); if (ruby_frame->prev) { data->frame.last_func = ruby_frame->prev->last_func; @@ -5389,9 +5338,7 @@ proc_s_new(klass) proc = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data); *data = *ruby_block; -#ifdef USE_THREAD data->orig_thread = rb_thread_current(); -#endif data->iter = data->prev?Qtrue:Qfalse; data->frame.argv = ALLOC_N(VALUE, data->frame.argc); MEMCPY(data->frame.argv, ruby_block->frame.argv, VALUE, data->frame.argc); @@ -5423,11 +5370,9 @@ blk_orphan(data) (data->scope->flag & SCOPE_NOSTACK)) { return 1; } -#ifdef USE_THREAD if (data->orig_thread != rb_thread_current()) { return 1; } -#endif return 0; } @@ -5662,7 +5607,7 @@ method_inspect(method) { struct METHOD *data; VALUE str; - char *s; + const char *s; Data_Get_Struct(method, struct METHOD, data); str = rb_str_new2("#<"); @@ -5739,8 +5684,6 @@ Init_Proc() rb_define_method(rb_mKernel, "method", rb_obj_method, 1); } -#ifdef USE_THREAD - static VALUE rb_eThreadError; int rb_thread_pending = 0; @@ -5995,12 +5938,14 @@ static char *th_raise_file; static int th_raise_line; static VALUE th_cmd; static int th_sig; +static char *th_signm; #define RESTORE_NORMAL 0 #define RESTORE_FATAL 1 #define RESTORE_INTERRUPT 2 #define RESTORE_TRAP 3 -#define RESTORE_RAISE 4 +#define RESTORE_RAISE 4 +#define RESTORE_SIGNAL 5 static void rb_thread_restore_context(th, exit) @@ -6063,6 +6008,10 @@ rb_thread_restore_context(th, exit) errno = EINTR; break; + case RESTORE_SIGNAL: + rb_raise(rb_eSignal, "SIG%s", th_signm); + break; + case RESTORE_RAISE: ruby_frame->last_func = 0; ruby_sourcefile = th_raise_file; @@ -6160,7 +6109,9 @@ rb_thread_schedule() select_err: rb_thread_pending = 0; - if (curr_thread == curr_thread->next) return; + if (curr_thread == curr_thread->next + && curr_thread->status == THREAD_RUNNABLE) + return; next = 0; curr = curr_thread; /* starting thread */ @@ -6493,6 +6444,8 @@ rb_thread_join(thread) thread_t th = rb_thread_check(thread); if (rb_thread_dead(th)) return thread; + if (th == curr_thread) + rb_raise(rb_eThreadError, "recursive join"); if ((th->wait_for & WAIT_JOIN) && th->join == curr_thread) rb_raise(rb_eThreadError, "Thread#join: deadlock"); curr_thread->status = THREAD_STOPPED; @@ -6501,6 +6454,15 @@ rb_thread_join(thread) curr_thread->wait_for |= WAIT_JOIN; rb_thread_schedule(); + if (!NIL_P(th->errinfo)) { + VALUE oldbt = get_backtrace(th->errinfo); + VALUE errat = make_backtrace(); + + rb_ary_unshift(errat, rb_ary_entry(oldbt, 0)); + set_backtrace(th->errinfo, errat); + rb_exc_raise(th->errinfo); + } + return thread; } @@ -6588,10 +6550,10 @@ static VALUE rb_thread_stop() { rb_thread_critical = 0; - curr_thread->status = THREAD_STOPPED; if (curr_thread == curr_thread->next) { rb_raise(rb_eThreadError, "stopping only thread"); } + curr_thread->status = THREAD_STOPPED; rb_thread_schedule(); return Qnil; @@ -6874,14 +6836,6 @@ rb_thread_value(thread) thread_t th = rb_thread_check(thread); rb_thread_join(thread); - if (!NIL_P(th->errinfo)) { - VALUE oldbt = get_backtrace(th->errinfo); - VALUE errat = make_backtrace(); - - rb_ary_unshift(errat, rb_ary_entry(oldbt, 0)); - set_backtrace(th->errinfo, errat); - rb_exc_raise(th->errinfo); - } return th->result; } @@ -6970,6 +6924,26 @@ rb_thread_interrupt() rb_thread_restore_context(curr_thread, RESTORE_INTERRUPT); } +void +rb_thread_signal_raise(sig) + char *sig; +{ + if (sig == 0) return; /* should not happen */ + rb_thread_critical = 0; + if (curr_thread == main_thread) { + rb_thread_ready(curr_thread); + rb_raise(rb_eSignal, "SIG%s", sig); + } + rb_thread_ready(main_thread); + rb_thread_save_context(curr_thread); + if (setjmp(curr_thread->context)) { + return; + } + th_signm = sig; + curr_thread = main_thread; + rb_thread_restore_context(curr_thread, RESTORE_SIGNAL); +} + void rb_thread_trap_eval(cmd, sig) VALUE cmd; @@ -7027,7 +7001,7 @@ static int loading_nest; static int rb_thread_loading(feature) - char *feature; + const char *feature; { if (curr_thread != curr_thread->next && loading_thread) { while (loading_thread != curr_thread) { @@ -7211,7 +7185,6 @@ Init_Thread() rb_define_method(rb_cContinuation, "call", rb_continuation_call, -1); rb_define_method(rb_mKernel, "callcc", rb_callcc, 0); } -#endif static VALUE rb_f_catch(dmy, tag) @@ -7245,7 +7218,7 @@ catch_i(tag) VALUE rb_catch(tag, proc, data) - char *tag; + const char *tag; VALUE (*proc)(); VALUE data; { @@ -7269,13 +7242,11 @@ rb_f_throw(argc, argv) tt->dst = t; break; } -#ifdef USE_THREAD if (tt->tag == PROT_THREAD) { rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%x", rb_id2name(t), curr_thread); } -#endif tt = tt->prev; } if (!tt) { @@ -7289,7 +7260,7 @@ rb_f_throw(argc, argv) void rb_throw(tag, val) - char *tag; + const char *tag; VALUE val; { VALUE argv[2]; @@ -7303,7 +7274,6 @@ rb_throw(tag, val) static void return_check() { -#ifdef USE_THREAD struct tag *tt = prot_tag; while (tt) { @@ -7316,6 +7286,5 @@ return_check() } tt = tt->prev; } -#endif } diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index ceadc4dd77..d7f58d7b3b 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -561,7 +561,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/nkf/MANIFEST b/ext/nkf/MANIFEST index 7e3345a6b7..5e01e6e237 100644 --- a/ext/nkf/MANIFEST +++ b/ext/nkf/MANIFEST @@ -3,5 +3,5 @@ depend extconf.rb lib/kconv.rb nkf.c -orig/nkf.c +1.7/nkf.c test.rb diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c index 6b5db0fe70..2442973f2f 100644 --- a/ext/nkf/nkf.c +++ b/ext/nkf/nkf.c @@ -43,7 +43,7 @@ printf("[[%c][%c][%d]]\n", c, output[output_ctr - 1], output_ctr); } #define PERL_XS 1 -#include "orig/nkf.c" +#include "1.7/nkf.c" static VALUE rb_nkf_kconv(obj, opt, src) @@ -61,12 +61,12 @@ rb_nkf_kconv(obj, opt, src) } arguments(opt_ptr); } - dst = rb_str_new(0, RSTRING(src)->len*3 + 10); /* large enough? */ incsize = INCSIZE; input_ctr = 0; input = str2cstr(src, &i_len); + dst = rb_str_new(0, i_len*3 + 10); /* large enough? */ output_ctr = 0; output = RSTRING(dst)->ptr; @@ -106,12 +106,13 @@ rb_nkf_guess(obj, src) { unsigned char *p; unsigned char *pend; + int plen; int sequence_counter = 0; Check_Type(src, T_STRING); - p = RSTRING(src)->ptr; - pend = p + RSTRING(src)->len; + p = str2cstr(src, &plen); + pend = p + plen; #define INCR do {\ p++;\ diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 9e471195e6..84b98f0d70 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -19,9 +19,7 @@ static int readline_event() { CHECK_INTS; -#ifdef USE_THREAD rb_thread_schedule(); -#endif } static VALUE @@ -135,14 +133,14 @@ readline_attempted_completion_function(char *text, int start, int end) static VALUE readline_s_vi_editing_mode(VALUE self) { - rl_vi_editing_mode(); + rl_vi_editing_mode(1,0); return Qnil; } static VALUE readline_s_emacs_editing_mode(VALUE self) { - rl_emacs_editing_mode(); + rl_emacs_editing_mode(1,0); return Qnil; } diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 66bf56a251..fcf8f18c1b 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -30,7 +30,7 @@ extern int rb_thread_select(int, fd_set*, fd_set*, fd_set*, struct timeval*); /* # include #endif -#if defined(USE_THREAD) && defined(HAVE_FCNTL) +#if defined(HAVE_FCNTL) #ifdef HAVE_SYS_SELECT_H #include #endif @@ -43,20 +43,20 @@ extern int rb_thread_select(int, fd_set*, fd_set*, fd_set*, struct timeval*); /* #endif VALUE rb_cBasicSocket; -VALUE rb_cIPsocket; -VALUE rb_cTCPsocket; -VALUE rb_cTCPserver; -VALUE rb_cUDPsocket; +VALUE rb_cIPSocket; +VALUE rb_cTCPSocket; +VALUE rb_cTCPServer; +VALUE rb_cUDPSocket; #ifdef AF_UNIX -VALUE rb_cUNIXsocket; -VALUE rb_cUNIXserver; +VALUE rb_cUNIXSocket; +VALUE rb_cUNIXServer; #endif VALUE rb_cSocket; static VALUE rb_eSocket; #ifdef SOCKS -VALUE rb_cSOCKSsocket; +VALUE rb_cSOCKSSocket; void SOCKSinit(); int Rconnect(); #endif @@ -146,9 +146,7 @@ bsock_close_read(sock) if (fptr->f2 == 0) { return rb_io_close(sock); } -#ifdef USE_THREAD rb_thread_fd_close(fileno(fptr->f)); -#endif fptr->mode &= ~FMODE_READABLE; #ifdef NT free(fptr->f); @@ -293,9 +291,7 @@ bsock_send(argc, argv, sock) f = GetWriteFile(fptr); fd = fileno(f); retry: -#ifdef USE_THREAD rb_thread_fd_writable(fd); -#endif m = rb_str2cstr(msg, &mlen); if (RTEST(to)) { t = rb_str2cstr(to, &tlen); @@ -312,9 +308,7 @@ bsock_send(argc, argv, sock) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail("send(2)"); @@ -329,9 +323,9 @@ static VALUE unixaddr _((struct sockaddr_un*)); enum sock_recv_type { RECV_RECV, /* BasicSocket#recv(no from) */ - RECV_TCP, /* TCPsocket#recvfrom */ - RECV_UDP, /* UDPsocket#recvfrom */ - RECV_UNIX, /* UNIXsocket#recvfrom */ + RECV_TCP, /* TCPSocket#recvfrom */ + RECV_UDP, /* UDPSocket#recvfrom */ + RECV_UNIX, /* UNIXSocket#recvfrom */ RECV_SOCKET, /* Socket#recvfrom */ }; @@ -358,9 +352,7 @@ s_recv(sock, argc, argv, from) GetOpenFile(sock, fptr); fd = fileno(fptr->f); -#ifdef USE_THREAD rb_thread_wait_fd(fd); -#endif TRAP_BEG; retry: RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags, @@ -374,9 +366,7 @@ s_recv(sock, argc, argv, from) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail("recvfrom(2)"); @@ -504,7 +494,7 @@ setipaddr(name, addr) } } -#if defined(USE_THREAD) && defined(HAVE_FCNTL) +#if defined(HAVE_FCNTL) static int thread_connect(fd, sockaddr, len, type) int fd; @@ -661,7 +651,7 @@ open_inet(class, h, serv, type) syscall = "bind(2)"; } else { -#if defined(USE_THREAD) && defined(HAVE_FCNTL) +#if defined(HAVE_FCNTL) status = thread_connect(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr), type); #else @@ -742,7 +732,7 @@ tcp_s_gethostbyname(obj, host) for (pch = h->h_aliases; *pch; pch++) { rb_ary_push(names, rb_str_new2(*pch)); } - rb_ary_push(ary, NUM2INT(h->h_addrtype)); + rb_ary_push(ary, INT2NUM(h->h_addrtype)); #ifdef h_addr for (pch = h->h_addr_list; *pch; pch++) { memcpy((char *) &addr.sin_addr, *pch, h->h_length); @@ -780,9 +770,7 @@ s_accept(class, fd, sockaddr, len) int fd2; retry: -#ifdef USE_THREAD rb_thread_wait_fd(fd); -#endif TRAP_BEG; fd2 = accept(fd, sockaddr, len); TRAP_END; @@ -793,9 +781,7 @@ s_accept(class, fd, sockaddr, len) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail(0); @@ -813,7 +799,7 @@ tcp_accept(sock) GetOpenFile(sock, fptr); fromlen = sizeof(struct sockaddr_in); - return s_accept(rb_cTCPsocket, fileno(fptr->f), + return s_accept(rb_cTCPSocket, fileno(fptr->f), (struct sockaddr*)&from, &fromlen); } @@ -981,9 +967,7 @@ udp_connect(sock, host, port) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail("connect(2)"); @@ -1040,9 +1024,7 @@ udp_send(argc, argv, sock) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail("sendto(2)"); @@ -1110,7 +1092,7 @@ unix_accept(sock) GetOpenFile(sock, fptr); fromlen = sizeof(struct sockaddr_un); - return s_accept(rb_cUNIXsocket, fileno(fptr->f), + return s_accept(rb_cUNIXSocket, fileno(fptr->f), (struct sockaddr*)&from, &fromlen); } @@ -1293,9 +1275,7 @@ sock_connect(sock, addr) #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } rb_sys_fail("connect(2)"); @@ -1416,7 +1396,7 @@ mkhostent(h) for (pch = h->h_aliases; *pch; pch++) { rb_ary_push(names, rb_str_new2(*pch)); } - rb_ary_push(ary, NUM2INT(h->h_addrtype)); + rb_ary_push(ary, INT2NUM(h->h_addrtype)); #ifdef h_addr for (pch = h->h_addr_list; *pch; pch++) { rb_ary_push(ary, rb_str_new(*pch, h->h_length)); @@ -1533,49 +1513,56 @@ Init_socket() rb_define_method(rb_cBasicSocket, "send", bsock_send, -1); rb_define_method(rb_cBasicSocket, "recv", bsock_recv, -1); - rb_cIPsocket = rb_define_class("IPsocket", rb_cBasicSocket); - rb_define_method(rb_cIPsocket, "addr", ip_addr, 0); - rb_define_method(rb_cIPsocket, "peeraddr", ip_peeraddr, 0); - rb_define_singleton_method(rb_cIPsocket, "getaddress", ip_s_getaddress, 1); + rb_cIPSocket = rb_define_class("IPSocket", rb_cBasicSocket); + rb_define_global_const("IPsocket", rb_cIPSocket); + rb_define_method(rb_cIPSocket, "addr", ip_addr, 0); + rb_define_method(rb_cIPSocket, "peeraddr", ip_peeraddr, 0); + rb_define_singleton_method(rb_cIPSocket, "getaddress", ip_s_getaddress, 1); - rb_cTCPsocket = rb_define_class("TCPsocket", rb_cIPsocket); - rb_define_singleton_method(rb_cTCPsocket, "open", tcp_s_open, 2); - rb_define_singleton_method(rb_cTCPsocket, "new", tcp_s_open, 2); - rb_define_singleton_method(rb_cTCPsocket, "gethostbyname", tcp_s_gethostbyname, 1); - rb_define_method(rb_cTCPsocket, "recvfrom", tcp_recvfrom, -1); + rb_cTCPSocket = rb_define_class("TCPSocket", rb_cIPSocket); + rb_define_global_const("TCPsocket", rb_cTCPSocket); + rb_define_singleton_method(rb_cTCPSocket, "open", tcp_s_open, 2); + rb_define_singleton_method(rb_cTCPSocket, "new", tcp_s_open, 2); + rb_define_singleton_method(rb_cTCPSocket, "gethostbyname", tcp_s_gethostbyname, 1); + rb_define_method(rb_cTCPSocket, "recvfrom", tcp_recvfrom, -1); #ifdef SOCKS - rb_cSOCKSsocket = rb_define_class("SOCKSsocket", rb_cTCPsocket); - rb_define_singleton_method(rb_cSOCKSsocket, "open", socks_s_open, 2); - rb_define_singleton_method(rb_cSOCKSsocket, "new", socks_s_open, 2); + rb_cSOCKSSocket = rb_define_class("SOCKSSocket", rb_cTCPSocket); + rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket); + rb_define_singleton_method(rb_cSOCKSSocket, "open", socks_s_open, 2); + rb_define_singleton_method(rb_cSOCKSSocket, "new", socks_s_open, 2); #endif - rb_cTCPserver = rb_define_class("TCPserver", rb_cTCPsocket); - rb_define_singleton_method(rb_cTCPserver, "open", tcp_svr_s_open, -1); - rb_define_singleton_method(rb_cTCPserver, "new", tcp_svr_s_open, -1); - rb_define_method(rb_cTCPserver, "accept", tcp_accept, 0); + rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket); + rb_define_global_const("TCPserver", rb_cTCPServer); + rb_define_singleton_method(rb_cTCPServer, "open", tcp_svr_s_open, -1); + rb_define_singleton_method(rb_cTCPServer, "new", tcp_svr_s_open, -1); + rb_define_method(rb_cTCPServer, "accept", tcp_accept, 0); - rb_cUDPsocket = rb_define_class("UDPsocket", rb_cIPsocket); - rb_define_singleton_method(rb_cUDPsocket, "open", udp_s_open, 0); - rb_define_singleton_method(rb_cUDPsocket, "new", udp_s_open, 0); - rb_define_method(rb_cUDPsocket, "connect", udp_connect, 2); - rb_define_method(rb_cUDPsocket, "bind", udp_bind, 2); - rb_define_method(rb_cUDPsocket, "send", udp_send, -1); - rb_define_method(rb_cUDPsocket, "recvfrom", udp_recvfrom, -1); + rb_cUDPSocket = rb_define_class("UDPSocket", rb_cIPSocket); + rb_define_global_const("UDPsocket", rb_cUDPSocket); + rb_define_singleton_method(rb_cUDPSocket, "open", udp_s_open, 0); + rb_define_singleton_method(rb_cUDPSocket, "new", udp_s_open, 0); + rb_define_method(rb_cUDPSocket, "connect", udp_connect, 2); + rb_define_method(rb_cUDPSocket, "bind", udp_bind, 2); + rb_define_method(rb_cUDPSocket, "send", udp_send, -1); + rb_define_method(rb_cUDPSocket, "recvfrom", udp_recvfrom, -1); #ifdef HAVE_SYS_UN_H - rb_cUNIXsocket = rb_define_class("UNIXsocket", rb_cBasicSocket); - rb_define_singleton_method(rb_cUNIXsocket, "open", unix_s_sock_open, 1); - rb_define_singleton_method(rb_cUNIXsocket, "new", unix_s_sock_open, 1); - rb_define_method(rb_cUNIXsocket, "path", unix_path, 0); - rb_define_method(rb_cUNIXsocket, "addr", unix_addr, 0); - rb_define_method(rb_cUNIXsocket, "peeraddr", unix_peeraddr, 0); - rb_define_method(rb_cUNIXsocket, "recvfrom", unix_recvfrom, -1); + rb_cUNIXSocket = rb_define_class("UNIXSocket", rb_cBasicSocket); + rb_define_global_const("UNIXsocket", rb_cUNIXSocket); + rb_define_singleton_method(rb_cUNIXSocket, "open", unix_s_sock_open, 1); + rb_define_singleton_method(rb_cUNIXSocket, "new", unix_s_sock_open, 1); + rb_define_method(rb_cUNIXSocket, "path", unix_path, 0); + rb_define_method(rb_cUNIXSocket, "addr", unix_addr, 0); + rb_define_method(rb_cUNIXSocket, "peeraddr", unix_peeraddr, 0); + rb_define_method(rb_cUNIXSocket, "recvfrom", unix_recvfrom, -1); - rb_cUNIXserver = rb_define_class("UNIXserver", rb_cUNIXsocket); - rb_define_singleton_method(rb_cUNIXserver, "open", unix_svr_s_open, 1); - rb_define_singleton_method(rb_cUNIXserver, "new", unix_svr_s_open, 1); - rb_define_method(rb_cUNIXserver, "accept", unix_accept, 0); + rb_cUNIXServer = rb_define_class("UNIXServer", rb_cUNIXSocket); + rb_define_global_const("UNIXserver", rb_cUNIXServer); + rb_define_singleton_method(rb_cUNIXServer, "open", unix_svr_s_open, 1); + rb_define_singleton_method(rb_cUNIXServer, "new", unix_svr_s_open, 1); + rb_define_method(rb_cUNIXServer, "accept", unix_accept, 0); #endif rb_cSocket = rb_define_class("Socket", rb_cBasicSocket); diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index 11eb977861..a08391b7bb 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -55,9 +55,7 @@ void _timer_for_tcl (ClientData clientData) timer->flag = 0; CHECK_INTS; -#ifdef USE_THREAD if (!rb_thread_critical) rb_thread_schedule(); -#endif timer->token = Tk_CreateTimerHandler(200, _timer_for_tcl, (ClientData)timer); @@ -82,11 +80,9 @@ lib_mainloop(VALUE self) } DUMP1("stop Tk_Mainloop"); -#ifdef USE_THREAD if (timer->flag) { Tk_DeleteTimerHandler(timer->token); } -#endif return Qnil; } diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 8fc57f307e..2aa49879fd 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -228,7 +228,7 @@ module TkComm return '' if cmd == '' id = _next_cmd_id Tk_CMDTBL[id] = cmd - @cmdtbl = [] if not @cmdtbl + @cmdtbl = [] unless @cmdtbl @cmdtbl.push id return format("rb_out %s", id); end @@ -711,14 +711,14 @@ class TkVariable elsif val.kind_of?(Array) a = [] val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))} - s = '"' + a.join(" ").gsub(/[][$"]/, '\\\\\&') + '"' #' + s = '"' + a.join(" ").gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; array set %s %s', @id, @id, s)) elsif val.kind_of?(Hash) s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ - .gsub(/[][$"]/, '\\\\\&') + '"' #' + .gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; array set %s %s', @id, @id, s)) else - s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' #' + s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; set %s %s', @id, @id, s)) end end @@ -738,16 +738,15 @@ class TkVariable if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1" raise else - Hash[*tk_split_simplelist(INTERP\ - ._eval(format('global %s; array get %s', - @id, @id)))] + Hash[*tk_split_simplelist(INTERP._eval(format('global %s; array get %s', + @id, @id)))] end end end def value=(val) begin - s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' #' + s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; set %s %s', @id, @id, s)) rescue if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1" @@ -760,12 +759,12 @@ class TkVariable elsif val.kind_of?(Array) a = [] val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))} - s = '"' + a.join(" ").gsub(/[][$"]/, '\\\\\&') + '"' #' + s = '"' + a.join(" ").gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) elsif val.kind_of?(Hash) s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ - .gsub(/[][$"]/, '\\\\\&') + '"' #' + .gsub(/[][$"]/, '\\\\\&') + '"' INTERP._eval(format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) else @@ -972,7 +971,7 @@ class TkVarAccessvalue}) + if (slot == 'font' || slot == 'kanjifont' || + slot == 'latinfont' || slot == 'asciifont') + if value == None + fontobj + else + font_configure({slot=>value}) + end else tk_call path, 'configure', "-#{slot}", value end @@ -1624,13 +1627,11 @@ class TkObjectval}) else tk_call 'entryconfigure', index, "-#{key}", val diff --git a/ext/tk/lib/tkfont.rb b/ext/tk/lib/tkfont.rb index 421988aeca..1526f68d88 100644 --- a/ext/tk/lib/tkfont.rb +++ b/ext/tk/lib/tkfont.rb @@ -153,8 +153,8 @@ class TkFont charset = (info = font['charset'] .to_s)? info: '*' encoding = (info = font['encoding'].to_s)? info: '*' - Array([foundry, family, weight, slant, swidth, adstyle, - pixels, points, resx, resy, space, avgWidth, charset, encoding]) + [foundry, family, weight, slant, swidth, adstyle, + pixels, points, resx, resy, space, avgWidth, charset, encoding] end def create_latinfont_tk4x(font) @@ -238,13 +238,10 @@ class TkFont } @kanjifont = '-' + _get_font_info_from_hash(finfo).join('-') + '-' - elsif font.kind_of? TkFont @kanjifont = font.kanji_font - else @kanjifont = font - end end @@ -309,11 +306,9 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font) - else tk_call('font', 'create', @kanjifont, '-copy', font, '-charset', 'jisx0208.1983') - end end @@ -397,9 +392,9 @@ class TkFont if option "" else - Array([ ['family',[]], ['size',[]], ['weight',[]], ['slant',[]], - ['underline',[]], ['overstrike',[]], ['charset',[]], - ['pointadjust',[]] ]) + [['family',[]], ['size',[]], ['weight',[]], ['slant',[]], + ['underline',[]], ['overstrike',[]], ['charset',[]], + ['pointadjust',[]]] end end @@ -440,9 +435,9 @@ class TkFont if option "" else - Array([ ['family',[]], ['size',[]], ['weight',[]], ['slant',[]], - ['underline',[]], ['overstrike',[]], ['charset',[]], - ['pointadjust',[]] ]) + [['family',[]], ['size',[]], ['weight',[]], ['slant',[]], + ['underline',[]], ['overstrike',[]], ['charset',[]], + ['pointadjust',[]]] end end @@ -583,15 +578,15 @@ class TkFont def kanji_replace_core_tk81(knj) if font.kind_of? Hash - tk_call('font', 'configure', @compoundfont, *hash_kv(font)) + tk_call('font', 'configure', @compoundfont, *hash_kv(knj)) else keys = {} - if font.kind_of? Array - actual_core(array2tk_list(font)).each{|key,val| keys[key] = val} - elsif font.kind_of? TkFont - actual_core(font.latin_font).each{|key,val| keys[key] = val} + if knj.kind_of? Array + actual_core(array2tk_list(knj)).each{|key,val| keys[key] = val} + elsif knj.kind_of? TkFont + actual_core(knj.latin_font).each{|key,val| keys[key] = val} else - actual_core(font).each{|key,val| keys[key] = val} + actual_core(knj).each{|key,val| keys[key] = val} end tk_call('font', 'configure', @compoundfont, *hash_kv(keys)) end @@ -616,7 +611,7 @@ class TkFont if option "" else - Array([ ['ascent',[]], ['descent',[]], ['linespace',[]], ['fixed',[]] ]) + [['ascent',[]], ['descent',[]], ['linespace',[]], ['fixed',[]]] end end diff --git a/file.c b/file.c index 857e807c37..0f68582e08 100644 --- a/file.c +++ b/file.c @@ -51,7 +51,7 @@ VALUE rb_time_new _((time_t, time_t)); #endif #ifndef HAVE_STRING_H -char *strrchr _((char*,char)); +char *strrchr _((const char*,const char)); #endif #include @@ -256,7 +256,7 @@ group_member(gid) int eaccess(path, mode) - char *path; + const char *path; int mode; { #ifndef NT @@ -560,7 +560,7 @@ test_grpowned(obj, fname) #if defined(S_ISUID) || defined(S_ISGID) || defined(S_ISVTX) static VALUE check3rdbyte(file, mode) - char *file; + const char *file; int mode; { struct stat st; @@ -745,7 +745,7 @@ rb_file_ctime(obj) static void chmod_internal(path, mode) - char *path; + const char *path; int mode; { if (chmod(path, mode) == -1) @@ -796,7 +796,7 @@ struct chown_args { static void chown_internal(path, args) - char *path; + const char *path; struct chown_args *args; { if (chown(path, args->owner, args->group) < 0) @@ -902,7 +902,7 @@ struct utimbuf { static void utime_internal(path, utp) - char *path; + const char *path; struct utimbuf *utp; { if (utime(path, utp) < 0) @@ -987,7 +987,7 @@ rb_file_s_readlink(obj, path) static void unlink_internal(path) - char *path; + const char *path; { if (unlink(path) < 0) rb_sys_fail(path); @@ -1147,7 +1147,7 @@ rb_file_s_expand_path(argc, argv) static int rmext(p, e) - char *p, *e; + const char *p, *e; { int l1, l2; @@ -1303,7 +1303,7 @@ rb_file_truncate(obj, len) # define LOCK_UN 8 # endif -#if defined(USE_THREAD) && defined(EWOULDBLOCK) +#if defined(EWOULDBLOCK) static int rb_thread_flock(fd, op, fptr) int fd, op; @@ -1515,7 +1515,7 @@ static VALUE rb_mConst; void rb_file_const(name, value) - char *name; + const char *name; VALUE value; { rb_define_const(rb_cFile, name, value); diff --git a/gc.c b/gc.c index 215479e0f6..b7c8475f5d 100644 --- a/gc.c +++ b/gc.c @@ -911,10 +911,7 @@ rb_gc() rb_gc_mark_locations((VALUE*)((char*)rb_gc_stack_start + 2), (VALUE*)((char*)&stack_end + 2)); #endif - -#ifdef USE_THREAD rb_gc_mark_threads(); -#endif /* mark protected global variables */ for (list = Global_List; list; list = list->next) { diff --git a/hash.c b/hash.c index 34e7213856..f860c98a12 100644 --- a/hash.c +++ b/hash.c @@ -847,48 +847,24 @@ extern char **environ; #endif static char **origenviron; -void -ruby_unsetenv(name) - char *name; -{ - int i, len; - - len = strlen(name); - for(i=0; environ[i]; i++) { - if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') { - break; - } - } - while (environ[i]) { - environ[i] = environ[i+1]; - i++; - } -} - static VALUE env_delete(obj, name) VALUE obj, name; { int i, len; - char *nam, *val = 0; + char *nam, *val; rb_secure(4); - nam = STR2CSTR(name); - if (strcmp(nam, "PATH") == 0 && !OBJ_TAINTED(name)) { - path_tainted = 0; - } - len = strlen(nam); - for(i=0; environ[i]; i++) { - if (strncmp(environ[i], nam, len) == 0 && environ[i][len] == '=') { - val = environ[i]+len+1; - break; - } - } - while (environ[i]) { - environ[i] = environ[i+1]; - i++; + nam = str2cstr(name, &len); + if (strlen(nam) != len) { + rb_raise(rb_eArgError, "bad environment variable name"); } + val = getenv(nam); if (val) { + ruby_setenv(nam, 0); + if (strcmp(nam, "PATH") == 0 && !OBJ_TAINTED(name)) { + path_tainted = 0; + } return rb_str_new2(val); } return Qnil; @@ -1011,7 +987,7 @@ ruby_setenv(name, value) char *name; char *value; { -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN32__) #ifdef USE_WIN32_RTL_ENV register char *envstr; STRLEN namlen = strlen(name); @@ -1069,7 +1045,7 @@ ruby_setenv(name, value) #else /* WIN32 */ - register int i=envix(name); /* where does it go? */ + int i=envix(name); /* where does it go? */ if (environ == origenviron) { /* need we copy environment? */ int j; @@ -1084,6 +1060,7 @@ ruby_setenv(name, value) environ = tmpenv; /* tell exec where it is now */ } if (!value) { + free(environ[i]); while (environ[i]) { environ[i] = environ[i+1]; i++; @@ -1113,6 +1090,13 @@ ruby_setenv(name, value) #endif /* WIN32 */ } +void +ruby_unsetenv(name) + char *name; +{ + ruby_setenv(name, 0); +} + static VALUE rb_f_setenv(obj, nm, val) VALUE obj, nm, val; diff --git a/inits.c b/inits.c index 170912d443..fdc49f0f4b 100644 --- a/inits.c +++ b/inits.c @@ -56,9 +56,7 @@ rb_call_inits() Init_eval(); Init_String(); Init_Exception(); -#ifdef USE_THREAD Init_Thread(); -#endif Init_Numeric(); Init_Bignum(); Init_Array(); diff --git a/instruby.rb b/instruby.rb index 6f46f86ee2..4f0f217eae 100644 --- a/instruby.rb +++ b/instruby.rb @@ -7,6 +7,7 @@ destdir = ARGV[0] || '' $:.unshift CONFIG["srcdir"]+"/lib" require "ftools" +require "find" binsuffix = CONFIG["binsuffix"] if ENV["prefix"] @@ -51,8 +52,12 @@ File.makedirs archdir, true Dir.chdir "ext" system "../miniruby#{binsuffix} extmk.rb install #{destdir}" Dir.chdir CONFIG["srcdir"] -for f in Dir["lib/*.rb"] - File.install f, pkglibdir, 0644, true + +Find.find("lib") do |f| + next unless /\.rb$/ =~ f + dir = pkglibdir+"/"+File.dirname(f[4..-1]) + File.makedirs dir, true unless File.directory? dir + File.install f, dir, 0644, true end for f in Dir["*.h"] diff --git a/intern.h b/intern.h index 9c72f72db1..49c043a278 100644 --- a/intern.h +++ b/intern.h @@ -41,7 +41,7 @@ VALUE rb_uint2big _((unsigned long)); VALUE rb_int2big _((long)); VALUE rb_uint2inum _((unsigned long)); VALUE rb_int2inum _((long)); -VALUE rb_str2inum _((char*, int)); +VALUE rb_str2inum _((const char*, int)); VALUE rb_big2str _((VALUE, int)); long rb_big2long _((VALUE)); #define rb_big2int(x) rb_big2long(x) @@ -73,28 +73,28 @@ VALUE rb_class_protected_instance_methods _((int, VALUE*, VALUE)); VALUE rb_class_private_instance_methods _((int, VALUE*, VALUE)); VALUE rb_obj_singleton_methods _((VALUE)); void rb_define_method_id _((VALUE, ID, VALUE (*)(), int)); -void rb_undef_method _((VALUE, char*)); -void rb_define_protected_method _((VALUE, char*, VALUE (*)(), int)); -void rb_define_private_method _((VALUE, char*, VALUE (*)(), int)); -void rb_define_singleton_method _((VALUE,char*,VALUE(*)(),int)); -void rb_define_private_method _((VALUE,char*,VALUE(*)(),int)); +void rb_undef_method _((VALUE, const char*)); +void rb_define_protected_method _((VALUE, const char*, VALUE (*)(), int)); +void rb_define_private_method _((VALUE, const char*, VALUE (*)(), int)); +void rb_define_singleton_method _((VALUE,const char*,VALUE(*)(),int)); +void rb_define_private_method _((VALUE,const char*,VALUE(*)(),int)); VALUE rb_singleton_class _((VALUE)); /* enum.c */ VALUE rb_enum_length _((VALUE)); /* error.c */ extern int ruby_nerrs; -VALUE rb_exc_new _((VALUE, char*, int)); -VALUE rb_exc_new2 _((VALUE, char*)); +VALUE rb_exc_new _((VALUE, const char*, int)); +VALUE rb_exc_new2 _((VALUE, const char*)); VALUE rb_exc_new3 _((VALUE, VALUE)); -void rb_loaderror __((char*, ...)) NORETURN; -void rb_compile_error __((char*, ...)); -void rb_compile_error_append __((char*, ...)); +void rb_loaderror __((const char*, ...)) NORETURN; +void rb_compile_error __((const char*, ...)); +void rb_compile_error_append __((const char*, ...)); /* eval.c */ void rb_exc_raise _((VALUE)) NORETURN; void rb_exc_fatal _((VALUE)) NORETURN; -void rb_remove_method _((VALUE, char*)); -void rb_disable_super _((VALUE, char*)); -void rb_enable_super _((VALUE, char*)); +void rb_remove_method _((VALUE, const char*)); +void rb_disable_super _((VALUE, const char*)); +void rb_enable_super _((VALUE, const char*)); void rb_clear_cache _((void)); void rb_alias _((VALUE, ID, ID)); void rb_attr _((VALUE,ID,int,int,int)); @@ -104,7 +104,6 @@ VALUE rb_dvar_ref _((ID)); void rb_dvar_asgn _((ID, VALUE)); void rb_dvar_push _((ID, VALUE)); VALUE rb_eval_cmd _((VALUE, VALUE)); -VALUE rb_trap_eval _((VALUE, int)); int rb_respond_to _((VALUE, ID)); void rb_interrupt _((void)); VALUE rb_apply _((VALUE, ID, VALUE)); @@ -115,7 +114,7 @@ VALUE rb_obj_instance_eval _((int, VALUE*, VALUE)); void rb_load _((VALUE, int)); void rb_load_protect _((VALUE, int, int*)); void rb_jump_tag _((int)) NORETURN; -void rb_provide _((char*)); +void rb_provide _((const char*)); VALUE rb_f_require _((VALUE, VALUE)); void rb_obj_call_init _((VALUE, int, VALUE*)); VALUE rb_class_new_instance _((int, VALUE*, VALUE)); @@ -135,6 +134,7 @@ VALUE rb_thread_create _((VALUE (*)(), void*)); int rb_thread_scope_shared_p _((void)); void rb_thread_interrupt _((void)); void rb_thread_trap_eval _((VALUE, int)); +void rb_thread_signal_raise _((char*)); int rb_thread_select(); void rb_thread_wait_for(); VALUE rb_thread_current _((void)); @@ -142,9 +142,9 @@ VALUE rb_thread_main _((void)); VALUE rb_thread_local_aref _((VALUE, ID)); VALUE rb_thread_local_aset _((VALUE, ID, VALUE)); /* file.c */ -int eaccess _((char*, int)); +int eaccess _((const char*, int)); VALUE rb_file_s_expand_path _((int, VALUE *)); -void rb_file_const _((char*, VALUE)); +void rb_file_const _((const char*, VALUE)); /* gc.c */ void rb_global_variable _((VALUE*)); void rb_gc_mark_locations _((VALUE*, VALUE*)); @@ -176,7 +176,7 @@ VALUE rb_io_ungetc _((VALUE, VALUE)); VALUE rb_io_close _((VALUE)); VALUE rb_io_eof _((VALUE)); VALUE rb_io_binmode _((VALUE)); -VALUE rb_file_open _((char*, char*)); +VALUE rb_file_open _((const char*, const char*)); VALUE rb_gets _((void)); void rb_str_setter _((VALUE, ID, VALUE*)); /* numeric.c */ @@ -198,7 +198,7 @@ VALUE rb_obj_taint _((VALUE)); VALUE rb_obj_tainted _((VALUE)); VALUE rb_obj_untaint _((VALUE)); VALUE rb_obj_id _((VALUE)); -VALUE rb_convert_type _((VALUE,int,char*,char*)); +VALUE rb_convert_type _((VALUE,int,const char*,const char*)); VALUE rb_Integer _((VALUE)); VALUE rb_Float _((VALUE)); VALUE rb_String _((VALUE)); @@ -217,11 +217,11 @@ void rb_backref_set _((VALUE)); VALUE rb_lastline_get _((void)); void rb_lastline_set _((VALUE)); /* process.c */ -int rb_proc_exec _((char*)); +int rb_proc_exec _((const char*)); void rb_syswait _((int)); /* range.c */ -VALUE rb_range_new _((VALUE, VALUE)); -VALUE rb_range_beg_end _((VALUE, int*, int*)); +VALUE rb_range_new _((VALUE, VALUE, int)); +VALUE rb_range_beg_len _((VALUE, int*, int*, int, int)); /* re.c */ VALUE rb_reg_nth_defined _((int, VALUE)); VALUE rb_reg_nth_match _((int, VALUE)); @@ -229,12 +229,12 @@ 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 _((char*, int, int)); +VALUE rb_reg_new _((const char*, int, int)); VALUE rb_reg_match _((VALUE, VALUE)); VALUE rb_reg_match2 _((VALUE)); int rb_reg_options _((VALUE)); -char*rb_get_kcode _((void)); -void rb_set_kcode _((char*)); +const char* rb_get_kcode _((void)); +void rb_set_kcode _((const char*)); int rb_ignorecase_p _((void)); /* ruby.c */ extern VALUE rb_argv0; @@ -257,12 +257,12 @@ void rb_trap_exec _((void)); /* sprintf.c */ VALUE rb_f_sprintf _((int, VALUE*)); /* string.c */ -VALUE rb_str_new _((char*, int)); -VALUE rb_str_new2 _((char*)); +VALUE rb_str_new _((const char*, int)); +VALUE rb_str_new2 _((const char*)); VALUE rb_str_new3 _((VALUE)); VALUE rb_str_new4 _((VALUE)); -VALUE rb_tainted_str_new _((char*, int)); -VALUE rb_tainted_str_new2 _((char*)); +VALUE rb_tainted_str_new _((const char*, int)); +VALUE rb_tainted_str_new2 _((const char*)); VALUE rb_obj_as_string _((VALUE)); VALUE rb_str_to_str _((VALUE)); VALUE rb_str_dup _((VALUE)); @@ -272,32 +272,34 @@ VALUE rb_str_substr _((VALUE, int, int)); void rb_str_modify _((VALUE)); VALUE rb_str_freeze _((VALUE)); VALUE rb_str_resize _((VALUE, int)); -VALUE rb_str_cat _((VALUE, char*, int)); +VALUE rb_str_cat _((VALUE, const char*, int)); VALUE rb_str_concat _((VALUE, VALUE)); int rb_str_hash _((VALUE)); int rb_str_cmp _((VALUE, VALUE)); -VALUE rb_str_upto _((VALUE, VALUE)); +VALUE rb_str_upto _((VALUE, VALUE, int)); VALUE rb_str_inspect _((VALUE)); -VALUE rb_str_split _((VALUE, char*)); +VALUE rb_str_split _((VALUE, const char*)); /* struct.c */ VALUE rb_struct_new __((VALUE, ...)); -VALUE rb_struct_define __((char*, ...)); +VALUE rb_struct_define __((const char*, ...)); VALUE rb_struct_alloc _((VALUE, VALUE)); VALUE rb_struct_aref _((VALUE, VALUE)); VALUE rb_struct_aset _((VALUE, VALUE, VALUE)); VALUE rb_struct_getmember _((VALUE, ID)); +/* time.c */ +VALUE rb_time_new(); /* variable.c */ VALUE rb_mod_name _((VALUE)); VALUE rb_class_path _((VALUE)); -void rb_set_class_path _((VALUE, VALUE, char*)); -VALUE rb_path2class _((char*)); +void rb_set_class_path _((VALUE, VALUE, const char*)); +VALUE rb_path2class _((const char*)); void rb_name_class _((VALUE, ID)); -void rb_autoload _((char*, char*)); +void rb_autoload _((const char*, const char*)); VALUE rb_f_autoload _((VALUE, VALUE, VALUE)); void rb_gc_mark_global_tbl _((void)); VALUE rb_f_trace_var _((int, VALUE*)); VALUE rb_f_untrace_var _((int, VALUE*)); -VALUE rb_gvar_set2 _((char*, VALUE)); +VALUE rb_gvar_set2 _((const char*, VALUE)); VALUE rb_f_global_variables _((void)); void rb_alias_variable _((ID, ID)); void rb_mark_generic_ivar _((VALUE)); diff --git a/io.c b/io.c index 01c509c5ec..5852bee244 100644 --- a/io.c +++ b/io.c @@ -110,16 +110,12 @@ extern int ReadDataPending(); # define READ_DATA_PENDING(fp) ReadDataPending(fp) #endif -#ifndef USE_THREAD -# define READ_CHECK(fp) 0 -#else -# define READ_CHECK(fp) do {\ +#define READ_CHECK(fp) do {\ if (!READ_DATA_PENDING(fp)) {\ rb_thread_wait_fd(fileno(fp));\ rb_io_check_closed(fptr);\ }\ } while(0) -#endif void rb_eof_error() @@ -154,8 +150,8 @@ rb_io_check_writable(fptr) } /* writing functions */ -VALUE -rb_io_write(io, str) +static VALUE +io_write(io, str) VALUE io, str; { OpenFile *fptr; @@ -200,6 +196,13 @@ rb_io_write(io, str) return INT2FIX(n); } +VALUE +rb_io_write(io, str) + VALUE io, str; +{ + return rb_funcall(io, id_write, 1, str); +} + static VALUE rb_io_addstr(io, str) VALUE io, str; @@ -419,7 +422,7 @@ read_all(port) } static VALUE -rb_io_read(argc, argv, io) +io_read(argc, argv, io) int argc; VALUE *argv; VALUE io; @@ -850,10 +853,7 @@ rb_io_fptr_close(fptr) int fd; if (fptr->f == NULL && fptr->f2 == NULL) return; - -#ifdef USE_THREAD rb_thread_fd_close(fileno(fptr->f)); -#endif if (fptr->finalize) { (*fptr->finalize)(fptr); @@ -911,6 +911,7 @@ rb_io_close_read(io) VALUE io; { OpenFile *fptr; + int n; rb_secure(4); GetOpenFile(io, fptr); @@ -920,10 +921,11 @@ rb_io_close_read(io) if (fptr->f2 == 0) { return rb_io_close(io); } - fclose(fptr->f); + n = fclose(fptr->f); fptr->mode &= ~FMODE_READABLE; fptr->f = fptr->f2; fptr->f2 = 0; + if (n != 0) rb_sys_fail(fptr->path); return Qnil; } @@ -933,6 +935,7 @@ rb_io_close_write(io) VALUE io; { OpenFile *fptr; + int n; rb_secure(4); GetOpenFile(io, fptr); @@ -942,9 +945,10 @@ rb_io_close_write(io) if (fptr->f2 == 0) { return rb_io_close(io); } - fclose(fptr->f2); + n = fclose(fptr->f2); fptr->f2 = 0; fptr->mode &= ~FMODE_WRITABLE; + if (n != 0) rb_sys_fail(fptr->path); return Qnil; } @@ -965,11 +969,9 @@ rb_io_syswrite(io, str) rb_io_check_writable(fptr); f = GetWriteFile(fptr); -#ifdef USE_THREAD if (!rb_thread_fd_writable(fileno(f))) { rb_io_check_closed(fptr); } -#endif n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len); if (n == -1) rb_sys_fail(fptr->path); @@ -991,9 +993,7 @@ rb_io_sysread(io, len) str = rb_str_new(0, ilen); -#ifdef USE_THREAD rb_thread_wait_fd(fileno(fptr->f)); -#endif TRAP_BEG; n = read(fileno(fptr->f), RSTRING(str)->ptr, RSTRING(str)->len); TRAP_END; @@ -1158,8 +1158,8 @@ rb_open(fname, flag, mode) FILE * rb_fopen(fname, mode) - char *fname; - char *mode; + const char *fname; + const char *mode; { FILE *file; @@ -1179,7 +1179,7 @@ rb_fopen(fname, mode) FILE * rb_fdopen(fd, mode) int fd; - char *mode; + const char *mode; { FILE *file; @@ -1198,7 +1198,7 @@ rb_fdopen(fd, mode) VALUE rb_file_open(fname, mode) - char *fname, *mode; + const char *fname, *mode; { OpenFile *fptr; NEWOBJ(port, struct RFile); @@ -1388,8 +1388,6 @@ pipe_open(pname, mode) } if (doexec) { - extern char *ruby_sourcefile; - extern int ruby_sourceline; int fd; for (fd = 3; fd < NOFILE; fd++) @@ -1403,11 +1401,7 @@ pipe_open(pname, mode) case -1: /* fork failed */ if (errno == EAGAIN) { -#ifdef USE_THREAD rb_thread_sleep(1); -#else - sleep(1); -#endif goto retry; } close(pr[0]); close(pw[1]); @@ -1603,9 +1597,7 @@ rb_io_reopen(io, nfile) else if (orig->mode & FMODE_WRITABLE) { fflush(orig->f); } -#ifdef USE_THREAD rb_thread_fd_close(fileno(fptr->f)); -#endif /* copy OpenFile structure */ fptr->mode = orig->mode; @@ -2060,8 +2052,8 @@ next_argv() next_p = 0; if (RARRAY(rb_argv)->len > 0) { filename = rb_ary_shift(rb_argv); - fn = RSTRING(filename)->ptr; - if (RSTRING(filename)->len == 1 && fn[0] == '-') { + fn = STR2CSTR(filename); + if (strlen(fn) == 1 && fn[0] == '-') { file = rb_stdin; if (ruby_inplace_mode) { rb_defout = rb_stdout; @@ -2282,6 +2274,7 @@ rb_f_select(argc, argv, obj) int i, max = 0, n; int interrupt_flag = 0; int pending = 0; + VALUE io; rb_scan_args(argc, argv, "13", &read, &write, &except, &timeout); if (NIL_P(timeout)) { @@ -2298,9 +2291,7 @@ rb_f_select(argc, argv, obj) rp = &rset; FD_ZERO(rp); for (i=0; ilen; i++) { - VALUE io = rb_io_get_io(RARRAY(read)->ptr[i]); - - GetOpenFile(io, fptr); + GetOpenFile(rb_io_get_io(RARRAY(read)->ptr[i]), fptr); FD_SET(fileno(fptr->f), rp); if (READ_DATA_PENDING(fptr->f)) { /* check for buffered data */ pending++; @@ -2321,9 +2312,7 @@ rb_f_select(argc, argv, obj) wp = &wset; FD_ZERO(wp); for (i=0; ilen; i++) { - VALUE io = rb_io_get_io(RARRAY(write)->ptr[i]); - - GetOpenFile(io, fptr); + GetOpenFile(rb_io_get_io(RARRAY(write)->ptr[i]), fptr); FD_SET(fileno(fptr->f), wp); if (max < fileno(fptr->f)) max = fileno(fptr->f); if (fptr->f2) { @@ -2340,9 +2329,7 @@ rb_f_select(argc, argv, obj) ep = &eset; FD_ZERO(ep); for (i=0; ilen; i++) { - VALUE io = rb_io_get_io(RARRAY(except)->ptr[i]); - - GetOpenFile(io, fptr); + GetOpenFile(rb_io_get_io(RARRAY(except)->ptr[i]), fptr); FD_SET(fileno(fptr->f), ep); if (max < fileno(fptr->f)) max = fileno(fptr->f); if (fptr->f2) { @@ -2356,24 +2343,10 @@ rb_f_select(argc, argv, obj) max++; -#ifdef USE_THREAD n = rb_thread_select(max, rp, wp, ep, tp); if (n < 0) { rb_sys_fail(0); } -#else - retry: - TRAP_BEG; - n = select(max, rp, wp, ep, tp); - TRAP_END; - if (n < 0) { - if (errno != EINTR) { - rb_sys_fail(0); - } - if (tp == NULL) goto retry; - interrupt_flag = 1; - } -#endif if (!pending && n == 0) return Qnil; /* returns nil on timeout */ res = rb_ary_new2(3); @@ -2385,7 +2358,7 @@ rb_f_select(argc, argv, obj) if (rp) { list = RARRAY(res)->ptr[0]; for (i=0; i< RARRAY(read)->len; i++) { - GetOpenFile(RARRAY(read)->ptr[i], fptr); + GetOpenFile(rb_io_get_io(RARRAY(read)->ptr[i]), fptr); if (FD_ISSET(fileno(fptr->f), rp) || FD_ISSET(fileno(fptr->f), &pset)) { rb_ary_push(list, RARRAY(read)->ptr[i]); @@ -2396,7 +2369,7 @@ rb_f_select(argc, argv, obj) if (wp) { list = RARRAY(res)->ptr[1]; for (i=0; i< RARRAY(write)->len; i++) { - GetOpenFile(RARRAY(write)->ptr[i], fptr); + GetOpenFile(rb_io_get_io(RARRAY(write)->ptr[i]), fptr); if (FD_ISSET(fileno(fptr->f), wp)) { rb_ary_push(list, RARRAY(write)->ptr[i]); } @@ -2409,7 +2382,7 @@ rb_f_select(argc, argv, obj) if (ep) { list = RARRAY(res)->ptr[2]; for (i=0; i< RARRAY(except)->len; i++) { - GetOpenFile(RARRAY(except)->ptr[i], fptr); + GetOpenFile(rb_io_get_io(RARRAY(except)->ptr[i]), fptr); if (FD_ISSET(fileno(fptr->f), ep)) { rb_ary_push(list, RARRAY(except)->ptr[i]); } @@ -2787,7 +2760,7 @@ arg_read(argc, argv) retry: if (!next_argv()) return str; - tmp = rb_io_read(argc, argv, file); + tmp = io_read(argc, argv, file); if (NIL_P(tmp) && next_p != -1) { rb_io_close(file); next_p = 1; @@ -3017,8 +2990,8 @@ Init_IO() rb_define_method(rb_cIO, "readlines", rb_io_readlines, -1); - rb_define_method(rb_cIO, "read", rb_io_read, -1); - rb_define_method(rb_cIO, "write", rb_io_write, 1); + rb_define_method(rb_cIO, "read", io_read, -1); + rb_define_method(rb_cIO, "write", io_write, 1); rb_define_method(rb_cIO, "gets", rb_io_gets_method, -1); rb_define_method(rb_cIO, "readline", rb_io_readline, -1); rb_define_method(rb_cIO, "getc", rb_io_getc, 0); diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb index 12c850240b..35b766ece0 100644 --- a/lib/cgi-lib.rb +++ b/lib/cgi-lib.rb @@ -27,14 +27,14 @@ and query.cookie has Hash class methods == print HTTP header and HTML string to $> require "cgi-lib.rb" - CGI.print{ - CGI.tag("HTML"){ - CGI.tag("HEAD"){ CGI.tag("TITLE"){"TITLE"} } + - CGI.tag("BODY"){ - CGI.tag("FORM", {"ACTION"=>"test.rb", "METHOD"=>"POST"}){ - CGI.tag("INPUT", {"TYPE"=>"submit", "VALUE"=>"submit"}) + CGI::print{ + CGI::tag("HTML"){ + CGI::tag("HEAD"){ CGI::tag("TITLE"){"TITLE"} } + + CGI::tag("BODY"){ + CGI::tag("FORM", {"ACTION"=>"test.rb", "METHOD"=>"POST"}){ + CGI::tag("INPUT", {"TYPE"=>"submit", "VALUE"=>"submit"}) } + - CGI.tag("HR") + CGI::tag("HR") } } } @@ -43,68 +43,68 @@ and query.cookie has Hash class methods == make raw cookie string require "cgi-lib.rb" - cookie1 = CGI.cookie({'name' => 'name', - 'value' => 'value', - 'path' => 'path', # optional - 'domain' => 'domain', # optional - 'expires' => Time.now, # optional - 'secure' => true # optional - }) + cookie1 = CGI::cookie({'name' => 'name', + 'value' => 'value', + 'path' => 'path', # optional + 'domain' => 'domain', # optional + 'expires' => Time.now, # optional + 'secure' => true # optional + }) - CGI.print("Content-Type: text/html", cookie1, cookie2){ "string" } + CGI::print("Content-Type: text/html", cookie1, cookie2){ "string" } == print HTTP header and string to $> require "cgi-lib.rb" - CGI.print{ "string" } - # == CGI.print("Content-Type: text/html"){ "string" } - CGI.print("Content-Type: text/html", cookie1, cookie2){ "string" } + CGI::print{ "string" } + # == CGI::print("Content-Type: text/html"){ "string" } + CGI::print("Content-Type: text/html", cookie1, cookie2){ "string" } === NPH (no-parse-header) mode require "cgi-lib.rb" - CGI.print("nph"){ "string" } - # == CGI.print("nph", "Content-Type: text/html"){ "string" } - CGI.print("nph", "Content-Type: text/html", cookie1, cookie2){ "string" } + CGI::print("nph"){ "string" } + # == CGI::print("nph", "Content-Type: text/html"){ "string" } + CGI::print("nph", "Content-Type: text/html", cookie1, cookie2){ "string" } == make HTML tag string require "cgi-lib.rb" - CGI.tag("element", {"attribute_name"=>"attribute_value"}){"content"} + CGI::tag("element", {"attribute_name"=>"attribute_value"}){"content"} == make HTTP header string require "cgi-lib.rb" - CGI.header # == CGI.header("Content-Type: text/html") - CGI.header("Content-Type: text/html", cookie1, cookie2) + CGI::header # == CGI::header("Content-Type: text/html") + CGI::header("Content-Type: text/html", cookie1, cookie2) === NPH (no-parse-header) mode - CGI.header("nph") # == CGI.header("nph", "Content-Type: text/html") - CGI.header("nph", "Content-Type: text/html", cookie1, cookie2) + CGI::header("nph") # == CGI::header("nph", "Content-Type: text/html") + CGI::header("nph", "Content-Type: text/html", cookie1, cookie2) == escape url encode require "cgi-lib.rb" - url_encoded_string = CGI.escape("string") + url_encoded_string = CGI::escape("string") == unescape url encoded require "cgi-lib.rb" - string = CGI.unescape("url encoded string") + string = CGI::unescape("url encoded string") == escape HTML &"<> require "cgi-lib.rb" - CGI.escapeHTML("string") + CGI::escapeHTML("string") =end @@ -117,11 +117,6 @@ class CGI < SimpleDelegator LF = "\012" EOL = CR + LF - # if running on Windows(IIS or PWS) then change cwd. - if ENV['SERVER_SOFTWARE'] =~ /^Microsoft-/ - Dir.chdir(ENV['PATH_TRANSLATED'].sub(/[^\\]+$/, '')) - end - # escape url encode def escape(str) str.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) } @@ -160,12 +155,8 @@ class CGI < SimpleDelegator case ENV['REQUEST_METHOD'] when "GET" - # exception messages should be printed to stdout. - STDERR.reopen($>) ENV['QUERY_STRING'] or "" when "POST" - # exception messages should be printed to stdout. - STDERR.reopen($>) input.read Integer(ENV['CONTENT_LENGTH']) else read_from_cmdline @@ -198,7 +189,7 @@ class CGI < SimpleDelegator attr("cookie") # make HTML tag string - def CGI.tag(element, attributes = {}) + def CGI::tag(element, attributes = {}) "<" + escapeHTML(element) + attributes.collect{|name, value| " " + escapeHTML(name) + '="' + escapeHTML(value) + '"' }.to_s + ">" + @@ -206,7 +197,7 @@ class CGI < SimpleDelegator end # make raw cookie string - def CGI.cookie(options) + def CGI::cookie(options) "Set-Cookie: " + options['name'] + '=' + escape(options['value']) + (options['domain'] ? '; domain=' + options['domain'] : '') + (options['path'] ? '; path=' + options['path'] : '') + @@ -215,7 +206,7 @@ class CGI < SimpleDelegator end # make HTTP header string - def CGI.header(*options) + def CGI::header(*options) if ENV['MOD_RUBY'] options.each{|option| option.sub(/(.*?): (.*)/){ @@ -238,32 +229,31 @@ class CGI < SimpleDelegator end # print HTTP header and string to $> - def CGI.print(*options) - $>.print CGI.header(*options) + yield.to_s + def CGI::print(*options) + $>.print CGI::header(*options) + yield.to_s end # print message to $> - def CGI.message(message, title = "", header = ["Content-Type: text/html"]) + def CGI::message(message, title = "", header = ["Content-Type: text/html"]) if message.kind_of?(Hash) title = message['title'] header = message['header'] message = message['body'] end - CGI.print(*header){ - CGI.tag("HTML"){ - CGI.tag("HEAD"){ CGI.tag("TITLE"){ title } } + - CGI.tag("BODY"){ message } + CGI::print(*header){ + CGI::tag("HTML"){ + CGI::tag("HEAD"){ CGI.tag("TITLE"){ title } } + + CGI::tag("BODY"){ message } } } TRUE end # print error message to $> and exit - def CGI.error - CGI.message({'title'=>'ERROR', 'body'=> - CGI.tag("PRE"){ - "ERROR: " + CGI.tag("STRONG"){ escapeHTML($!.to_s) } + "\n" + - escapeHTML($@.join("\n")) + def CGI::error + CGI::message({'title'=>'ERROR', 'body'=> + CGI::tag("PRE"){ + "ERROR: " + CGI::tag("STRONG"){ escapeHTML($!.to_s) } + "\n" + escapeHTML($@.join("\n")) } }) exit diff --git a/lib/date2.rb b/lib/date2.rb index 6e87824b38..a1045a982e 100644 --- a/lib/date2.rb +++ b/lib/date2.rb @@ -1,107 +1,138 @@ # date.rb: Written by Tadayoshi Funaba 1998, 1999 -# $Id: date.rb,v 1.5 1999/02/06 08:51:56 tadf Exp $ +# $Id: date.rb,v 1.7 1999/03/06 02:05:59 tadf Exp $ class Date include Comparable - MONTHNAMES = [ nil, 'January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December' ] + MONTHNAMES = [ nil, 'January', 'February', 'March', + 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' ] - DAYNAMES = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', - 'Friday', 'Saturday' ] + DAYNAMES = [ 'Sunday', 'Monday', 'Tuesday', + 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] ITALY = 2299161 # Oct 15, 1582 ENGLAND = 2361222 # Sept 14, 1752 - def Date.civil_to_jd(y, m, d, gs = true) - if m <= 2 then - y -= 1 - m += 12 - end - a = (y / 100).to_i - b = 2 - a + (a / 4).to_i - jd = (365.25 * (y + 4716)).to_i + - (30.6001 * (m + 1)).to_i + - d + b - 1524 - unless - (if gs.kind_of? Numeric then jd >= gs else gs end) then - jd -= b - end - jd - end + class << self - def Date.jd_to_civil(jd, gs = true) - unless - (if gs.kind_of? Numeric then jd >= gs else gs end) then - a = jd - else - x = ((jd - 1867216.25) / 36524.25).to_i - a = jd + 1 + x - (x / 4).to_i - end - b = a + 1524 - c = ((b - 122.1) / 365.25).to_i - d = (365.25 * c).to_i - e = ((b - d) / 30.6001).to_i - dom = b - d - (30.6001 * e).to_i - if e <= 13 then - m = e - 1 - y = c - 4716 - else - m = e - 13 - y = c - 4715 - end - return y, m, dom - end - - def Date.mjd_to_jd(mjd) - mjd + 2400000.5 - end - - def Date.jd_to_mjd(jd) - jd - 2400000.5 - end - - def Date.tjd_to_jd(tjd) - tjd + 2440000.5 - end - - def Date.jd_to_tjd(jd) - jd - 2440000.5 - end - - def Date.julian_leap? (y) - y % 4 == 0 - end - - def Date.gregorian_leap? (y) - y % 4 == 0 and y % 100 != 0 or y % 400 == 0 - end - - def Date.leap? (y) - Date.gregorian_leap?(y) - end - - def initialize(jd = 0, gs = ITALY) - @jd, @gs = jd, gs - end - - def Date.exist? (y, m, d, gs = true) - jd = Date.civil_to_jd(y, m, d, gs) - if [y, m, d] == Date.jd_to_civil(jd, gs) then + def civil_to_jd(y, m, d, gs=true) + if m <= 2 + y -= 1 + m += 12 + end + a = (y / 100).to_i + b = 2 - a + (a / 4).to_i + jd = (365.25 * (y + 4716)).to_i + + (30.6001 * (m + 1)).to_i + + d + b - 1524 + unless + (if gs.kind_of? Numeric then jd >= gs else gs end) + jd -= b + end jd end - end - def Date.new3(y = -4712, m = 1, d = 1, gs = ITALY) - unless jd = Date.exist?(y, m, d, gs) then - fail ArgumentError, 'invalid date' + def jd_to_civil(jd, gs=true) + unless + (if gs.kind_of? Numeric then jd >= gs else gs end) + a = jd + else + x = ((jd - 1867216.25) / 36524.25).to_i + a = jd + 1 + x - (x / 4).to_i + end + b = a + 1524 + c = ((b - 122.1) / 365.25).to_i + d = (365.25 * c).to_i + e = ((b - d) / 30.6001).to_i + dom = b - d - (30.6001 * e).to_i + if e <= 13 + m = e - 1 + y = c - 4716 + else + m = e - 13 + y = c - 4715 + end + return y, m, dom end - Date.new(jd, gs) + + def ordinal_to_jd(y, d, gs=true) + civil_to_jd(y, 1, d, gs) + end + + def jd_to_ordinal(jd, gs=true) + y, *_ = jd_to_civil(jd, gs) + ns = if gs.kind_of? Numeric then jd >= gs else gs end + pl = civil_to_jd(y - 1, 12, 31, ns) + doy = jd - pl + return y, doy + end + + def mjd_to_jd(mjd) + mjd + 2400000.5 + end + + def jd_to_mjd(jd) + jd - 2400000.5 + end + + def tjd_to_jd(tjd) + tjd + 2440000.5 + end + + def jd_to_tjd(jd) + jd - 2440000.5 + end + + def julian_leap? (y) + y % 4 == 0 + end + + def gregorian_leap? (y) + y % 4 == 0 and y % 100 != 0 or y % 400 == 0 + end + + alias_method :leap?, :gregorian_leap? + + def exist3? (y, m, d, gs=true) + jd = civil_to_jd(y, m, d, gs) + if [y, m, d] == jd_to_civil(jd, gs) + jd + end + end + + alias_method :exist?, :exist3? + + def new3(y=-4712, m=1, d=1, gs=ITALY) + unless jd = exist3?(y, m, d, gs) + fail ArgumentError, 'invalid date' + end + new(jd, gs) + end + + def exist2? (y, d, gs=true) + jd = ordinal_to_jd(y, d, gs) + if [y, d] == jd_to_ordinal(jd, gs) + jd + end + end + + def new2(y=-4712, d=1, gs=ITALY) + unless jd = exist2?(y, d, gs) + fail ArgumentError, 'invalid date' + end + new(jd, gs) + end + + def today(gs=ITALY) + new(civil_to_jd(*(Time.now.to_a[3..5].reverse << gs)), gs) + end + end - def Date.today(gs = ITALY) - Date.new(Date.civil_to_jd(*(Time.now.to_a[3..5].reverse << gs)), gs) + def initialize(jd=0, gs=ITALY) + @jd, @gs = jd, gs end def jd @@ -109,19 +140,19 @@ class Date end def mjd - def self.mjd; @mjd end + def self.mjd() @mjd end @mjd = Date.jd_to_mjd(@jd) end def tjd - def self.tjd; @tjd end + def self.tjd() @tjd end @tjd = Date.jd_to_tjd(@jd) end def civil - def self.year; @year end - def self.mon; @mon end - def self.mday; @mday end + def self.year() @year end + def self.mon() @mon end + def self.mday() @mday end @year, @mon, @mday = Date.jd_to_civil(@jd, @gs) end @@ -133,10 +164,9 @@ class Date end def yday - def self.yday; @yday end - ns = if @gs.kind_of? Numeric then @jd >= @gs else @gs end - jd = Date.civil_to_jd(year - 1, 12, 31, ns) - @yday = @jd - jd + def self.yday() @yday end + _, @yday = Date.jd_to_ordinal(@jd, @gs) + @yday end def mon @@ -150,12 +180,12 @@ class Date end def wday - def self.wday; @wday end + def self.wday() @wday end @wday = (@jd + 1) % 7 end def leap? - def self.leap?; @leap_p end + def self.leap?() @leap_p end ns = if @gs.kind_of? Numeric then @jd >= @gs else @gs end jd = Date.civil_to_jd(year, 2, 28, ns) @leap_p = Date.jd_to_civil(jd + 1, ns)[1] == 2 @@ -214,4 +244,12 @@ class Date format('%04d-%02d-%02d', year, mon, mday) end + def _dump(limit) + Marshal.dump([@jd, @gs], -1) + end + + def Date._load(str) + Date.new(*Marshal.load(str)) + end + end diff --git a/lib/delegate.rb b/lib/delegate.rb index 0771f2feeb..29f2a5ded2 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -34,14 +34,8 @@ class Delegator begin __getobj__.__send__(:#{method}, *args, &block) rescue Exception - c = -caller(0).size - if /:in `__getobj__'$/ =~ $@[c-1] #` - n = 1 - else - c -= 1 - n = 2 - end - $@[c,n] = nil + $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #` + $@.delete_if{|s| /^\\(eval\\):/ =~ s} raise end end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 52b4ed20a9..df03b128fc 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -37,7 +37,7 @@ $libdir += "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] $archdir = $libdir+"/"+CONFIG["arch"] $install = CONFIG["INSTALL_PROGRAM"] $install_data = CONFIG["INSTALL_DATA"] -if $install !~ /^\// then +if $install =~ %r!^[^\s/]+/! then $install = CONFIG["srcdir"]+"/"+$install $install_data = CONFIG["srcdir"]+"/"+$install_data end diff --git a/lib/monitor.rb b/lib/monitor.rb index 81fe8f2b22..75d9c35821 100644 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -1,271 +1,96 @@ -## monitor.rb +=begin -# Author: Shugo Maeda -# Version: $Revision: 0.1 $ +monitor.rb +Author: Shugo Maeda +Version: 1.2.1 -# USAGE: -# -# foo = Foo.new -# foo.extend(MonitorMixin) -# cond = foo.new_cond -# -# thread1: -# foo.synchronize { -# ... -# cond.wait_until { foo.done? } -# ... -# } -# -# thread2: -# foo.synchronize { -# foo.do_something -# cond.signal -# } +USAGE: -# ATTENTION: -# -# If you include MonitorMixin and override `initialize', you should -# call `super'. -# If you include MonitorMixin to built-in classes, you should override -# `new' to call `mon_initialize'. + foo = Foo.new + foo.extend(MonitorMixin) + cond = foo.new_cond -## Code: + thread1: + foo.synchronize { + ... + cond.wait_until { foo.done? } + ... + } + + thread2: + foo.synchronize { + foo.do_something + cond.signal + } + +=end -require "final" - module MonitorMixin - - RCS_ID = %q$Id: monitor.rb,v 0.1 1998/03/01 08:40:18 shugo Exp shugo $ - - module Primitive - - include MonitorMixin - - MON_OWNER_TABLE = {} - MON_COUNT_TABLE = {} - MON_ENTERING_QUEUE_TABLE = {} - MON_WAITING_QUEUE_TABLE = {} - - FINALIZER = Proc.new { |id| - MON_OWNER_TABLE.delete(id) - MON_COUNT_TABLE.delete(id) - MON_ENTERING_QUEUE_TABLE.delete(id) - MON_WAITING_QUEUE_TABLE.delete(id) - } - - def self.extend_object(obj) - super(obj) - obj.mon_initialize - end - - def mon_initialize - MON_OWNER_TABLE[id] = nil - MON_COUNT_TABLE[id] = 0 - MON_ENTERING_QUEUE_TABLE[id] = [] - MON_WAITING_QUEUE_TABLE[id] = [] - ObjectSpace.define_finalizer(self, FINALIZER) - end - - def mon_owner - return MON_OWNER_TABLE[id] - end - - def mon_count - return MON_COUNT_TABLE[id] - end - - def mon_entering_queue - return MON_ENTERING_QUEUE_TABLE[id] - end - - def mon_waiting_queue - return MON_WAITING_QUEUE_TABLE[id] - end - - def set_mon_owner(val) - return MON_OWNER_TABLE[id] = val - end - - def set_mon_count(val) - return MON_COUNT_TABLE[id] = val - end - - private :mon_count, :mon_entering_queue, :mon_waiting_queue, - :set_mon_owner, :set_mon_count + module Accessible + protected + attr_accessor :mon_owner, :mon_count + attr_reader :mon_entering_queue, :mon_waiting_queue end - module NonPrimitive - - include MonitorMixin - - attr_reader :mon_owner, :mon_count, - :mon_entering_queue, :mon_waiting_queue - - def self.extend_object(obj) - super(obj) - obj.mon_initialize - end - + module Initializable + protected def mon_initialize @mon_owner = nil @mon_count = 0 @mon_entering_queue = [] @mon_waiting_queue = [] end - - def set_mon_owner(val) - @mon_owner = val - end - - def set_mon_count(val) - @mon_count = val - end - - private :mon_count, :mon_entering_queue, :mon_waiting_queue, - :set_mon_owner, :set_mon_count end - def self.extendable_module(obj) - if Fixnum === obj or TrueClass === obj or FalseClass === obj or - NilClass === obj - raise TypeError, "MonitorMixin can't extend #{obj.type}" - else - begin - obj.instance_eval("@mon_owner") - return NonPrimitive - rescue TypeError - return Primitive - end - end - end - - def self.extend_object(obj) - obj.extend(extendable_module(obj)) - end - - def self.includable_module(klass) - if klass.instance_of?(Module) - return NonPrimitive - end - begin - dummy = klass.new - return extendable_module(dummy) - rescue ArgumentError - if klass.singleton_methods.include?("new") - return Primitive - else - return NonPrimitive - end - rescue NameError - raise TypeError, "#{klass} can't include MonitorMixin" - end - end - - def self.append_features(klass) - mod = includable_module(klass) - klass.module_eval("include mod") - end - - def initialize(*args) - super - mon_initialize - end - - def try_mon_enter - result = false - Thread.critical = true - if mon_owner.nil? - set_mon_owner(Thread.current) - end - if mon_owner == Thread.current - set_mon_count(mon_count + 1) - result = true - end - Thread.critical = false - return result - end - - def mon_enter - Thread.critical = true - while mon_owner != nil && mon_owner != Thread.current - mon_entering_queue.push(Thread.current) - Thread.stop - Thread.critical = true - end - set_mon_owner(Thread.current) - set_mon_count(mon_count + 1) - Thread.critical = false - end - - def mon_exit - if mon_owner != Thread.current - raise ThreadError, "current thread not owner" - end - Thread.critical = true - set_mon_count(mon_count - 1) - if mon_count == 0 - set_mon_owner(nil) - if mon_waiting_queue.empty? - t = mon_entering_queue.shift - else - t = mon_waiting_queue.shift - end - end - t.wakeup if t - Thread.critical = false - Thread.pass - end - - def mon_synchronize - mon_enter - begin - yield - ensure - mon_exit - end - end - alias synchronize mon_synchronize - class ConditionVariable - def initialize(monitor) - @monitor = monitor - @waiters = [] - end + class Timeout < Exception; end - def wait + include Accessible + + def wait(timeout = nil) if @monitor.mon_owner != Thread.current raise ThreadError, "current thread not owner" end - @monitor.instance_eval(< + += methods + +== new (make new Telnet object) + + host = Telnet.new({"Binmode" => FALSE, # default: FALSE + "Host" => "localhost", # default: "localhost" + "Output_log" => "output_log", # default: not output + "Dump_log" => "dump_log", # default: not output + "Port" => 23, # default: 23 + "Prompt" => /[$%#>] \Z/, # default: /[$%#>] \Z/ + "Telnetmode" => TRUE, # default: TRUE + "Timeout" => 10, # default: 10 + "Waittime" => 0, # default: 0 + "Proxy" => proxy}) # default: nil + # proxy is Telnet or TCPsocket object + +Telnet object has socket class methods. + +if set "Telnetmode" option FALSE. not TELNET command interpretation. +"Waittime" is time to confirm "Prompt". There is a possibility that +the same character as "Prompt" is included in the data, and, when +the network or the host is very heavy, the value is enlarged. + + +== waitfor (wait for match) + + line = host.waitfor(/match/) + line = host.waitfor({"Match" => /match/, + "String" => "string", + "Timeout" => secs}) + +if set "String" option. Match = Regexp.new(quote(string)) + + +=== realtime output + + host.waitfor(/match/){|c| print c } + host.waitfor({"Match" => /match/, + "String" => "string", + "Timeout" => secs}){|c| print c} + +of cource, set sync=TRUE or flush is necessary. + + +== cmd (send string and wait prompt) + + line = host.cmd("string") + line = host.cmd({"String" => "string", + "Prompt" => /[$%#>] \Z/, + "Timeout" => 10}) + + +=== realtime output + + host.cmd("string"){|c| print c } + host.cmd({"String" => "string", + "Prompt" => /[$%#>] \Z/, + "Timeout" => 10}){|c| print c } + +of cource, set sync=TRUE or flush is necessary. + + +== print (send string) + + host.print("string") + + +== telnetmode (turn telnet command interpretation) + + host.telnetmode # turn on/off + host.telnetmode(TRUE) # on + host.telnetmode(FALSE) # off + + +== binmode (toggle newline translation) + + host.binmode # turn TRUE/FALSE + host.binmode(TRUE) # no translate newline + host.binmode(FALSE) # translate newline + + +== login + + host.login("username", "password") + host.login({"Name" => "username", + "Password" => "password", + "Prompt" => /[$%#>] \Z/, + "Timeout" => 10}) + + +=== realtime output + + host.login("username", "password"){|c| print c } + host.login({"Name" => "username", + "Password" => "password", + "Prompt" => /[$%#>] \Z/, + "Timeout" => 10}){|c| print c } + +of cource, set sync=TRUE or flush is necessary. + + += sample + +== login and send command + + localhost = Telnet.new({"Host" => "localhost", + "Timeout" => 10, + "Prompt" => /[$%#>] \Z/}) + localhost.login("username", "password"){|c| print c } + localhost.cmd("command"){|c| print c } + localhost.close + + +== checks a POP server to see if you have mail + + pop = Telnet.new({"Host" => "your_destination_host_here", + "Port" => 110, + "Telnetmode" => FALSE, + "Prompt" => /^\+OK/}) + pop.cmd("user " + "your_username_here"){|c| print c} + pop.cmd("pass " + "your_password_here"){|c| print c} + pop.cmd("list"){|c| print c} + + += history + +ver0.162 1999/03/17 +add "Proxy" option +required timeout.rb + ver0.161 1999/02/03 select --> IO::select @@ -44,128 +178,16 @@ add realtime output. ver0.10 1998/04/13 first release. -== make new Telnet object -host = Telnet.new({"Binmode" => FALSE, default: FALSE - "Host" => "localhost", default: "localhost" - "Output_log" => "output_log", default: not output - "Dump_log" => "dump_log", default: not output - "Port" => 23, default: 23 - "Prompt" => /[$%#>] \Z/, default: /[$%#>] \Z/ - "Telnetmode" => TRUE, default: TRUE - "Timeout" => 10, default: 10 - "Waittime" => 0}) default: 0 - -if set "Telnetmode" option FALSE. not TELNET command interpretation. -"Waittime" is time to confirm "Prompt". There is a possibility that -the same character as "Prompt" is included in the data, and, when -the network or the host is very heavy, the value is enlarged. - -== wait for match -line = host.waitfor(/match/) -line = host.waitfor({"Match" => /match/, - "String" => "string", - "Timeout" => secs}) -if set "String" option. Match = Regexp.new(quote(string)) - -realtime output. of cource, set sync=TRUE or flush is necessary. -host.waitfor(/match/){|c| print c } -host.waitfor({"Match" => /match/, - "String" => "string", - "Timeout" => secs}){|c| print c} - -== send string and wait prompt -line = host.cmd("string") -line = host.cmd({"String" => "string", - "Prompt" => /[$%#>] \Z/, - "Timeout" => 10}) - -realtime output. of cource, set sync=TRUE or flush is necessary. -host.cmd("string"){|c| print c } -host.cmd({"String" => "string", - "Prompt" => /[$%#>] \Z/, - "Timeout" => 10}){|c| print c } - -== send string -host.print("string") - -== turn telnet command interpretation -host.telnetmode # turn on/off -host.telnetmode(TRUE) # on -host.telnetmode(FALSE) # off - -== toggle newline translation -host.binmode # turn TRUE/FALSE -host.binmode(TRUE) # no translate newline -host.binmode(FALSE) # translate newline - -== login -host.login("username", "password") -host.login({"Name" => "username", - "Password" => "password", - "Prompt" => /[$%#>] \Z/, - "Timeout" => 10}) - -realtime output. of cource, set sync=TRUE or flush is necessary. -host.login("username", "password"){|c| print c } -host.login({"Name" => "username", - "Password" => "password", - "Prompt" => /[$%#>] \Z/, - "Timeout" => 10}){|c| print c } - -and Telnet object has socket class methods - -== sample -localhost = Telnet.new({"Host" => "localhost", - "Timeout" => 10, - "Prompt" => /[$%#>] \Z/}) -localhost.login("username", "password"){|c| print c } -localhost.cmd("command"){|c| print c } -localhost.close - -== sample 2 -checks a POP server to see if you have mail. - -pop = Telnet.new({"Host" => "your_destination_host_here", - "Port" => 110, - "Telnetmode" => FALSE, - "Prompt" => /^\+OK/}) -pop.cmd("user " + "your_username_here"){|c| print c} -pop.cmd("pass " + "your_password_here"){|c| print c} -pop.cmd("list"){|c| print c} - =end require "socket" require "delegate" require "thread" - -class TimeOut < Exception -end +require "timeout" +TimeOut = TimeoutError class Telnet < SimpleDelegator - def timeout(sec) - is_timeout = FALSE - begin - x = Thread.current - y = Thread.start { - sleep sec - if x.alive? - #print "timeout!\n" - x.raise TimeOut, "timeout" - end - } - begin - yield - rescue TimeOut - is_timeout = TRUE - end - ensure - Thread.kill y if y && y.alive? - end - is_timeout - end - IAC = 255.chr # interpret as command: DONT = 254.chr # you are not to use option DO = 253.chr # please, you use option @@ -259,32 +281,45 @@ class Telnet < SimpleDelegator @dumplog.binmode end - message = "Trying " + @options["Host"] + "...\n" - STDOUT.write(message) - @log.write(message) if @options.include?("Output_log") - @dumplog.write(message) if @options.include?("Dump_log") + if @options.include?("Proxy") + if @options["Proxy"].kind_of?(Telnet) + @sock = @options["Proxy"].sock + elsif @options["Proxy"].kind_of?(TCPsocket) + @sock = @options["Proxy"] + else + raise "Error; Proxy is Telnet or TCPSocket object." + end + else + message = "Trying " + @options["Host"] + "...\n" + STDOUT.write(message) + @log.write(message) if @options.include?("Output_log") + @dumplog.write(message) if @options.include?("Dump_log") - is_timeout = timeout(@options["Timeout"]){ begin - @sock = TCPsocket.open(@options["Host"], @options["Port"]) + timeout(@options["Timeout"]){ + @sock = TCPsocket.open(@options["Host"], @options["Port"]) + } + rescue TimeoutError + raise TimeOut, "timed-out; opening of the host" rescue @log.write($! + "\n") if @options.include?("Output_log") @dumplog.write($! + "\n") if @options.include?("Dump_log") raise end - } - raise TimeOut, "timed-out; opening of the host" if is_timeout - @sock.sync = TRUE - @sock.binmode + @sock.sync = TRUE + @sock.binmode - message = "Connected to " + @options["Host"] + ".\n" - STDOUT.write(message) - @log.write(message) if @options.include?("Output_log") - @dumplog.write(message) if @options.include?("Dump_log") + message = "Connected to " + @options["Host"] + ".\n" + STDOUT.write(message) + @log.write(message) if @options.include?("Output_log") + @dumplog.write(message) if @options.include?("Dump_log") + end super(@sock) end + attr :sock + def telnetmode(mode = 'turn') if 'turn' == mode @options["Telnetmode"] = @options["Telnetmode"] ? FALSE : TRUE @@ -347,12 +382,12 @@ class Telnet < SimpleDelegator end def waitfor(options) - timeout = @options["Timeout"] + time_out = @options["Timeout"] waittime = @options["Waittime"] if options.kind_of?(Hash) prompt = options["Prompt"] if options.include?("Prompt") - timeout = options["Timeout"] if options.include?("Timeout") + time_out = options["Timeout"] if options.include?("Timeout") waittime = options["Waittime"] if options.include?("Waittime") prompt = Regexp.new( Regexp.quote(options["String"]) ) if options.include?("String") @@ -363,7 +398,7 @@ class Telnet < SimpleDelegator line = '' until(not IO::select([@sock], nil, nil, waittime) and prompt === line) raise TimeOut, "timed-out; wait for the next data" if - not IO::select([@sock], nil, nil, timeout) + not IO::select([@sock], nil, nil, time_out) buf = '' begin buf = @sock.sysread(1024 * 1024) @@ -399,13 +434,13 @@ class Telnet < SimpleDelegator end def cmd(options) - match = @options["Prompt"] - timeout = @options["Timeout"] + match = @options["Prompt"] + time_out = @options["Timeout"] if options.kind_of?(Hash) - string = options["String"] - match = options["Match"] if options.include?("Match") - timeout = options["Timeout"] if options.include?("Timeout") + string = options["String"] + match = options["Match"] if options.include?("Match") + time_out = options["Timeout"] if options.include?("Timeout") else string = options end @@ -413,9 +448,9 @@ class Telnet < SimpleDelegator IO::select(nil, [@sock]) print(string) if iterator? - waitfor({"Prompt" => match, "Timeout" => timeout}){|c| yield c } + waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c } else - waitfor({"Prompt" => match, "Timeout" => timeout}) + waitfor({"Prompt" => match, "Timeout" => time_out}) end end diff --git a/lib/thread.rb b/lib/thread.rb index ec75144374..4e6d765686 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -144,6 +144,10 @@ class Queue @que.length == 0 end + def clear + @que.replace([]) + end + def length @que.length end diff --git a/lib/weakref.rb b/lib/weakref.rb index d53aa15c71..d969553090 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -2,11 +2,12 @@ # # Usage: # foo = Object.new -# foo.hash +# foo = Object.new +# p foo.to_s # original's class # foo = WeakRef.new(foo) -# foo.hash +# p foo.to_s # should be same class # ObjectSpace.garbage_collect -# foo.hash # => Raises WeakRef::RefError (because original GC'ed) +# p foo.to_s # should raise exception (recycled) require "delegate" @@ -18,9 +19,11 @@ class WeakRef #endif +#if !defined(HAVE_FCNTL) || !defined(F_DUPFD) +# include +#endif + +#define BADEXIT -1 + int -dup2(oldfd,newfd) -int oldfd; -int newfd; +dup2(fd1, fd2) +int fd1, fd2; { #if defined(HAVE_FCNTL) && defined(F_DUPFD) - close(newfd); - return fcntl(oldfd, F_DUPFD, newfd); + if (fd1 != fd2) { +#ifdef F_GETFL + if (fcntl(fd1, F_GETFL) < 0) + return BADEXIT; + if (fcntl(fd2, F_GETFL) >= 0) + close(fd2); #else - int fdtmp[256]; - int fdx = 0; - int fd; + close(fd2); +#endif + if (fcntl(fd1, F_DUPFD, fd2) < 0) + return BADEXIT; + } + return fd2; +#else + extern int errno; + int i, fd, fds[256]; - if (oldfd == newfd) - return 0; - close(newfd); - while ((fd = dup(oldfd)) != newfd) /* good enough for low fd's */ - fdtmp[fdx++] = fd; - while (fdx > 0) - close(fdtmp[--fdx]); - return 0; + if (fd1 == fd2) return 0; + close(fd2); + for (i=0; i<256; i++) { + fd = fds[i] = dup(fd1); + if (fd == fd2) break; + } + while (i) { + close(fds[i--]); + } + if (fd == fd2) return 0; + errno = EMFILE; + return BADEXIT; #endif } diff --git a/missing/fnmatch.c b/missing/fnmatch.c index 09f474b0ec..4cf746118a 100644 --- a/missing/fnmatch.c +++ b/missing/fnmatch.c @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; #define EOS '\0' -static char *rangematch(const char *, int, int); +static char *rangematch(); int fnmatch(pattern, string, flags) diff --git a/node.h b/node.h index a9b5c92e25..cf114cf804 100644 --- a/node.h +++ b/node.h @@ -331,9 +331,9 @@ VALUE rb_method_booundp(); #define NOEX_PRIVATE 2 #define NOEX_PROTECTED 4 -NODE *rb_compile_cstr _((char *, char *, int)); -NODE *rb_compile_string _((char *, VALUE)); -NODE *rb_compile_file _((char *, VALUE, int)); +NODE *rb_compile_cstr _((const char*, const char*, int)); +NODE *rb_compile_string _((const char*, VALUE)); +NODE *rb_compile_file _((const char*, VALUE, int)); void rb_add_method _((VALUE, ID, NODE *, int)); NODE *rb_node_newnode(); diff --git a/numeric.c b/numeric.c index 65e27c0bd2..102665f8df 100644 --- a/numeric.c +++ b/numeric.c @@ -167,7 +167,7 @@ num_nonzero_p(num) VALUE num; { if (RTEST(rb_funcall(num, rb_intern("zero?"), 0, 0))) { - return Qfalse; + return Qnil; } return num; } diff --git a/object.c b/object.c index 733f2accd2..d6a4a72e07 100644 --- a/object.c +++ b/object.c @@ -740,7 +740,7 @@ rb_obj_private_methods(obj) struct arg_to { VALUE val; - char *s; + const char *s; }; static VALUE @@ -766,7 +766,7 @@ VALUE rb_convert_type(val, type, tname, method) VALUE val; int type; - char *tname, *method; + const char *tname, *method; { struct arg_to arg1, arg2; diff --git a/pack.c b/pack.c index f064cc4be6..a5f54542a5 100644 --- a/pack.c +++ b/pack.c @@ -914,6 +914,16 @@ hex2num(c) } } +#define PACK_LENGTH_ADJUST(type) do { \ + tmp = 0; \ + if (len > (send - s)/sizeof(type)) { \ + tmp = len - (send - s) / sizeof(type); \ + len = (send - s) / sizeof(type); \ + } \ +} while (0) + +#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil); + static VALUE pack_unpack(str, fmt) VALUE str, fmt; @@ -923,7 +933,7 @@ pack_unpack(str, fmt) char *p, *pend; VALUE ary; char type; - int len; + int len, tmp; s = rb_str2cstr(str, &len); send = s + len; @@ -1052,93 +1062,92 @@ pack_unpack(str, fmt) break; case 'c': - if (len > send - s) - len = send - s; + PACK_LENGTH_ADJUST(char); while (len-- > 0) { int c = *s++; if (c > (char)127) c-=256; rb_ary_push(ary, INT2FIX(c)); } + PACK_ITEM_ADJUST(); break; case 'C': - if (len > send - s) - len = send - s; + PACK_LENGTH_ADJUST(char); while (len-- > 0) { unsigned char c = *s++; rb_ary_push(ary, INT2FIX(c)); } + PACK_ITEM_ADJUST(); break; case 's': - if (len >= (send - s) / sizeof(short)) - len = (send - s) / sizeof(short); + PACK_LENGTH_ADJUST(short); while (len-- > 0) { short tmp; memcpy(&tmp, s, sizeof(short)); s += sizeof(short); rb_ary_push(ary, INT2FIX(tmp)); } + PACK_ITEM_ADJUST(); break; case 'S': - if (len >= (send - s) / sizeof(short)) - len = (send - s) / sizeof(short); + PACK_LENGTH_ADJUST(short); while (len-- > 0) { unsigned short tmp; memcpy(&tmp, s, sizeof(short)); s += sizeof(short); rb_ary_push(ary, INT2FIX(tmp)); } + PACK_ITEM_ADJUST(); break; case 'i': - if (len >= (send - s) / sizeof(int)) - len = (send - s) / sizeof(int); + PACK_LENGTH_ADJUST(int); while (len-- > 0) { int tmp; memcpy(&tmp, s, sizeof(int)); s += sizeof(int); rb_ary_push(ary, rb_int2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'I': - if (len >= (send - s) / sizeof(int)) - len = (send - s) / sizeof(int); + PACK_LENGTH_ADJUST(int); while (len-- > 0) { unsigned int tmp; memcpy(&tmp, s, sizeof(int)); s += sizeof(int); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'l': - if (len >= (send - s) / sizeof(long)) - len = (send - s) / sizeof(long); + PACK_LENGTH_ADJUST(long); while (len-- > 0) { long tmp; memcpy(&tmp, s, sizeof(long)); s += sizeof(long); rb_ary_push(ary, rb_int2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'L': - if (len >= (send - s) / sizeof(long)) - len = (send - s) / sizeof(long); + PACK_LENGTH_ADJUST(long); while (len-- > 0) { unsigned long tmp; memcpy(&tmp, s, sizeof(long)); s += sizeof(long); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'n': - if (len >= (send - s) / sizeof(short)) - len = (send - s) / sizeof(short); + PACK_LENGTH_ADJUST(short); while (len-- > 0) { unsigned short tmp; memcpy(&tmp, s, sizeof(short)); @@ -1146,11 +1155,11 @@ pack_unpack(str, fmt) tmp = ntohs(tmp); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'N': - if (len >= (send - s) / sizeof(long)) - len = (send - s) / sizeof(long); + PACK_LENGTH_ADJUST(long); while (len-- > 0) { unsigned long tmp; memcpy(&tmp, s, sizeof(long)); @@ -1158,11 +1167,11 @@ pack_unpack(str, fmt) tmp = ntohl(tmp); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'v': - if (len >= (send - s) / sizeof(short)) - len = (send - s) / sizeof(short); + PACK_LENGTH_ADJUST(short); while (len-- > 0) { unsigned short tmp; memcpy(&tmp, s, sizeof(short)); @@ -1170,11 +1179,11 @@ pack_unpack(str, fmt) tmp = vtohs(tmp); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'V': - if (len >= (send - s) / sizeof(long)) - len = (send - s) / sizeof(long); + PACK_LENGTH_ADJUST(long); while (len-- > 0) { unsigned long tmp; memcpy(&tmp, s, sizeof(long)); @@ -1182,23 +1191,23 @@ pack_unpack(str, fmt) tmp = vtohl(tmp); rb_ary_push(ary, rb_uint2inum(tmp)); } + PACK_ITEM_ADJUST(); break; case 'f': case 'F': - if (len >= (send - s) / sizeof(float)) - len = (send - s) / sizeof(float); + PACK_LENGTH_ADJUST(float); while (len-- > 0) { float tmp; memcpy(&tmp, s, sizeof(float)); s += sizeof(float); rb_ary_push(ary, rb_float_new((double)tmp)); } + PACK_ITEM_ADJUST(); break; case 'e': - if (len >= (send - s) / sizeof(float)) - len = (send - s) / sizeof(float); + PACK_LENGTH_ADJUST(float); while (len-- > 0) { float tmp; FLOAT_CONVWITH(ftmp); @@ -1208,11 +1217,11 @@ pack_unpack(str, fmt) tmp = VTOHF(tmp,ftmp); rb_ary_push(ary, rb_float_new((double)tmp)); } + PACK_ITEM_ADJUST(); break; case 'E': - if (len >= (send - s) / sizeof(double)) - len = (send - s) / sizeof(double); + PACK_LENGTH_ADJUST(double); while (len-- > 0) { double tmp; DOUBLE_CONVWITH(dtmp); @@ -1222,23 +1231,23 @@ pack_unpack(str, fmt) tmp = VTOHD(tmp,dtmp); rb_ary_push(ary, rb_float_new(tmp)); } + PACK_ITEM_ADJUST(); break; case 'D': case 'd': - if (len >= (send - s) / sizeof(double)) - len = (send - s) / sizeof(double); + PACK_LENGTH_ADJUST(double); while (len-- > 0) { double tmp; memcpy(&tmp, s, sizeof(double)); s += sizeof(double); rb_ary_push(ary, rb_float_new(tmp)); } + PACK_ITEM_ADJUST(); break; case 'g': - if (len >= (send - s) / sizeof(float)) - len = (send - s) / sizeof(float); + PACK_LENGTH_ADJUST(float); while (len-- > 0) { float tmp; FLOAT_CONVWITH(ftmp;) @@ -1248,11 +1257,11 @@ pack_unpack(str, fmt) tmp = NTOHF(tmp,ftmp); rb_ary_push(ary, rb_float_new((double)tmp)); } + PACK_ITEM_ADJUST(); break; case 'G': - if (len >= (send - s) / sizeof(double)) - len = (send - s) / sizeof(double); + PACK_LENGTH_ADJUST(double); while (len-- > 0) { double tmp; DOUBLE_CONVWITH(dtmp); @@ -1262,6 +1271,7 @@ pack_unpack(str, fmt) tmp = NTOHD(tmp,dtmp); rb_ary_push(ary, rb_float_new(tmp)); } + PACK_ITEM_ADJUST(); break; case 'u': diff --git a/parse.c b/parse.c index 996adf61bb..255cdc3542 100644 --- a/parse.c +++ b/parse.c @@ -211,11 +211,11 @@ typedef union { -#define YYFINAL 617 +#define YYFINAL 619 #define YYFLAG -32768 #define YYNTBASE 118 -#define YYTRANSLATE(x) ((unsigned)(x) <= 345 ? yytranslate[x] : 206) +#define YYTRANSLATE(x) ((unsigned)(x) <= 345 ? yytranslate[x] : 207) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, @@ -277,14 +277,14 @@ static const short yyprhs[] = { 0, 495, 499, 500, 505, 511, 513, 515, 516, 519, 521, 524, 527, 533, 536, 539, 545, 550, 555, 563, 567, 569, 572, 575, 576, 578, 579, 581, 585, 587, 592, - 595, 597, 598, 601, 603, 607, 611, 614, 616, 618, - 620, 622, 624, 626, 628, 633, 637, 641, 646, 650, - 652, 657, 661, 663, 664, 671, 673, 676, 678, 681, - 688, 695, 701, 707, 712, 720, 727, 731, 732, 739, - 740, 748, 749, 755, 756, 763, 764, 765, 775, 777, - 779, 781, 783, 785, 787, 790, 792, 794, 796, 802, - 803, 806, 808, 810, 811, 814, 816, 820, 821, 827, - 828, 834, 836, 838, 840, 842, 844, 849, 856, 860, + 595, 597, 598, 601, 603, 607, 610, 612, 614, 616, + 618, 620, 622, 624, 629, 633, 637, 642, 646, 648, + 653, 657, 659, 660, 667, 669, 672, 674, 677, 684, + 691, 697, 703, 708, 716, 723, 727, 728, 735, 736, + 744, 745, 751, 752, 759, 760, 761, 771, 773, 775, + 777, 779, 781, 783, 786, 788, 790, 792, 798, 799, + 802, 804, 806, 807, 810, 812, 816, 817, 823, 824, + 830, 832, 834, 836, 838, 840, 845, 852, 856, 863, 867, 872, 874, 880, 882, 887, 890, 892, 894, 900, 901, 902, 905, 907, 910, 912, 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, @@ -292,13 +292,13 @@ static const short yyprhs[] = { 0, 974, 979, 984, 987, 992, 995, 998, 1000, 1001, 1003, 1007, 1011, 1013, 1017, 1020, 1023, 1026, 1027, 1029, 1034, 1035, 1038, 1041, 1043, 1047, 1051, 1053, 1055, 1057, 1059, - 1061, 1062, 1064, 1065, 1067, 1068, 1070, 1072, 1074, 1076, - 1078 + 1061, 1063, 1065, 1066, 1068, 1069, 1071, 1072, 1074, 1076, + 1078, 1080, 1082 }; static const short yyrhs[] = { -1, - 119, 120, 0, 121, 201, 0, 0, 122, 0, 121, - 205, 122, 0, 1, 122, 0, 172, 168, 0, 0, + 119, 120, 0, 121, 202, 0, 0, 122, 0, 121, + 206, 122, 0, 1, 122, 0, 172, 168, 0, 0, 41, 135, 123, 135, 0, 41, 49, 49, 0, 41, 49, 61, 0, 41, 49, 60, 0, 6, 136, 0, 122, 37, 125, 0, 122, 38, 125, 0, 122, 39, @@ -347,8 +347,8 @@ static const short yyrhs[] = { -1, 140, 0, 140, 74, 140, 0, 104, 140, 0, 105, 140, 0, 140, 79, 140, 0, 140, 80, 140, 0, 140, 71, 140, 0, 140, 72, 140, 0, 0, 42, - 202, 143, 140, 0, 140, 92, 140, 93, 140, 0, - 154, 0, 145, 0, 0, 146, 202, 0, 126, 0, + 203, 143, 140, 0, 140, 92, 140, 93, 140, 0, + 154, 0, 145, 0, 0, 146, 203, 0, 126, 0, 150, 111, 0, 150, 148, 0, 150, 111, 88, 140, 148, 0, 197, 111, 0, 197, 148, 0, 197, 111, 88, 140, 148, 0, 150, 111, 197, 148, 0, 150, @@ -356,34 +356,34 @@ static const short yyrhs[] = { -1, 148, 0, 88, 140, 148, 0, 147, 0, 89, 140, 0, 111, 147, 0, 0, 150, 0, 0, 140, 0, 150, 111, 140, 0, 150, 0, 150, 111, 88, 140, - 0, 88, 140, 0, 146, 0, 0, 150, 203, 0, - 179, 0, 154, 81, 51, 0, 154, 81, 47, 0, - 82, 134, 0, 54, 0, 57, 0, 55, 0, 58, - 0, 59, 0, 183, 0, 184, 0, 154, 112, 144, - 113, 0, 86, 153, 113, 0, 87, 196, 108, 0, - 27, 115, 152, 110, 0, 27, 115, 110, 0, 27, - 0, 28, 115, 152, 110, 0, 28, 115, 110, 0, - 28, 0, 0, 42, 202, 115, 155, 125, 110, 0, - 48, 0, 199, 170, 0, 173, 0, 173, 170, 0, - 11, 125, 162, 120, 164, 10, 0, 12, 125, 162, - 120, 165, 10, 0, 18, 125, 163, 120, 10, 0, - 19, 125, 163, 120, 10, 0, 16, 120, 174, 10, - 0, 20, 166, 25, 125, 163, 120, 10, 0, 7, - 120, 177, 165, 178, 10, 0, 85, 120, 110, 0, - 0, 3, 134, 185, 156, 120, 10, 0, 0, 3, - 79, 125, 204, 157, 120, 10, 0, 0, 4, 134, - 158, 120, 10, 0, 0, 5, 135, 159, 187, 120, - 10, 0, 0, 0, 5, 195, 200, 160, 135, 161, - 187, 120, 10, 0, 21, 0, 22, 0, 23, 0, - 24, 0, 204, 0, 13, 0, 204, 13, 0, 204, - 0, 26, 0, 165, 0, 14, 125, 162, 120, 164, - 0, 0, 15, 120, 0, 133, 0, 127, 0, 0, - 96, 96, 0, 72, 0, 96, 166, 96, 0, 0, - 26, 169, 167, 120, 10, 0, 0, 107, 171, 167, - 120, 108, 0, 47, 0, 51, 0, 48, 0, 173, - 0, 126, 0, 199, 115, 145, 110, 0, 154, 109, - 199, 115, 145, 110, 0, 154, 109, 199, 0, 154, - 81, 199, 115, 145, 110, 0, 29, 115, 145, 110, + 0, 88, 140, 0, 146, 0, 0, 150, 204, 0, + 179, 0, 154, 81, 51, 0, 82, 134, 0, 54, + 0, 57, 0, 55, 0, 58, 0, 59, 0, 183, + 0, 184, 0, 154, 112, 144, 113, 0, 86, 153, + 113, 0, 87, 196, 108, 0, 27, 115, 152, 110, + 0, 27, 115, 110, 0, 27, 0, 28, 115, 152, + 110, 0, 28, 115, 110, 0, 28, 0, 0, 42, + 203, 115, 155, 125, 110, 0, 48, 0, 199, 170, + 0, 173, 0, 173, 170, 0, 11, 125, 162, 120, + 164, 10, 0, 12, 125, 162, 120, 165, 10, 0, + 18, 125, 163, 120, 10, 0, 19, 125, 163, 120, + 10, 0, 16, 120, 174, 10, 0, 20, 166, 25, + 125, 163, 120, 10, 0, 7, 120, 177, 165, 178, + 10, 0, 85, 120, 110, 0, 0, 3, 134, 185, + 156, 120, 10, 0, 0, 3, 79, 125, 205, 157, + 120, 10, 0, 0, 4, 134, 158, 120, 10, 0, + 0, 5, 135, 159, 187, 120, 10, 0, 0, 0, + 5, 195, 201, 160, 135, 161, 187, 120, 10, 0, + 21, 0, 22, 0, 23, 0, 24, 0, 205, 0, + 13, 0, 205, 13, 0, 205, 0, 26, 0, 165, + 0, 14, 125, 162, 120, 164, 0, 0, 15, 120, + 0, 133, 0, 127, 0, 0, 96, 96, 0, 72, + 0, 96, 166, 96, 0, 0, 26, 169, 167, 120, + 10, 0, 0, 107, 171, 167, 120, 108, 0, 47, + 0, 51, 0, 48, 0, 173, 0, 126, 0, 199, + 115, 145, 110, 0, 154, 109, 199, 115, 145, 110, + 0, 154, 109, 199, 0, 154, 81, 199, 115, 145, + 110, 0, 154, 81, 200, 0, 29, 115, 145, 110, 0, 29, 0, 17, 175, 162, 120, 176, 0, 150, 0, 150, 111, 88, 140, 0, 88, 140, 0, 165, 0, 174, 0, 8, 149, 163, 120, 177, 0, 0, @@ -391,20 +391,21 @@ static const short yyrhs[] = { -1, 0, 135, 0, 50, 0, 49, 0, 52, 0, 53, 0, 47, 0, 50, 0, 49, 0, 51, 0, 31, 0, 30, 0, 32, 0, 33, 0, 46, 0, 45, - 0, 182, 0, 60, 0, 61, 0, 204, 0, 0, - 95, 186, 125, 204, 0, 1, 204, 0, 115, 188, - 202, 110, 0, 188, 204, 0, 189, 111, 191, 111, + 0, 182, 0, 60, 0, 61, 0, 205, 0, 0, + 95, 186, 125, 205, 0, 1, 205, 0, 115, 188, + 203, 110, 0, 188, 205, 0, 189, 111, 191, 111, 192, 194, 0, 189, 111, 191, 194, 0, 189, 111, 192, 194, 0, 189, 194, 0, 191, 111, 192, 194, 0, 191, 194, 0, 192, 194, 0, 193, 0, 0, 47, 0, 189, 111, 47, 0, 47, 91, 140, 0, 190, 0, 191, 111, 190, 0, 88, 47, 0, 89, 47, 0, 111, 193, 0, 0, 183, 0, 115, 125, - 202, 110, 0, 0, 197, 203, 0, 150, 203, 0, + 203, 110, 0, 0, 197, 204, 0, 150, 204, 0, 198, 0, 197, 111, 198, 0, 140, 84, 140, 0, - 47, 0, 51, 0, 48, 0, 109, 0, 81, 0, - 0, 205, 0, 0, 116, 0, 0, 116, 0, 111, - 0, 117, 0, 116, 0, 204, 0, 205, 117, 0 + 47, 0, 51, 0, 48, 0, 47, 0, 48, 0, + 109, 0, 81, 0, 0, 206, 0, 0, 116, 0, + 0, 116, 0, 111, 0, 117, 0, 116, 0, 205, + 0, 206, 117, 0 }; #endif @@ -431,14 +432,14 @@ static const short yyrline[] = { 0, 767, 771, 772, 776, 782, 787, 795, 799, 801, 806, 810, 814, 819, 823, 828, 833, 838, 842, 847, 852, 854, 860, 864, 869, 870, 875, 880, 886, 898, 903, - 909, 923, 927, 929, 933, 938, 943, 947, 951, 952, - 956, 957, 958, 959, 960, 965, 973, 977, 984, 990, - 996, 1001, 1005, 1009, 1009, 1014, 1018, 1023, 1024, 1033, - 1042, 1051, 1059, 1067, 1075, 1083, 1103, 1107, 1117, 1125, - 1132, 1140, 1149, 1157, 1165, 1174, 1175, 1182, 1190, 1194, - 1198, 1202, 1207, 1208, 1209, 1211, 1212, 1214, 1215, 1224, - 1228, 1233, 1234, 1236, 1240, 1244, 1248, 1253, 1258, 1266, - 1271, 1278, 1282, 1286, 1290, 1291, 1293, 1298, 1304, 1310, + 909, 923, 927, 929, 933, 938, 942, 946, 947, 951, + 952, 953, 954, 955, 960, 968, 972, 979, 985, 991, + 996, 1000, 1004, 1004, 1009, 1013, 1018, 1019, 1028, 1037, + 1046, 1054, 1062, 1070, 1078, 1098, 1102, 1112, 1120, 1127, + 1135, 1144, 1152, 1160, 1169, 1170, 1177, 1185, 1189, 1193, + 1197, 1202, 1203, 1204, 1206, 1207, 1209, 1210, 1219, 1223, + 1228, 1229, 1231, 1235, 1239, 1243, 1248, 1253, 1261, 1266, + 1273, 1277, 1281, 1285, 1286, 1288, 1293, 1299, 1305, 1311, 1316, 1322, 1330, 1337, 1338, 1343, 1349, 1350, 1352, 1359, 1364, 1368, 1373, 1374, 1378, 1380, 1381, 1382, 1384, 1385, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, @@ -446,8 +447,8 @@ static const short yyrline[] = { 0, 1434, 1438, 1442, 1446, 1450, 1454, 1458, 1462, 1467, 1474, 1482, 1489, 1494, 1499, 1506, 1511, 1515, 1520, 1533, 1551, 1555, 1559, 1567, 1568, 1573, 1578, 1579, 1580, 1582, 1583, - 1585, 1586, 1588, 1589, 1591, 1592, 1593, 1595, 1596, 1598, - 1599 + 1585, 1586, 1588, 1589, 1591, 1592, 1594, 1595, 1596, 1598, + 1599, 1601, 1602 }; #endif @@ -476,8 +477,8 @@ static const char * const yytname[] = { "$","error","$undefined.","kCLASS", "iterator","method_call","case_body","when_args","cases","rescue","ensure","literal", "symbol","numeric","variable","var_ref","backref","superclass","@17","f_arglist", "f_args","f_arg","f_opt","f_optarg","f_rest_arg","f_block_arg","opt_f_block_arg", -"singleton","assoc_list","assocs","assoc","operation","dot_or_colon","opt_terms", -"opt_nl","trailer","term","terms", NULL +"singleton","assoc_list","assocs","assoc","operation","operation2","dot_or_colon", +"opt_terms","opt_nl","trailer","term","terms", NULL }; #endif @@ -504,12 +505,12 @@ static const short yyr1[] = { 0, 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, 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, 173, 173, 173, + 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, 173, 173, 173, 173, 173, 173, 174, 175, 175, 175, 176, 176, 177, 177, 178, 178, 179, 179, 179, 180, 180, 180, 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, @@ -517,8 +518,8 @@ static const short yyr1[] = { 0, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 190, 191, 191, 192, 193, 194, 194, 195, 195, 196, 196, 196, 197, 197, 198, 199, 199, 199, 200, 200, - 201, 201, 202, 202, 203, 203, 203, 204, 204, 205, - 205 + 201, 201, 202, 202, 203, 203, 204, 204, 204, 205, + 205, 206, 206 }; static const short yyr2[] = { 0, @@ -542,14 +543,14 @@ static const short yyr2[] = { 0, 3, 0, 4, 5, 1, 1, 0, 2, 1, 2, 2, 5, 2, 2, 5, 4, 4, 7, 3, 1, 2, 2, 0, 1, 0, 1, 3, 1, 4, 2, - 1, 0, 2, 1, 3, 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, 0, - 2, 1, 1, 0, 2, 1, 3, 0, 5, 0, - 5, 1, 1, 1, 1, 1, 4, 6, 3, 6, + 1, 0, 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, 0, 2, + 1, 1, 0, 2, 1, 3, 0, 5, 0, 5, + 1, 1, 1, 1, 1, 4, 6, 3, 6, 3, 4, 1, 5, 1, 4, 2, 1, 1, 5, 0, 0, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -557,313 +558,325 @@ static const short yyr2[] = { 0, 4, 4, 2, 4, 2, 2, 1, 0, 1, 3, 3, 1, 3, 2, 2, 2, 0, 1, 4, 0, 2, 2, 1, 3, 3, 1, 1, 1, 1, 1, - 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, - 2 + 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 2 }; static const short yydefact[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 249, 250, 251, 252, 220, 223, 282, - 306, 305, 307, 308, 0, 0, 353, 19, 0, 310, - 309, 346, 348, 303, 302, 347, 299, 300, 208, 210, - 295, 209, 211, 212, 312, 313, 0, 0, 0, 0, - 202, 340, 0, 0, 0, 0, 2, 351, 5, 22, - 26, 0, 36, 0, 40, 45, 31, 175, 0, 228, - 204, 293, 311, 213, 214, 0, 7, 54, 55, 0, - 0, 242, 100, 112, 101, 125, 97, 118, 107, 106, + 0, 0, 0, 248, 249, 250, 251, 219, 222, 282, + 306, 305, 307, 308, 0, 0, 355, 19, 0, 310, + 309, 346, 348, 303, 302, 347, 299, 300, 207, 209, + 295, 208, 210, 211, 312, 313, 0, 0, 0, 0, + 202, 340, 0, 0, 0, 0, 2, 353, 5, 22, + 26, 0, 36, 0, 40, 45, 31, 175, 0, 227, + 204, 293, 311, 212, 213, 0, 7, 54, 55, 0, + 0, 241, 100, 112, 101, 125, 97, 118, 107, 106, 123, 105, 104, 99, 128, 109, 98, 113, 117, 119, 111, 103, 120, 130, 122, 121, 114, 124, 108, 96, 116, 115, 110, 126, 129, 127, 95, 102, 93, 94, 91, 92, 56, 58, 57, 86, 87, 84, 68, 69, 70, 73, 75, 71, 64, 88, 89, 76, 77, 81, 72, 74, 65, 66, 67, 78, 79, 80, 82, 83, - 85, 90, 0, 244, 59, 60, 311, 338, 0, 121, + 85, 90, 0, 243, 59, 60, 311, 338, 0, 121, 114, 124, 108, 91, 92, 56, 57, 61, 14, 290, - 301, 226, 304, 0, 26, 228, 0, 0, 0, 0, - 220, 223, 282, 353, 263, 262, 0, 0, 50, 53, + 301, 225, 304, 0, 26, 227, 0, 0, 0, 0, + 219, 222, 282, 355, 262, 261, 0, 0, 50, 53, 0, 0, 0, 0, 0, 0, 179, 196, 201, 190, - 193, 24, 175, 311, 214, 193, 343, 0, 25, 177, - 35, 29, 0, 9, 354, 172, 0, 0, 151, 175, - 152, 207, 0, 0, 0, 36, 196, 355, 0, 355, - 0, 355, 44, 298, 297, 296, 294, 30, 166, 167, - 359, 358, 3, 360, 352, 0, 0, 0, 0, 0, + 193, 24, 175, 311, 213, 193, 343, 0, 25, 177, + 35, 29, 0, 9, 356, 172, 0, 0, 151, 175, + 152, 206, 0, 0, 0, 36, 196, 357, 0, 357, + 0, 357, 44, 298, 297, 296, 294, 30, 166, 167, + 361, 360, 3, 362, 354, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 48, 42, 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, 177, 268, 8, 270, 229, - 137, 131, 0, 0, 177, 32, 227, 0, 0, 315, - 238, 314, 0, 353, 328, 350, 349, 246, 62, 195, - 260, 254, 0, 253, 0, 0, 0, 257, 0, 256, - 0, 0, 0, 0, 177, 0, 193, 191, 219, 0, - 0, 180, 181, 0, 177, 183, 184, 222, 0, 0, - 353, 11, 13, 12, 0, 224, 0, 0, 0, 0, - 0, 237, 37, 357, 356, 203, 216, 342, 217, 357, - 341, 361, 6, 15, 16, 17, 18, 27, 28, 0, + 0, 0, 0, 0, 0, 177, 267, 8, 269, 228, + 137, 131, 0, 0, 177, 32, 226, 0, 0, 315, + 237, 314, 0, 355, 328, 352, 351, 245, 62, 195, + 259, 253, 0, 252, 0, 0, 0, 256, 0, 255, + 0, 0, 0, 0, 177, 0, 193, 191, 218, 0, + 0, 180, 181, 0, 177, 183, 184, 221, 0, 0, + 355, 11, 13, 12, 0, 223, 0, 0, 0, 0, + 0, 236, 37, 359, 358, 203, 215, 342, 216, 359, + 341, 363, 6, 15, 16, 17, 18, 27, 28, 0, 198, 23, 0, 41, 0, 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, 206, 348, 205, 0, 346, 347, 279, 0, 176, - 264, 264, 0, 0, 142, 136, 0, 240, 317, 0, - 0, 0, 0, 329, 0, 0, 328, 0, 0, 337, - 332, 337, 337, 327, 0, 0, 0, 194, 0, 291, - 260, 255, 260, 0, 284, 0, 234, 0, 0, 0, - 52, 347, 279, 0, 0, 0, 189, 218, 345, 0, - 197, 192, 193, 346, 0, 0, 0, 344, 221, 281, - 178, 10, 0, 173, 0, 21, 37, 197, 200, 0, - 46, 0, 49, 0, 177, 34, 0, 0, 0, 0, - 177, 33, 215, 266, 0, 0, 0, 138, 132, 277, - 0, 0, 0, 243, 339, 0, 334, 335, 353, 0, - 319, 0, 323, 0, 325, 0, 326, 247, 63, 0, - 0, 261, 0, 0, 0, 0, 258, 0, 286, 0, - 0, 232, 233, 51, 0, 193, 187, 186, 215, 193, - 0, 20, 0, 43, 174, 0, 140, 134, 141, 135, - 0, 0, 0, 265, 0, 0, 0, 0, 316, 239, - 331, 0, 245, 330, 337, 337, 336, 0, 333, 337, - 328, 290, 292, 236, 0, 230, 231, 0, 260, 0, - 182, 0, 185, 225, 199, 280, 278, 139, 133, 267, - 269, 271, 241, 318, 0, 321, 322, 324, 0, 289, - 0, 285, 287, 288, 283, 235, 193, 337, 0, 260, - 188, 320, 248, 259, 0, 0, 0 + 149, 349, 350, 205, 0, 280, 346, 348, 347, 278, + 0, 176, 263, 263, 0, 0, 142, 136, 0, 239, + 317, 0, 0, 0, 0, 329, 0, 0, 328, 0, + 0, 337, 332, 337, 337, 327, 0, 0, 0, 194, + 0, 291, 259, 254, 259, 0, 284, 0, 233, 0, + 0, 0, 52, 347, 278, 0, 0, 0, 189, 217, + 345, 0, 197, 192, 193, 346, 0, 0, 0, 344, + 220, 281, 178, 10, 0, 173, 0, 21, 37, 197, + 200, 0, 46, 0, 49, 0, 177, 34, 0, 0, + 0, 0, 177, 33, 214, 265, 0, 0, 0, 138, + 132, 276, 0, 0, 0, 242, 339, 0, 334, 335, + 355, 0, 319, 0, 323, 0, 325, 0, 326, 246, + 63, 0, 0, 260, 0, 0, 0, 0, 257, 0, + 286, 0, 0, 231, 232, 51, 0, 193, 187, 186, + 214, 193, 0, 20, 0, 43, 174, 0, 140, 134, + 141, 135, 0, 0, 0, 264, 0, 0, 0, 0, + 316, 238, 331, 0, 244, 330, 337, 337, 336, 0, + 333, 337, 328, 290, 292, 235, 0, 229, 230, 0, + 259, 0, 182, 0, 185, 224, 199, 279, 277, 139, + 133, 266, 268, 270, 240, 318, 0, 321, 322, 324, + 0, 289, 0, 285, 287, 288, 283, 234, 193, 337, + 0, 259, 188, 320, 247, 258, 0, 0, 0 }; -static const short yydefgoto[] = { 615, +static const short yydefgoto[] = { 617, 1, 224, 58, 59, 345, 217, 60, 61, 62, 225, - 63, 64, 65, 257, 66, 81, 154, 169, 436, 155, - 156, 67, 414, 413, 347, 409, 410, 341, 200, 333, - 437, 201, 372, 202, 229, 220, 473, 421, 501, 303, - 305, 435, 571, 313, 319, 526, 527, 188, 496, 288, - 411, 290, 412, 69, 176, 317, 446, 605, 311, 524, - 71, 237, 72, 204, 74, 205, 301, 420, 428, 429, - 430, 431, 432, 433, 567, 513, 159, 231, 206, 207, - 191, 308, 243, 216, 356, 314, 245 + 63, 64, 65, 257, 66, 81, 154, 169, 438, 155, + 156, 67, 416, 415, 347, 411, 412, 341, 200, 333, + 439, 201, 372, 202, 229, 220, 475, 423, 503, 303, + 305, 437, 573, 313, 319, 528, 529, 188, 498, 288, + 413, 290, 414, 69, 176, 317, 448, 607, 311, 526, + 71, 237, 72, 204, 74, 205, 301, 422, 430, 431, + 432, 433, 434, 435, 569, 515, 159, 231, 206, 207, + 191, 406, 308, 243, 216, 356, 314, 245 }; static const short yypact[] = {-32768, - 1422, 4530, 39, 164, 2922, 4236, 1856, 4620, 4620, 2328, - 4620, 4620, 5698,-32768,-32768,-32768,-32768, 3387, 3477, 3567, --32768,-32768,-32768,-32768, 4620, 4133, -53,-32768, -41,-32768, --32768, 1520, 1739,-32768,-32768, 1634,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 5430, 5430, 164, 2419, - 5430, 5430, 5962, 4030, 5520, 5430,-32768, 158, 420, 322, - 88, 86,-32768, 82, 5786,-32768, 6041, -8, 160, 27, --32768,-32768, 105,-32768, 168, 3027, 420,-32768,-32768, 4620, - 50,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 1542, 4807, 38, 69, 3109, 4513, 2043, 4897, 4897, 2515, + 4897, 4897, 5975,-32768,-32768,-32768,-32768, 3574, 3664, 3754, +-32768,-32768,-32768,-32768, 4897, 4410, -48,-32768, -23,-32768, +-32768, 1716, 1926,-32768,-32768, 1821,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 5707, 5707, 69, 2606, + 5707, 5707, 6239, 4307, 5797, 5707,-32768, 123, 348, 336, + 108, 82,-32768, 43, 6063,-32768, 6278, 78, 157, 40, +-32768,-32768, 83,-32768, 199, 3214, 348,-32768,-32768, 4897, + 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 1, 94, 146, 182,-32768, +-32768,-32768,-32768,-32768,-32768, 90, 105, 142, 182,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 183, 196, 200,-32768, 201,-32768,-32768,-32768,-32768,-32768, + 191, 206, 226,-32768, 230,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 4620,-32768,-32768,-32768,-32768,-32768, 235,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 127, 244, - 3117, 3207, 3297, 46,-32768, 149, 46, 273, 42, 42, - 198, 202, 206, -53,-32768, 150, 10, 286, 92, 93, - 74, 2527, 5430, 5430, 5430, 4340,-32768, 5961,-32768,-32768, - 204,-32768, 111, 37, 44, 218,-32768, 4435,-32768, 4710, --32768,-32768, 270,-32768,-32768, 222, 242, 2635, 294, 116, - 294,-32768, 2419, 272, 275, 276, 6041, -27, 274, -27, - 282, 60,-32768,-32768,-32768,-32768,-32768,-32768, 294, 294, --32768,-32768,-32768,-32768, 2817, 4620, 4620, 4620, 4620, 4620, - 4620, 5070,-32768, 2419, 5962,-32768, 280, 5430, 5430, 5430, - 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, - 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, 5430, - 5430, 5430, 5430, 249, 285, 4710,-32768,-32768,-32768,-32768, --32768,-32768, 5430, 5430, 4710,-32768,-32768, 13, 158,-32768, --32768,-32768, 2726, 35, 18,-32768,-32768,-32768,-32768, 5430, - 368,-32768, 1964, 380, 2146, 5160, 391,-32768, 2726,-32768, - 2726, 222, 249, 303, 4710, 4620, 1206, 6041,-32768, 292, - 5430, 4800,-32768, 320, 4710, 4890,-32768,-32768, 295, 298, - -53,-32768,-32768,-32768, 4236,-32768, 5430, 2635, 301, 320, - 300,-32768, 306, 5430,-32768,-32768,-32768,-32768,-32768, 5430, --32768,-32768, 420, 322, 322, 322, 322,-32768,-32768, 5430, - 307,-32768, 312,-32768, 5874, 294, 6161, 6161, 6161, 6161, - 263, 263, 6201, 6121, 6161, 6161, 6081, 6081, -6, -6, - 6001, 263, 263, 134, 134, 475, 14, 14, 294, 294, - 294, 3657,-32768, 3747, 3837, 195, 117, 3927, 310,-32768, - 98, 98, 5430, 5430, 6041, 6041, 316,-32768,-32768, 4620, - 2726, 418, 324, 339, 388, 389, 20, 2726, 158, 330, --32768, 331, 333,-32768, 4236, 4236, 48, 335, 2237, 438, - 355,-32768, 368, 5430, 337, 30,-32768, 440, 451, 347, - 75,-32768, 348, 353, 42, 379,-32768,-32768, 6041, 5430, - 5961,-32768, 358, 135, 357, 5430, 5961,-32768,-32768,-32768, --32768,-32768, 4620, 6041, 363,-32768, 262, 6041, 6041, 5250, --32768, 5962,-32768, 5430, 4710,-32768, 5430, 5430, 5430, 5430, - 4710,-32768, 197,-32768, 5610, 2726, 2635, 6041, 6041,-32768, - 2726, 13, 463,-32768,-32768, 5430,-32768,-32768, -53, 464, --32768, 24,-32768, 36,-32768, 386,-32768,-32768,-32768, 1856, - 5430,-32768, 2726, 467, 4620, 469,-32768, 472, 6041, 5340, - 2055,-32768,-32768, 148, 2726, 1206, 4980,-32768, 216, 1206, - 26,-32768, 5430,-32768, 6041, 373, 6041, 6041, 6041, 6041, - 377, 5430, 5430,-32768, 392, 479, 383, 483,-32768,-32768, - 6041, 393,-32768, 339, 390, 333,-32768, 339,-32768, 333, - 18, 244,-32768,-32768, 46,-32768,-32768, 5430, 83, 487, --32768, 5430,-32768,-32768, 6041,-32768,-32768, 6041, 6041,-32768, --32768,-32768,-32768,-32768, 36,-32768,-32768,-32768, 2726,-32768, - 1964, 6041,-32768,-32768,-32768,-32768, 1206, 333, 489, 355, --32768,-32768,-32768,-32768, 502, 506,-32768 +-32768,-32768, 4897,-32768,-32768,-32768,-32768,-32768, 240,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 85, 122, + 3304, 3394, 3484, 48,-32768, 109, 48, 186, 52, 52, + 106, 110, 126, -48,-32768, 141, 96, 194, 117, 146, + 63, 2714, 5707, 5707, 5707, 4617,-32768, 690,-32768,-32768, + 166,-32768, 147, 193, 195, 208,-32768, 4712,-32768, 4987, +-32768,-32768, 62,-32768,-32768, 202, 150, 2822, 286, 162, + 286,-32768, 2606, 250, 252, 255, 6278, -13, 278, -13, + 265, 104,-32768,-32768,-32768,-32768,-32768,-32768, 286, 286, +-32768,-32768,-32768,-32768, 3004, 4897, 4897, 4897, 4897, 4897, + 4897, 5347,-32768, 2606, 6239,-32768, 282, 5707, 5707, 5707, + 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, + 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, 5707, + 5707, 5707, 5707, 308, 310, 4987,-32768,-32768,-32768,-32768, +-32768,-32768, 5707, 5707, 4987,-32768,-32768, 11, 123,-32768, +-32768,-32768, 2913, 35, 3,-32768,-32768,-32768,-32768, 5707, + 379,-32768, 2151, 382, 2333, 5437, 386,-32768, 2913,-32768, + 2913, 202, 308, 316, 4987, 4897, 1569, 6278,-32768, 288, + 5707, 5077,-32768, 321, 4987, 5167,-32768,-32768, 289, 290, + -48,-32768,-32768,-32768, 4513,-32768, 5707, 2822, 295, 321, + 297,-32768, 294, 5707,-32768,-32768,-32768,-32768,-32768, 5707, +-32768,-32768, 348, 336, 336, 336, 336,-32768,-32768, 5707, + 299,-32768, 301,-32768, 6151, 286, 1062, 1062, 1062, 1062, + 539, 539, 1304, 993, 1062, 1062, 1252, 1252, -6, -6, + 6238, 539, 539, 229, 229, 133, 99, 99, 286, 286, + 286, 3844, 3934, 4024, 4114,-32768, 205,-32768, 253, 4204, + 300,-32768, 5, 5, 5707, 5707, 6278, 6278, 307,-32768, +-32768, 4897, 2913, 408, 313, 333, 380, 383, 20, 2913, + 123, 315,-32768, 320, 325,-32768, 4513, 4513, 8, 326, + 2424, 423, 368,-32768, 379, 5707, 328, 27,-32768, 432, + 434, 331, -5,-32768, 332, 335, 52, 361,-32768,-32768, + 6278, 5707, 690,-32768, 341, 260, 344, 5707, 690,-32768, +-32768,-32768,-32768,-32768, 4897, 6278, 350,-32768, 279, 6278, + 6278, 5527,-32768, 6239,-32768, 5707, 4987,-32768, 5707, 5707, + 5707, 5707, 4987,-32768, 222,-32768, 5887, 2913, 2822, 6278, + 6278,-32768, 2913, 11, 449,-32768,-32768, 5707,-32768,-32768, + -48, 450,-32768, 24,-32768, 26,-32768, 372,-32768,-32768, +-32768, 2043, 5707,-32768, 2913, 452, 4897, 453,-32768, 456, + 6278, 5617, 2242,-32768,-32768, 180, 2913, 1569, 5257,-32768, + 263, 1569, 46,-32768, 5707,-32768, 6278, 357, 6278, 6278, + 6278, 6278, 358, 5707, 5707,-32768, 373, 460, 363, 462, +-32768,-32768, 6278, 365,-32768, 333, 362, 325,-32768, 333, +-32768, 325, 3, 122,-32768,-32768, 48,-32768,-32768, 5707, + 118, 466,-32768, 5707,-32768,-32768, 6278,-32768,-32768, 6278, + 6278,-32768,-32768,-32768,-32768,-32768, 26,-32768,-32768,-32768, + 2913,-32768, 2151, 6278,-32768,-32768,-32768,-32768, 1569, 325, + 469, 368,-32768,-32768,-32768,-32768, 481, 482,-32768 }; static const short yypgoto[] = {-32768, --32768, 345,-32768, 31,-32768,-32768, 19, 1162, -9, -151, - -24, -52,-32768,-32768, 3, 53, -4,-32768,-32768,-32768, --32768, 853,-32768,-32768,-32768, -214, -190, 16, -295, -201, --32768, -12,-32768, 23,-32768, -1,-32768,-32768,-32768,-32768, --32768,-32768,-32768, -162, -166, -103, -286, 22, 96,-32768, --32768, -47,-32768,-32768, 644, -70,-32768,-32768, -54,-32768, --32768,-32768,-32768, 387, 515, 503,-32768,-32768, -50, 99, --32768, -426, 15, -427, -284, -387,-32768,-32768, -29, -298, - 130,-32768,-32768, -181, 11, -26,-32768 +-32768, 549,-32768, 30,-32768,-32768, 19, 1282, -9, -149, + -12, -52,-32768,-32768, 7, 39, -3,-32768,-32768,-32768, +-32768, 929,-32768,-32768,-32768, -235, -189, -4, -279, -201, +-32768, -15,-32768, 22,-32768, -1,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, -175, -158, -128, -278, -7, 87,-32768, +-32768, -29,-32768,-32768, 174, -69,-32768,-32768, -61,-32768, +-32768,-32768,-32768, 498, 509, 581,-32768,-32768, -58, 88, +-32768, -468, 2, -451, -276, -379,-32768,-32768, -26, -301, + 130,-32768,-32768,-32768, -159, -111, -19,-32768 }; -#define YYLAST 6304 +#define YYLAST 6381 static const short yytable[] = { 68, - 68, 168, 322, 185, 337, 68, 68, 68, 68, 68, - 68, 187, 256, 321, 315, 186, 203, 203, 203, 340, - 434, 214, 232, 68, 440, 226, 174, 177, 297, 179, - 180, 244, 77, 199, 199, 211, 462, 468, 228, 230, - 462, 209, 312, 212, 515, 517, 250, 251, 68, 236, - 299, 187, -275, 203, 302, 233, 82, 258, 312, 250, - 251, 468, 215, 187, 424, 218, 424, 318, 250, 251, - 564, 351, 284, 318, 203, 250, 251, 258, 68, 250, - 251, -306, 568, 354, 566, 78, 570, 569, 355, 79, - 323, 296, 279, 280, 281, 282, 283, 439, 298, 316, - 285, 222, 373, 286, 417, 425, 426, 425, 426, -306, - 454, 425, 426, -276, 281, 282, 283, 80, 324, 291, - 465, 325, 423, 425, 426, 457, 293, 292, 241, 242, - 76, 76, 427, 289, 294, 584, 76, 76, 76, 76, - 76, 76, 434, 297, 300, 241, 242, 76, 76, 76, - 215, 68, 320, 320, 76, -346, 528, 241, 242, 471, - 462, 241, 242, 241, 242, 241, 242, 608, 569, 494, - 360, 304, -311, -214, -305, 355, 252, 596, 597, 76, - 289, -346, 598, -346, 76, 287, -346, 291, 295, -346, - 68, 284, 253, 495, 203, 292, 323, 258, 226, 489, - -311, -214, -305, -311, -214, 76, 203, 490, 203, 76, - 78, 199, 271, 272, 79, -50, 68, 487, 330, 334, - 612, 68, 335, 199, 350, 488, -307, 335, -215, 226, - 339, 278, 279, 280, 281, 282, 283, 309, 468, 371, - 358, 462, 361, 68, 68, 68, 68, 68, 68, 68, - 293, 310, 68, 187, -307, 289, -215, 374, 294, -215, - -45, 538, -308, -310, 364, 365, 366, 367, 368, 369, - 520, 418, 419, 241, 242, 363, -309, 487, -53, 552, - -301, -304, 76, 531, 203, 488, 434, 553, 535, 316, - -308, -310, 603, 203, 546, 402, 403, 438, 552, 404, - 551, 68, 463, 445, -309, -52, 553, -51, -301, -304, - 326, 68, 196, 68, 332, 306, 208, 68, 342, 68, - 210, 76, 483, 203, 68, 76, 258, 562, 336, 343, - 344, 406, 403, 203, 581, 407, 346, 76, 583, 76, - 472, 271, 272, 307, 455, 57, 68, 76, 348, 451, - 403, 170, 76, 452, 178, 250, 251, 258, 276, 277, - 278, 279, 280, 281, 282, 283, 464, 403, 525, 439, - 407, -39, -46, 187, 76, 76, 76, 76, 76, 76, - 76, 352, 439, 76, 353, -38, 357, 73, 73, 359, - 375, 157, 442, 73, 73, 73, 73, 73, 73, 189, - 447, 458, 511, 203, 469, 611, 203, 470, 476, 477, - 320, 73, 601, 405, 408, 76, -46, 480, 68, 68, - 486, 481, 493, 492, 76, 500, 68, 504, 320, 506, - 518, 519, 76, 505, 507, 508, 73, 68, 502, 189, - 512, 514, 76, 516, 76, 521, 523, 530, 76, 532, - 76, 189, 450, 453, 76, 76, 246, 247, 248, 249, - 533, 485, 491, 408, 76, 534, 73, 194, 537, 539, - 542, 68, 560, 563, 426, 559, 574, 76, 576, 453, - 187, 577, 586, 203, 544, 185, 587, 590, 591, 203, - 592, 541, 593, 187, 68, 68, 606, 186, 613, 68, - 595, 616, 594, 75, 75, 617, 614, 497, 604, 75, - 75, 75, 75, 75, 75, 190, 555, 600, 68, 158, - 599, 68, 0, 68, 0, 509, 565, 75, 0, 68, - 0, 0, 0, 68, 76, 0, 0, 76, 258, 73, - 0, 0, 0, 575, 0, 0, 0, 0, 0, 76, - 76, 0, 75, 271, 272, 190, 0, 76, 0, 0, - 0, 0, 349, 0, 0, 0, 0, 190, 76, 0, - 0, 0, 0, 279, 280, 281, 282, 283, 73, 0, - 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 68, 0, 68, - 0, 0, 76, 0, 73, 0, 0, 0, 0, 73, - 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, - 76, 0, 0, 0, 0, 76, 76, 0, 0, 0, - 76, 73, 73, 73, 73, 73, 73, 73, 0, 0, - 73, 189, 0, 0, 70, 70, 0, 422, 0, 76, - 70, 0, 76, 70, 76, 75, 0, 441, 0, 443, - 76, 0, 0, 448, 76, 449, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 68, 315, 168, 185, 337, 68, 68, 68, 68, 68, + 68, 187, 256, 199, 199, 211, 203, 203, 203, 186, + 340, 321, 214, 68, 322, 232, 174, 177, 436, 179, + 180, 77, 442, 318, 470, 228, 230, 226, 244, 312, + 209, 299, 82, 212, 250, 251, 297, 571, 68, 426, + 236, 187, 464, 203, 517, 519, 464, 258, 470, 233, + 312, 302, 568, 187, 572, -274, 426, 215, 250, 251, + 566, 296, 570, 351, 203, -346, 496, 318, 68, 250, + 251, 250, 251, 218, 78, 250, 251, 222, 79, 456, + 427, 428, 279, 280, 281, 282, 283, 354, 298, 467, + 497, -346, 355, -346, 373, 419, -346, 427, 428, -346, + 342, 427, 428, 427, 428, 78, 80, 429, 358, 79, + 361, 343, 344, 241, 242, 459, 241, 242, 571, 310, + 76, 76, 441, -275, 316, 300, 76, 76, 76, 76, + 76, 76, 241, 242, 425, 610, 289, 76, 76, 76, + 215, 68, 436, 253, 76, 586, 241, 242, 284, 320, + 320, 297, 258, 241, 242, 291, 530, 241, 242, 289, + -306, 304, 252, 292, 70, 70, 323, 295, 464, 76, + 70, 473, 287, 70, 76, -305, 285, 598, 599, 286, + 68, 199, 600, -50, 203, 309, 258, -311, -306, 281, + 282, 283, 316, 199, 324, 76, 203, 325, 203, 76, + 226, 271, 272, -305, 360, 289, 68, 330, 326, 355, + 196, 68, -307, 70, 208, -311, -213, 284, -311, 339, + 614, 279, 280, 281, 282, 283, 371, 470, 241, 242, + 210, 226, 323, 68, 68, 68, 68, 68, 68, 68, + -307, -45, 68, 187, -213, 334, 348, -213, 335, 464, + -214, 374, -308, 540, 364, 365, 366, 367, 368, 369, + 350, -310, 533, 335, 363, 291, 332, 293, 420, 421, + 522, 293, 76, 292, 203, 294, -309, 489, -214, 294, + -308, -214, 258, 203, 440, 490, 436, 548, 537, -310, + 447, 68, 605, 553, 554, 465, -301, 271, 272, -53, + -304, 68, 555, 68, -309, -52, 346, 68, 336, 68, + 306, 76, 485, 203, 68, 76, 278, 279, 280, 281, + 282, 283, -51, 203, -301, 491, 583, 76, -304, 76, + 585, 474, 489, 492, 457, 554, 68, 76, 307, 258, + 490, 564, 76, 555, 402, 403, 407, 408, 404, 352, + 409, 353, 453, 408, -38, 70, 454, 466, 408, 250, + 251, 409, 359, 187, 76, 76, 76, 76, 76, 76, + 76, 527, 441, 76, 246, 247, 248, 249, -39, -46, + 357, 70, 375, 441, 444, 449, 70, 460, 471, 472, + 488, 603, 478, 203, -46, 494, 479, 613, 203, 482, + 483, 513, 495, 405, 410, 76, 502, 506, 70, 320, + 68, 68, 507, 508, 76, 514, 509, 70, 68, 510, + 516, 525, 76, 520, 521, 518, 523, 320, 532, 68, + 504, 534, 76, 535, 76, 487, 493, 536, 76, 194, + 76, 539, 452, 455, 76, 76, 541, 544, 562, 565, + 428, 576, 578, 410, 76, 579, 588, 589, 592, 593, + 594, 595, 597, 68, 596, 608, 70, 76, 615, 455, + 618, 619, 187, 616, 561, 203, 70, 185, 70, 557, + 546, 203, 70, 543, 70, 187, 68, 68, 73, 73, + 499, 68, 157, 186, 73, 73, 73, 73, 73, 73, + 189, 606, 602, 158, 601, 567, 511, 0, 0, 0, + 68, 70, 73, 68, 0, 68, 0, 0, 0, 0, + 0, 68, 0, 0, 76, 68, 0, 0, 0, 76, + 0, 0, 0, 0, 0, 577, 0, 73, 0, 57, + 189, 76, 76, 0, 0, 170, 0, 0, 178, 76, + 0, 0, 189, 0, 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 0, 0, 0, 73, 0, 0, + 0, 75, 75, 0, 0, 0, 0, 75, 75, 75, + 75, 75, 75, 190, 0, 0, 70, 0, 0, 68, + 0, 68, 258, 70, 76, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 0, 76, 271, 272, 0, + 0, 0, 76, 0, 0, 0, 0, 76, 76, 0, + 75, 0, 76, 190, 276, 277, 278, 279, 280, 281, + 282, 283, 0, 0, 0, 190, 0, 0, 0, 0, + 73, 76, 0, 0, 76, 0, 76, 0, 0, 0, + 75, 0, 76, 0, 0, 0, 76, 0, 0, 0, + 0, 70, 70, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, - 0, 0, 475, 70, 75, 0, 0, 0, 0, 73, - 0, 73, 0, 0, 0, 73, 0, 73, 0, 0, - 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, - 75, 0, 0, 0, 0, 75, 0, 0, 76, 0, - 76, 0, 0, 0, 73, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, - 75, 75, 75, 75, 0, 0, 75, 190, 0, 0, - 0, 189, 0, 0, 0, 503, 0, 0, 0, 0, - 0, 0, 510, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 522, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 73, 73, 0, 0, - 0, 0, 0, 0, 73, 75, 0, 75, 0, 0, - 0, 75, 0, 75, 0, 73, 0, 0, 75, 0, - 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, - 556, 557, 0, 0, 0, 558, 0, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 73, - 0, 70, 0, 0, 572, 0, 70, 573, 189, 0, - 198, 198, 198, 0, 0, 579, 0, 190, 0, 580, - 0, 189, 73, 73, 0, 0, 0, 73, 70, 0, - 0, 0, 0, 0, 0, 0, 0, 70, 0, 219, - 221, 0, 0, 227, 198, 0, 73, 239, 240, 73, - 0, 73, 0, 0, 0, 0, 0, 73, 0, 0, - 0, 73, 75, 75, 0, 0, 0, 0, 198, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 0, 609, 0, 610, 70, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 0, 70, 0, - 0, 0, 70, 0, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, - 0, 0, 0, 0, 190, 73, 0, 73, 0, 0, - 0, 70, 0, 0, 0, 0, 0, 190, 75, 75, + 0, 0, 0, 0, 0, 70, 0, 0, 70, 0, + 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, + 70, 0, 0, 0, 0, 73, 0, 0, 0, 0, + 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 76, 0, 76, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 73, 73, 73, 73, 73, 73, 0, + 0, 73, 189, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 349, 0, 271, 272, + 0, 0, 75, 331, 70, 0, 70, 0, 0, 0, + 0, 273, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 0, 0, 0, 0, 0, 75, 0, + 73, 0, 0, 75, 0, 0, 0, 0, 0, 0, + 73, 0, 73, 0, 0, 0, 73, 0, 73, 0, + 0, 0, 0, 73, 0, 75, 75, 75, 75, 75, + 75, 75, 0, 0, 75, 190, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, + 0, 424, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 443, 0, 445, 0, 0, 0, 450, 0, 451, + 0, 0, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 0, 75, 477, 0, 0, 75, + 0, 75, 0, 0, 0, 0, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 73, 0, 0, 0, 0, 0, 0, 73, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 0, + 0, 0, 0, 0, 0, 0, 198, 198, 198, 0, + 0, 0, 0, 0, 0, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 0, 0, 75, 0, 75, 0, 0, + 0, 505, 73, 0, 0, 219, 221, 0, 512, 227, + 198, 189, 0, 239, 240, 0, 0, 0, 0, 524, + 0, 0, 0, 0, 189, 73, 73, 0, 0, 0, + 73, 0, 75, 75, 198, 0, 0, 0, 0, 0, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 0, 75, 73, 0, 73, 0, 0, 0, 0, 0, + 73, 0, 0, 0, 73, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 558, 559, 0, 0, + 0, 560, 0, 0, 0, 75, 258, 259, 260, 261, + 262, 263, 264, 265, 190, 267, 268, 0, 0, 0, + 574, 271, 272, 575, 0, 0, 0, 190, 75, 75, + 0, 581, 0, 75, 0, 582, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 0, 0, 73, 0, + 73, 0, 75, 0, 0, 75, 0, 75, 0, 0, 0, 0, 0, 75, 0, 0, 0, 75, 0, 0, - 0, 0, 0, 0, 0, 327, 328, 239, 198, 0, + 0, 327, 328, 239, 198, 258,-32768,-32768,-32768,-32768, + 263, 264, 0, 0,-32768,-32768, 198, 0, 198, 0, + 271, 272, 0, 0, 0, 0, 0, 0, 0, 611, + 0, 612, 0, 0, 0, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 198, 0, 198, 0, 70, 0, 0, 0, 0, 0, - 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, + 227, 75, 0, 75, 0, 0, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 0, 0, 198, 0, 0, 0, 0, 0, + 0, 417, 418, 198, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 227, 0, + 0, 0, 0, 0, 227, 0, 0, 0, 0, 0, + 0, 0, 0, 198, 0, 0, 0, 0, 0, 461, + 463, 0, 0, 198, 469, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 476, 0, 0, 0, 0, + 0, 0, 480, 0, 0, 0, 0, 0, 469, 175, + 175, 0, 175, 175, 0, 0, 0, 0, 481, 197, + 197, 197, 0, 0, 0, 0, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268,-32768,-32768, 0, 0, + 271, 272, 0, 198, 0, 0, 238, 0, 198, 0, + 0, 0, 0, 500, 501, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 0, 0, 197, 0, 0, + 0, 175, 0, 0, 0, 0, 0, 258, 259, 260, + 261, 262, 263, 264, 531, 0, 267, 268, 0, 0, + 0, 0, 271, 272, 0, 0, 0, 0, 0, 0, + 538, 0, 0, 0, 0, 0, 542, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 0, 0, 0, + 480, 0, 0, 0, 547, 198, 0, 549, 550, 551, + 552, 198, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 175, 0, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 0, 75, 227, 0, 0, 0, 0, 0, - 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 0, 0, 198, 70, - 70, 0, 0, 0, 70, 415, 416, 198, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 227, 70, 0, 0, 70, 0, 227, 175, - 175, 0, 175, 175, 70, 0, 0, 198, 70, 197, - 197, 197, 0, 459, 461, 0, 175, 198, 467, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 474, - 0, 0, 0, 0, 0, 0, 478, 0, 0, 0, - 0, 0, 467, 0, 0, 0, 238, 0, 0, 0, - 0, 0, 479, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 197, 0, 0, - 0, 175, 70, 0, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 198, 0, 0, - 198, 0, 0, 0, 0, 498, 499, 0, 0, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 0, 0, 271, 272, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 529, 273, 0, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 0, - 0, 0, 536, 0, 175, 0, 456, 0, 540, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 478, 0, 0, 0, 545, 198, 0, 547, - 548, 549, 550, 198, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 197, 561, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 197, - 0, 197, 0, 478, 0, 0, 0, 0, 0, 0, - 0, 0, 478, 0, 0, 0, 0, 0, 0, 467, - 0, 0, 0, 0, 0, 585, 0, 0, 0, 0, - 0, 0, 0, 0, 588, 589, 0, 175, 175, 175, + 0, 480, 0, 0, 0, 0, 0, 0, 0, 0, + 480, 0, 0, 0, 0, 0, 0, 469, 0, 0, + 0, 0, 0, 587, 0, 0, 0, 197, 0, 0, + 0, 0, 590, 591, 0, 0, 0, 0, 0, 197, + 0, 197, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 604, 0, + 0, 0, 609, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 175, 175, 175, 175, 175, 175, 0, 0, 0, 0, 0, 0, 0, 0, -4, 2, 0, 3, 4, 5, 6, 7, 0, - 602, 0, 8, 9, 607, 0, 0, 10, 0, 11, + 0, 0, 8, 9, 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 197, 18, 19, 20, 21, 22, 23, 24, 0, 197, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, @@ -871,54 +884,88 @@ static const short yytable[] = { 68, 44, 45, 46, 47, 48, 0, 197, 175, 0, 0, 0, 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, - 0, 54, 0, 0, 0, 0, 0, 0, 0, -301, - 0, 0, 0, 0, 0, 55, 56, -301, -301, -301, - 0, 0, 0, -301, -301, 0, -301, -4, -4, 0, - 0, 0, 0, 0, 0, -272, 0, 0, 0, 0, - 0, 0, 0, -301, -301, 0, -301, -301, -301, -301, - 0, 0, 0, 0, 0, 0, 197, 0, 0, 197, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 175, 0, -301, -301, -301, -301, -301, -301, -301, - -301, -301, -301, -301, -301, -301, 0, 0, -301, -301, + 0, 54, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 55, 56, 271, 272, 0, + 0, 0, 0, 0, 0, 0, 0, -4, -4, 0, + 273, 0, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 0, 0, 0, 0, 0, 0, 0, 458, + 0, 0, 0, 0, 0, 0, 197, 0, 0, 0, + 0, 197, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -301, 0, 0, 0, 0, + 0, 0, 0, -301, -301, -301, 0, 0, 0, -301, -301, 0, -301, 0, 0, 0, 0, 0, 0, 0, - -301, -301, 0, -301, -301, -301, -301, -301, -301, -301, - -301, -301, -301, 0, 0, 0, 0, -301, -301, -301, - -301, -301, 0, -304, 175, -301, -301, 0, 0, 0, - 0, -304, -304, -304, 0, 0, 197, -304, -304, 0, - -304, 0, 197, 0, 0, 0, 0, 0, 0, -273, - 0, 0, 0, 0, 0, 0, 0, -304, -304, 0, - -304, -304, -304, -304, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 175, 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, + 0, -271, 0, 0, 0, 0, 0, 0, 0, -301, + -301, 0, -301, -301, -301, -301, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 197, 0, + 0, 0, 0, 0, 197, 0, 0, 0, 0, -301, + -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, + -301, -301, 0, 0, -301, -301, -301, 0, -301, 0, + 0, 0, 0, 0, 0, 0, -301, -301, 175, -301, + -301, -301, -301, -301, -301, -301, -301, -301, -301, 0, + -304, 0, 0, -301, -301, -301, -301, -301, -304, -304, + -304, -301, -301, 0, -304, -304, 0, -304, 0, 0, + 0, 0, 0, 0, 0, 0, -272, 0, 0, 0, 0, 0, 0, 0, -304, -304, 0, -304, -304, -304, - -304, -304, -304, -304, -304, -304, -304, 0, -226, 0, - 0, -304, -304, -304, -304, -304, -226, -226, -226, -304, - -304, 0, -226, -226, 0, -226, 0, 0, 0, 0, - 0, 0, 0, 0, -274, 0, 0, 0, 0, 0, - 0, 0, -226, -226, 0, -226, -226, -226, -226, 0, + -304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, + 0, -304, -304, 0, -304, -304, -304, -304, -304, -304, + -304, -304, -304, -304, 0, -225, 0, 0, -304, -304, + -304, -304, -304, -225, -225, -225, -304, -304, 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, 0, 0, 0, 0, 0, 0, - 0, 0, -226, -226, -226, -226, -226, -226, -226, -226, - -226, -226, -226, -226, -226, 0, 0, -226, -226, -226, + 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, + -4, -4, -4, 8, 9, 0, 0, -4, 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, + 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, - -226, 0, -226, -226, -226, -226, -226, -226, -226, -226, - -226, -226, 0, 0, 0, 0, -226, -226, -226, 0, - -226, 0, 0, 0, -226, -226, 2, 0, 3, 4, - 5, 6, 7, -4, -4, -4, 8, 9, 0, 0, - -4, 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, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 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, 0, 3, 4, 5, 6, 7, -4, -4, + -4, 8, 9, 0, -4, -4, 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, 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, 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, 0, 3, 4, 5, 6, - 7, -4, -4, -4, 8, 9, 0, -4, -4, 10, - 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, + 0, 0, 49, 0, 0, 50, 51, 52, 53, 0, + 54, 0, 2, 0, 3, 4, 5, 6, 7, 0, + 0, -4, 8, 9, 55, 56, -4, 10, -4, 11, + 12, 13, 14, 15, 16, 17, -4, -4, 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, 0, -4, 8, 9, 55, 56, -4, 10, 0, + 11, 12, 13, 14, 15, 16, 17, -4, -4, 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, -4, -4, 8, 9, 55, 56, 0, 10, + 0, 11, 12, 13, 14, 15, 16, 17, -4, -4, 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, @@ -926,7 +973,7 @@ static const short yytable[] = { 68, 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, -4, 8, 9, 55, 56, -4, + 6, 7, 0, 0, 0, 8, 9, 55, 56, 0, 10, -4, 11, 12, 13, 14, 15, 16, 17, -4, -4, 18, 19, 20, 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, 0, 26, 27, 28, 29, 30, @@ -935,199 +982,191 @@ static const short yytable[] = { 68, 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, 0, -4, 8, 9, 55, 56, - -4, 10, 0, 11, 12, 13, 14, 15, 16, 17, + 5, 6, 7, 0, 0, 0, 8, 9, 55, 56, + 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, -4, -4, 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, -4, -4, 8, 9, 55, - 56, 0, 10, 0, 11, 12, 13, 14, 15, 16, - 17, -4, -4, 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, + 223, 51, 52, 53, 0, 54, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, + 56, 0, 0, 0, 2, -4, 3, 4, 5, 6, + 7, -4, -4, 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, + 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, 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, -4, 11, 12, 13, 14, 15, - 16, 17, -4, -4, 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, 0, 0, 8, - 9, 55, 56, 0, 10, 0, 11, 12, 13, 14, - 15, 16, 17, -4, -4, 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, 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, -4, 3, 4, 5, 6, 7, -4, + -4, 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, 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, - 49, 0, 0, 223, 51, 52, 53, 0, 54, 0, + 0, 0, 0, 49, 0, 0, 50, 51, 52, 53, + 0, 54, 0, 2, 0, 3, 4, 5, 6, 7, + 0, 0, -4, 8, 9, 55, 56, 0, 10, -4, + 11, 12, 13, 14, 15, 16, 17, -4, -4, 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, 55, 56, 0, 0, 0, 2, -4, 3, - 4, 5, 6, 7, -4, -4, 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, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 49, 0, 0, 50, 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, -4, -4, + 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, 0, 0, 0, 49, 0, - 0, 50, 51, 52, 53, 0, 54, 0, 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, 83, 84, 85, 86, 87, 88, 89, 90, 0, + 362, 91, 92, 93, 94, 95, 0, 0, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 34, 35, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 55, 56, 0, 0, 0, 2, -4, 3, 4, 5, - 6, 7, -4, -4, 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, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, + 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, + 0, 134, 0, 135, 0, 136, 137, 138, 139, 0, + 0, 0, 0, 0, 0, 0, 140, 0, 0, 0, + 0, 0, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 0, 151, 0, 0, 3, 4, 5, 0, + 7, 0, 152, 153, 8, 9, 0, 0, 0, 10, + 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 49, 0, 0, 50, - 51, 52, 53, 0, 54, 0, 2, 0, 3, 4, - 5, 6, 7, 0, 0, -4, 8, 9, 55, 56, - 0, 10, -4, 11, 12, 13, 14, 15, 16, 17, - -4, -4, 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, 0, 0, 3, - 4, 5, 6, 7, 0, 0, 0, 8, 9, 55, - 56, 0, 10, 0, 11, 12, 13, 14, 15, 16, - 17, -4, -4, 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 55, 56, 0, 0, 83, 84, 85, 86, 87, 88, - 89, 90, 0, 362, 91, 92, 93, 94, 95, 0, - 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 34, 35, 125, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 126, 127, 128, 129, 130, 131, 0, - 132, 133, 0, 0, 134, 0, 135, 0, 136, 137, - 138, 139, 0, 0, 0, 0, 0, 0, 0, 140, - 0, 0, 0, 0, 0, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 0, 151, 0, 0, 3, - 4, 5, 0, 7, 0, 152, 153, 8, 9, 0, - 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, - 17, 0, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 193, 194, 54, 0, 0, -346, - -346, -346, 0, -346, 0, 0, 0, -346, -346, 0, - 195, 56, -346, 289, -346, -346, -346, -346, -346, -346, - -346, 295, 0, -346, -346, -346, -346, -346, -346, -346, - 0, 0, 0, 0, 0, 0, 0, 0, -346, 0, - 0, -346, -346, -346, -346, -346, -346, -346, -346, -346, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, -346, -346, -346, 0, + -346, 0, 0, 0, -346, -346, 0, 195, 56, -346, + 289, -346, -346, -346, -346, -346, -346, -346, 295, 0, + -346, -346, -346, -346, -346, -346, -346, 0, 0, 0, + 0, 0, 0, 0, 0, -346, 0, 0, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, + -346, -346, -346, -346, -346, -346, -346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -346, 0, - 0, -346, -346, -346, -346, -346, -346, 0, 0, -348, - -348, -348, 0, -348, 0, 0, 0, -348, -348, 0, - -346, -346, -348, -346, -348, -348, -348, -348, -348, -348, - -348, -346, 0, -348, -348, -348, -348, -348, -348, -348, - 0, 0, 0, 0, 0, 0, 0, 0, -348, 0, - 0, -348, -348, -348, -348, -348, -348, -348, -348, -348, + 0, 0, 0, 0, 0, -346, 0, 0, -346, -346, + -346, -346, -346, -346, 0, 0, -348, -348, -348, 0, + -348, 0, 0, 0, -348, -348, 0, -346, -346, -348, + -346, -348, -348, -348, -348, -348, -348, -348, -346, 0, + -348, -348, -348, -348, -348, -348, -348, 0, 0, 0, + 0, 0, 0, 0, 0, -348, 0, 0, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, + -348, -348, -348, -348, -348, -348, -348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -348, 0, - 0, -348, -348, -348, -348, -348, -348, 0, 0, -347, - -347, -347, 0, -347, 0, 0, 0, -347, -347, 0, - -348, -348, -347, -348, -347, -347, -347, -347, -347, -347, - -347, -348, 0, -347, -347, -347, -347, -347, -347, -347, - 0, 0, 0, 0, 0, 0, 0, 0, -347, 0, - 0, -347, -347, -347, -347, -347, -347, -347, -347, -347, + 0, 0, 0, 0, 0, -348, 0, 0, -348, -348, + -348, -348, -348, -348, 0, 0, -347, -347, -347, 0, + -347, 0, 0, 0, -347, -347, 0, -348, -348, -347, + -348, -347, -347, -347, -347, -347, -347, -347, -348, 0, + -347, -347, -347, -347, -347, -347, -347, 0, 0, 0, + 0, 0, 0, 0, 0, -347, 0, 0, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, + -347, -347, -347, -347, -347, -347, -347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -347, 0, - 0, -347, -347, -347, -347, -347, -347, 0, 0, 3, - 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, - -347, -347, 10, -347, 11, 12, 13, 14, 15, 16, - 17, -347, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, -347, 0, 0, -347, -347, + -347, -347, -347, -347, 0, 0, 3, 4, 5, 0, + 7, 0, 0, 0, 8, 9, 0, -347, -347, 10, + -347, 11, 12, 13, 14, 15, 16, 17, -347, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 0, 0, 49, 0, - 0, 192, 51, 52, 193, 194, 54, 0, 0, 3, - 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, - 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, - 17, 196, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, 3, 4, 5, 0, + 7, 0, 0, 0, 8, 9, 0, 195, 56, 10, + 0, 11, 12, 13, 14, 15, 16, 17, 196, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 0, 0, 49, 0, - 0, 192, 51, 52, 193, 194, 54, 0, 0, 3, - 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, - 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, - 17, 208, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, 3, 4, 5, 0, + 7, 0, 0, 0, 8, 9, 0, 195, 56, 10, + 0, 11, 12, 13, 14, 15, 16, 17, 208, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 0, 0, 49, 0, - 0, 192, 51, 52, 193, 194, 54, 0, 0, -346, - -346, -346, 0, -346, 0, 0, 0, -346, -346, 0, - 195, 56, -346, 0, -346, -346, -346, -346, -346, -346, - -346, 210, 0, -346, -346, -346, -346, -346, -346, -346, - 0, 0, 0, 0, 0, 0, 0, 0, -346, 0, - 0, -346, -346, -346, -346, -346, -346, -346, -346, -346, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, -346, -346, -346, 0, + -346, 0, 0, 0, -346, -346, 0, 195, 56, -346, + 0, -346, -346, -346, -346, -346, -346, -346, 210, 0, + -346, -346, -346, -346, -346, -346, -346, 0, 0, 0, + 0, 0, 0, 0, 0, -346, 0, 0, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, + -346, -346, -346, -346, -346, -346, -346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -346, 0, - 0, -346, -346, -346, -346, -346, -346, 0, 0, -347, - -347, -347, 0, -347, 0, 0, 0, -347, -347, 0, - -346, -346, -347, 0, -347, -347, -347, -347, -347, -347, - -347, -346, 0, -347, -347, -347, -347, -347, -347, -347, - 0, 0, 0, 0, 0, 0, 0, 0, -347, 0, - 0, -347, -347, -347, -347, -347, -347, -347, -347, -347, + 0, 0, 0, 0, 0, -346, 0, 0, -346, -346, + -346, -346, -346, -346, 0, 0, -348, -348, -348, 0, + -348, 0, 0, 0, -348, -348, 0, -346, -346, -348, + 0, -348, -348, -348, -348, -348, -348, -348, -346, 0, + -348, -348, -348, -348, -348, -348, -348, 0, 0, 0, + 0, 0, 0, 0, 0, -348, 0, 0, -348, -348, + -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, + -348, -348, -348, -348, -348, -348, -348, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -348, 0, 0, -348, -348, + -348, -348, -348, -348, 0, 0, -347, -347, -347, 0, + -347, 0, 0, 0, -347, -347, 0, -348, -348, -347, + 0, -347, -347, -347, -347, -347, -347, -347, -348, 0, + -347, -347, -347, -347, -347, -347, -347, 0, 0, 0, + 0, 0, 0, 0, 0, -347, 0, 0, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, + -347, -347, -347, -347, -347, -347, -347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -347, 0, - 0, -347, -347, -347, -347, -347, -347, 0, 0, 3, - 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, - -347, -347, 10, 0, 11, 12, 13, 14, 15, 16, - 17, -347, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, -347, 0, 0, -347, -347, + -347, -347, -347, -347, 0, 0, 3, 4, 5, 0, + 7, 0, 0, 0, 8, 9, 0, -347, -347, 10, + 0, 11, 12, 13, 14, 15, 16, 17, -347, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 0, 0, 49, 0, - 0, 192, 51, 52, 193, 194, 54, 0, 0, 3, - 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, - 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, - 17, 485, 0, 181, 182, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, 3, 4, 5, 0, + 7, 0, 0, 0, 8, 9, 0, 195, 56, 10, + 0, 11, 12, 13, 14, 15, 16, 17, 487, 0, + 181, 182, 20, 21, 22, 23, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 27, 0, 0, 30, 31, + 171, 172, 34, 35, 173, 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, 0, 0, 0, 49, 0, - 0, 192, 51, 52, 193, 194, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 195, 56, 83, 84, 85, 86, 87, 88, 89, 90, - 0, 491, 91, 92, 93, 94, 95, 0, 0, 96, + 0, 0, 0, 0, 0, 49, 0, 0, 192, 51, + 52, 193, 194, 54, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 195, 56, 83, + 84, 85, 86, 87, 88, 89, 90, 0, 493, 91, + 92, 93, 94, 95, 0, 0, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 160, 161, 162, 163, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 164, 165, 166, 124, 234, 235, 167, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, + 128, 129, 130, 131, 0, 132, 133, 0, 0, 134, + 0, 135, 0, 136, 137, 138, 139, 0, 0, 0, + 0, 0, 0, 0, 140, 0, 0, 0, 0, 0, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 0, 151, 83, 84, 85, 86, 87, 88, 89, 90, + 152, 0, 91, 92, 93, 94, 95, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 160, 161, 162, 163, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 164, 165, 166, 124, 234, 235, + 117, 118, 119, 120, 164, 165, 166, 124, 213, 0, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 0, 134, 0, 135, 0, 136, 137, 138, 139, @@ -1138,366 +1177,348 @@ static const short yytable[] = { 68, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 160, 161, 162, 163, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 164, 165, 166, - 124, 213, 0, 167, 0, 0, 0, 0, 0, 0, + 124, 0, 0, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 0, 134, 0, 135, 0, 136, 137, 138, 139, 0, 0, 0, 0, 0, 0, 0, 140, 0, 0, 0, 0, 0, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 0, 151, 83, 84, - 85, 86, 87, 88, 89, 90, 152, 0, 91, 92, - 93, 94, 95, 0, 0, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 160, 161, 162, 163, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 164, 165, 166, 124, 0, 0, 167, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 126, 127, 128, - 129, 130, 131, 0, 132, 133, 0, 0, 134, 0, - 135, 0, 136, 137, 138, 139, 0, 0, 0, 0, - 0, 0, 0, 140, 0, 0, 0, 0, 0, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 0, - 151, 0, 3, 4, 5, 0, 7, 0, 0, 152, - 8, 9, 0, 0, 0, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 20, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 145, 146, 147, 148, 149, 150, 0, 151, 0, 3, + 4, 5, 0, 7, 0, 0, 152, 8, 9, 0, + 0, 0, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 20, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 49, 0, 0, 192, 51, 52, 193, 194, 54, - 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, - 0, 7, 0, 195, 56, 8, 9, 0, 0, 329, - 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, - 0, 181, 182, 20, 21, 22, 23, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 27, 0, 0, 30, - 31, 171, 172, 34, 35, 173, 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, 192, - 51, 52, 193, 194, 54, 0, 0, 0, 0, 0, - 0, 0, 3, 4, 5, 6, 7, 0, 195, 56, - 8, 9, 0, 0, 338, 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, 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, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 55, 56, 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, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 55, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 20, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 193, 194, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 460, 194, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 466, 194, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 582, 194, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 370, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 444, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 543, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 578, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 0, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 20, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 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, 192, 51, 52, 0, 0, 54, - 0, 0, 3, 4, 5, 0, 7, 0, 0, 0, - 8, 9, 0, 195, 56, 10, 0, 11, 12, 13, - 14, 15, 16, 17, 0, 0, 181, 182, 183, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 184, 0, 0, 30, 31, 171, 172, 34, 35, - 173, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 0, 0, 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, - 3, 4, 5, 0, 7, 554, 0, 0, 8, 9, - 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, - 16, 17, 0, 0, 181, 182, 183, 21, 22, 23, - 24, 0, 0, 0, 0, 0, 0, 0, 0, 184, - 0, 0, 30, 31, 171, 172, 34, 35, 173, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, - 0, 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, 3, 4, - 5, 0, 7, 0, 0, 0, 8, 9, 0, 0, - 0, 10, 0, 11, 12, 13, 14, 15, 16, 17, - 0, 0, 181, 182, 183, 21, 22, 23, 24, 0, - 0, 0, 0, 0, 0, 0, 0, 184, 0, 0, - 30, 31, 171, 172, 34, 35, 173, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, - 254, 51, 52, 255, 0, 54, 3, 4, 5, 0, - 7, 0, 0, 0, 8, 9, 0, 0, 0, 10, - 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, - 181, 182, 183, 21, 22, 23, 24, 0, 0, 0, - 0, 0, 0, 0, 0, 184, 0, 0, 30, 31, - 171, 172, 34, 35, 173, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 49, 0, 0, 254, 51, - 52, 482, 0, 54, 3, 4, 5, 0, 7, 0, - 0, 0, 8, 9, 0, 0, 0, 10, 0, 11, + 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, + 0, 192, 51, 52, 193, 194, 54, 0, 0, 0, + 0, 0, 0, 0, 3, 4, 5, 0, 7, 0, + 195, 56, 8, 9, 0, 0, 329, 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 181, 182, - 183, 21, 22, 23, 24, 0, 0, 0, 0, 0, - 0, 0, 0, 184, 0, 0, 30, 31, 171, 172, + 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, + 0, 0, 0, 27, 0, 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 0, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 0, 0, 271, - 272, 0, 0, 49, 331, 0, 192, 51, 52, 0, - 0, 54, 273, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 273, 484, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 273, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268,-32768,-32768, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258, 259, 260, 261, 262, 263, - 264, 265, 0, 267, 268, 0, 0, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258,-32768,-32768,-32768,-32768, 263, - 264, 0, 0,-32768,-32768, 0, 0, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 258, 259, 260, 261, 262, 263, - 264, 0, 0, 267, 268, 0, 0, 0, 0, 271, - 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283 + 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, 192, 51, 52, 193, + 194, 54, 0, 0, 0, 0, 0, 0, 0, 3, + 4, 5, 6, 7, 0, 195, 56, 8, 9, 0, + 0, 338, 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, 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, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 55, 56, 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, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 55, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 20, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 193, 194, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 462, 194, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 468, 194, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 584, 194, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 370, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 446, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 545, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 580, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 0, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 20, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 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, 192, 51, 52, 0, 0, 54, 0, 0, 3, + 4, 5, 0, 7, 0, 0, 0, 8, 9, 0, + 195, 56, 10, 0, 11, 12, 13, 14, 15, 16, + 17, 0, 0, 181, 182, 183, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 184, 0, + 0, 30, 31, 171, 172, 34, 35, 173, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, + 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, 3, 4, 5, + 0, 7, 556, 0, 0, 8, 9, 0, 0, 0, + 10, 0, 11, 12, 13, 14, 15, 16, 17, 0, + 0, 181, 182, 183, 21, 22, 23, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 184, 0, 0, 30, + 31, 171, 172, 34, 35, 173, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 0, 0, 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, 3, 4, 5, 0, 7, + 0, 0, 0, 8, 9, 0, 0, 0, 10, 0, + 11, 12, 13, 14, 15, 16, 17, 0, 0, 181, + 182, 183, 21, 22, 23, 24, 0, 0, 0, 0, + 0, 0, 0, 0, 184, 0, 0, 30, 31, 171, + 172, 34, 35, 173, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 49, 0, 0, 254, 51, 52, + 255, 0, 54, 3, 4, 5, 0, 7, 0, 0, + 0, 8, 9, 0, 0, 0, 10, 0, 11, 12, + 13, 14, 15, 16, 17, 0, 0, 181, 182, 183, + 21, 22, 23, 24, 0, 0, 0, 0, 0, 0, + 0, 0, 184, 0, 0, 30, 31, 171, 172, 34, + 35, 173, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 49, 0, 0, 254, 51, 52, 484, 0, + 54, 3, 4, 5, 0, 7, 0, 0, 0, 8, + 9, 0, 0, 0, 10, 0, 11, 12, 13, 14, + 15, 16, 17, 0, 0, 181, 182, 183, 21, 22, + 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, + 184, 0, 0, 30, 31, 171, 172, 34, 35, 173, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 0, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 0, 0, 271, 272, 0, 0, + 49, 0, 0, 192, 51, 52, 0, 0, 54, 273, + 486, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 0, 0, 271, 272, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 273, + 0, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283 }; static const short yycheck[] = { 1, - 2, 6, 184, 13, 206, 7, 8, 9, 10, 11, - 12, 13, 65, 180, 177, 13, 18, 19, 20, 210, - 305, 26, 52, 25, 311, 50, 8, 9, 76, 11, - 12, 58, 2, 18, 19, 20, 332, 336, 51, 52, - 336, 19, 13, 25, 432, 433, 34, 35, 50, 54, - 1, 53, 26, 55, 81, 53, 4, 64, 13, 34, - 35, 360, 116, 65, 47, 107, 47, 26, 34, 35, - 47, 223, 81, 26, 76, 34, 35, 64, 80, 34, - 35, 81, 47, 111, 512, 47, 514, 514, 116, 51, - 81, 76, 99, 100, 101, 102, 103, 15, 80, 17, - 109, 49, 254, 112, 295, 88, 89, 88, 89, 109, - 325, 88, 89, 26, 101, 102, 103, 79, 109, 83, - 335, 112, 304, 88, 89, 327, 83, 91, 116, 117, - 1, 2, 115, 107, 91, 110, 7, 8, 9, 10, - 11, 12, 427, 191, 95, 116, 117, 18, 19, 20, - 116, 153, 179, 180, 25, 81, 443, 116, 117, 341, - 456, 116, 117, 116, 117, 116, 117, 595, 595, 72, - 111, 153, 81, 81, 81, 116, 91, 565, 566, 50, - 107, 107, 570, 109, 55, 26, 112, 83, 115, 115, - 192, 81, 111, 96, 196, 91, 81, 64, 223, 83, - 109, 109, 109, 112, 112, 76, 208, 91, 210, 80, - 47, 196, 79, 80, 51, 111, 218, 83, 196, 109, - 608, 223, 112, 208, 109, 91, 81, 112, 81, 254, - 208, 98, 99, 100, 101, 102, 103, 111, 537, 252, - 230, 537, 232, 245, 246, 247, 248, 249, 250, 251, - 83, 8, 254, 255, 109, 107, 109, 255, 91, 112, - 111, 463, 81, 81, 246, 247, 248, 249, 250, 251, - 437, 298, 299, 116, 117, 245, 81, 83, 111, 83, - 81, 81, 153, 446, 286, 91, 571, 91, 455, 17, - 109, 109, 579, 295, 485, 47, 48, 310, 83, 51, - 491, 303, 332, 316, 109, 111, 91, 111, 109, 109, - 25, 313, 115, 315, 111, 81, 115, 319, 49, 321, - 115, 192, 375, 325, 326, 196, 64, 509, 111, 60, - 61, 47, 48, 335, 536, 51, 115, 208, 540, 210, - 345, 79, 80, 109, 326, 1, 348, 218, 107, 47, - 48, 7, 223, 51, 10, 34, 35, 64, 96, 97, - 98, 99, 100, 101, 102, 103, 47, 48, 14, 15, - 51, 110, 111, 375, 245, 246, 247, 248, 249, 250, - 251, 110, 15, 254, 110, 110, 113, 1, 2, 108, - 111, 5, 13, 7, 8, 9, 10, 11, 12, 13, - 10, 110, 429, 405, 110, 607, 408, 110, 108, 110, - 437, 25, 575, 284, 285, 286, 111, 111, 420, 421, - 405, 110, 113, 408, 295, 110, 428, 10, 455, 91, - 435, 436, 303, 110, 47, 47, 50, 439, 420, 53, - 111, 111, 313, 111, 315, 111, 9, 111, 319, 10, - 321, 65, 323, 324, 325, 326, 37, 38, 39, 40, - 10, 115, 115, 334, 335, 113, 80, 89, 111, 113, - 108, 473, 10, 10, 89, 502, 10, 348, 10, 350, - 482, 10, 110, 485, 482, 495, 110, 96, 10, 491, - 108, 473, 10, 495, 496, 497, 10, 495, 10, 501, - 111, 0, 110, 1, 2, 0, 610, 412, 579, 7, - 8, 9, 10, 11, 12, 13, 495, 572, 520, 5, - 571, 523, -1, 525, -1, 427, 512, 25, -1, 531, - -1, -1, -1, 535, 405, -1, -1, 408, 64, 153, - -1, -1, -1, 525, -1, -1, -1, -1, -1, 420, - 421, -1, 50, 79, 80, 53, -1, 428, -1, -1, - -1, -1, 218, -1, -1, -1, -1, 65, 439, -1, - -1, -1, -1, 99, 100, 101, 102, 103, 192, -1, - -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 599, -1, 601, - -1, -1, 473, -1, 218, -1, -1, -1, -1, 223, - -1, -1, -1, -1, 485, -1, -1, -1, -1, -1, - 491, -1, -1, -1, -1, 496, 497, -1, -1, -1, - 501, 245, 246, 247, 248, 249, 250, 251, -1, -1, - 254, 255, -1, -1, 1, 2, -1, 303, -1, 520, - 7, -1, 523, 10, 525, 153, -1, 313, -1, 315, - 531, -1, -1, 319, 535, 321, -1, -1, -1, -1, + 2, 177, 6, 13, 206, 7, 8, 9, 10, 11, + 12, 13, 65, 18, 19, 20, 18, 19, 20, 13, + 210, 180, 26, 25, 184, 52, 8, 9, 305, 11, + 12, 2, 311, 26, 336, 51, 52, 50, 58, 13, + 19, 1, 4, 25, 34, 35, 76, 516, 50, 47, + 54, 53, 332, 55, 434, 435, 336, 64, 360, 53, + 13, 81, 514, 65, 516, 26, 47, 116, 34, 35, + 47, 76, 47, 223, 76, 81, 72, 26, 80, 34, + 35, 34, 35, 107, 47, 34, 35, 49, 51, 325, + 88, 89, 99, 100, 101, 102, 103, 111, 80, 335, + 96, 107, 116, 109, 254, 295, 112, 88, 89, 115, + 49, 88, 89, 88, 89, 47, 79, 115, 230, 51, + 232, 60, 61, 116, 117, 327, 116, 117, 597, 8, + 1, 2, 15, 26, 17, 95, 7, 8, 9, 10, + 11, 12, 116, 117, 304, 597, 107, 18, 19, 20, + 116, 153, 429, 111, 25, 110, 116, 117, 81, 179, + 180, 191, 64, 116, 117, 83, 445, 116, 117, 107, + 81, 153, 91, 91, 1, 2, 81, 115, 458, 50, + 7, 341, 26, 10, 55, 81, 109, 567, 568, 112, + 192, 196, 572, 111, 196, 111, 64, 81, 109, 101, + 102, 103, 17, 208, 109, 76, 208, 112, 210, 80, + 223, 79, 80, 109, 111, 107, 218, 196, 25, 116, + 115, 223, 81, 50, 115, 109, 81, 81, 112, 208, + 610, 99, 100, 101, 102, 103, 252, 539, 116, 117, + 115, 254, 81, 245, 246, 247, 248, 249, 250, 251, + 109, 111, 254, 255, 109, 109, 107, 112, 112, 539, + 81, 255, 81, 465, 246, 247, 248, 249, 250, 251, + 109, 81, 448, 112, 245, 83, 111, 83, 298, 299, + 439, 83, 153, 91, 286, 91, 81, 83, 109, 91, + 109, 112, 64, 295, 310, 91, 573, 487, 457, 109, + 316, 303, 581, 493, 83, 332, 81, 79, 80, 111, + 81, 313, 91, 315, 109, 111, 115, 319, 111, 321, + 81, 192, 375, 325, 326, 196, 98, 99, 100, 101, + 102, 103, 111, 335, 109, 83, 538, 208, 109, 210, + 542, 345, 83, 91, 326, 83, 348, 218, 109, 64, + 91, 511, 223, 91, 47, 48, 47, 48, 51, 110, + 51, 110, 47, 48, 110, 192, 51, 47, 48, 34, + 35, 51, 108, 375, 245, 246, 247, 248, 249, 250, + 251, 14, 15, 254, 37, 38, 39, 40, 110, 111, + 113, 218, 111, 15, 13, 10, 223, 110, 110, 110, + 405, 577, 108, 405, 111, 410, 110, 609, 410, 111, + 110, 431, 113, 284, 285, 286, 110, 10, 245, 439, + 422, 423, 110, 91, 295, 111, 47, 254, 430, 47, + 111, 9, 303, 437, 438, 111, 111, 457, 111, 441, + 422, 10, 313, 10, 315, 115, 115, 113, 319, 89, + 321, 111, 323, 324, 325, 326, 113, 108, 10, 10, + 89, 10, 10, 334, 335, 10, 110, 110, 96, 10, + 108, 10, 111, 475, 110, 10, 303, 348, 10, 350, + 0, 0, 484, 612, 504, 487, 313, 497, 315, 497, + 484, 493, 319, 475, 321, 497, 498, 499, 1, 2, + 414, 503, 5, 497, 7, 8, 9, 10, 11, 12, + 13, 581, 574, 5, 573, 514, 429, -1, -1, -1, + 522, 348, 25, 525, -1, 527, -1, -1, -1, -1, + -1, 533, -1, -1, 405, 537, -1, -1, -1, 410, + -1, -1, -1, -1, -1, 527, -1, 50, -1, 1, + 53, 422, 423, -1, -1, 7, -1, -1, 10, 430, + -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, + 441, -1, -1, -1, -1, -1, -1, 80, -1, -1, + -1, 1, 2, -1, -1, -1, -1, 7, 8, 9, + 10, 11, 12, 13, -1, -1, 423, -1, -1, 601, + -1, 603, 64, 430, 475, 25, -1, -1, -1, -1, + -1, -1, -1, -1, 441, -1, 487, 79, 80, -1, + -1, -1, 493, -1, -1, -1, -1, 498, 499, -1, + 50, -1, 503, 53, 96, 97, 98, 99, 100, 101, + 102, 103, -1, -1, -1, 65, -1, -1, -1, -1, + 153, 522, -1, -1, 525, -1, 527, -1, -1, -1, + 80, -1, 533, -1, -1, -1, 537, -1, -1, -1, + -1, 498, 499, -1, -1, -1, 503, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, + -1, -1, -1, -1, -1, 522, -1, -1, 525, -1, + -1, -1, -1, -1, -1, -1, 533, -1, -1, -1, + 537, -1, -1, -1, -1, 218, -1, -1, -1, -1, + 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 601, -1, 603, 153, -1, -1, -1, -1, -1, -1, + -1, -1, 245, 246, 247, 248, 249, 250, 251, -1, + -1, 254, 255, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 218, -1, 79, 80, + -1, -1, 192, 84, 601, -1, 603, -1, -1, -1, + -1, 92, -1, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, -1, -1, -1, -1, -1, 218, -1, + 303, -1, -1, 223, -1, -1, -1, -1, -1, -1, + 313, -1, 315, -1, -1, -1, 319, -1, 321, -1, + -1, -1, -1, 326, -1, 245, 246, 247, 248, 249, + 250, 251, -1, -1, 254, 255, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 348, -1, -1, -1, -1, + -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 313, -1, 315, -1, -1, -1, 319, -1, 321, + -1, -1, 375, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 313, -1, 315, 348, -1, -1, 319, + -1, 321, -1, -1, -1, -1, 326, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 422, + 423, -1, -1, -1, -1, -1, -1, 430, 348, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 441, -1, + -1, -1, -1, -1, -1, -1, 18, 19, 20, -1, + -1, -1, -1, -1, -1, 375, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 303, - -1, -1, 348, 50, 192, -1, -1, -1, -1, 313, - -1, 315, -1, -1, -1, 319, -1, 321, -1, -1, - -1, -1, 326, -1, -1, -1, -1, -1, -1, -1, - 218, -1, -1, -1, -1, 223, -1, -1, 599, -1, - 601, -1, -1, -1, 348, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 245, 246, 247, - 248, 249, 250, 251, -1, -1, 254, 255, -1, -1, - -1, 375, -1, -1, -1, 421, -1, -1, -1, -1, - -1, -1, 428, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 439, -1, -1, -1, -1, -1, -1, + -1, 423, 475, -1, -1, 47, 48, -1, 430, 51, + 52, 484, -1, 55, 56, -1, -1, -1, -1, 441, + -1, -1, -1, -1, 497, 498, 499, -1, -1, -1, + 503, -1, 422, 423, 76, -1, -1, -1, -1, -1, + 430, -1, -1, -1, -1, -1, -1, -1, -1, 522, + -1, 441, 525, -1, 527, -1, -1, -1, -1, -1, + 533, -1, -1, -1, 537, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 498, 499, -1, -1, + -1, 503, -1, -1, -1, 475, 64, 65, 66, 67, + 68, 69, 70, 71, 484, 73, 74, -1, -1, -1, + 522, 79, 80, 525, -1, -1, -1, 497, 498, 499, + -1, 533, -1, 503, -1, 537, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, -1, -1, 601, -1, + 603, -1, 522, -1, -1, 525, -1, 527, -1, -1, + -1, -1, -1, 533, -1, -1, -1, 537, -1, -1, + -1, 193, 194, 195, 196, 64, 65, 66, 67, 68, + 69, 70, -1, -1, 73, 74, 208, -1, 210, -1, + 79, 80, -1, -1, -1, -1, -1, -1, -1, 601, + -1, 603, -1, -1, -1, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 303, 420, 421, -1, -1, - -1, -1, -1, -1, 428, 313, -1, 315, -1, -1, - -1, 319, -1, 321, -1, 439, -1, -1, 326, -1, - -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, - 496, 497, -1, -1, -1, 501, -1, -1, -1, -1, - 348, -1, -1, -1, -1, -1, -1, -1, -1, 473, - -1, 218, -1, -1, 520, -1, 223, 523, 482, -1, - 18, 19, 20, -1, -1, 531, -1, 375, -1, 535, - -1, 495, 496, 497, -1, -1, -1, 501, 245, -1, - -1, -1, -1, -1, -1, -1, -1, 254, -1, 47, - 48, -1, -1, 51, 52, -1, 520, 55, 56, 523, - -1, 525, -1, -1, -1, -1, -1, 531, -1, -1, - -1, 535, 420, 421, -1, -1, -1, -1, 76, -1, - 428, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 439, -1, 599, -1, 601, 303, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 313, -1, 315, -1, - -1, -1, 319, -1, 321, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 473, -1, -1, -1, -1, - -1, -1, -1, -1, 482, 599, -1, 601, -1, -1, - -1, 348, -1, -1, -1, -1, -1, 495, 496, 497, - -1, -1, -1, 501, -1, -1, -1, -1, -1, -1, + 252, 601, -1, 603, -1, -1, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, -1, -1, 286, -1, -1, -1, -1, -1, + -1, 293, 294, 295, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, + -1, -1, -1, -1, 316, -1, -1, -1, -1, -1, + -1, -1, -1, 325, -1, -1, -1, -1, -1, 331, + 332, -1, -1, 335, 336, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 347, -1, -1, -1, -1, + -1, -1, 354, -1, -1, -1, -1, -1, 360, 8, + 9, -1, 11, 12, -1, -1, -1, -1, 370, 18, + 19, 20, -1, -1, -1, -1, 25, -1, -1, -1, + -1, -1, -1, -1, -1, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, -1, -1, + 79, 80, -1, 405, -1, -1, 55, -1, 410, -1, + -1, -1, -1, 415, 416, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, -1, -1, 76, -1, -1, + -1, 80, -1, -1, -1, -1, -1, 64, 65, 66, + 67, 68, 69, 70, 446, -1, 73, 74, -1, -1, + -1, -1, 79, 80, -1, -1, -1, -1, -1, -1, + 462, -1, -1, -1, -1, -1, 468, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, -1, -1, -1, + 482, -1, -1, -1, 486, 487, -1, 489, 490, 491, + 492, 493, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 153, -1, 508, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 520, -1, -1, 523, -1, 525, -1, -1, - -1, -1, -1, 531, -1, -1, -1, 535, -1, -1, - -1, -1, -1, -1, -1, 193, 194, 195, 196, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 208, -1, 210, -1, 421, -1, -1, -1, -1, -1, - -1, 428, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 439, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 599, -1, 601, 252, -1, -1, -1, -1, -1, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, -1, -1, 286, 496, - 497, -1, -1, -1, 501, 293, 294, 295, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 310, 520, -1, -1, 523, -1, 316, 8, - 9, -1, 11, 12, 531, -1, -1, 325, 535, 18, - 19, 20, -1, 331, 332, -1, 25, 335, 336, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 347, - -1, -1, -1, -1, -1, -1, 354, -1, -1, -1, - -1, -1, 360, -1, -1, -1, 55, -1, -1, -1, - -1, -1, 370, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, - -1, 80, 599, -1, 601, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, - 408, -1, -1, -1, -1, 413, 414, -1, -1, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, -1, -1, 79, 80, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 444, 92, -1, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, - -1, -1, 460, -1, 153, -1, 111, -1, 466, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 480, -1, -1, -1, 484, 485, -1, 487, - 488, 489, 490, 491, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 196, 506, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, - -1, 210, -1, 521, -1, -1, -1, -1, -1, -1, - -1, -1, 530, -1, -1, -1, -1, -1, -1, 537, - -1, -1, -1, -1, -1, 543, -1, -1, -1, -1, - -1, -1, -1, -1, 552, 553, -1, 246, 247, 248, + -1, 523, -1, -1, -1, -1, -1, -1, -1, -1, + 532, -1, -1, -1, -1, -1, -1, 539, -1, -1, + -1, -1, -1, 545, -1, -1, -1, 196, -1, -1, + -1, -1, 554, 555, -1, -1, -1, -1, -1, 208, + -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 580, -1, + -1, -1, 584, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 246, 247, 248, 249, 250, 251, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, 3, 4, 5, 6, 7, -1, - 578, -1, 11, 12, 582, -1, -1, 16, -1, 18, + -1, -1, 11, 12, -1, -1, -1, 16, -1, 18, 19, 20, 21, 22, 23, 24, -1, 286, 27, 28, 29, 30, 31, 32, 33, -1, 295, 36, -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, @@ -1505,54 +1526,88 @@ static const short yycheck[] = { 1, 59, 60, 61, 62, 63, -1, 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, 335, -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, - -1, 90, -1, -1, -1, -1, -1, -1, -1, 0, - -1, -1, -1, -1, -1, 104, 105, 8, 9, 10, - -1, -1, -1, 14, 15, -1, 17, 116, 117, -1, - -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, - -1, -1, -1, 34, 35, -1, 37, 38, 39, 40, - -1, -1, -1, -1, -1, -1, 405, -1, -1, 408, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 420, -1, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, -1, -1, 79, 80, - 81, -1, 83, -1, -1, -1, -1, -1, -1, -1, - 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, -1, -1, -1, -1, 108, 109, 110, - 111, 112, -1, 0, 473, 116, 117, -1, -1, -1, - -1, 8, 9, 10, -1, -1, 485, 14, 15, -1, - 17, -1, 491, -1, -1, -1, -1, -1, -1, 26, - -1, -1, -1, -1, -1, -1, -1, 34, 35, -1, - 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 525, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - -1, -1, 79, 80, 81, -1, 83, -1, -1, -1, - -1, -1, -1, -1, 91, 92, -1, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, -1, 0, -1, - -1, 108, 109, 110, 111, 112, 8, 9, 10, 116, - 117, -1, 14, 15, -1, 17, -1, -1, -1, -1, - -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, - -1, -1, 34, 35, -1, 37, 38, 39, 40, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, -1, -1, 79, 80, 81, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 90, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 104, 105, 79, 80, -1, + -1, -1, -1, -1, -1, -1, -1, 116, 117, -1, 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, -1, -1, -1, -1, 108, 109, 110, -1, - 112, -1, -1, -1, 116, 117, 1, -1, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, - 15, 16, -1, 18, 19, 20, 21, 22, 23, 24, - -1, -1, 27, 28, 29, 30, 31, 32, 33, -1, - -1, 36, -1, -1, -1, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, + 102, 103, -1, -1, -1, -1, -1, -1, -1, 111, + -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, + -1, 410, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 422, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, -1, -1, 8, 9, 10, -1, -1, -1, 14, + 15, -1, 17, -1, -1, -1, -1, -1, -1, -1, + -1, 26, -1, -1, -1, -1, -1, -1, -1, 34, + 35, -1, 37, 38, 39, 40, 475, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, + -1, -1, -1, -1, 493, -1, -1, -1, -1, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, -1, -1, 79, 80, 81, -1, 83, -1, + -1, -1, -1, -1, -1, -1, 91, 92, 527, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, + 0, -1, -1, 108, 109, 110, 111, 112, 8, 9, + 10, 116, 117, -1, 14, 15, -1, 17, -1, -1, + -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, + -1, -1, -1, -1, 34, 35, -1, 37, 38, 39, + 40, -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, 82, -1, -1, - 85, 86, 87, 88, -1, 90, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, - 105, -1, -1, -1, 1, -1, 3, 4, 5, 6, - 7, 116, 117, 10, 11, 12, -1, 14, 15, 16, - -1, 18, 19, 20, 21, 22, 23, 24, -1, -1, + -1, -1, -1, -1, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, -1, -1, 79, + 80, 81, -1, 83, -1, -1, -1, -1, -1, -1, + -1, 91, 92, -1, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, -1, 0, -1, -1, 108, 109, + 110, 111, 112, 8, 9, 10, 116, 117, -1, 14, + 15, -1, 17, -1, -1, -1, -1, -1, -1, -1, + -1, 26, -1, -1, -1, -1, -1, -1, -1, 34, + 35, -1, 37, 38, 39, 40, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, -1, -1, 79, 80, 81, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 92, -1, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, + -1, -1, -1, 108, 109, 110, -1, 112, -1, -1, + -1, 116, 117, 1, -1, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, -1, -1, 15, 16, -1, + 18, 19, 20, 21, 22, 23, 24, -1, -1, 27, + 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, + -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, + 88, -1, 90, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 104, 105, -1, -1, + -1, 1, -1, 3, 4, 5, 6, 7, 116, 117, + 10, 11, 12, -1, 14, 15, 16, -1, 18, 19, + 20, 21, 22, 23, 24, -1, -1, 27, 28, 29, + 30, 31, 32, 33, -1, -1, 36, -1, -1, -1, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, 87, 88, -1, + 90, -1, 1, -1, 3, 4, 5, 6, 7, -1, + -1, 10, 11, 12, 104, 105, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 116, 117, 27, 28, + 29, 30, 31, 32, 33, -1, -1, 36, -1, -1, + -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, + -1, 90, -1, 1, -1, 3, 4, 5, 6, 7, + -1, -1, 10, 11, 12, 104, 105, 15, 16, -1, + 18, 19, 20, 21, 22, 23, 24, 116, 117, 27, + 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, + -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, + 88, -1, 90, -1, 1, -1, 3, 4, 5, 6, + 7, -1, 9, 10, 11, 12, 104, 105, -1, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 116, 117, 27, 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, @@ -1560,7 +1615,7 @@ static const short yycheck[] = { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, -1, 1, -1, 3, 4, 5, - 6, 7, -1, -1, 10, 11, 12, 104, 105, 15, + 6, 7, -1, -1, -1, 11, 12, 104, 105, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 116, 117, 27, 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, 44, 45, @@ -1569,199 +1624,191 @@ static const short yycheck[] = { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, -1, 1, -1, 3, 4, - 5, 6, 7, -1, -1, 10, 11, 12, 104, 105, - 15, 16, -1, 18, 19, 20, 21, 22, 23, 24, + 5, 6, 7, -1, -1, -1, 11, 12, 104, 105, + -1, 16, -1, 18, 19, 20, 21, 22, 23, 24, 116, 117, 27, 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, - 85, 86, 87, 88, -1, 90, -1, 1, -1, 3, - 4, 5, 6, 7, -1, 9, 10, 11, 12, 104, - 105, -1, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 116, 117, 27, 28, 29, 30, 31, 32, 33, - -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 85, 86, 87, 88, -1, 90, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, + 105, -1, -1, -1, 1, 110, 3, 4, 5, 6, + 7, 116, 117, -1, 11, 12, -1, -1, -1, 16, + -1, 18, 19, 20, 21, 22, 23, 24, -1, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, 36, + -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, -1, 90, -1, 1, -1, - 3, 4, 5, 6, 7, -1, -1, -1, 11, 12, - 104, 105, -1, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 116, 117, 27, 28, 29, 30, 31, 32, - 33, -1, -1, 36, -1, -1, -1, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, - -1, -1, 85, 86, 87, 88, -1, 90, -1, 1, - -1, 3, 4, 5, 6, 7, -1, -1, -1, 11, - 12, 104, 105, -1, 16, -1, 18, 19, 20, 21, - 22, 23, 24, 116, 117, 27, 28, 29, 30, 31, - 32, 33, -1, -1, 36, -1, -1, -1, -1, 41, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, -1, 90, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 104, 105, -1, + -1, -1, 1, 110, 3, 4, 5, 6, 7, 116, + 117, -1, 11, 12, -1, -1, -1, 16, -1, 18, + 19, 20, 21, 22, 23, 24, -1, -1, 27, 28, + 29, 30, 31, 32, 33, -1, -1, 36, -1, -1, + -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, + -1, 90, -1, 1, -1, 3, 4, 5, 6, 7, + -1, -1, 10, 11, 12, 104, 105, -1, 16, 108, + 18, 19, 20, 21, 22, 23, 24, 116, 117, 27, + 28, 29, 30, 31, 32, 33, -1, -1, 36, -1, + -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, + 88, -1, 90, -1, -1, -1, 3, 4, 5, 6, + 7, -1, -1, -1, 11, 12, 104, 105, -1, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 116, 117, + 27, 28, 29, 30, 31, 32, 33, -1, -1, 36, + -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, -1, 90, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 104, 105, -1, + -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, + 117, 13, 14, 15, 16, 17, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 82, -1, -1, 85, 86, 87, 88, -1, 90, -1, + 62, 63, 64, 65, 66, 67, -1, 69, 70, -1, + -1, 73, -1, 75, -1, 77, 78, 79, 80, -1, + -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, + -1, -1, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, -1, 105, -1, -1, 3, 4, 5, -1, + 7, -1, 114, 115, 11, 12, -1, -1, -1, 16, + -1, 18, 19, 20, 21, 22, 23, 24, -1, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 104, 105, -1, -1, -1, 1, 110, 3, - 4, 5, 6, 7, 116, 117, -1, 11, 12, -1, - -1, -1, 16, -1, 18, 19, 20, 21, 22, 23, - 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + 107, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, -1, 90, -1, -1, -1, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + 107, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 104, 105, -1, -1, -1, 1, 110, 3, 4, 5, - 6, 7, 116, 117, -1, 11, 12, -1, -1, -1, - 16, -1, 18, 19, 20, 21, 22, 23, 24, -1, - -1, 27, 28, 29, 30, 31, 32, 33, -1, -1, - 36, -1, -1, -1, -1, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + 107, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, - 86, 87, 88, -1, 90, -1, 1, -1, 3, 4, - 5, 6, 7, -1, -1, 10, 11, 12, 104, 105, - -1, 16, 108, 18, 19, 20, 21, 22, 23, 24, - 116, 117, 27, 28, 29, 30, 31, 32, 33, -1, - -1, 36, -1, -1, -1, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + 107, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, - 85, 86, 87, 88, -1, 90, -1, -1, -1, 3, - 4, 5, 6, 7, -1, -1, -1, 11, 12, 104, - 105, -1, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 116, 117, 27, 28, 29, 30, 31, 32, 33, - -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, -1, 90, -1, -1, -1, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 104, 105, -1, -1, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 117, 13, 14, 15, 16, 17, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 62, 63, 64, 65, 66, 67, -1, - 69, 70, -1, -1, 73, -1, 75, -1, 77, 78, - 79, 80, -1, -1, -1, -1, -1, -1, -1, 88, - -1, -1, -1, -1, -1, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, -1, 105, -1, -1, 3, - 4, 5, -1, 7, -1, 114, 115, 11, 12, -1, - -1, -1, 16, -1, 18, 19, 20, 21, 22, 23, - 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, 107, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, 107, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, 107, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, 107, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, 3, 4, 5, -1, + 7, -1, -1, -1, 11, 12, -1, 104, 105, 16, + -1, 18, 19, 20, 21, 22, 23, 24, 115, -1, + 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, - 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, - 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 115, -1, 27, 28, 29, 30, 31, 32, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, - -1, 85, 86, 87, 88, 89, 90, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 104, 105, 3, 4, 5, 6, 7, 8, 9, 10, - -1, 115, 13, 14, 15, 16, 17, -1, -1, 20, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 104, 105, 3, + 4, 5, 6, 7, 8, 9, 10, -1, 115, 13, + 14, 15, 16, 17, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, + 64, 65, 66, 67, -1, 69, 70, -1, -1, 73, + -1, 75, -1, 77, 78, 79, 80, -1, -1, -1, + -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + -1, 105, 3, 4, 5, 6, 7, 8, 9, 10, + 114, -1, 13, 14, 15, 16, 17, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 41, 42, 43, 44, 45, 46, 47, 48, 49, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 67, -1, 69, 70, -1, -1, 73, -1, 75, -1, 77, 78, 79, 80, @@ -1772,219 +1819,189 @@ static const short yycheck[] = { 1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, -1, 51, -1, -1, -1, -1, -1, -1, + 48, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 67, -1, 69, 70, -1, -1, 73, -1, 75, -1, 77, 78, 79, 80, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, -1, 105, 3, 4, - 5, 6, 7, 8, 9, 10, 114, -1, 13, 14, - 15, 16, 17, -1, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, -1, -1, 51, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, - 65, 66, 67, -1, 69, 70, -1, -1, 73, -1, - 75, -1, 77, 78, 79, 80, -1, -1, -1, -1, - -1, -1, -1, 88, -1, -1, -1, -1, -1, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, - 105, -1, 3, 4, 5, -1, 7, -1, -1, 114, - 11, 12, -1, -1, -1, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, + 98, 99, 100, 101, 102, 103, -1, 105, -1, 3, + 4, 5, -1, 7, -1, -1, 114, 11, 12, -1, + -1, -1, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, - -1, 7, -1, 104, 105, 11, 12, -1, -1, 110, - 16, -1, 18, 19, 20, 21, 22, 23, 24, -1, - -1, 27, 28, 29, 30, 31, 32, 33, -1, -1, - -1, -1, -1, -1, -1, -1, 42, -1, -1, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, - 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, 104, 105, - 11, 12, -1, -1, 110, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, 36, -1, -1, -1, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, 36, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, 89, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, 89, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, 89, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, 89, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, -1, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, -1, -1, 90, - -1, -1, 3, 4, 5, -1, 7, -1, -1, -1, - 11, 12, -1, 104, 105, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, - 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 82, -1, -1, 85, 86, 87, 88, -1, 90, - 3, 4, 5, -1, 7, 96, -1, -1, 11, 12, - -1, -1, -1, 16, -1, 18, 19, 20, 21, 22, - 23, 24, -1, -1, 27, 28, 29, 30, 31, 32, - 33, -1, -1, -1, -1, -1, -1, -1, -1, 42, - -1, -1, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, - -1, -1, 85, 86, 87, 88, -1, 90, 3, 4, - 5, -1, 7, -1, -1, -1, 11, 12, -1, -1, - -1, 16, -1, 18, 19, 20, 21, 22, 23, 24, - -1, -1, 27, 28, 29, 30, 31, 32, 33, -1, - -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, - 85, 86, 87, 88, -1, 90, 3, 4, 5, -1, - 7, -1, -1, -1, 11, 12, -1, -1, -1, 16, - -1, 18, 19, 20, 21, 22, 23, 24, -1, -1, - 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, - -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, - 87, 88, -1, 90, 3, 4, 5, -1, 7, -1, - -1, -1, 11, 12, -1, -1, -1, 16, -1, 18, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, 89, 90, -1, -1, -1, + -1, -1, -1, -1, 3, 4, 5, -1, 7, -1, + 104, 105, 11, 12, -1, -1, 110, 16, -1, 18, 19, 20, 21, 22, 23, 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, -1, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, -1, -1, 79, - 80, -1, -1, 82, 84, -1, 85, 86, 87, -1, - -1, 90, 92, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 92, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, 71, -1, 73, 74, -1, -1, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, -1, -1, 73, 74, -1, -1, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 64, 65, 66, 67, 68, 69, - 70, -1, -1, 73, 74, -1, -1, -1, -1, 79, - 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103 + 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 82, -1, -1, 85, 86, 87, 88, + 89, 90, -1, -1, -1, -1, -1, -1, -1, 3, + 4, 5, 6, 7, -1, 104, 105, 11, 12, -1, + -1, 110, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, 36, -1, -1, -1, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, 36, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, 89, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, -1, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, -1, -1, 90, -1, -1, 3, + 4, 5, -1, 7, -1, -1, -1, 11, 12, -1, + 104, 105, 16, -1, 18, 19, 20, 21, 22, 23, + 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, 87, 88, -1, 90, 3, 4, 5, + -1, 7, 96, -1, -1, 11, 12, -1, -1, -1, + 16, -1, 18, 19, 20, 21, 22, 23, 24, -1, + -1, 27, 28, 29, 30, 31, 32, 33, -1, -1, + -1, -1, -1, -1, -1, -1, 42, -1, -1, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 82, -1, -1, 85, + 86, 87, 88, -1, 90, 3, 4, 5, -1, 7, + -1, -1, -1, 11, 12, -1, -1, -1, 16, -1, + 18, 19, 20, 21, 22, 23, 24, -1, -1, 27, + 28, 29, 30, 31, 32, 33, -1, -1, -1, -1, + -1, -1, -1, -1, 42, -1, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, 87, + 88, -1, 90, 3, 4, 5, -1, 7, -1, -1, + -1, 11, 12, -1, -1, -1, 16, -1, 18, 19, + 20, 21, 22, 23, 24, -1, -1, 27, 28, 29, + 30, 31, 32, 33, -1, -1, -1, -1, -1, -1, + -1, -1, 42, -1, -1, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, 87, 88, -1, + 90, 3, 4, 5, -1, 7, -1, -1, -1, 11, + 12, -1, -1, -1, 16, -1, 18, 19, 20, 21, + 22, 23, 24, -1, -1, 27, 28, 29, 30, 31, + 32, 33, -1, -1, -1, -1, -1, -1, -1, -1, + 42, -1, -1, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + -1, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, -1, -1, 79, 80, -1, -1, + 82, -1, -1, 85, 86, 87, -1, -1, 90, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, -1, -1, 79, 80, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, + -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/misc/bison.simple" @@ -3522,38 +3539,31 @@ case 205: break;} case 206: #line 939 "parse.y" -{ - value_expr(yyvsp[-2].node); - yyval.node = new_call(yyvsp[-2].node, yyvsp[0].id, 0); - ; - break;} -case 207: -#line 944 "parse.y" { yyval.node = NEW_COLON3(yyvsp[0].id); ; break;} -case 208: -#line 948 "parse.y" +case 207: +#line 943 "parse.y" { yyval.node = NEW_STR(yyvsp[0].val); ; break;} -case 210: -#line 953 "parse.y" +case 209: +#line 948 "parse.y" { yyval.node = NEW_XSTR(yyvsp[0].val); ; break;} -case 215: -#line 961 "parse.y" +case 214: +#line 956 "parse.y" { value_expr(yyvsp[-3].node); yyval.node = NEW_CALL(yyvsp[-3].node, tAREF, yyvsp[-1].node); ; break;} -case 216: -#line 966 "parse.y" +case 215: +#line 961 "parse.y" { if (yyvsp[-1].node == 0) yyval.node = NEW_ZARRAY(); /* zero length array*/ @@ -3562,14 +3572,14 @@ case 216: } ; break;} -case 217: -#line 974 "parse.y" +case 216: +#line 969 "parse.y" { yyval.node = NEW_HASH(yyvsp[-1].node); ; break;} -case 218: -#line 978 "parse.y" +case 217: +#line 973 "parse.y" { if (!cur_mid && !in_single) yyerror("return appeared outside of method"); @@ -3577,8 +3587,16 @@ case 218: yyval.node = NEW_RETURN(yyvsp[-1].node); ; break;} +case 218: +#line 980 "parse.y" +{ + if (!cur_mid && !in_single) + yyerror("return appeared outside of method"); + yyval.node = NEW_RETURN(0); + ; + break;} case 219: -#line 985 "parse.y" +#line 986 "parse.y" { if (!cur_mid && !in_single) yyerror("return appeared outside of method"); @@ -3586,58 +3604,50 @@ case 219: ; break;} case 220: -#line 991 "parse.y" -{ - if (!cur_mid && !in_single) - yyerror("return appeared outside of method"); - yyval.node = NEW_RETURN(0); - ; - break;} -case 221: -#line 997 "parse.y" +#line 992 "parse.y" { value_expr(yyvsp[-1].node); yyval.node = NEW_YIELD(yyvsp[-1].node); ; break;} +case 221: +#line 997 "parse.y" +{ + yyval.node = NEW_YIELD(0); + ; + break;} case 222: -#line 1002 "parse.y" +#line 1001 "parse.y" { yyval.node = NEW_YIELD(0); ; break;} case 223: -#line 1006 "parse.y" -{ - yyval.node = NEW_YIELD(0); - ; - break;} -case 224: -#line 1009 "parse.y" +#line 1004 "parse.y" {in_defined = 1;; break;} -case 225: -#line 1010 "parse.y" +case 224: +#line 1005 "parse.y" { in_defined = 0; yyval.node = NEW_DEFINED(yyvsp[-1].node); ; break;} -case 226: -#line 1015 "parse.y" +case 225: +#line 1010 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 227: -#line 1019 "parse.y" +case 226: +#line 1014 "parse.y" { yyvsp[0].node->nd_iter = NEW_FCALL(yyvsp[-1].id, 0); yyval.node = yyvsp[0].node; ; break;} -case 229: -#line 1025 "parse.y" +case 228: +#line 1020 "parse.y" { if (yyvsp[-1].node && nd_type(yyvsp[-1].node) == NODE_BLOCK_PASS) { rb_compile_error("both block arg and actual block given"); @@ -3647,56 +3657,56 @@ case 229: fixpos(yyval.node, yyvsp[-1].node); ; break;} -case 230: -#line 1037 "parse.y" +case 229: +#line 1032 "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 231: -#line 1046 "parse.y" +case 230: +#line 1041 "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 232: -#line 1054 "parse.y" +case 231: +#line 1049 "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 233: -#line 1062 "parse.y" +case 232: +#line 1057 "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 234: -#line 1070 "parse.y" +case 233: +#line 1065 "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 235: -#line 1078 "parse.y" +case 234: +#line 1073 "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 236: -#line 1089 "parse.y" +case 235: +#line 1084 "parse.y" { if (!yyvsp[-3].node && !yyvsp[-2].node && !yyvsp[-1].node) yyval.node = NEW_BEGIN(yyvsp[-4].node); @@ -3712,14 +3722,14 @@ case 236: fixpos(yyval.node, yyvsp[-4].node); ; break;} -case 237: -#line 1104 "parse.y" +case 236: +#line 1099 "parse.y" { yyval.node = yyvsp[-1].node; ; break;} -case 238: -#line 1108 "parse.y" +case 237: +#line 1103 "parse.y" { if (cur_mid || in_single) yyerror("class definition in method body"); @@ -3729,8 +3739,8 @@ case 238: local_push(); ; break;} -case 239: -#line 1118 "parse.y" +case 238: +#line 1113 "parse.y" { yyval.node = NEW_CLASS(yyvsp[-4].id, yyvsp[-1].node, yyvsp[-3].node); fixpos(yyval.node, yyvsp[-3].node); @@ -3739,16 +3749,16 @@ case 239: class_nest--; ; break;} -case 240: -#line 1126 "parse.y" +case 239: +#line 1121 "parse.y" { class_nest++; cref_push(); local_push(); ; break;} -case 241: -#line 1133 "parse.y" +case 240: +#line 1128 "parse.y" { yyval.node = NEW_SCLASS(yyvsp[-4].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-4].node); @@ -3757,8 +3767,8 @@ case 241: class_nest--; ; break;} -case 242: -#line 1141 "parse.y" +case 241: +#line 1136 "parse.y" { if (cur_mid || in_single) yyerror("module definition in method body"); @@ -3767,8 +3777,8 @@ case 242: local_push(); ; break;} -case 243: -#line 1150 "parse.y" +case 242: +#line 1145 "parse.y" { yyval.node = NEW_MODULE(yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-1].node); @@ -3777,8 +3787,8 @@ case 243: class_nest--; ; break;} -case 244: -#line 1158 "parse.y" +case 243: +#line 1153 "parse.y" { if (cur_mid || in_single) yyerror("nested method definition"); @@ -3786,8 +3796,8 @@ case 244: local_push(); ; break;} -case 245: -#line 1167 "parse.y" +case 244: +#line 1162 "parse.y" { /* NOEX_PRIVATE for toplevel */ yyval.node = NEW_DEFN(yyvsp[-4].id, yyvsp[-2].node, yyvsp[-1].node, class_nest?0:1); @@ -3796,12 +3806,12 @@ case 245: cur_mid = 0; ; break;} -case 246: -#line 1174 "parse.y" +case 245: +#line 1169 "parse.y" {lex_state = EXPR_FNAME;; break;} -case 247: -#line 1175 "parse.y" +case 246: +#line 1170 "parse.y" { value_expr(yyvsp[-3].node); in_single++; @@ -3809,8 +3819,8 @@ case 247: lex_state = EXPR_END; /* force for args */ ; break;} -case 248: -#line 1184 "parse.y" +case 247: +#line 1179 "parse.y" { yyval.node = NEW_DEFS(yyvsp[-7].node, yyvsp[-4].id, yyvsp[-2].node, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-7].node); @@ -3818,151 +3828,158 @@ case 248: in_single--; ; break;} -case 249: -#line 1191 "parse.y" +case 248: +#line 1186 "parse.y" { yyval.node = NEW_BREAK(); ; break;} -case 250: -#line 1195 "parse.y" +case 249: +#line 1190 "parse.y" { yyval.node = NEW_NEXT(); ; break;} -case 251: -#line 1199 "parse.y" +case 250: +#line 1194 "parse.y" { yyval.node = NEW_REDO(); ; break;} -case 252: -#line 1203 "parse.y" +case 251: +#line 1198 "parse.y" { yyval.node = NEW_RETRY(); ; break;} -case 259: -#line 1218 "parse.y" +case 258: +#line 1213 "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 1225 "parse.y" +case 259: +#line 1220 "parse.y" { yyval.node = 0; ; break;} -case 261: -#line 1229 "parse.y" +case 260: +#line 1224 "parse.y" { yyval.node = yyvsp[0].node; ; break;} +case 263: +#line 1232 "parse.y" +{ + yyval.node = 0; + ; + break;} case 264: -#line 1237 "parse.y" +#line 1236 "parse.y" { yyval.node = 0; ; break;} case 265: -#line 1241 "parse.y" +#line 1240 "parse.y" { yyval.node = 0; ; break;} case 266: -#line 1245 "parse.y" +#line 1244 "parse.y" { - yyval.node = 0; + yyval.node = yyvsp[-1].node; ; break;} case 267: #line 1249 "parse.y" -{ - yyval.node = yyvsp[-1].node; - ; - break;} -case 268: -#line 1254 "parse.y" { yyval.vars = dyna_push(); ; break;} -case 269: -#line 1260 "parse.y" +case 268: +#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 1262 "parse.y" +{ + yyval.vars = dyna_push(); + ; + break;} case 270: #line 1267 "parse.y" -{ - yyval.vars = dyna_push(); - ; - break;} -case 271: -#line 1272 "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 1274 "parse.y" +{ + yyval.node = NEW_VCALL(yyvsp[0].id); + ; + break;} case 272: -#line 1279 "parse.y" +#line 1278 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} case 273: -#line 1283 "parse.y" +#line 1282 "parse.y" { yyval.node = NEW_VCALL(yyvsp[0].id); ; break;} -case 274: -#line 1287 "parse.y" -{ - yyval.node = NEW_VCALL(yyvsp[0].id); - ; - break;} -case 277: -#line 1294 "parse.y" +case 276: +#line 1289 "parse.y" { yyval.node = new_fcall(yyvsp[-3].id, yyvsp[-1].node); fixpos(yyval.node, yyvsp[-1].node); ; break;} -case 278: -#line 1299 "parse.y" +case 277: +#line 1294 "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 1305 "parse.y" +case 278: +#line 1300 "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 1311 "parse.y" +case 279: +#line 1306 "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 280: +#line 1312 "parse.y" +{ + value_expr(yyvsp[-2].node); + yyval.node = new_call(yyvsp[-2].node, yyvsp[0].id, 0); + ; + break;} case 281: #line 1317 "parse.y" { @@ -4281,12 +4298,12 @@ case 345: yyval.node = list_append(NEW_LIST(yyvsp[-2].node), yyvsp[0].node); ; break;} -case 358: -#line 1595 "parse.y" +case 360: +#line 1598 "parse.y" {yyerrok;; break;} -case 361: -#line 1599 "parse.y" +case 363: +#line 1602 "parse.y" {yyerrok;; break;} } @@ -4511,7 +4528,7 @@ yyerrhandle: } return 1; } -#line 1600 "parse.y" +#line 1603 "parse.y" #include #include @@ -4523,7 +4540,9 @@ yyerrhandle: static char *tokenbuf = NULL; static int tokidx, toksiz = 0; +#ifndef strdup char *strdup(); +#endif static NODE *rb_str_extend(); @@ -4579,7 +4598,6 @@ yyerror(msg) return 0; } -static int newline_seen; static int heredoc_end; int ruby_in_compile = 0; @@ -4593,7 +4611,6 @@ yycompile(f) ruby__end__seen = 0; ruby_eval_tree = 0; - newline_seen = 0; heredoc_end = 0; ruby_sourcefile = f; ruby_in_compile = 1; @@ -4628,7 +4645,7 @@ lex_get_str(s) NODE* rb_compile_string(f, s) - char *f; + const char *f; VALUE s; { lex_gets = lex_get_str; @@ -4636,14 +4653,16 @@ rb_compile_string(f, s) lex_input = s; lex_pbeg = lex_p = lex_pend = 0; if (!ruby_sourcefile || strcmp(f, ruby_sourcefile)) /* not in eval() */ - ruby_sourceline = 1; + ruby_sourceline = 0; + else if (ruby_frame) /* in eval() */ + cur_mid = ruby_frame->last_func; return yycompile(f); } NODE* rb_compile_cstr(f, s, len) - char *f, *s; + const char *f, *s; int len; { return rb_compile_string(f, rb_str_new(s, len)); @@ -4651,14 +4670,14 @@ rb_compile_cstr(f, s, len) NODE* rb_compile_file(f, file, start) - char *f; + const char *f; VALUE file; int start; { lex_gets = rb_io_gets; lex_input = file; lex_pbeg = lex_p = lex_pend = 0; - ruby_sourceline = start; + ruby_sourceline = start - 1; return yycompile(strdup(f)); } @@ -4692,22 +4711,11 @@ nextc() if (NIL_P(v)) return -1; if (heredoc_end > 0) { - ruby_sourceline = heredoc_end+1; + ruby_sourceline = heredoc_end; heredoc_end = 0; } normalize_newline(v); - while (RSTRING(v)->len >= 2 && - RSTRING(v)->ptr[RSTRING(v)->len-1] == '\n' && - RSTRING(v)->ptr[RSTRING(v)->len-2] == '\\' && - (RSTRING(v)->len == 2 || - RSTRING(v)->ptr[RSTRING(v)->len-3] != '\\')) { - VALUE v2 = (*lex_gets)(lex_input); - - if (!NIL_P(v2)) { - normalize_newline(v2); - rb_str_cat(v, RSTRING(v2)->ptr, RSTRING(v2)->len); - } - } + ruby_sourceline++; lex_pbeg = lex_p = RSTRING(v)->ptr; lex_pend = lex_p + RSTRING(v)->len; if (strncmp(lex_pbeg, "__END__", 7) == 0 && lex_pbeg[7] == '\n') { @@ -4812,7 +4820,7 @@ read_escape() } buf[i] = c; } - c = scan_oct(buf, i+1, &i); + c = scan_oct(buf, i, &i); } return c; @@ -4829,7 +4837,7 @@ read_escape() break; } } - c = scan_hex(buf, i+1, &i); + c = scan_hex(buf, i, &i); } return c; @@ -4898,9 +4906,6 @@ parse_regx(term, paren) } switch (c) { - case '\n': - ruby_sourceline++; - break; case '[': in_brack = 1; break; @@ -4921,7 +4926,6 @@ parse_regx(term, paren) return 0; case '\n': - ruby_sourceline++; break; case '\\': @@ -4951,16 +4955,20 @@ parse_regx(term, paren) if (c == paren) nest++; if (c == term) nest--; } - if (c == '\n') { - ruby_sourceline++; - } - else if (c == term) { + if (c == term) { tokadd(c); } else { + int c1; pushback(c); - tokadd('\\'); - tokadd(read_escape()); + c1 = read_escape(); + if (c1 != c) { + tokadd(c1); + } + else { + tokadd('\\'); + tokadd(c); + } } } continue; @@ -5014,6 +5022,7 @@ parse_regx(term, paren) tokfix(); lex_state = EXPR_END; if (list) { + nd_set_line(list, re_start-1); if (toklen() > 0) { VALUE ss = rb_str_new(tok(), toklen()); list_append(list, NEW_STR(ss)); @@ -5049,9 +5058,9 @@ parse_string(func, term, paren) return parse_qstring(term, paren); } if (func == 0) { /* read 1 line for heredoc */ - ruby_sourceline++; /* -1 for chomp */ yylval.val = rb_str_new(lex_pbeg, lex_pend - lex_pbeg - 1); + lex_p = lex_pend; return tSTRING; } strstart = ruby_sourceline; @@ -5071,9 +5080,6 @@ parse_string(func, term, paren) c = nextc(); } } - else if (c == '\n') { - ruby_sourceline++; - } else if (c == '#') { list = rb_str_extend(list, term); if (list == (NODE*)-1) goto unterm_str; @@ -5081,10 +5087,7 @@ parse_string(func, term, paren) } else if (c == '\\') { c = nextc(); - if (c == '\n') { - ruby_sourceline++; - } - else if (c == term) { + if (c == term) { tokadd(c); } else { @@ -5106,7 +5109,9 @@ parse_string(func, term, paren) tokfix(); lex_state = EXPR_END; + if (list) { + nd_set_line(list, strstart-1); if (toklen() > 0) { VALUE ss = rb_str_new(tok(), toklen()); list_append(list, NEW_STR(ss)); @@ -5150,16 +5155,9 @@ parse_qstring(term, paren) c = nextc(); } } - else if (c == '\n') { - ruby_sourceline++; - } else if (c == '\\') { c = nextc(); switch (c) { - case '\n': - ruby_sourceline++; - continue; - case '\\': c = '\\'; break; @@ -5318,6 +5316,7 @@ here_document(term, indent) ruby_sourceline = linesave; if (list) { + nd_set_line(list, linesave); yylval.node = list; } switch (term) { @@ -5353,12 +5352,7 @@ yylex() int space_seen = 0; struct kwtable *kw; - if (newline_seen) { - ruby_sourceline += newline_seen; - newline_seen = 0; - } - -retry: + retry: switch (c = nextc()) { case '\0': /* NUL */ case '\004': /* ^D */ @@ -5376,26 +5370,6 @@ retry: while ((c = nextc()) != '\n') { if (c == -1) return 0; - if (ismbchar(c)) { - int i, len = mbclen(c)-1; - - for (i = 0; i < len; i++) { - c = nextc(); - if (c == '\n') { - pushback(c); - break; - } - } - } - else if (c == ' ') { - if ((c = nextc()) == '\\') { - c = nextc(); - if (c == '\n') ruby_sourceline++; - } - else { - pushback(c); - } - } } /* fall through */ case '\n': @@ -5403,12 +5377,10 @@ retry: case EXPR_BEG: case EXPR_FNAME: case EXPR_DOT: - ruby_sourceline++; goto retry; default: break; } - newline_seen++; lex_state = EXPR_BEG; return '\n'; @@ -5456,7 +5428,6 @@ retry: /* skip embedded rd document */ if (strncmp(lex_p, "begin", 5) == 0 && ISSPACE(lex_p[5])) { for (;;) { - ruby_sourceline++; lex_p = lex_pend; c = nextc(); if (c == -1) { @@ -5468,7 +5439,6 @@ retry: break; } } - ruby_sourceline++; lex_p = lex_pend; goto retry; } @@ -5630,10 +5600,12 @@ retry: yylval.id = '+'; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (lex_state == EXPR_ARG && space_seen && !ISSPACE(c))) { if (ISDIGIT(c)) { goto start_num; } + if (lex_state == EXPR_ARG) arg_ambiguous(); pushback(c); lex_state = EXPR_BEG; return tUPLUS; @@ -5656,12 +5628,14 @@ retry: yylval.id = '-'; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (lex_state == EXPR_ARG && space_seen && !ISSPACE(c))) { if (ISDIGIT(c)) { pushback(c); c = '-'; goto start_num; } + if (lex_state == EXPR_ARG) arg_ambiguous(); lex_state = EXPR_BEG; pushback(c); return tUMINUS; @@ -5936,7 +5910,6 @@ retry: case '\\': c = nextc(); if (c == '\n') { - ruby_sourceline++; space_seen = 1; goto retry; /* skip \\n */ } @@ -6636,6 +6609,9 @@ aryset(recv, idx, val) idx = arg_add(idx, val); } } + else { + idx = val; + } return NEW_CALL(recv, tASET, idx); } @@ -7120,9 +7096,6 @@ static struct { 0, 0, }; -char *rb_id2name(); -char *rb_class2name(); - static st_table *sym_tbl; static st_table *sym_rev_tbl; @@ -7137,7 +7110,7 @@ Init_sym() ID rb_intern(name) - char *name; + const char *name; { static ID last_id = LAST_TOKEN; int id; diff --git a/parse.y b/parse.y index 2d5ecfb4c7..7779e7918a 100644 --- a/parse.y +++ b/parse.y @@ -176,7 +176,7 @@ static void top_local_setup(); %type array assoc_list assocs assoc undef_list backref %type iter_var opt_iter_var iter_block iter_do_block %type mlhs mlhs_head mlhs_tail mlhs_basic mlhs_entry mlhs_item lhs -%type variable symbol operation +%type variable symbol operation operation2 %type cname fname op f_rest_arg %type f_arg %token tUPLUS /* unary+ */ @@ -935,11 +935,6 @@ primary : literal value_expr($1); $$ = NEW_COLON2($1, $3); } - | primary tCOLON2 tIDENTIFIER - { - value_expr($1); - $$ = new_call($1, $3, 0); - } | tCOLON3 cname { $$ = NEW_COLON3($2); @@ -1313,6 +1308,11 @@ method_call : operation '(' opt_call_args ')' $$ = new_call($1, $3, $5); fixpos($$, $1); } + | primary tCOLON2 operation2 + { + value_expr($1); + $$ = new_call($1, $3, 0); + } | kSUPER '(' opt_call_args ')' { if (!cur_mid && !in_single && !in_defined) @@ -1579,6 +1579,9 @@ operation : tIDENTIFIER | tCONSTANT | tFID +operation2 : tIDENTIFIER + | tFID + dot_or_colon : '.' | tCOLON2 @@ -1608,7 +1611,9 @@ terms : term static char *tokenbuf = NULL; static int tokidx, toksiz = 0; +#ifndef strdup char *strdup(); +#endif static NODE *rb_str_extend(); @@ -1664,7 +1669,6 @@ yyerror(msg) return 0; } -static int newline_seen; static int heredoc_end; int ruby_in_compile = 0; @@ -1678,7 +1682,6 @@ yycompile(f) ruby__end__seen = 0; ruby_eval_tree = 0; - newline_seen = 0; heredoc_end = 0; ruby_sourcefile = f; ruby_in_compile = 1; @@ -1713,7 +1716,7 @@ lex_get_str(s) NODE* rb_compile_string(f, s) - char *f; + const char *f; VALUE s; { lex_gets = lex_get_str; @@ -1721,14 +1724,16 @@ rb_compile_string(f, s) lex_input = s; lex_pbeg = lex_p = lex_pend = 0; if (!ruby_sourcefile || strcmp(f, ruby_sourcefile)) /* not in eval() */ - ruby_sourceline = 1; + ruby_sourceline = 0; + else if (ruby_frame) /* in eval() */ + cur_mid = ruby_frame->last_func; return yycompile(f); } NODE* rb_compile_cstr(f, s, len) - char *f, *s; + const char *f, *s; int len; { return rb_compile_string(f, rb_str_new(s, len)); @@ -1736,14 +1741,14 @@ rb_compile_cstr(f, s, len) NODE* rb_compile_file(f, file, start) - char *f; + const char *f; VALUE file; int start; { lex_gets = rb_io_gets; lex_input = file; lex_pbeg = lex_p = lex_pend = 0; - ruby_sourceline = start; + ruby_sourceline = start - 1; return yycompile(strdup(f)); } @@ -1777,22 +1782,11 @@ nextc() if (NIL_P(v)) return -1; if (heredoc_end > 0) { - ruby_sourceline = heredoc_end+1; + ruby_sourceline = heredoc_end; heredoc_end = 0; } normalize_newline(v); - while (RSTRING(v)->len >= 2 && - RSTRING(v)->ptr[RSTRING(v)->len-1] == '\n' && - RSTRING(v)->ptr[RSTRING(v)->len-2] == '\\' && - (RSTRING(v)->len == 2 || - RSTRING(v)->ptr[RSTRING(v)->len-3] != '\\')) { - VALUE v2 = (*lex_gets)(lex_input); - - if (!NIL_P(v2)) { - normalize_newline(v2); - rb_str_cat(v, RSTRING(v2)->ptr, RSTRING(v2)->len); - } - } + ruby_sourceline++; lex_pbeg = lex_p = RSTRING(v)->ptr; lex_pend = lex_p + RSTRING(v)->len; if (strncmp(lex_pbeg, "__END__", 7) == 0 && lex_pbeg[7] == '\n') { @@ -1897,7 +1891,7 @@ read_escape() } buf[i] = c; } - c = scan_oct(buf, i+1, &i); + c = scan_oct(buf, i, &i); } return c; @@ -1914,7 +1908,7 @@ read_escape() break; } } - c = scan_hex(buf, i+1, &i); + c = scan_hex(buf, i, &i); } return c; @@ -1983,9 +1977,6 @@ parse_regx(term, paren) } switch (c) { - case '\n': - ruby_sourceline++; - break; case '[': in_brack = 1; break; @@ -2006,7 +1997,6 @@ parse_regx(term, paren) return 0; case '\n': - ruby_sourceline++; break; case '\\': @@ -2036,16 +2026,20 @@ parse_regx(term, paren) if (c == paren) nest++; if (c == term) nest--; } - if (c == '\n') { - ruby_sourceline++; - } - else if (c == term) { + if (c == term) { tokadd(c); } else { + int c1; pushback(c); - tokadd('\\'); - tokadd(read_escape()); + c1 = read_escape(); + if (c1 != c) { + tokadd(c1); + } + else { + tokadd('\\'); + tokadd(c); + } } } continue; @@ -2099,6 +2093,7 @@ parse_regx(term, paren) tokfix(); lex_state = EXPR_END; if (list) { + nd_set_line(list, re_start-1); if (toklen() > 0) { VALUE ss = rb_str_new(tok(), toklen()); list_append(list, NEW_STR(ss)); @@ -2134,9 +2129,9 @@ parse_string(func, term, paren) return parse_qstring(term, paren); } if (func == 0) { /* read 1 line for heredoc */ - ruby_sourceline++; /* -1 for chomp */ yylval.val = rb_str_new(lex_pbeg, lex_pend - lex_pbeg - 1); + lex_p = lex_pend; return tSTRING; } strstart = ruby_sourceline; @@ -2156,9 +2151,6 @@ parse_string(func, term, paren) c = nextc(); } } - else if (c == '\n') { - ruby_sourceline++; - } else if (c == '#') { list = rb_str_extend(list, term); if (list == (NODE*)-1) goto unterm_str; @@ -2166,10 +2158,7 @@ parse_string(func, term, paren) } else if (c == '\\') { c = nextc(); - if (c == '\n') { - ruby_sourceline++; - } - else if (c == term) { + if (c == term) { tokadd(c); } else { @@ -2191,7 +2180,9 @@ parse_string(func, term, paren) tokfix(); lex_state = EXPR_END; + if (list) { + nd_set_line(list, strstart-1); if (toklen() > 0) { VALUE ss = rb_str_new(tok(), toklen()); list_append(list, NEW_STR(ss)); @@ -2235,16 +2226,9 @@ parse_qstring(term, paren) c = nextc(); } } - else if (c == '\n') { - ruby_sourceline++; - } else if (c == '\\') { c = nextc(); switch (c) { - case '\n': - ruby_sourceline++; - continue; - case '\\': c = '\\'; break; @@ -2403,6 +2387,7 @@ here_document(term, indent) ruby_sourceline = linesave; if (list) { + nd_set_line(list, linesave); yylval.node = list; } switch (term) { @@ -2438,12 +2423,7 @@ yylex() int space_seen = 0; struct kwtable *kw; - if (newline_seen) { - ruby_sourceline += newline_seen; - newline_seen = 0; - } - -retry: + retry: switch (c = nextc()) { case '\0': /* NUL */ case '\004': /* ^D */ @@ -2461,26 +2441,6 @@ retry: while ((c = nextc()) != '\n') { if (c == -1) return 0; - if (ismbchar(c)) { - int i, len = mbclen(c)-1; - - for (i = 0; i < len; i++) { - c = nextc(); - if (c == '\n') { - pushback(c); - break; - } - } - } - else if (c == ' ') { - if ((c = nextc()) == '\\') { - c = nextc(); - if (c == '\n') ruby_sourceline++; - } - else { - pushback(c); - } - } } /* fall through */ case '\n': @@ -2488,12 +2448,10 @@ retry: case EXPR_BEG: case EXPR_FNAME: case EXPR_DOT: - ruby_sourceline++; goto retry; default: break; } - newline_seen++; lex_state = EXPR_BEG; return '\n'; @@ -2541,7 +2499,6 @@ retry: /* skip embedded rd document */ if (strncmp(lex_p, "begin", 5) == 0 && ISSPACE(lex_p[5])) { for (;;) { - ruby_sourceline++; lex_p = lex_pend; c = nextc(); if (c == -1) { @@ -2553,7 +2510,6 @@ retry: break; } } - ruby_sourceline++; lex_p = lex_pend; goto retry; } @@ -2715,10 +2671,12 @@ retry: yylval.id = '+'; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (lex_state == EXPR_ARG && space_seen && !ISSPACE(c))) { if (ISDIGIT(c)) { goto start_num; } + if (lex_state == EXPR_ARG) arg_ambiguous(); pushback(c); lex_state = EXPR_BEG; return tUPLUS; @@ -2741,12 +2699,14 @@ retry: yylval.id = '-'; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (lex_state == EXPR_ARG && space_seen && !ISSPACE(c))) { if (ISDIGIT(c)) { pushback(c); c = '-'; goto start_num; } + if (lex_state == EXPR_ARG) arg_ambiguous(); lex_state = EXPR_BEG; pushback(c); return tUMINUS; @@ -3021,7 +2981,6 @@ retry: case '\\': c = nextc(); if (c == '\n') { - ruby_sourceline++; space_seen = 1; goto retry; /* skip \\n */ } @@ -3721,6 +3680,9 @@ aryset(recv, idx, val) idx = arg_add(idx, val); } } + else { + idx = val; + } return NEW_CALL(recv, tASET, idx); } @@ -4205,9 +4167,6 @@ static struct { 0, 0, }; -char *rb_id2name(); -char *rb_class2name(); - static st_table *sym_tbl; static st_table *sym_rev_tbl; @@ -4222,7 +4181,7 @@ Init_sym() ID rb_intern(name) - char *name; + const char *name; { static ID last_id = LAST_TOKEN; int id; diff --git a/process.c b/process.c index 8a275652d9..a235009149 100644 --- a/process.c +++ b/process.c @@ -79,12 +79,10 @@ rb_waitpid(pid, flags, st) { int result; #ifndef NO_WAITPID -#if defined(USE_THREAD) int oflags = flags; if (!rb_thread_alone()) { /* there're other threads to run */ flags |= WNOHANG; } -#endif retry: #ifdef HAVE_WAITPID @@ -94,21 +92,17 @@ rb_waitpid(pid, flags, st) #endif if (result < 0) { if (errno == EINTR) { -#ifdef USE_THREAD rb_thread_schedule(); -#endif goto retry; } return -1; } -#ifdef USE_THREAD if (result == 0) { if (oflags & WNOHANG) return 0; rb_thread_schedule(); if (rb_thread_alone()) flags = oflags; goto retry; } -#endif #else /* NO_WAITPID */ if (pid_tbl && st_lookup(pid_tbl, pid, st)) { rb_last_status = INT2FIX(*st); @@ -124,9 +118,7 @@ rb_waitpid(pid, flags, st) result = wait(st); if (result < 0) { if (errno == EINTR) { -#ifdef USE_THREAD rb_thread_schedule(); -#endif continue; } return -1; @@ -137,9 +129,7 @@ rb_waitpid(pid, flags, st) if (!pid_tbl) pid_tbl = st_init_numtable(); st_insert(pid_tbl, pid, st); -#ifdef USE_THREAD if (!rb_thread_alone()) rb_thread_schedule(); -#endif } #endif rb_last_status = INT2FIX(*st); @@ -181,9 +171,7 @@ rb_f_wait() while ((pid = wait(&state)) < 0) { if (errno == EINTR) { -#ifdef USE_THREAD rb_thread_schedule(); -#endif continue; } rb_sys_fail(0); @@ -212,7 +200,7 @@ rb_f_waitpid(obj, vpid, vflags) char *strtok(); -#if defined(USE_THREAD) && defined(HAVE_SETITIMER) +#ifdef HAVE_SETITIMER #define before_exec() rb_thread_stop_timer() #define after_exec() rb_thread_start_timer() #else @@ -320,10 +308,11 @@ proc_exec_n(argc, argv, progv) int rb_proc_exec(str) - char *str; + const char *str; { #ifndef USE_CWGUSI - char *s = str, *t; + const char *s = str; + char *ss, *t; char **argv, **a; security(str); @@ -358,9 +347,9 @@ rb_proc_exec(str) } } a = argv = ALLOCA_N(char*, (s-str)/2+2); - s = ALLOCA_N(char, s-str+1); - strcpy(s, str); - if (*a++ = strtok(s, " \t")) { + ss = ALLOCA_N(char, s-str+1); + strcpy(ss, str); + if (*a++ = strtok(ss, " \t")) { while (t = strtok(NULL, " \t")) { *a++ = t; } @@ -712,11 +701,7 @@ rb_f_system(argc, argv) case -1: if (errno == EAGAIN) { -#ifdef USE_THREAD rb_thread_sleep(1); -#else - sleep(1); -#endif goto retry; } rb_sys_fail(0); @@ -742,30 +727,12 @@ rb_f_sleep(argc, argv) int beg, end; beg = time(0); -#ifdef USE_THREAD if (argc == 0) { rb_thread_sleep_forever(); } else if (argc == 1) { rb_thread_wait_for(rb_time_timeval(argv[0])); } -#else - if (argc == 0) { - TRAP_BEG; - sleep((32767<<16)+32767); - TRAP_END; - } - else if (argc == 1) { - struct timeval tv; - int n; - - tv = rb_time_timeval(argv[0]); - TRAP_BEG; - n = select(0, 0, 0, 0, &tv); - TRAP_END; - if (n<0) rb_sys_fail(0); - } -#endif else { rb_raise(rb_eArgError, "wrong # of arguments"); } diff --git a/range.c b/range.c index 30c9996153..74bbdcdceb 100644 --- a/range.c +++ b/range.c @@ -13,8 +13,10 @@ #include "ruby.h" VALUE rb_cRange; -static ID id_upto, id_cmp; -static ID id_beg, id_end; +static ID id_cmp, id_beg, id_end; + +#define EXCL(r) FL_TEST((r), FL_USER1) +#define SET_EXCL(r) FL_SET((r), FL_USER1) static VALUE range_check(args) @@ -31,8 +33,9 @@ range_failed() } static VALUE -range_s_new(klass, beg, end) +range_new(klass, beg, end, exclude_end) VALUE klass, beg, end; + int exclude_end; { VALUE obj; VALUE args[2]; @@ -43,6 +46,9 @@ range_s_new(klass, beg, end) } obj = rb_obj_alloc(klass); + if (exclude_end) { + SET_EXCL(obj); + } rb_ivar_set(obj, id_beg, beg); rb_ivar_set(obj, id_end, end); @@ -52,67 +58,97 @@ range_s_new(klass, beg, end) } VALUE -rb_range_new(beg, end) +rb_range_new(beg, end, exclude_end) VALUE beg, end; + int exclude_end; { - return range_s_new(rb_cRange, beg, end); + return range_new(rb_cRange, beg, end, exclude_end); } static VALUE -range_eqq(rng, obj) - VALUE rng, obj; +range_s_new(argc, argv, klass) + int argc; + VALUE *argv; + VALUE klass; +{ + VALUE beg, end, flag, range; + + rb_scan_args(argc, argv, "21", &beg, &end, &flag); + if (argc == 2) flag == Qtrue; + return range_new(klass, beg, end, RTEST(flag)); +} + +static VALUE +range_exclude_end_p(range) + VALUE range; +{ + return EXCL(range)?Qtrue:Qfalse;; +} + +static VALUE +range_eqq(range, obj) + VALUE range, obj; { VALUE beg, end; - beg = rb_ivar_get(rng, id_beg); - end = rb_ivar_get(rng, id_end); + beg = rb_ivar_get(range, id_beg); + end = rb_ivar_get(range, id_end); if (FIXNUM_P(beg) && FIXNUM_P(obj) && FIXNUM_P(end)) { - if (FIX2INT(beg) <= FIX2INT(obj) && FIX2INT(obj) <= FIX2INT(end)) { - return Qtrue; + if (FIX2INT(beg) <= FIX2INT(obj)) { + if (EXCL(range)) { + if (FIX2INT(obj) <= FIX2INT(end)) return Qtrue; + } + else { + if (FIX2INT(obj) < FIX2INT(end)) return Qtrue; + } } return Qfalse; } - else { - if (RTEST(rb_funcall(beg, rb_intern("<="), 1, obj)) && - RTEST(rb_funcall(end, rb_intern(">="), 1, obj))) { - return Qtrue; + else if (RTEST(rb_funcall(beg, rb_intern("<="), 1, obj))) { + if (EXCL(range)) { + if (RTEST(rb_funcall(end, rb_intern(">="), 1, obj))) + return Qtrue; + } + else { + if (RTEST(rb_funcall(end, rb_intern(">"), 1, obj))) + return Qtrue; + if (FIX2INT(obj) < FIX2INT(end)) return Qtrue; } - return Qfalse; } -} - -struct upto_data { - VALUE beg; - VALUE end; -}; - -static VALUE -range_upto(data) - struct upto_data *data; -{ - return rb_funcall(data->beg, id_upto, 1, data->end); + return Qfalse; } static VALUE -range_each(obj) - VALUE obj; +range_each(range) + VALUE range; { VALUE b, e; - b = rb_ivar_get(obj, id_beg); - e = rb_ivar_get(obj, id_end); + b = rb_ivar_get(range, id_beg); + e = rb_ivar_get(range, id_end); - if (FIXNUM_P(b)) { /* fixnum is a special case(for performance) */ - rb_fix_upto(b, e); + if (FIXNUM_P(b) && FIXNUM_P(e)) { /* fixnums are special */ + long end = FIX2LONG(e); + long i; + + if (!EXCL(range)) end += 1; + for (i=FIX2LONG(b); i len) goto out_of_range; + if (end < 0) { + end += len; + if (end < 0) { + if (err == 1 && e == -1 && !EXCL(range)) { + len = 0; + goto length_set; + } + goto out_of_range; + } + } + len = end - beg; + if (!EXCL(range)) len++; /* include end point */ + if (len < 0) goto out_of_range; + + length_set: + *begp = beg; + *lenp = len; + return Qtrue; + + out_of_range: + if (err) { + rb_raise(rb_eIndexError, "%d..%s%d out of range", + b, EXCL(range)?".":"", e); + } + return Qnil; } static VALUE @@ -160,7 +228,7 @@ range_to_s(range) str = rb_obj_as_string(rb_ivar_get(range, id_beg)); str2 = rb_obj_as_string(rb_ivar_get(range, id_end)); - rb_str_cat(str, "..", 2); + rb_str_cat(str, "...", EXCL(range)?3:2); rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len); return str; @@ -174,30 +242,40 @@ range_inspect(range) str = rb_inspect(rb_ivar_get(range, id_beg)); str2 = rb_inspect(rb_ivar_get(range, id_end)); - rb_str_cat(str, "..", 2); + rb_str_cat(str, "...", EXCL(range)?3:2); rb_str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len); return str; } static VALUE -range_length(rng) - VALUE rng; +range_length(range) + VALUE range; { VALUE beg, end; VALUE size; - beg = rb_ivar_get(rng, id_beg); - end = rb_ivar_get(rng, id_end); + beg = rb_ivar_get(range, id_beg); + end = rb_ivar_get(range, id_end); if (RTEST(rb_funcall(beg, '>', 1, end))) { return INT2FIX(0); } + if (FIXNUM_P(beg) && FIXNUM_P(end)) { + if (EXCL(range)) { + return INT2FIX(FIX2INT(end) - FIX2INT(beg)); + } + else { + return INT2FIX(FIX2INT(end) - FIX2INT(beg) + 1); + } + } if (!rb_obj_is_kind_of(beg, rb_cNumeric)) { - return rb_enum_length(rng); + return rb_enum_length(range); } size = rb_funcall(end, '-', 1, beg); - size = rb_funcall(size, '+', 1, INT2FIX(1)); + if (!EXCL(range)) { + size = rb_funcall(size, '+', 1, INT2FIX(1)); + } return size; } @@ -207,7 +285,7 @@ Init_Range() { rb_cRange = rb_define_class("Range", rb_cObject); rb_include_module(rb_cRange, rb_mEnumerable); - rb_define_singleton_method(rb_cRange, "new", range_s_new, 2); + rb_define_singleton_method(rb_cRange, "new", range_s_new, -1); rb_define_method(rb_cRange, "===", range_eqq, 1); rb_define_method(rb_cRange, "each", range_each, 0); rb_define_method(rb_cRange, "first", range_first, 0); @@ -217,10 +295,11 @@ Init_Range() rb_define_method(rb_cRange, "to_s", range_to_s, 0); rb_define_method(rb_cRange, "inspect", range_inspect, 0); + rb_define_method(rb_cRange, "exclude_end?", range_exclude_end_p, 0); + rb_define_method(rb_cRange, "length", range_length, 0); rb_define_method(rb_cRange, "size", range_length, 0); - id_upto = rb_intern("upto"); id_cmp = rb_intern("<=>"); id_beg = rb_intern("begin"); id_end = rb_intern("end"); diff --git a/re.c b/re.c index f8c268ea37..8ac61bf228 100644 --- a/re.c +++ b/re.c @@ -18,7 +18,7 @@ static VALUE rb_eRegxpError; #define END(no) regs->end[no] #if 'a' == 97 /* it's ascii */ -static char casetable[] = { +static const char casetable[] = { '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', @@ -198,10 +198,10 @@ extern int ruby_in_compile; static void rb_reg_expr_str(str, s, len) VALUE str; - char *s; + const char *s; int len; { - char *p, *pend; + const char *p, *pend; int slash = 0; p = s; pend = p + len; @@ -233,7 +233,7 @@ rb_reg_expr_str(str, s, len) static VALUE rb_reg_desc(s, len, re) - char *s; + const char *s; int len; VALUE re; { @@ -282,9 +282,9 @@ rb_reg_inspect(re) static void rb_reg_raise(s, len, err, re) - char *s; + const char *s; int len; - char *err; + const char *err; VALUE re; { VALUE desc = rb_reg_desc(s, len, re); @@ -329,7 +329,7 @@ rb_reg_kcode_method(re) static Regexp* make_regexp(s, len, flag) - char *s; + const char *s; int len, flag; { Regexp *rp; @@ -392,6 +392,59 @@ match_clone(orig) return (VALUE)match; } +static VALUE +match_size(match) + VALUE match; +{ + return INT2FIX(RMATCH(match)->regs->num_regs); +} + +static VALUE +match_offset(match, n) + VALUE match, n; +{ + int i = NUM2INT(n); + + if (i < 0 || RMATCH(match)->regs->num_regs <= i) + rb_raise(rb_eIndexError, "index %d out of matches", i); + + if (RMATCH(match)->regs->beg[i] < 0) + return rb_assoc_new(Qnil, Qnil); + + return rb_assoc_new(INT2FIX(RMATCH(match)->regs->beg[i]), + INT2FIX(RMATCH(match)->regs->end[i])); +} + +static VALUE +match_begin(match, n) + VALUE match, n; +{ + int i = NUM2INT(n); + + if (i < 0 || RMATCH(match)->regs->num_regs <= i) + rb_raise(rb_eIndexError, "index %d out of matches", i); + + if (RMATCH(match)->regs->beg[i] < 0) + return Qnil; + + return INT2FIX(RMATCH(match)->regs->beg[i]); +} + +static VALUE +match_end(match, n) + VALUE match, n; +{ + int i = NUM2INT(n); + + if (i < 0 || RMATCH(match)->regs->num_regs <= i) + rb_raise(rb_eIndexError, "index %d out of matches", i); + + if (RMATCH(match)->regs->beg[i] < 0) + return Qnil; + + return INT2FIX(RMATCH(match)->regs->end[i]); +} + #define MATCH_BUSY FL_USER2 void @@ -467,16 +520,12 @@ rb_reg_search(reg, str, start, reverse) else if (reg_kcode != curr_kcode) kcode_reset_option(); -#ifdef USE_THREAD if (rb_thread_scope_shared_p()) { match = Qnil; } else { match = rb_backref_get(); } -#else - match = rb_backref_get(); -#endif if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) { if (matchcache) { match = matchcache; @@ -569,7 +618,7 @@ rb_reg_match_post(match) if (NIL_P(match)) return Qnil; if (RMATCH(match)->BEG(0) == -1) return Qnil; return rb_str_new(RSTRING(RMATCH(match)->str)->ptr+RMATCH(match)->END(0), - RSTRING(RMATCH(match)->str)->len-RMATCH(match)->END(0)); + RSTRING(RMATCH(match)->str)->len-RMATCH(match)->END(0)); } VALUE @@ -648,7 +697,7 @@ match_aref(argc, argv, match) regs = RMATCH(match)->regs; i = FIX2INT(idx); - if (i>=regs->num_regs) return Qnil; + if (i >= regs->num_regs) return Qnil; ptr = RSTRING(RMATCH(match)->str)->ptr; return rb_str_new(ptr+regs->beg[i], regs->end[i]-regs->beg[i]); @@ -664,12 +713,19 @@ match_to_s(match) return str; } +static VALUE +match_string(match) + VALUE match; +{ + return rb_str_dup(RMATCH(match)->str); +} + VALUE rb_cRegexp; static VALUE rb_reg_new_1(klass, s, len, options) VALUE klass; - char *s; + const char *s; int len; int options; /* CASEFOLD = 1 */ /* EXTENDED = 2 */ @@ -727,7 +783,7 @@ rb_reg_new_1(klass, s, len, options) VALUE rb_reg_new(s, len, options) - char *s; + const char *s; int len; int options; { @@ -815,6 +871,16 @@ rb_reg_match2(re) return INT2FIX(start); } +static VALUE +rb_reg_match_method(re, str) + VALUE re, str; +{ + VALUE result = rb_reg_match(re, str); + + if (NIL_P(result)) return Qnil; + return rb_backref_get(); +} + static VALUE rb_reg_s_new(argc, argv, self) int argc; @@ -827,8 +893,9 @@ rb_reg_s_new(argc, argv, self) if (argc == 0 || argc > 3) { rb_raise(rb_eArgError, "wrong # of argument"); } - if (argc >= 2 && RTEST(argv[1])) { - flag = RE_OPTION_IGNORECASE; + if (argc >= 2) { + if (FIXNUM_P(argv[1])) flag = FIX2INT(argv[1]); + else if (RTEST(argv[1])) flag = RE_OPTION_IGNORECASE; } if (argc == 3) { char *kcode = STR2CSTR(argv[2]); @@ -865,40 +932,50 @@ rb_reg_s_new(argc, argv, self) } static VALUE -rb_reg_s_quote(re, str) - VALUE re, str; +rb_reg_s_quote(argc, argv) + int argc; + VALUE *argv; { - char *s, *send, *t; - char *tmp; - int len; + VALUE str, kcode; + int kcode_saved = reg_kcode; + char *s, *send, *t; + char *tmp; + int len; - s = str2cstr(str, &len); - send = s + len; - tmp = ALLOCA_N(char, len*2); - t = tmp; - - for (; s != send; s++) { - if (ismbchar(*s)) { - size_t n = mbclen(*s); - - while (n--) - *t++ = *s++; - s--; - continue; - } - if (*s == '[' || *s == ']' - || *s == '{' || *s == '}' - || *s == '(' || *s == ')' - || *s == '|' - || *s == '*' || *s == '.' || *s == '\\' - || *s == '?' || *s == '+' - || *s == '^' || *s == '$') { - *t++ = '\\'; - } - *t++ = *s; + rb_scan_args(argc, argv, "11", &str, &kcode); + if (!NIL_P(kcode)) { + rb_set_kcode(STR2CSTR(kcode)); + curr_kcode = reg_kcode; + reg_kcode = kcode_saved; } + s = str2cstr(str, &len); + send = s + len; + tmp = ALLOCA_N(char, len*2); + t = tmp; - return rb_str_new(tmp, t - tmp); + for (; s != send; s++) { + if (ismbchar(*s)) { + size_t n = mbclen(*s); + + while (n--) + *t++ = *s++; + s--; + continue; + } + if (*s == '[' || *s == ']' + || *s == '{' || *s == '}' + || *s == '(' || *s == ')' + || *s == '|' + || *s == '*' || *s == '.' || *s == '\\' + || *s == '?' || *s == '+' + || *s == '^' || *s == '$') { + *t++ = '\\'; + } + *t++ = *s; + } + kcode_reset_option(); + + return rb_str_new(tmp, t - tmp); } int @@ -1039,7 +1116,7 @@ rb_reg_regsub(str, src, regs) return val; } -char* +const char* rb_get_kcode() { switch (reg_kcode) { @@ -1062,7 +1139,7 @@ kcode_getter() void rb_set_kcode(code) - char *code; + const char *code; { if (code == 0) goto set_no_conversion; @@ -1166,25 +1243,38 @@ Init_Regexp() rb_cRegexp = rb_define_class("Regexp", rb_cObject); rb_define_singleton_method(rb_cRegexp, "new", rb_reg_s_new, -1); rb_define_singleton_method(rb_cRegexp, "compile", rb_reg_s_new, -1); - rb_define_singleton_method(rb_cRegexp, "quote", rb_reg_s_quote, 1); + rb_define_singleton_method(rb_cRegexp, "quote", rb_reg_s_quote, -1); + rb_define_singleton_method(rb_cRegexp, "escape", rb_reg_s_quote, -1); rb_define_method(rb_cRegexp, "clone", rb_reg_clone, 0); rb_define_method(rb_cRegexp, "==", rb_reg_equal, 1); rb_define_method(rb_cRegexp, "=~", rb_reg_match, 1); rb_define_method(rb_cRegexp, "===", rb_reg_match, 1); rb_define_method(rb_cRegexp, "~", rb_reg_match2, 0); + rb_define_method(rb_cRegexp, "match", rb_reg_match_method, 1); rb_define_method(rb_cRegexp, "inspect", rb_reg_inspect, 0); rb_define_method(rb_cRegexp, "source", rb_reg_source, 0); rb_define_method(rb_cRegexp, "casefold?", rb_reg_casefold_p, 0); rb_define_method(rb_cRegexp, "kcode", rb_reg_kcode_method, 0); + rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE)); + rb_define_const(rb_cRegexp, "EXTENDED", INT2FIX(RE_OPTION_EXTENDED)); + rb_global_variable(®_cache); rb_global_variable(&matchcache); rb_cMatch = rb_define_class("MatchingData", rb_cData); rb_define_method(rb_cMatch, "clone", match_clone, 0); + rb_define_method(rb_cMatch, "size", match_size, 0); + rb_define_method(rb_cMatch, "length", match_size, 0); + rb_define_method(rb_cMatch, "offset", match_offset, 1); + rb_define_method(rb_cMatch, "begin", match_begin, 1); + rb_define_method(rb_cMatch, "end", match_end, 1); rb_define_method(rb_cMatch, "to_a", match_to_a, 0); rb_define_method(rb_cMatch, "[]", match_aref, -1); + rb_define_method(rb_cMatch, "pre_match", rb_reg_match_pre, 0); + rb_define_method(rb_cMatch, "post_match", rb_reg_match_post, 0); rb_define_method(rb_cMatch, "to_s", match_to_s, 0); + rb_define_method(rb_cMatch, "string_s", match_string, 0); rb_define_method(rb_cMatch, "inspect", rb_any_to_s, 0); } diff --git a/regex.c b/regex.c index 4a33461ebe..685e767c10 100644 --- a/regex.c +++ b/regex.c @@ -177,9 +177,9 @@ static int group_match_null_string_p(); static char re_syntax_table[256]; static void init_syntax_once _((void)); -static unsigned char *translate = 0; +static const unsigned char *translate = 0; static void init_regs _((struct re_registers*, unsigned int)); -static void bm_init_skip _((int *, unsigned char*, int, char*)); +static void bm_init_skip _((int *, unsigned char*, int, const char*)); static int current_mbctype = MBCTYPE_ASCII; #undef P @@ -212,9 +212,9 @@ init_syntax_once() void re_set_casetable(table) - char *table; + const char *table; { - translate = (unsigned char*)table; + translate = (const unsigned char*)table; } /* Jim Meyering writes: @@ -331,7 +331,7 @@ enum regexpcode finalize_push_n, /* Similar to finalize_push, buf finalize n time only */ set_number_at, /* Set the following relative location to the subsequent number. */ - anychar, /* Matches any (more or less) one character. */ + anychar, /* Matches any (more or less) one character excluding newlines. */ charset, /* Matches any one char belonging to specified set. First following byte is number of bitmap bytes. Then come bytes for a bitmap saying which chars are in. @@ -352,6 +352,8 @@ enum regexpcode stop_paren, /* Place holder at the end of (?:..). */ casefold_on, /* Turn on casefold flag. */ casefold_off, /* Turn off casefold flag. */ + posix_on, /* Turn on POSIXified match (match with newlines). */ + posix_off, /* Turn off POSIXified match. */ start_nowidth, /* Save string point to the stack. */ stop_nowidth, /* Restore string place at the point start_nowidth. */ pop_and_fail, /* Fail after popping nowidth entry from stack. */ @@ -673,30 +675,30 @@ is_in_list(c, b) unsigned int c; const unsigned char *b; { - unsigned short size; - unsigned short i, j; - int result = 0; + unsigned short size; + unsigned short i, j; + int result = 0; - size = *b++; - if ((int)c / BYTEWIDTH < (int)size && b[c / BYTEWIDTH] & 1 << c % BYTEWIDTH) { - return 2; - } - b += size + 2; - size = EXTRACT_UNSIGNED(&b[-2]); - if (size == 0) return 0; + size = *b++; + if ((int)c / BYTEWIDTH < (int)size && b[c / BYTEWIDTH] & 1 << c % BYTEWIDTH) { + return 2; + } + b += size + 2; + size = EXTRACT_UNSIGNED(&b[-2]); + if (size == 0) return 0; - for (i = 0, j = size; i < j; ) { - unsigned short k = (unsigned short)(i + j) >> 1; + for (i = 0, j = size; i < j; ) { + unsigned short k = (unsigned short)(i + j) >> 1; - if (c > EXTRACT_MBC(&b[k*8+4])) - i = k + 1; - else - j = k; - } - if (i < size && EXTRACT_MBC(&b[i*8]) <= c - && ((unsigned char)c != '\n' && (unsigned char)c != '\0')) - return 1; - return result; + if (c > EXTRACT_MBC(&b[k*8+4])) + i = k + 1; + else + j = k; + } + if (i < size && EXTRACT_MBC(&b[i*8]) <= c + && ((unsigned char)c != '\n' && (unsigned char)c != '\0')) + return 1; + return result; } static void @@ -708,230 +710,233 @@ print_partial_compiled_pattern(start, end) unsigned char *p = start; unsigned char *pend = end; - if (start == NULL) - { - printf("(null)\n"); - return; - } - + if (start == NULL) { + printf("(null)\n"); + return; + } + /* Loop over pattern commands. */ - while (p < pend) - { - switch ((enum regexpcode)*p++) - { - case unused: - printf("/unused"); - break; + while (p < pend) { + switch ((enum regexpcode)*p++) { + case unused: + printf("/unused"); + break; - case exactn: - mcnt = *p++; - printf("/exactn/%d", mcnt); - do - { - putchar('/'); - printf("%c", *p++); - } - while (--mcnt); - break; + case exactn: + mcnt = *p++; + printf("/exactn/%d", mcnt); + do { + putchar('/'); + printf("%c", *p++); + } + while (--mcnt); + break; - case start_memory: - mcnt = *p++; - printf("/start_memory/%d/%d", mcnt, *p++); - break; + case start_memory: + mcnt = *p++; + printf("/start_memory/%d/%d", mcnt, *p++); + break; - case stop_memory: - mcnt = *p++; - printf("/stop_memory/%d/%d", mcnt, *p++); - break; + case stop_memory: + mcnt = *p++; + printf("/stop_memory/%d/%d", mcnt, *p++); + break; - case stop_paren: - printf("/stop_paren"); - break; + case stop_paren: + printf("/stop_paren"); + break; - case casefold_on: - printf("/casefold_on"); - break; + case casefold_on: + printf("/casefold_on"); + break; - case casefold_off: - printf("/casefold_off"); - break; + case casefold_off: + printf("/casefold_off"); + break; - case start_nowidth: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/start_nowidth//%d", mcnt); - break; + case posix_on: + printf("/posix_on"); + break; - case stop_nowidth: - printf("/stop_nowidth//"); - p += 2; - break; + case posix_off: + printf("/posix_off"); + break; - case pop_and_fail: - printf("/pop_and_fail"); - break; + case start_nowidth: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/start_nowidth//%d", mcnt); + break; - case duplicate: - printf("/duplicate/%d", *p++); - break; + case stop_nowidth: + printf("/stop_nowidth//"); + p += 2; + break; - case anychar: - printf("/anychar"); - break; + case pop_and_fail: + printf("/pop_and_fail"); + break; - case charset: - case charset_not: - { - register int c; + case duplicate: + printf("/duplicate/%d", *p++); + break; - printf("/charset%s", - (enum regexpcode)*(p - 1) == charset_not ? "_not" : ""); + case anychar: + printf("/anychar"); + break; - mcnt = *p++; - printf("/%d", mcnt); - for (c = 0; c < mcnt; c++) - { - unsigned bit; - unsigned char map_byte = p[c]; + case charset: + case charset_not: + { + register int c; - putchar ('/'); - - for (bit = 0; bit < BYTEWIDTH; bit++) - if (map_byte & (1 << bit)) - printf("%c", c * BYTEWIDTH + bit); - } - p += mcnt; - mcnt = EXTRACT_UNSIGNED_AND_INCR(p); - printf("/"); - while (mcnt--) { - print_mbc(EXTRACT_MBC_AND_INCR(p)); - printf("-"); - print_mbc(EXTRACT_MBC_AND_INCR(p)); - } - break; - } + printf("/charset%s", + (enum regexpcode)*(p - 1) == charset_not ? "_not" : ""); - case begline: - printf("/begline"); - break; + mcnt = *p++; + printf("/%d", mcnt); + for (c = 0; c < mcnt; c++) { + unsigned bit; + unsigned char map_byte = p[c]; - case endline: - printf("/endline"); - break; + putchar ('/'); - case on_failure_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/on_failure_jump//%d", mcnt); - break; - - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/dummy_failure_jump//%d", mcnt); - break; - - case push_dummy_failure: - printf("/push_dummy_failure"); - break; - - case finalize_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/finalize_jump//%d", mcnt); - break; - - case maybe_finalize_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/maybe_finalize_jump//%d", mcnt); - break; - - case jump_past_alt: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/jump_past_alt//%d", mcnt); - break; - - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/jump//%d", mcnt); - break; - - case succeed_n: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - EXTRACT_NUMBER_AND_INCR (mcnt2, p); - printf("/succeed_n//%d//%d", mcnt, mcnt2); - break; - - case jump_n: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - EXTRACT_NUMBER_AND_INCR (mcnt2, p); - printf("/jump_n//%d//%d", mcnt, mcnt2); - break; - - case set_number_at: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - EXTRACT_NUMBER_AND_INCR (mcnt2, p); - printf("/set_number_at//%d//%d", mcnt, mcnt2); - break; - - case try_next: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/try_next//%d", mcnt); - break; - - case finalize_push: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - printf("/finalize_push//%d", mcnt); - break; - - case finalize_push_n: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - EXTRACT_NUMBER_AND_INCR (mcnt2, p); - printf("/finalize_push_n//%d//%d", mcnt, mcnt2); - break; - - case wordbound: - printf("/wordbound"); - break; - - case notwordbound: - printf("/notwordbound"); - break; - - case wordbeg: - printf("/wordbeg"); - break; - - case wordend: - printf("/wordend"); - - case wordchar: - printf("/wordchar"); - break; - - case notwordchar: - printf("/notwordchar"); - break; - - case begbuf: - printf("/begbuf"); - break; - - case endbuf: - printf("/endbuf"); - break; - - case endbuf2: - printf("/endbuf2"); - break; - - default: - printf("?%d", *(p-1)); + for (bit = 0; bit < BYTEWIDTH; bit++) + if (map_byte & (1 << bit)) + printf("%c", c * BYTEWIDTH + bit); } + p += mcnt; + mcnt = EXTRACT_UNSIGNED_AND_INCR(p); + printf("/"); + while (mcnt--) { + print_mbc(EXTRACT_MBC_AND_INCR(p)); + printf("-"); + print_mbc(EXTRACT_MBC_AND_INCR(p)); + } + break; + } + + case begline: + printf("/begline"); + break; + + case endline: + printf("/endline"); + break; + + case on_failure_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/on_failure_jump//%d", mcnt); + break; + + case dummy_failure_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/dummy_failure_jump//%d", mcnt); + break; + + case push_dummy_failure: + printf("/push_dummy_failure"); + break; + + case finalize_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/finalize_jump//%d", mcnt); + break; + + case maybe_finalize_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/maybe_finalize_jump//%d", mcnt); + break; + + case jump_past_alt: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/jump_past_alt//%d", mcnt); + break; + + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/jump//%d", mcnt); + break; + + case succeed_n: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + EXTRACT_NUMBER_AND_INCR (mcnt2, p); + printf("/succeed_n//%d//%d", mcnt, mcnt2); + break; + + case jump_n: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + EXTRACT_NUMBER_AND_INCR (mcnt2, p); + printf("/jump_n//%d//%d", mcnt, mcnt2); + break; + + case set_number_at: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + EXTRACT_NUMBER_AND_INCR (mcnt2, p); + printf("/set_number_at//%d//%d", mcnt, mcnt2); + break; + + case try_next: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/try_next//%d", mcnt); + break; + + case finalize_push: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + printf("/finalize_push//%d", mcnt); + break; + + case finalize_push_n: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + EXTRACT_NUMBER_AND_INCR (mcnt2, p); + printf("/finalize_push_n//%d//%d", mcnt, mcnt2); + break; + + case wordbound: + printf("/wordbound"); + break; + + case notwordbound: + printf("/notwordbound"); + break; + + case wordbeg: + printf("/wordbeg"); + break; + + case wordend: + printf("/wordend"); + + case wordchar: + printf("/wordchar"); + break; + + case notwordchar: + printf("/notwordchar"); + break; + + case begbuf: + printf("/begbuf"); + break; + + case endbuf: + printf("/endbuf"); + break; + + case endbuf2: + printf("/endbuf2"); + break; + + default: + printf("?%d", *(p-1)); } + } printf("/\n"); } static void print_compiled_pattern(bufp) - struct re_pattern_buffer *bufp; + struct re_pattern_buffer *bufp; { unsigned char *buffer = (unsigned char*)bufp->buffer; @@ -940,8 +945,8 @@ print_compiled_pattern(bufp) static char* calculate_must_string(start, end) - char *start; - char *end; + char *start; + char *end; { int mcnt; int max = 0; @@ -950,100 +955,100 @@ calculate_must_string(start, end) char *must = 0; if (start == NULL) return 0; - + /* Loop over pattern commands. */ - while (p < pend) - { - switch ((enum regexpcode)*p++) - { - case unused: - break; + while (p < pend) { + switch ((enum regexpcode)*p++) { + case unused: + break; - case exactn: - mcnt = *p; - if (mcnt > max) { - must = p; - max = mcnt; - } - p += mcnt+1; - break; + case exactn: + mcnt = *p; + if (mcnt > max) { + must = p; + max = mcnt; + } + p += mcnt+1; + break; - case start_memory: - case stop_memory: - p += 2; - break; + case start_memory: + case stop_memory: + p += 2; + break; - case duplicate: - p++; - break; + case duplicate: + p++; + break; - case casefold_on: - case casefold_off: - return 0; /* should not check must_string */ + case casefold_on: + case casefold_off: + case posix_on: + case posix_off: + return 0; /* should not check must_string */ - case pop_and_fail: - case anychar: - case begline: - case endline: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: - case wordchar: - case notwordchar: - case begbuf: - case endbuf: - case endbuf2: - case push_dummy_failure: - case stop_paren: - break; + case pop_and_fail: + case anychar: + case begline: + case endline: + case wordbound: + case notwordbound: + case wordbeg: + case wordend: + case wordchar: + case notwordchar: + case begbuf: + case endbuf: + case endbuf2: + case push_dummy_failure: + case stop_paren: + break; - case charset: - case charset_not: - mcnt = *p++; - p += mcnt; - mcnt = EXTRACT_UNSIGNED_AND_INCR(p); - while (mcnt--) { - p += 4; - } - break; + case charset: + case charset_not: + mcnt = *p++; + p += mcnt; + mcnt = EXTRACT_UNSIGNED_AND_INCR(p); + while (mcnt--) { + p += 4; + } + break; - case on_failure_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - if (mcnt > 0) p += mcnt; - if ((enum regexpcode)p[-3] == jump) { - p -= 3; - EXTRACT_NUMBER_AND_INCR (mcnt, p); - if (mcnt > 0) p += mcnt; - } - break; + case on_failure_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + if (mcnt > 0) p += mcnt; + if ((enum regexpcode)p[-3] == jump) { + p -= 3; + EXTRACT_NUMBER_AND_INCR (mcnt, p); + if (mcnt > 0) p += mcnt; + } + break; - case dummy_failure_jump: - case succeed_n: - case try_next: - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - if (mcnt > 0) p += mcnt; - break; + case dummy_failure_jump: + case succeed_n: + case try_next: + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + if (mcnt > 0) p += mcnt; + break; - case start_nowidth: - case stop_nowidth: - case finalize_jump: - case maybe_finalize_jump: - case finalize_push: - p += 2; - break; + case start_nowidth: + case stop_nowidth: + case finalize_jump: + case maybe_finalize_jump: + case finalize_push: + p += 2; + break; - case jump_n: - case set_number_at: - case finalize_push_n: - p += 4; - break; + case jump_n: + case set_number_at: + case finalize_push_n: + p += 4; + break; - default: - break; - } + default: + break; } + } return must; } @@ -1065,1038 +1070,1045 @@ calculate_must_string(start, end) char * re_compile_pattern(pattern, size, bufp) - char *pattern; + const char *pattern; int size; struct re_pattern_buffer *bufp; { - register char *b = bufp->buffer; - register char *p = pattern; - char *nextp; - char *pend = pattern + size; - register unsigned c, c1; - char *p0; - int numlen; + register char *b = bufp->buffer; + register const char *p = pattern; + const char *nextp; + const char *pend = pattern + size; + register unsigned c, c1; + const char *p0; + int numlen; - /* Address of the count-byte of the most recently inserted `exactn' - command. This makes it possible to tell whether a new exact-match - character can be added to that command or requires a new `exactn' - command. */ + /* Address of the count-byte of the most recently inserted `exactn' + command. This makes it possible to tell whether a new exact-match + character can be added to that command or requires a new `exactn' + command. */ - char *pending_exact = 0; + char *pending_exact = 0; - /* Address of the place where a forward-jump should go to the end of - the containing expression. Each alternative of an `or', except the - last, ends with a forward-jump of this sort. */ + /* Address of the place where a forward-jump should go to the end of + the containing expression. Each alternative of an `or', except the + last, ends with a forward-jump of this sort. */ - char *fixup_alt_jump = 0; + char *fixup_alt_jump = 0; - /* Address of start of the most recently finished expression. - This tells postfix * where to find the start of its operand. */ + /* Address of start of the most recently finished expression. + This tells postfix * where to find the start of its operand. */ - char *laststart = 0; + char *laststart = 0; - /* In processing a repeat, 1 means zero matches is allowed. */ + /* In processing a repeat, 1 means zero matches is allowed. */ - char zero_times_ok; + char zero_times_ok; - /* In processing a repeat, 1 means many matches is allowed. */ + /* In processing a repeat, 1 means many matches is allowed. */ - char many_times_ok; + char many_times_ok; - /* In processing a repeat, 1 means non-greedy matches. */ + /* In processing a repeat, 1 means non-greedy matches. */ - char greedy; + char greedy; - /* Address of beginning of regexp, or inside of last (. */ + /* Address of beginning of regexp, or inside of last (. */ - char *begalt = b; + char *begalt = b; - /* Place in the uncompiled pattern (i.e., the {) to - which to go back if the interval is invalid. */ - char *beg_interval; + /* Place in the uncompiled pattern (i.e., the {) to + which to go back if the interval is invalid. */ + const char *beg_interval; - /* In processing an interval, at least this many matches must be made. */ - int lower_bound; + /* In processing an interval, at least this many matches must be made. */ + int lower_bound; - /* In processing an interval, at most this many matches can be made. */ - int upper_bound; + /* In processing an interval, at most this many matches can be made. */ + int upper_bound; - /* Stack of information saved by ( and restored by ). - Five stack elements are pushed by each (: - First, the value of b. - Second, the value of fixup_alt_jump. - Third, the value of begalt. - Fourth, the value of regnum. - Fifth, the type of the paren. */ + /* Stack of information saved by ( and restored by ). + Five stack elements are pushed by each (: + First, the value of b. + Second, the value of fixup_alt_jump. + Third, the value of begalt. + Fourth, the value of regnum. + Fifth, the type of the paren. */ - int *stackb = RE_TALLOC(40, int); - int *stackp = stackb; - int *stacke = stackb + 40; - int *stackt; + int *stackb = RE_TALLOC(40, int); + int *stackp = stackb; + int *stacke = stackb + 40; + int *stackt; - /* Counts ('s as they are encountered. Remembered for the matching ), - where it becomes the register number to put in the stop_memory - command. */ + /* Counts ('s as they are encountered. Remembered for the matching ), + where it becomes the register number to put in the stop_memory + command. */ - int regnum = 1; + int regnum = 1; - int range = 0; - int had_mbchar = 0; - int had_char_class = 0; + int range = 0; + int had_mbchar = 0; + int had_char_class = 0; - int options = bufp->options; + int options = bufp->options; - bufp->fastmap_accurate = 0; - bufp->must = 0; - bufp->must_skip = 0; - bufp->stclass = 0; + bufp->fastmap_accurate = 0; + bufp->must = 0; + bufp->must_skip = 0; + bufp->stclass = 0; - /* Initialize the syntax table. */ - init_syntax_once(); + /* Initialize the syntax table. */ + init_syntax_once(); - if (bufp->allocated == 0) { - bufp->allocated = INIT_BUF_SIZE; - if (bufp->buffer) - /* EXTEND_BUFFER loses when bufp->allocated is 0. */ - bufp->buffer = (char*)xrealloc (bufp->buffer, INIT_BUF_SIZE); - else - /* Caller did not allocate a buffer. Do it for them. */ - bufp->buffer = (char*)xmalloc(INIT_BUF_SIZE); - if (!bufp->buffer) goto memory_exhausted; - begalt = b = bufp->buffer; - } + if (bufp->allocated == 0) { + bufp->allocated = INIT_BUF_SIZE; + if (bufp->buffer) + /* EXTEND_BUFFER loses when bufp->allocated is 0. */ + bufp->buffer = (char*)xrealloc (bufp->buffer, INIT_BUF_SIZE); + else + /* Caller did not allocate a buffer. Do it for them. */ + bufp->buffer = (char*)xmalloc(INIT_BUF_SIZE); + if (!bufp->buffer) goto memory_exhausted; + begalt = b = bufp->buffer; + } - while (p != pend) { - PATFETCH(c); + while (p != pend) { + PATFETCH(c); - switch (c) - { - case '$': + switch (c) { + case '$': + { + p0 = p; + /* When testing what follows the $, + look past the \-constructs that don't consume anything. */ + + while (p0 != pend) { - p0 = p; - /* When testing what follows the $, - look past the \-constructs that don't consume anything. */ - - while (p0 != pend) - { - if (*p0 == '\\' && p0 + 1 != pend - && (p0[1] == 'b' || p0[1] == 'B')) - p0 += 2; - else - break; - } - /* $ means succeed if at end of line, but only in special contexts. - If validly in the middle of a pattern, it is a normal character. */ - - if (p0 == pend || *p0 == '\n' - || *p0 == ')' - || *p0 == '|') - { - BUFPUSH(endline); - break; - } - goto normal_char; - } - case '^': - /* ^ means succeed if at beg of line, but only if no preceding - pattern. */ - - if (laststart) - goto invalid_pattern; - if (laststart && p - 2 >= pattern && p[-2] != '\n') - goto normal_char; - BUFPUSH(begline); - break; - - case '+': - case '?': - case '*': - /* If there is no previous pattern, char not special. */ - if (!laststart) { - goto invalid_pattern; + if (*p0 == '\\' && p0 + 1 != pend + && (p0[1] == 'b' || p0[1] == 'B')) + p0 += 2; + else + break; } - /* If there is a sequence of repetition chars, - collapse it down to just one. */ - zero_times_ok = c != '+'; - many_times_ok = c != '?'; - greedy = 1; - if (p != pend) { + BUFPUSH(endline); + break; + } + case '^': + BUFPUSH(begline); + break; + + case '+': + case '?': + case '*': + /* If there is no previous pattern, char not special. */ + if (!laststart) { + goto invalid_pattern; + } + /* If there is a sequence of repetition chars, + collapse it down to just one. */ + zero_times_ok = c != '+'; + many_times_ok = c != '?'; + greedy = 1; + if (p != pend) { + PATFETCH(c); + switch (c) { + case '?': + greedy = 0; + break; + case '*': + case '+': + goto nested_meta; + default: + PATUNFETCH; + break; + } + } + + repeat: + /* Star, etc. applied to an empty pattern is equivalent + to an empty pattern. */ + if (!laststart) + break; + + /* Now we know whether or not zero matches is allowed + and also whether or not two or more matches is allowed. */ + if (many_times_ok) { + /* If more than one repetition is allowed, put in at the + end a backward relative jump from b to before the next + jump we're going to put in below (which jumps from + laststart to after this jump). */ + GET_BUFFER_SPACE(3); + store_jump(b,greedy?maybe_finalize_jump:finalize_push,laststart-3); + b += 3; /* Because store_jump put stuff here. */ + } + + /* On failure, jump from laststart to next pattern, which will be the + end of the buffer after this jump is inserted. */ + GET_BUFFER_SPACE(3); + insert_jump(on_failure_jump, laststart, b + 3, b); + b += 3; + + if (zero_times_ok) { + if (greedy == 0) { + GET_BUFFER_SPACE(3); + insert_jump(try_next, laststart, b + 3, b); + b += 3; + } + } + else { + /* At least one repetition is required, so insert a + `dummy_failure_jump' before the initial + `on_failure_jump' instruction of the loop. This + effects a skip over that instruction the first time + we hit that loop. */ + GET_BUFFER_SPACE(3); + insert_jump(dummy_failure_jump, laststart, laststart + 6, b); + b += 3; + } + break; + + case '.': + laststart = b; + BUFPUSH(anychar); + break; + + case '[': + if (p == pend) + goto invalid_pattern; + while ((b - bufp->buffer + 9 + (1 << BYTEWIDTH) / BYTEWIDTH) + > bufp->allocated) + EXTEND_BUFFER; + + laststart = b; + if (*p == '^') + { + BUFPUSH(charset_not); + p++; + } + else + BUFPUSH(charset); + p0 = p; + + BUFPUSH((1 << BYTEWIDTH) / BYTEWIDTH); + /* Clear the whole map */ + memset(b, 0, (1 << BYTEWIDTH) / BYTEWIDTH + 2); + + had_mbchar = 0; + had_char_class = 0; + + /* charset_not matches newline according to a syntax bit. */ + if ((enum regexpcode)b[-2] == charset_not) { + if (bufp->options & RE_OPTION_POSIX) + SET_LIST_BIT ('\n'); + else + SET_LIST_BIT ('\0'); + } + + /* Read in characters and ranges, setting map bits. */ + for (;;) + { + int size; + unsigned last = (unsigned)-1; + + if ((size = EXTRACT_UNSIGNED(&b[(1 << BYTEWIDTH) / BYTEWIDTH])) + || current_mbctype) { + /* Ensure the space is enough to hold another interval + of multi-byte chars in charset(_not)?. */ + size = (1 << BYTEWIDTH) / BYTEWIDTH + 2 + size*8 + 8; + while (b + size + 1 > bufp->buffer + bufp->allocated) + EXTEND_BUFFER; + } + range_retry: + PATFETCH(c); + + if (c == ']') { + if (p == p0 + 1) { + if (p == pend) + goto invalid_pattern; + } + else + /* Stop if this isn't merely a ] inside a bracket + expression, but rather the end of a bracket + expression. */ + break; + } + /* Look ahead to see if it's a range when the last thing + was a character class. */ + if (had_char_class && c == '-' && *p != ']') + goto invalid_pattern; + if (ismbchar(c)) { + PATFETCH_MBC(c); + had_mbchar++; + } + + /* \ escapes characters when inside [...]. */ + if (c == '\\') { PATFETCH(c); switch (c) { - case '?': - greedy = 0; - break; - case '*': - case '+': - goto nested_meta; - default: - PATUNFETCH; - break; - } - } - - repeat: - /* Star, etc. applied to an empty pattern is equivalent - to an empty pattern. */ - if (!laststart) - break; - - /* Now we know whether or not zero matches is allowed - and also whether or not two or more matches is allowed. */ - if (many_times_ok) { - /* If more than one repetition is allowed, put in at the - end a backward relative jump from b to before the next - jump we're going to put in below (which jumps from - laststart to after this jump). */ - GET_BUFFER_SPACE(3); - store_jump(b,greedy?maybe_finalize_jump:finalize_push,laststart-3); - b += 3; /* Because store_jump put stuff here. */ - } - - /* On failure, jump from laststart to next pattern, which will be the - end of the buffer after this jump is inserted. */ - GET_BUFFER_SPACE(3); - insert_jump(on_failure_jump, laststart, b + 3, b); - b += 3; - - if (zero_times_ok) { - if (greedy == 0) { - GET_BUFFER_SPACE(3); - insert_jump(try_next, laststart, b + 3, b); - b += 3; - } - } - else { - /* At least one repetition is required, so insert a - `dummy_failure_jump' before the initial - `on_failure_jump' instruction of the loop. This - effects a skip over that instruction the first time - we hit that loop. */ - GET_BUFFER_SPACE(3); - insert_jump(dummy_failure_jump, laststart, laststart + 6, b); - b += 3; - } - break; - - case '.': - laststart = b; - BUFPUSH(anychar); - break; - - case '[': - if (p == pend) - goto invalid_pattern; - while ((b - bufp->buffer + 9 + (1 << BYTEWIDTH) / BYTEWIDTH) - > bufp->allocated) - EXTEND_BUFFER; - - laststart = b; - if (*p == '^') - { - BUFPUSH(charset_not); - p++; - } - else - BUFPUSH(charset); - p0 = p; - - BUFPUSH((1 << BYTEWIDTH) / BYTEWIDTH); - /* Clear the whole map */ - memset(b, 0, (1 << BYTEWIDTH) / BYTEWIDTH + 2); - - had_mbchar = 0; - had_char_class = 0; - /* Read in characters and ranges, setting map bits. */ - for (;;) - { - int size; - unsigned last = (unsigned)-1; - - if ((size = EXTRACT_UNSIGNED(&b[(1 << BYTEWIDTH) / BYTEWIDTH])) - || current_mbctype) { - /* Ensure the space is enough to hold another interval - of multi-byte chars in charset(_not)?. */ - size = (1 << BYTEWIDTH) / BYTEWIDTH + 2 + size*8 + 8; - while (b + size + 1 > bufp->buffer + bufp->allocated) - EXTEND_BUFFER; + case 'w': + for (c = 0; c < (1 << BYTEWIDTH); c++) { + if (SYNTAX(c) == Sword || + (!current_mbctype && SYNTAX(c) == Sword2)) + SET_LIST_BIT(c); } - range_retry: - PATFETCH(c); - - if (c == ']') { - if (p == p0 + 1) { - if (p == pend) - goto invalid_pattern; - } - else - /* Stop if this isn't merely a ] inside a bracket - expression, but rather the end of a bracket - expression. */ - break; + if (current_mbctype) { + set_list_bits(0x80, 0xffffffff, b); } - /* Look ahead to see if it's a range when the last thing - was a character class. */ - if (had_char_class && c == '-' && *p != ']') - goto invalid_pattern; + last = -1; + continue; + + case 'W': + for (c = 0; c < (1 << BYTEWIDTH); c++) { + if (SYNTAX(c) != Sword && + (current_mbctype || SYNTAX(c) != Sword2)) + SET_LIST_BIT(c); + } + last = -1; + continue; + + case 's': + for (c = 0; c < 256; c++) + if (ISSPACE(c)) + SET_LIST_BIT(c); + last = -1; + continue; + + case 'S': + for (c = 0; c < 256; c++) + if (!ISSPACE(c)) + SET_LIST_BIT(c); + if (current_mbctype) { + set_list_bits(0x80, 0xffffffff, b); + } + last = -1; + continue; + + case 'd': + for (c = '0'; c <= '9'; c++) + SET_LIST_BIT(c); + last = -1; + continue; + + case 'D': + for (c = 0; c < 256; c++) + if (!ISDIGIT(c)) + SET_LIST_BIT(c); + if (current_mbctype) { + set_list_bits(0x80, 0xffffffff, b); + } + last = -1; + continue; + + case 'x': + c = scan_hex(p, 2, &numlen); + p += numlen; + break; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + PATUNFETCH; + c = scan_oct(p, 3, &numlen); + p += numlen; + break; + + default: if (ismbchar(c)) { PATFETCH_MBC(c); had_mbchar++; } - - /* \ escapes characters when inside [...]. */ - if (c == '\\') { - PATFETCH(c); - switch (c) { - case 'w': - for (c = 0; c < (1 << BYTEWIDTH); c++) { - if (SYNTAX(c) == Sword || - (!current_mbctype && SYNTAX(c) == Sword2)) - SET_LIST_BIT(c); - } - if (current_mbctype) { - set_list_bits(0x80, 0xffffffff, b); - } - last = -1; - continue; - - case 'W': - for (c = 0; c < (1 << BYTEWIDTH); c++) { - if (SYNTAX(c) != Sword && - (current_mbctype || SYNTAX(c) != Sword2)) - SET_LIST_BIT(c); - } - last = -1; - continue; - - case 's': - for (c = 0; c < 256; c++) - if (ISSPACE(c)) - SET_LIST_BIT(c); - last = -1; - continue; - - case 'S': - for (c = 0; c < 256; c++) - if (!ISSPACE(c)) - SET_LIST_BIT(c); - if (current_mbctype) { - set_list_bits(0x80, 0xffffffff, b); - } - last = -1; - continue; - - case 'd': - for (c = '0'; c <= '9'; c++) - SET_LIST_BIT(c); - last = -1; - continue; - - case 'D': - for (c = 0; c < 256; c++) - if (!ISDIGIT(c)) - SET_LIST_BIT(c); - if (current_mbctype) { - set_list_bits(0x80, 0xffffffff, b); - } - last = -1; - continue; - - case 'x': - c = scan_hex(p, 2, &numlen); - p += numlen; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - PATUNFETCH; - c = scan_oct(p, 3, &numlen); - p += numlen; - break; - - default: - if (ismbchar(c)) { - PATFETCH_MBC(c); - had_mbchar++; - } - break; - } - } - - /* Get a range. */ - if (range) { - if (last > c) - goto invalid_pattern; - - range = 0; - if (had_mbchar == 0) { - for (;last<=c;last++) - SET_LIST_BIT(last); - } - else if (had_mbchar == 2) { - set_list_bits(last, c, b); - } - else { - /* restriction: range between sbc and mbc */ - goto invalid_pattern; - } - } - else if (p[0] == '-' && p[1] != ']') { - last = c; - PATFETCH(c1); - range = 1; - goto range_retry; - } - else if (c == '[' && *p == ':') { - /* Leave room for the null. */ - char str[CHAR_CLASS_MAX_LENGTH + 1]; - - PATFETCH_RAW (c); - c1 = 0; - - /* If pattern is `[[:'. */ - if (p == pend) - goto invalid_pattern; - - for (;;) { - PATFETCH (c); - if (c == ':' || c == ']' || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) - break; - str[c1++] = c; - } - str[c1] = '\0'; - - /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave - the leading `:' and `[' (but set bits for them). */ - if (c == ':' && *p == ']') { - int ch; - char is_alnum = STREQ(str, "alnum"); - char is_alpha = STREQ(str, "alpha"); - char is_blank = STREQ(str, "blank"); - char is_cntrl = STREQ(str, "cntrl"); - char is_digit = STREQ(str, "digit"); - char is_graph = STREQ(str, "graph"); - char is_lower = STREQ(str, "lower"); - char is_print = STREQ(str, "print"); - char is_punct = STREQ(str, "punct"); - char is_space = STREQ(str, "space"); - char is_upper = STREQ(str, "upper"); - char is_xdigit = STREQ(str, "xdigit"); - - if (!IS_CHAR_CLASS (str)) - goto invalid_pattern; - - /* Throw away the ] at the end of the character class. */ - PATFETCH (c); - - if (p == pend) - goto invalid_pattern; - - for (ch = 0; ch < 1 << BYTEWIDTH; ch++) { - if ( (is_alnum && ISALNUM(ch)) - || (is_alpha && ISALPHA(ch)) - || (is_blank && ISBLANK(ch)) - || (is_cntrl && ISCNTRL(ch)) - || (is_digit && ISDIGIT(ch)) - || (is_graph && ISGRAPH(ch)) - || (is_lower && ISLOWER(ch)) - || (is_print && ISPRINT(ch)) - || (is_punct && ISPUNCT(ch)) - || (is_space && ISSPACE(ch)) - || (is_upper && ISUPPER(ch)) - || (is_xdigit && ISXDIGIT(ch))) - SET_LIST_BIT (ch); - } - had_char_class = 1; - } - else { - c1++; - while (c1--) - PATUNFETCH; - SET_LIST_BIT(translate?translate['[']:'['); - SET_LIST_BIT(translate?translate[':']:':'); - had_char_class = 0; - last = ':'; - } - } - else if (had_mbchar == 0) - SET_LIST_BIT(c); - else - set_list_bits(c, c, b); - had_mbchar = 0; - } - - /* Discard any character set/class bitmap bytes that are all - 0 at the end of the map. Decrement the map-length byte too. */ - while ((int)b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; - if (b[-1] != (1 << BYTEWIDTH) / BYTEWIDTH) - memmove(&b[b[-1]], &b[(1 << BYTEWIDTH) / BYTEWIDTH], - 2 + EXTRACT_UNSIGNED (&b[(1 << BYTEWIDTH) / BYTEWIDTH])*8); - b += b[-1] + 2 + EXTRACT_UNSIGNED (&b[b[-1]])*8; - break; - - case '(': - PATFETCH(c); - if (c == '?') { - int negative = 0; - PATFETCH_RAW(c); - switch (c) { - case 'x': case 'i': case '-': - for (;;) { - switch (c) { - case '-': - negative = 1; - break; - - case ':': - case ')': - break; - - case 'x': - if (negative) - options &= ~RE_OPTION_EXTENDED; - else - options |= RE_OPTION_EXTENDED; - break; - case 'i': - if (negative) { - if (options&RE_OPTION_IGNORECASE) { - options &= ~RE_OPTION_IGNORECASE; - BUFPUSH(casefold_off); - } - } - else if (!(options&RE_OPTION_IGNORECASE)) { - options |= RE_OPTION_IGNORECASE; - BUFPUSH(casefold_on); - } - break; - - default: - FREE_AND_RETURN(stackb, "undefined (?...) inline option"); - } - if (c == ')') { - c = '#'; /* read whole in-line options */ - break; - } - if (c == ':') break; - PATFETCH_RAW(c); - } - break; - - case '#': - for (;;) { - PATFETCH(c); - if (c == ')') break; - } - c = '#'; - break; - - case ':': - case '=': - case '!': - break; - - default: - FREE_AND_RETURN(stackb, "undefined (?...) sequence"); + break; } } - else { - PATUNFETCH; - c = '('; - } - if (c == '#') break; - if (stackp+8 >= stacke) { - int *stackx; - unsigned int len = stacke - stackb; - stackx = DOUBLE_STACK(stackx,stackb,len,int); - /* Rearrange the pointers. */ - stackp = stackx + (stackp - stackb); - stackb = stackx; - stacke = stackb + 2 * len; - } + /* Get a range. */ + if (range) { + if (last > c) + goto invalid_pattern; - /* Laststart should point to the start_memory that we are about - to push (unless the pattern has RE_NREGS or more ('s). */ - /* obsolete: now RE_NREGS is just a default register size. */ - *stackp++ = b - bufp->buffer; - *stackp++ = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; - *stackp++ = begalt - bufp->buffer; - switch (c) { - case '(': - BUFPUSH(start_memory); - BUFPUSH(regnum); - *stackp++ = regnum++; - *stackp++ = b - bufp->buffer; - BUFPUSH(0); - /* too many ()'s to fit in a byte. (max 254) */ - if (regnum >= RE_REG_MAX) goto too_big; - break; - - case '=': - case '!': - BUFPUSH(start_nowidth); - *stackp++ = b - bufp->buffer; - BUFPUSH(0); /* temporary value */ - BUFPUSH(0); - if (c == '=') break; - - BUFPUSH(on_failure_jump); - *stackp++ = b - bufp->buffer; - BUFPUSH(0); /* temporary value */ - BUFPUSH(0); - break; - - case ':': - pending_exact = 0; - default: - break; - } - *stackp++ = c; - *stackp++ = options; - fixup_alt_jump = 0; - laststart = 0; - begalt = b; - break; - - case ')': - if (stackp == stackb) - FREE_AND_RETURN(stackb, "unmatched )"); - if ((options ^ stackp[-1]) & RE_OPTION_IGNORECASE) { - BUFPUSH((options&RE_OPTION_IGNORECASE)?casefold_off:casefold_on); - } - pending_exact = 0; - if (fixup_alt_jump) - { /* Push a dummy failure point at the end of the - alternative for a possible future - `finalize_jump' to pop. See comments at - `push_dummy_failure' in `re_match'. */ - BUFPUSH(push_dummy_failure); - - /* We allocated space for this jump when we assigned - to `fixup_alt_jump', in the `handle_alt' case below. */ - store_jump(fixup_alt_jump, jump, b); - } - options = *--stackp; - switch (c = *--stackp) { - case '(': - { - char *loc = bufp->buffer + *--stackp; - *loc = regnum - stackp[-1]; - BUFPUSH(stop_memory); - BUFPUSH(stackp[-1]); - BUFPUSH(regnum - stackp[-1]); - stackp--; - } - break; - - case '!': - BUFPUSH(pop_and_fail); - /* back patch */ - STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); - stackp--; - /* fall through */ - case '=': - BUFPUSH(stop_nowidth); - /* tell stack-pos place to start_nowidth */ - STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); - BUFPUSH(0); /* space to hold stack pos */ - BUFPUSH(0); - stackp--; - break; - - case ':': - BUFPUSH(stop_paren); - break; - - default: - break; - } - begalt = *--stackp + bufp->buffer; - stackp--; - fixup_alt_jump = *stackp ? *stackp + bufp->buffer - 1 : 0; - laststart = *--stackp + bufp->buffer; - if (c == '!' || c == '=') laststart = b; - break; - - case '|': - /* Insert before the previous alternative a jump which - jumps to this alternative if the former fails. */ - GET_BUFFER_SPACE(3); - insert_jump(on_failure_jump, begalt, b + 6, b); - pending_exact = 0; - b += 3; - /* The alternative before this one has a jump after it - which gets executed if it gets matched. Adjust that - jump so it will jump to this alternative's analogous - jump (put in below, which in turn will jump to the next - (if any) alternative's such jump, etc.). The last such - jump jumps to the correct final destination. A picture: - _____ _____ - | | | | - | v | v - a | b | c - - If we are at `b', then fixup_alt_jump right now points to a - three-byte space after `a'. We'll put in the jump, set - fixup_alt_jump to right after `b', and leave behind three - bytes which we'll fill in when we get to after `c'. */ - - if (fixup_alt_jump) - store_jump(fixup_alt_jump, jump_past_alt, b); - - /* Mark and leave space for a jump after this alternative, - to be filled in later either by next alternative or - when know we're at the end of a series of alternatives. */ - fixup_alt_jump = b; - GET_BUFFER_SPACE(3); - b += 3; - - laststart = 0; - begalt = b; - break; - - case '{': - /* If there is no previous pattern, this isn't an interval. */ - if (!laststart || p == pend) - { - goto normal_char; + range = 0; + if (had_mbchar == 0) { + for (;last<=c;last++) + SET_LIST_BIT(last); + } + else if (had_mbchar == 2) { + set_list_bits(last, c, b); + } + else { + /* restriction: range between sbc and mbc */ + goto invalid_pattern; } - - beg_interval = p - 1; - - lower_bound = -1; /* So can see if are set. */ - upper_bound = -1; - GET_UNSIGNED_NUMBER(lower_bound); - if (c == ',') { - GET_UNSIGNED_NUMBER(upper_bound); } + else if (p[0] == '-' && p[1] != ']') { + last = c; + PATFETCH(c1); + range = 1; + goto range_retry; + } + else if (c == '[' && *p == ':') { + /* Leave room for the null. */ + char str[CHAR_CLASS_MAX_LENGTH + 1]; + + PATFETCH_RAW (c); + c1 = 0; + + /* If pattern is `[[:'. */ + if (p == pend) + goto invalid_pattern; + + for (;;) { + PATFETCH (c); + if (c == ':' || c == ']' || p == pend + || c1 == CHAR_CLASS_MAX_LENGTH) + break; + str[c1++] = c; + } + str[c1] = '\0'; + + /* If isn't a word bracketed by `[:' and:`]': + undo the ending character, the letters, and leave + the leading `:' and `[' (but set bits for them). */ + if (c == ':' && *p == ']') { + int ch; + char is_alnum = STREQ(str, "alnum"); + char is_alpha = STREQ(str, "alpha"); + char is_blank = STREQ(str, "blank"); + char is_cntrl = STREQ(str, "cntrl"); + char is_digit = STREQ(str, "digit"); + char is_graph = STREQ(str, "graph"); + char is_lower = STREQ(str, "lower"); + char is_print = STREQ(str, "print"); + char is_punct = STREQ(str, "punct"); + char is_space = STREQ(str, "space"); + char is_upper = STREQ(str, "upper"); + char is_xdigit = STREQ(str, "xdigit"); + + if (!IS_CHAR_CLASS (str)) + goto invalid_pattern; + + /* Throw away the ] at the end of the character class. */ + PATFETCH (c); + + if (p == pend) + goto invalid_pattern; + + for (ch = 0; ch < 1 << BYTEWIDTH; ch++) { + if ( (is_alnum && ISALNUM(ch)) + || (is_alpha && ISALPHA(ch)) + || (is_blank && ISBLANK(ch)) + || (is_cntrl && ISCNTRL(ch)) + || (is_digit && ISDIGIT(ch)) + || (is_graph && ISGRAPH(ch)) + || (is_lower && ISLOWER(ch)) + || (is_print && ISPRINT(ch)) + || (is_punct && ISPUNCT(ch)) + || (is_space && ISSPACE(ch)) + || (is_upper && ISUPPER(ch)) + || (is_xdigit && ISXDIGIT(ch))) + SET_LIST_BIT (ch); + } + had_char_class = 1; + } + else { + c1++; + while (c1--) + PATUNFETCH; + SET_LIST_BIT(translate?translate['[']:'['); + SET_LIST_BIT(translate?translate[':']:':'); + had_char_class = 0; + last = ':'; + } + } + else if (had_mbchar == 0) + SET_LIST_BIT(c); else - /* Interval such as `{1}' => match exactly once. */ - upper_bound = lower_bound; + set_list_bits(c, c, b); + had_mbchar = 0; + } - if (lower_bound < 0 || c != '}') - goto unfetch_interval; + /* Discard any character set/class bitmap bytes that are all + 0 at the end of the map. Decrement the map-length byte too. */ + while ((int)b[-1] > 0 && b[b[-1] - 1] == 0) + b[-1]--; + if (b[-1] != (1 << BYTEWIDTH) / BYTEWIDTH) + memmove(&b[b[-1]], &b[(1 << BYTEWIDTH) / BYTEWIDTH], + 2 + EXTRACT_UNSIGNED (&b[(1 << BYTEWIDTH) / BYTEWIDTH])*8); + b += b[-1] + 2 + EXTRACT_UNSIGNED (&b[b[-1]])*8; + break; - if (lower_bound >= RE_DUP_MAX || upper_bound >= RE_DUP_MAX) - FREE_AND_RETURN(stackb, "too big quantifier in {,}"); - if (upper_bound < 0) upper_bound = RE_DUP_MAX; - if (lower_bound > upper_bound) - FREE_AND_RETURN(stackb, "can't do {n,m} with n > m"); - - beg_interval = 0; - pending_exact = 0; - - greedy = 1; - if (p != pend) { - PATFETCH(c); - if (c == '?') greedy = 0; - else PATUNFETCH; - } - - if (lower_bound == 0) { - zero_times_ok = 1; - if (upper_bound == RE_DUP_MAX) { - many_times_ok = 1; - goto repeat; - } - if (upper_bound == 1) { - many_times_ok = 0; - goto repeat; - } - } - if (lower_bound == 1) { - if (upper_bound == 1) { - /* No need to repeat */ + case '(': + PATFETCH(c); + if (c == '?') { + int negative = 0; + PATFETCH_RAW(c); + switch (c) { + case 'x': case 'p': case 'i': case '-': + for (;;) { + switch (c) { + case '-': + negative = 1; break; - } - if (upper_bound == RE_DUP_MAX) { - many_times_ok = 1; - zero_times_ok = 0; - goto repeat; - } - } - /* If upper_bound is zero, don't want to succeed at all; - jump from laststart to b + 3, which will be the end of - the buffer after this jump is inserted. */ + case ':': + case ')': + break; - if (upper_bound == 0) { - GET_BUFFER_SPACE(3); - insert_jump(jump, laststart, b + 3, b); - b += 3; - break; - } - - /* Otherwise, we have a nontrivial interval. When - we're all done, the pattern will look like: - set_number_at - set_number_at - succeed_n - - jump_n - (The upper bound and `jump_n' are omitted if - `upper_bound' is 1, though.) */ - { /* If the upper bound is > 1, we need to insert - more at the end of the loop. */ - unsigned nbytes = upper_bound == 1 ? 10 : 20; - - GET_BUFFER_SPACE(nbytes); - /* Initialize lower bound of the `succeed_n', even - though it will be set during matching by its - attendant `set_number_at' (inserted next), - because `re_compile_fastmap' needs to know. - Jump to the `jump_n' we might insert below. */ - insert_jump_n(succeed_n, laststart, b + (nbytes/2), - b, lower_bound); - b += 5; /* Just increment for the succeed_n here. */ - - /* Code to initialize the lower bound. Insert - before the `succeed_n'. The `5' is the last two - bytes of this `set_number_at', plus 3 bytes of - the following `succeed_n'. */ - insert_op_2(set_number_at, laststart, b, 5, lower_bound); - b += 5; - - if (upper_bound > 1) - { /* More than one repetition is allowed, so - append a backward jump to the `succeed_n' - that starts this interval. - - When we've reached this during matching, - we'll have matched the interval once, so - jump back only `upper_bound - 1' times. */ - GET_BUFFER_SPACE(5); - store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5, - upper_bound - 1); - b += 5; - - /* The location we want to set is the second - parameter of the `jump_n'; that is `b-2' as - an absolute address. `laststart' will be - the `set_number_at' we're about to insert; - `laststart+3' the number to set, the source - for the relative address. But we are - inserting into the middle of the pattern -- - so everything is getting moved up by 5. - Conclusion: (b - 2) - (laststart + 3) + 5, - i.e., b - laststart. - - We insert this at the beginning of the loop - so that if we fail during matching, we'll - reinitialize the bounds. */ - insert_op_2(set_number_at, laststart, b, b - laststart, - upper_bound - 1); - b += 5; - } - } - break; - - unfetch_interval: - /* If an invalid interval, match the characters as literals. */ - p = beg_interval; - beg_interval = 0; - - /* normal_char and normal_backslash need `c'. */ - PATFETCH (c); - goto normal_char; - - case '\\': - if (p == pend) goto invalid_pattern; - /* Do not translate the character after the \, so that we can - distinguish, e.g., \B from \b, even if we normally would - translate, e.g., B to b. */ - PATFETCH_RAW(c); - switch (c) - { - case 's': - case 'S': - case 'd': - case 'D': - while (b - bufp->buffer + 9 + (1 << BYTEWIDTH) / BYTEWIDTH - > bufp->allocated) - EXTEND_BUFFER; - - laststart = b; - if (c == 's' || c == 'd') { - BUFPUSH(charset); - } - else { - BUFPUSH(charset_not); - } - - BUFPUSH((1 << BYTEWIDTH) / BYTEWIDTH); - memset(b, 0, (1 << BYTEWIDTH) / BYTEWIDTH + 2); - if (c == 's' || c == 'S') { - SET_LIST_BIT(' '); - SET_LIST_BIT('\t'); - SET_LIST_BIT('\n'); - SET_LIST_BIT('\r'); - SET_LIST_BIT('\f'); - } - else { - char cc; - - for (cc = '0'; cc <= '9'; cc++) { - SET_LIST_BIT(cc); + case 'x': + if (negative) + options &= ~RE_OPTION_EXTENDED; + else + options |= RE_OPTION_EXTENDED; + break; + case 'p': + if (negative) { + if (options&RE_OPTION_POSIX) { + options &= ~RE_OPTION_POSIX; + BUFPUSH(posix_off); } } - - while ((int)b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; - if (b[-1] != (1 << BYTEWIDTH) / BYTEWIDTH) - memmove(&b[b[-1]], &b[(1 << BYTEWIDTH) / BYTEWIDTH], - 2 + EXTRACT_UNSIGNED(&b[(1 << BYTEWIDTH) / BYTEWIDTH])*8); - b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[b[-1]])*8; - break; - - case 'w': - laststart = b; - BUFPUSH(wordchar); - break; - - case 'W': - laststart = b; - BUFPUSH(notwordchar); - break; - - case '<': - BUFPUSH(wordbeg); - break; - - case '>': - BUFPUSH(wordend); - break; - - case 'b': - BUFPUSH(wordbound); - break; - - case 'B': - BUFPUSH(notwordbound); - break; - - case 'A': - BUFPUSH(begbuf); - break; - - case 'Z': - BUFPUSH(endbuf2); - break; - - case 'z': - BUFPUSH(endbuf); - break; - - /* hex */ - case 'x': - had_mbchar = 0; - c = scan_hex(p, 2, &numlen); - p += numlen; - goto numeric_char; - - /* octal */ - case '0': - had_mbchar = 0; - c = scan_oct(p, 3, &numlen); - p += numlen; - goto numeric_char; - - /* back-ref or octal */ - case '1': case '2': case '3': - case '4': case '5': case '6': - case '7': case '8': case '9': - { - char *p_save; - - PATUNFETCH; - p_save = p; - - had_mbchar = 0; - c1 = 0; - GET_UNSIGNED_NUMBER(c1); - if (!ISDIGIT(c)) PATUNFETCH; - - if (c1 >= regnum) { - /* need to get octal */ - p = p_save; - c = scan_oct(p_save, 3, &numlen) & 0xff; - p = p_save + numlen; - c1 = 0; - goto numeric_char; - } + else if (!(options&RE_OPTION_POSIX)) { + options |= RE_OPTION_POSIX; + BUFPUSH(posix_on); + } + break; + case 'i': + if (negative) { + if (options&RE_OPTION_IGNORECASE) { + options &= ~RE_OPTION_IGNORECASE; + BUFPUSH(casefold_off); + } + } + else if (!(options&RE_OPTION_IGNORECASE)) { + options |= RE_OPTION_IGNORECASE; + BUFPUSH(casefold_on); } - - /* Can't back reference to a subexpression if inside of it. */ - for (stackt = stackp - 2; stackt > stackb; stackt -= 5) - if (*stackt == c1) - goto normal_char; - laststart = b; - BUFPUSH(duplicate); - BUFPUSH(c1); break; - default: - goto normal_char; + default: + FREE_AND_RETURN(stackb, "undefined (?...) inline option"); } + if (c == ')') { + c = '#'; /* read whole in-line options */ + break; + } + if (c == ':') break; + PATFETCH_RAW(c); + } break; case '#': - if (options & RE_OPTION_EXTENDED) - { - while (p != pend) { - PATFETCH(c); - if (c == '\n') break; - } - break; - } - goto normal_char; + for (;;) { + PATFETCH(c); + if (c == ')') break; + } + c = '#'; + break; - case ' ': - case '\t': - case '\f': - case '\r': - case '\n': - if (options & RE_OPTION_EXTENDED) - break; + case ':': + case '=': + case '!': + break; default: - normal_char: /* Expects the character in `c'. */ - had_mbchar = 0; - if (ismbchar(c)) { - had_mbchar = 1; - c1 = p - pattern; + FREE_AND_RETURN(stackb, "undefined (?...) sequence"); + } + } + else { + PATUNFETCH; + c = '('; + } + if (c == '#') break; + if (stackp+8 >= stacke) { + int *stackx; + unsigned int len = stacke - stackb; + + stackx = DOUBLE_STACK(stackx,stackb,len,int); + /* Rearrange the pointers. */ + stackp = stackx + (stackp - stackb); + stackb = stackx; + stacke = stackb + 2 * len; + } + + /* Laststart should point to the start_memory that we are about + to push (unless the pattern has RE_NREGS or more ('s). */ + /* obsolete: now RE_NREGS is just a default register size. */ + *stackp++ = b - bufp->buffer; + *stackp++ = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; + *stackp++ = begalt - bufp->buffer; + switch (c) { + case '(': + BUFPUSH(start_memory); + BUFPUSH(regnum); + *stackp++ = regnum++; + *stackp++ = b - bufp->buffer; + BUFPUSH(0); + /* too many ()'s to fit in a byte. (max 254) */ + if (regnum >= RE_REG_MAX) goto too_big; + break; + + case '=': + case '!': + BUFPUSH(start_nowidth); + *stackp++ = b - bufp->buffer; + BUFPUSH(0); /* temporary value */ + BUFPUSH(0); + if (c == '=') break; + + BUFPUSH(on_failure_jump); + *stackp++ = b - bufp->buffer; + BUFPUSH(0); /* temporary value */ + BUFPUSH(0); + break; + + case ':': + pending_exact = 0; + default: + break; + } + *stackp++ = c; + *stackp++ = options; + fixup_alt_jump = 0; + laststart = 0; + begalt = b; + break; + + case ')': + if (stackp == stackb) + FREE_AND_RETURN(stackb, "unmatched )"); + if ((options ^ stackp[-1]) & RE_OPTION_IGNORECASE) { + BUFPUSH((options&RE_OPTION_IGNORECASE)?casefold_off:casefold_on); + } + if ((options ^ stackp[-1]) & RE_OPTION_POSIX) { + BUFPUSH((options&RE_OPTION_POSIX)?posix_off:posix_on); + } + pending_exact = 0; + if (fixup_alt_jump) + { /* Push a dummy failure point at the end of the + alternative for a possible future + `finalize_jump' to pop. See comments at + `push_dummy_failure' in `re_match'. */ + BUFPUSH(push_dummy_failure); + + /* We allocated space for this jump when we assigned + to `fixup_alt_jump', in the `handle_alt' case below. */ + store_jump(fixup_alt_jump, jump, b); + } + options = *--stackp; + switch (c = *--stackp) { + case '(': + { + char *loc = bufp->buffer + *--stackp; + *loc = regnum - stackp[-1]; + BUFPUSH(stop_memory); + BUFPUSH(stackp[-1]); + BUFPUSH(regnum - stackp[-1]); + stackp--; + } + break; + + case '!': + BUFPUSH(pop_and_fail); + /* back patch */ + STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); + stackp--; + /* fall through */ + case '=': + BUFPUSH(stop_nowidth); + /* tell stack-pos place to start_nowidth */ + STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); + BUFPUSH(0); /* space to hold stack pos */ + BUFPUSH(0); + stackp--; + break; + + case ':': + BUFPUSH(stop_paren); + break; + + default: + break; + } + begalt = *--stackp + bufp->buffer; + stackp--; + fixup_alt_jump = *stackp ? *stackp + bufp->buffer - 1 : 0; + laststart = *--stackp + bufp->buffer; + if (c == '!' || c == '=') laststart = b; + break; + + case '|': + /* Insert before the previous alternative a jump which + jumps to this alternative if the former fails. */ + GET_BUFFER_SPACE(3); + insert_jump(on_failure_jump, begalt, b + 6, b); + pending_exact = 0; + b += 3; + /* The alternative before this one has a jump after it + which gets executed if it gets matched. Adjust that + jump so it will jump to this alternative's analogous + jump (put in below, which in turn will jump to the next + (if any) alternative's such jump, etc.). The last such + jump jumps to the correct final destination. A picture: + _____ _____ + | | | | + | v | v + a | b | c + + If we are at `b', then fixup_alt_jump right now points to a + three-byte space after `a'. We'll put in the jump, set + fixup_alt_jump to right after `b', and leave behind three + bytes which we'll fill in when we get to after `c'. */ + + if (fixup_alt_jump) + store_jump(fixup_alt_jump, jump_past_alt, b); + + /* Mark and leave space for a jump after this alternative, + to be filled in later either by next alternative or + when know we're at the end of a series of alternatives. */ + fixup_alt_jump = b; + GET_BUFFER_SPACE(3); + b += 3; + + laststart = 0; + begalt = b; + break; + + case '{': + /* If there is no previous pattern, this isn't an interval. */ + if (!laststart || p == pend) + { + goto normal_char; + } + + beg_interval = p - 1; + + lower_bound = -1; /* So can see if are set. */ + upper_bound = -1; + GET_UNSIGNED_NUMBER(lower_bound); + if (c == ',') { + GET_UNSIGNED_NUMBER(upper_bound); + } + else + /* Interval such as `{1}' => match exactly once. */ + upper_bound = lower_bound; + + if (lower_bound < 0 || c != '}') + goto unfetch_interval; + + if (lower_bound >= RE_DUP_MAX || upper_bound >= RE_DUP_MAX) + FREE_AND_RETURN(stackb, "too big quantifier in {,}"); + if (upper_bound < 0) upper_bound = RE_DUP_MAX; + if (lower_bound > upper_bound) + FREE_AND_RETURN(stackb, "can't do {n,m} with n > m"); + + beg_interval = 0; + pending_exact = 0; + + greedy = 1; + if (p != pend) { + PATFETCH(c); + if (c == '?') greedy = 0; + else PATUNFETCH; + } + + if (lower_bound == 0) { + zero_times_ok = 1; + if (upper_bound == RE_DUP_MAX) { + many_times_ok = 1; + goto repeat; + } + if (upper_bound == 1) { + many_times_ok = 0; + goto repeat; + } + } + if (lower_bound == 1) { + if (upper_bound == 1) { + /* No need to repeat */ + break; + } + if (upper_bound == RE_DUP_MAX) { + many_times_ok = 1; + zero_times_ok = 0; + goto repeat; + } + } + + /* If upper_bound is zero, don't want to succeed at all; + jump from laststart to b + 3, which will be the end of + the buffer after this jump is inserted. */ + + if (upper_bound == 0) { + GET_BUFFER_SPACE(3); + insert_jump(jump, laststart, b + 3, b); + b += 3; + break; + } + + /* Otherwise, we have a nontrivial interval. When + we're all done, the pattern will look like: + set_number_at + set_number_at + succeed_n + + jump_n + (The upper bound and `jump_n' are omitted if + `upper_bound' is 1, though.) */ + { /* If the upper bound is > 1, we need to insert + more at the end of the loop. */ + unsigned nbytes = upper_bound == 1 ? 10 : 20; + + GET_BUFFER_SPACE(nbytes); + /* Initialize lower bound of the `succeed_n', even + though it will be set during matching by its + attendant `set_number_at' (inserted next), + because `re_compile_fastmap' needs to know. + Jump to the `jump_n' we might insert below. */ + insert_jump_n(succeed_n, laststart, b + (nbytes/2), + b, lower_bound); + b += 5; /* Just increment for the succeed_n here. */ + + /* Code to initialize the lower bound. Insert + before the `succeed_n'. The `5' is the last two + bytes of this `set_number_at', plus 3 bytes of + the following `succeed_n'. */ + insert_op_2(set_number_at, laststart, b, 5, lower_bound); + b += 5; + + if (upper_bound > 1) + { /* More than one repetition is allowed, so + append a backward jump to the `succeed_n' + that starts this interval. + + When we've reached this during matching, + we'll have matched the interval once, so + jump back only `upper_bound - 1' times. */ + GET_BUFFER_SPACE(5); + store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5, + upper_bound - 1); + b += 5; + + /* The location we want to set is the second + parameter of the `jump_n'; that is `b-2' as + an absolute address. `laststart' will be + the `set_number_at' we're about to insert; + `laststart+3' the number to set, the source + for the relative address. But we are + inserting into the middle of the pattern -- + so everything is getting moved up by 5. + Conclusion: (b - 2) - (laststart + 3) + 5, + i.e., b - laststart. + + We insert this at the beginning of the loop + so that if we fail during matching, we'll + reinitialize the bounds. */ + insert_op_2(set_number_at, laststart, b, b - laststart, + upper_bound - 1); + b += 5; } - numeric_char: - nextp = p + mbclen(c) - 1; - if (!pending_exact || pending_exact + *pending_exact + 1 != b - || *pending_exact >= (c1 ? 0176 : 0177) - || *nextp == '+' || *nextp == '?' - || *nextp == '*' || *nextp == '^' - || *nextp == '{') { - laststart = b; - BUFPUSH(exactn); - pending_exact = b; - BUFPUSH(0); + } + break; + + unfetch_interval: + /* If an invalid interval, match the characters as literals. */ + p = beg_interval; + beg_interval = 0; + + /* normal_char and normal_backslash need `c'. */ + PATFETCH (c); + goto normal_char; + + case '\\': + if (p == pend) goto invalid_pattern; + /* Do not translate the character after the \, so that we can + distinguish, e.g., \B from \b, even if we normally would + translate, e.g., B to b. */ + PATFETCH_RAW(c); + switch (c) + { + case 's': + case 'S': + case 'd': + case 'D': + while (b - bufp->buffer + 9 + (1 << BYTEWIDTH) / BYTEWIDTH + > bufp->allocated) + EXTEND_BUFFER; + + laststart = b; + if (c == 's' || c == 'd') { + BUFPUSH(charset); } - if (!had_mbchar && c > 0x7f) { - BUFPUSH(0xff); - (*pending_exact)++; + else { + BUFPUSH(charset_not); } - BUFPUSH(c); - (*pending_exact)++; - if (had_mbchar) { - int len = mbclen(c) - 1; - while (len--) { - PATFETCH_RAW(c); - BUFPUSH(c); - (*pending_exact)++; + + BUFPUSH((1 << BYTEWIDTH) / BYTEWIDTH); + memset(b, 0, (1 << BYTEWIDTH) / BYTEWIDTH + 2); + if (c == 's' || c == 'S') { + SET_LIST_BIT(' '); + SET_LIST_BIT('\t'); + SET_LIST_BIT('\n'); + SET_LIST_BIT('\r'); + SET_LIST_BIT('\f'); + } + else { + char cc; + + for (cc = '0'; cc <= '9'; cc++) { + SET_LIST_BIT(cc); } } + + while ((int)b[-1] > 0 && b[b[-1] - 1] == 0) + b[-1]--; + if (b[-1] != (1 << BYTEWIDTH) / BYTEWIDTH) + memmove(&b[b[-1]], &b[(1 << BYTEWIDTH) / BYTEWIDTH], + 2 + EXTRACT_UNSIGNED(&b[(1 << BYTEWIDTH) / BYTEWIDTH])*8); + b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[b[-1]])*8; + break; + + case 'w': + laststart = b; + BUFPUSH(wordchar); + break; + + case 'W': + laststart = b; + BUFPUSH(notwordchar); + break; + + case '<': + BUFPUSH(wordbeg); + break; + + case '>': + BUFPUSH(wordend); + break; + + case 'b': + BUFPUSH(wordbound); + break; + + case 'B': + BUFPUSH(notwordbound); + break; + + case 'A': + BUFPUSH(begbuf); + break; + + case 'Z': + BUFPUSH(endbuf2); + break; + + case 'z': + BUFPUSH(endbuf); + break; + + /* hex */ + case 'x': + had_mbchar = 0; + c = scan_hex(p, 2, &numlen); + p += numlen; + goto numeric_char; + + /* octal */ + case '0': + had_mbchar = 0; + c = scan_oct(p, 3, &numlen); + p += numlen; + goto numeric_char; + + /* back-ref or octal */ + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + { + const char *p_save; + + PATUNFETCH; + p_save = p; + + had_mbchar = 0; + c1 = 0; + GET_UNSIGNED_NUMBER(c1); + if (!ISDIGIT(c)) PATUNFETCH; + + if (c1 >= regnum) { + /* need to get octal */ + p = p_save; + c = scan_oct(p_save, 3, &numlen) & 0xff; + p = p_save + numlen; + c1 = 0; + goto numeric_char; + } + } + + /* Can't back reference to a subexpression if inside of it. */ + for (stackt = stackp - 2; stackt > stackb; stackt -= 5) + if (*stackt == c1) + goto normal_char; + laststart = b; + BUFPUSH(duplicate); + BUFPUSH(c1); + break; + + default: + goto normal_char; } + break; + + case '#': + if (options & RE_OPTION_EXTENDED) + { + while (p != pend) { + PATFETCH(c); + if (c == '\n') break; + } + break; + } + goto normal_char; + + case ' ': + case '\t': + case '\f': + case '\r': + case '\n': + if (options & RE_OPTION_EXTENDED) + break; + + default: + normal_char: /* Expects the character in `c'. */ + had_mbchar = 0; + if (ismbchar(c)) { + had_mbchar = 1; + c1 = p - pattern; + } + numeric_char: + nextp = p + mbclen(c) - 1; + if (!pending_exact || pending_exact + *pending_exact + 1 != b + || *pending_exact >= (c1 ? 0176 : 0177) + || *nextp == '+' || *nextp == '?' + || *nextp == '*' || *nextp == '^' + || *nextp == '{') { + laststart = b; + BUFPUSH(exactn); + pending_exact = b; + BUFPUSH(0); + } + if (!had_mbchar && c > 0x7f) { + BUFPUSH(0xff); + (*pending_exact)++; + } + BUFPUSH(c); + (*pending_exact)++; + if (had_mbchar) { + int len = mbclen(c) - 1; + while (len--) { + PATFETCH_RAW(c); + BUFPUSH(c); + (*pending_exact)++; + } + } } + } if (fixup_alt_jump) store_jump(fixup_alt_jump, jump, b); @@ -2117,14 +2129,14 @@ re_compile_pattern(pattern, size, bufp) EXTRACT_NUMBER_AND_INCR(mcnt, laststart); if (mcnt == 4 && *laststart == anychar) { switch ((enum regexpcode)laststart[4]) { - case jump_n: - case finalize_jump: - case maybe_finalize_jump: - case jump: - case jump_past_alt: - case dummy_failure_jump: - bufp->options |= RE_OPTIMIZE_ANCHOR; - break; + case jump_n: + case finalize_jump: + case maybe_finalize_jump: + case jump: + case jump_past_alt: + case dummy_failure_jump: + bufp->options |= RE_OPTIMIZE_ANCHOR; + break; } } else if (*laststart == charset || *laststart == charset_not) { @@ -2193,12 +2205,12 @@ re_compile_pattern(pattern, size, bufp) void re_free_pattern(bufp) - struct re_pattern_buffer *bufp; + struct re_pattern_buffer *bufp; { - free(bufp->buffer); - free(bufp->fastmap); - if (bufp->must_skip) free(bufp->must_skip); - free(bufp); + free(bufp->buffer); + free(bufp->fastmap); + if (bufp->must_skip) free(bufp->must_skip); + free(bufp); } /* Store a jump of the form . @@ -2398,26 +2410,26 @@ slow_search(little, llen, big, blen, translate) static void bm_init_skip(skip, pat, m, translate) - int *skip; - unsigned char *pat; - int m; - char *translate; + int *skip; + unsigned char *pat; + int m; + const char *translate; { - int j, c; + int j, c; - for (c=0; c<256; c++) { - skip[c] = m; + for (c=0; c<256; c++) { + skip[c] = m; + } + if (translate) { + for (j=0; jfastmap_accurate = 1; bufp->can_be_null = 0; - while (p) - { - is_a_succeed_n = 0; - if (p == pend) - { - bufp->can_be_null = 1; - break; - } + while (p) { + is_a_succeed_n = 0; + if (p == pend) + { + bufp->can_be_null = 1; + break; + } #ifdef SWITCH_ENUM_BUG - switch ((int)((enum regexpcode)*p++)) + switch ((int)((enum regexpcode)*p++)) #else switch ((enum regexpcode)*p++) #endif @@ -2516,7 +2527,7 @@ re_compile_fastmap(bufp) fastmap[p[1]] = 1; break; - case begline: + case begline: case begbuf: case endbuf: case endbuf2: @@ -2525,7 +2536,7 @@ re_compile_fastmap(bufp) case wordbeg: case wordend: case pop_and_fail: - case push_dummy_failure: + case push_dummy_failure: case stop_paren: continue; @@ -2535,6 +2546,11 @@ re_compile_fastmap(bufp) options ^= RE_OPTION_IGNORECASE; continue; + case posix_on: + case posix_off: + options ^= RE_OPTION_POSIX; + continue; + case endline: if (TRANSLATE_P()) fastmap[translate['\n']] = 1; @@ -2546,83 +2562,83 @@ re_compile_fastmap(bufp) break; case jump_n: - case finalize_jump: + case finalize_jump: case maybe_finalize_jump: case jump: - case jump_past_alt: + case jump_past_alt: case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR(j, p); + EXTRACT_NUMBER_AND_INCR(j, p); p += j; if (j > 0) continue; - /* Jump backward reached implies we just went through + /* Jump backward reached implies we just went through the body of a loop and matched nothing. Opcode jumped to should be an on_failure_jump. Just treat it like an ordinary jump. For a * loop, it has pushed its failure point already; If so, discard that as redundant. */ - if ((enum regexpcode)*p != on_failure_jump + 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) continue; - p++; - EXTRACT_NUMBER_AND_INCR(j, p); - p += j; - if (stackp != stackb && *stackp == p) - stackp--; /* pop */ - continue; + p++; + EXTRACT_NUMBER_AND_INCR(j, p); + p += j; + if (stackp != stackb && *stackp == p) + stackp--; /* pop */ + continue; - case start_nowidth: + case start_nowidth: case stop_nowidth: - case finalize_push: + case finalize_push: p += 2; continue; - case finalize_push_n: + case finalize_push_n: p += 4; continue; case try_next: - case on_failure_jump: + case on_failure_jump: handle_on_failure_jump: - EXTRACT_NUMBER_AND_INCR(j, p); - if (p + j < pend) { - if (stackp == stacke) { - unsigned char **stackx; - unsigned int len = stacke - stackb; + EXTRACT_NUMBER_AND_INCR(j, p); + if (p + j < pend) { + if (stackp == stacke) { + unsigned char **stackx; + unsigned int len = stacke - stackb; - EXPAND_FAIL_STACK(stackx, stackb, len); - } - *++stackp = p + j; /* push */ + EXPAND_FAIL_STACK(stackx, stackb, len); } - else { - bufp->can_be_null = 1; - } - if (is_a_succeed_n) - EXTRACT_NUMBER_AND_INCR(k, p); /* Skip the n. */ - continue; + *++stackp = p + j; /* push */ + } + else { + bufp->can_be_null = 1; + } + if (is_a_succeed_n) + 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); + /* 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) { + if (k == 0) { p += 4; } else { goto handle_on_failure_jump; } - continue; + continue; case set_number_at: - p += 4; - continue; + p += 4; + continue; - case start_memory: + case start_memory: case stop_memory: p += 2; continue; @@ -2631,13 +2647,16 @@ re_compile_fastmap(bufp) bufp->can_be_null = 1; fastmap['\n'] = 1; case anychar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (j != '\n') - fastmap[j] = 1; - if (bufp->can_be_null) - { + { + char ex = (options & RE_OPTION_POSIX)?'\0':'\n'; + + for (j = 0; j < (1 << BYTEWIDTH); j++) { + if (j != ex) fastmap[j] = 1; + } + if (bufp->can_be_null) { FREE_AND_RETURN_VOID(stackb); } + } /* Don't return; check the alternative paths so we can set can_be_null if appropriate. */ break; @@ -2689,7 +2708,7 @@ re_compile_fastmap(bufp) case charset: /* NOTE: Charset for single-byte chars never contain - multi-byte char. See set_list_bits(). */ + multi-byte char. See set_list_bits(). */ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) { @@ -2727,11 +2746,11 @@ re_compile_fastmap(bufp) m: any set of first bytes that can start multi-byte chars. We assume S+M = U. - ___ _ _ - s+m = (S*s+M*m). */ + ___ _ _ + s+m = (S*s+M*m). */ /* Chars beyond end of map must be allowed */ /* NOTE: Charset_not for single-byte chars might contain - multi-byte chars. See set_list_bits(). */ + multi-byte chars. See set_list_bits(). */ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) if (!ismbchar(j)) fastmap[j] = 1; @@ -2782,16 +2801,16 @@ re_compile_fastmap(bufp) break; } - /* Get here means we have successfully found the possible starting - characters of one path of the pattern. We need not follow this - path any farther. Instead, look at the next alternative - remembered in the stack. */ - if (stackp != stackb) - p = *stackp--; /* pop */ - else - break; - } - FREE_AND_RETURN_VOID(stackb); + /* Get here means we have successfully found the possible starting + characters of one path of the pattern. We need not follow this + path any farther. Instead, look at the next alternative + remembered in the stack. */ + if (stackp != stackb) + p = *stackp--; /* pop */ + else + break; + } + FREE_AND_RETURN_VOID(stackb); } @@ -2810,7 +2829,7 @@ re_compile_fastmap(bufp) int re_search(bufp, string, size, startpos, range, regs) struct re_pattern_buffer *bufp; - char *string; + const char *string; int size, startpos, range; struct re_registers *regs; { @@ -2823,7 +2842,7 @@ re_search(bufp, string, size, startpos, range, regs) /* Update the fastmap now if not correct already. */ if (fastmap && !bufp->fastmap_accurate) { - re_compile_fastmap(bufp); + re_compile_fastmap(bufp); } /* If the search isn't to be a backwards one, don't waste time in a @@ -2880,140 +2899,133 @@ re_search(bufp, string, size, startpos, range, regs) } } - for (;;) - { - /* If a fastmap is supplied, skip quickly over characters that - cannot possibly be the start of a match. Note, however, that - if the pattern can possibly match the null string, we must - test it at each starting point so that we take the first null - string we get. */ + for (;;) { + /* If a fastmap is supplied, skip quickly over characters that + cannot possibly be the start of a match. Note, however, that + if the pattern can possibly match the null string, we must + test it at each starting point so that we take the first null + string we get. */ - if (fastmap && startpos < size - && bufp->can_be_null != 1 && !(anchor && startpos == 0)) - { - if (range > 0) /* Searching forwards. */ - { - register unsigned char *p, c; - int irange = range; + if (fastmap && startpos < size + && bufp->can_be_null != 1 && !(anchor && startpos == 0)) + { + if (range > 0) /* Searching forwards. */ + { + register unsigned char *p, c; + int irange = range; - p = (unsigned char*)string+startpos; + p = (unsigned char*)string+startpos; - while (range > 0) { - c = *p++; - if (ismbchar(c)) { - int len = mbclen(c) - 1; - if (fastmap[c]) - break; - p += len; - range -= len + 1; - c = *p; - if (fastmap[c] == 2) - break; - } - else { - if (fastmap[MAY_TRANSLATE() ? translate[c] : c]) - break; - range--; - } + while (range > 0) { + c = *p++; + if (ismbchar(c)) { + int len = mbclen(c) - 1; + if (fastmap[c]) + break; + p += len; + range -= len + 1; + c = *p; + if (fastmap[c] == 2) + break; + } + else { + if (fastmap[MAY_TRANSLATE() ? translate[c] : c]) + break; + range--; } - startpos += irange - range; } - else /* Searching backwards. */ - { - register unsigned char c; + startpos += irange - range; + } + else /* Searching backwards. */ + { + register unsigned char c; - c = string[startpos]; - c &= 0xff; - if (MAY_TRANSLATE() ? !fastmap[translate[c]] : !fastmap[c]) - goto advance; - } - } + c = string[startpos]; + c &= 0xff; + if (MAY_TRANSLATE() ? !fastmap[translate[c]] : !fastmap[c]) + goto advance; + } + } - if (startpos > size) return -1; - if (anchor && size > 0 && startpos == size) return -1; - if (fastmap && startpos == size && range >= 0 - && (bufp->can_be_null == 0 || - (bufp->can_be_null && size > 0 - && string[startpos-1] == '\n'))) - return -1; - - val = re_match(bufp, string, size, startpos, regs); - if (val >= 0) - return startpos; - if (val == -2) - return -2; + if (startpos > size) return -1; + if (anchor && size > 0 && startpos == size) return -1; + val = re_match(bufp, string, size, startpos, regs); + if (val >= 0) + return startpos; + if (val == -2) + return -2; #ifndef NO_ALLOCA #ifdef C_ALLOCA - alloca(0); + alloca(0); #endif /* C_ALLOCA */ #endif /* NO_ALLOCA */ - if (range > 0) { - if (anchor && startpos < size && startpos > 0 && string[startpos-1] != '\n') { - while (range > 0 && string[startpos] != '\n') { - range--; - startpos++; - } - } - else if (fastmap && (bufp->stclass)) { - register unsigned char *p; - unsigned int c; - int irange = range; - - p = (unsigned char*)string+startpos; - while (range > 0) { - c = *p++; - if (ismbchar(c) && fastmap[c] != 2) { - MBC2WC(c, p); - } - else if (MAY_TRANSLATE()) - c = translate[c]; - if (*bufp->stclass == charset) { - if (!is_in_list(c, bufp->stclass+1)) break; - } - else { - if (is_in_list(c, bufp->stclass+1)) break; - } - range--; - if (c > 256) range--; - } - startpos += irange - range; + if (range > 0) { + if (anchor && startpos < size && startpos > 0 && string[startpos-1] != '\n') { + while (range > 0 && string[startpos] != '\n') { + range--; + startpos++; } } + else if (fastmap && (bufp->stclass)) { + register unsigned char *p; + unsigned int c; + int irange = range; - advance: - if (!range) - break; - else if (range > 0) { - const char *d = string + startpos; + p = (unsigned char*)string+startpos; + while (range > 0) { + c = *p++; + if (ismbchar(c) && fastmap[c] != 2) { + MBC2WC(c, p); + } + else if (MAY_TRANSLATE()) + c = translate[c]; + if (*bufp->stclass == charset) { + if (!is_in_list(c, bufp->stclass+1)) break; + } + else { + if (is_in_list(c, bufp->stclass+1)) break; + } + range--; + if (c > 256) range--; + } + startpos += irange - range; + } + } - if (ismbchar(*d)) { - int len = mbclen(*d) - 1; - range-=len, startpos+=len; + advance: + if (!range) + break; + else if (range > 0) { + const char *d = string + startpos; + + if (ismbchar(*d)) { + int len = mbclen(*d) - 1; + range-=len, startpos+=len; + if (!range) + break; + } + range--, startpos++; + } + else { + range++, startpos--; + { + const char *s, *d, *p; + + s = string; d = string + startpos; + for (p = d; p-- > s && ismbchar(*p); ) + /* --p >= s would not work on 80[12]?86. + (when the offset of s equals 0 other than huge model.) */ + ; + if (!((d - p) & 1)) { if (!range) break; - } - range--, startpos++; - } - else { - range++, startpos--; - { - const char *s, *d, *p; - - s = string; d = string + startpos; - for (p = d; p-- > s && ismbchar(*p); ) - /* --p >= s would not work on 80[12]?86. - (when the offset of s equals 0 other than huge model.) */ - ; - if (!((d - p) & 1)) { - if (!range) - break; - range++, startpos--; - } + range++, startpos--; } } } + } return -1; } @@ -3029,10 +3041,9 @@ re_search(bufp, string, size, startpos, range, regs) 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'. */ + 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; @@ -3077,27 +3088,25 @@ typedef union if (!REG_UNSET(regstart[last_used_reg])) \ break; \ \ - if (stacke - stackp <= NUM_FAILURE_ITEMS) \ - { \ + if (stacke - stackp <= NUM_FAILURE_ITEMS) { \ unsigned char **stackx; \ unsigned int len = stacke - stackb; \ /* if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \ - { \ - FREE_VARIABLES(); \ - FREE_AND_RETURN(stackb,(-2)); \ - }*/ \ + { \ + FREE_VARIABLES(); \ + FREE_AND_RETURN(stackb,(-2)); \ + }*/ \ \ /* Roughly double the size of the stack. */ \ EXPAND_FAIL_STACK(stackx, stackb, len); \ } \ \ /* Now push the info for each of those registers. */ \ - for (this_reg = 1; this_reg <= last_used_reg; this_reg++) \ - { \ - *stackp++ = regstart[this_reg]; \ - *stackp++ = regend[this_reg]; \ - *stackp++ = reg_info[this_reg].word; \ - } \ + for (this_reg = 1; this_reg <= last_used_reg; this_reg++) { \ + *stackp++ = regstart[this_reg]; \ + *stackp++ = regend[this_reg]; \ + *stackp++ = reg_info[this_reg].word; \ + } \ \ /* Push how many registers we saved. */ \ *stackp++ = (unsigned char*)last_used_reg; \ @@ -3108,7 +3117,7 @@ typedef union } while(0) -/* This pops what PUSH_FAILURE_POINT pushes. */ + /* This pops what PUSH_FAILURE_POINT pushes. */ #define POP_FAILURE_POINT() \ do { \ @@ -3119,19 +3128,18 @@ typedef union stackp -= temp; /* Remove the register info. */ \ } while(0) -/* Registers are set to a sentinel when they haven't yet matched. */ + /* Registers are set to a sentinel when they haven't yet matched. */ #define REG_UNSET_VALUE ((unsigned char*)-1) #define REG_UNSET(e) ((e) == REG_UNSET_VALUE) #define PREFETCH if (d == dend) goto fail -/* Call this when have matched something; it sets `matched' flags for the + /* Call this when have matched something; it sets `matched' flags for the registers corresponding to the subexpressions of which we currently are inside. */ #define SET_REGS_MATCHED \ do { unsigned this_reg; \ - for (this_reg = 0; this_reg < num_regs; this_reg++) \ - { \ + 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]) \ @@ -3156,27 +3164,27 @@ typedef union static void init_regs(regs, num_regs) - struct re_registers *regs; - unsigned int num_regs; + struct re_registers *regs; + unsigned int num_regs; { - int i; + int i; - regs->num_regs = num_regs; - if (num_regs < RE_NREGS) - num_regs = RE_NREGS; + regs->num_regs = num_regs; + if (num_regs < RE_NREGS) + num_regs = RE_NREGS; - if (regs->allocated == 0) { - regs->beg = TMALLOC(num_regs, int); - regs->end = TMALLOC(num_regs, int); - regs->allocated = num_regs; - } - else if (regs->allocated < num_regs) { - TREALLOC(regs->beg, num_regs, int); - TREALLOC(regs->end, num_regs, int); - } - for (i=0; ibeg[i] = regs->end[i] = -1; - } + if (regs->allocated == 0) { + regs->beg = TMALLOC(num_regs, int); + regs->end = TMALLOC(num_regs, int); + regs->allocated = num_regs; + } + else if (regs->allocated < num_regs) { + TREALLOC(regs->beg, num_regs, int); + TREALLOC(regs->end, num_regs, int); + } + for (i=0; ibeg[i] = regs->end[i] = -1; + } } /* Match the pattern described by BUFP against STRING, which is of @@ -3197,7 +3205,7 @@ init_regs(regs, num_regs) int re_match(bufp, string_arg, size, pos, regs) struct re_pattern_buffer *bufp; - char *string_arg; + const char *string_arg; int size, pos; struct re_registers *regs; { @@ -3215,15 +3223,15 @@ re_match(bufp, string_arg, size, pos, regs) register int mcnt; /* Multipurpose. */ int options = bufp->options; - /* Failure point stack. Each place that can handle a failure further - down the line pushes a failure point on this stack. It consists of - restart, regend, and reg_info for all registers corresponding to the - subexpressions we're currently inside, plus the number of such - registers, and, finally, two char *'s. The first char * is where to - resume scanning the pattern; the second one is where to resume - scanning the strings. If the latter is zero, the failure point is a - ``dummy''; if a failure happens and the failure point is a dummy, it - gets discarded and the next next one is tried. */ + /* Failure point stack. Each place that can handle a failure further + down the line pushes a failure point on this stack. It consists of + restart, regend, and reg_info for all registers corresponding to the + subexpressions we're currently inside, plus the number of such + registers, and, finally, two char *'s. The first char * is where to + resume scanning the pattern; the second one is where to resume + scanning the strings. If the latter is zero, the failure point is a + ``dummy''; if a failure happens and the failure point is a dummy, it + gets discarded and the next next one is tried. */ unsigned char **stackb; unsigned char **stackp; @@ -3315,192 +3323,190 @@ re_match(bufp, string_arg, size, pos, regs) function if match is complete, or it drops through if match fails at this starting point in the input data. */ - for (;;) - { + for (;;) { #ifdef DEBUG_REGEX - fprintf(stderr, - "regex loop(%d): matching 0x%02d\n", - p - (unsigned char*)bufp->buffer, - *p); + fprintf(stderr, + "regex loop(%d): matching 0x%02d\n", + p - (unsigned char*)bufp->buffer, + *p); #endif - /* End of pattern means we might have succeeded. */ - if (p == pend) - { - /* If not end of string, try backtracking. Otherwise done. */ - if (d != dend) - { - while (stackp != stackb && (int)stackp[-1] == 1) - POP_FAILURE_POINT(); - if (stackp != stackb) - { - /* More failure points to try. */ + /* End of pattern means we might have succeeded. */ + if (p == pend) + { + /* If not end of string, try backtracking. Otherwise done. */ + if (d != dend) + { + while (stackp != stackb && (int)stackp[-1] == 1) { + if (best_regs_set) /* non-greedy, no need to backtrack */ + goto restore_best_regs; + POP_FAILURE_POINT(); + } + if (stackp != stackb) { + /* More failure points to try. */ - /* If exceeds best match so far, save it. */ - if (! best_regs_set || (d > best_regend[0])) - { - best_regs_set = 1; - best_regend[0] = d; /* Never use regstart[0]. */ + /* If exceeds best match so far, save it. */ + if (! best_regs_set || (d > best_regend[0])) { + best_regs_set = 1; + best_regend[0] = d; /* Never use regstart[0]. */ - for (mcnt = 1; mcnt < num_regs; mcnt++) - { - best_regstart[mcnt] = regstart[mcnt]; - best_regend[mcnt] = regend[mcnt]; - } - } - goto fail; - } - /* If no failure points, don't restore garbage. */ - else if (best_regs_set) - { - restore_best_regs: - /* Restore best match. */ - d = best_regend[0]; + for (mcnt = 1; mcnt < num_regs; mcnt++) { + best_regstart[mcnt] = regstart[mcnt]; + best_regend[mcnt] = regend[mcnt]; + } + } + goto fail; + } + /* If no failure points, don't restore garbage. */ + else if (best_regs_set) { + restore_best_regs: + /* Restore best match. */ + d = best_regend[0]; - for (mcnt = 0; mcnt < num_regs; mcnt++) - { - regstart[mcnt] = best_regstart[mcnt]; - regend[mcnt] = best_regend[mcnt]; - } - } - } - - /* If caller wants register contents data back, convert it - to indices. */ - if (regs) - { - regs->beg[0] = pos; - regs->end[0] = d - string; - for (mcnt = 1; mcnt < num_regs; mcnt++) + for (mcnt = 0; mcnt < num_regs; mcnt++) { - if (REG_UNSET(regend[mcnt])) - { - regs->beg[mcnt] = -1; - regs->end[mcnt] = -1; - continue; - } - regs->beg[mcnt] = regstart[mcnt] - string; - regs->end[mcnt] = regend[mcnt] - string; + regstart[mcnt] = best_regstart[mcnt]; + regend[mcnt] = best_regend[mcnt]; } } - FREE_VARIABLES(); - FREE_AND_RETURN(stackb, (d - pos - string)); - } + } - /* Otherwise match next pattern command. */ + /* If caller wants register contents data back, convert it + to indices. */ + if (regs) + { + regs->beg[0] = pos; + regs->end[0] = d - string; + for (mcnt = 1; mcnt < num_regs; mcnt++) + { + if (REG_UNSET(regend[mcnt])) + { + regs->beg[mcnt] = -1; + regs->end[mcnt] = -1; + continue; + } + regs->beg[mcnt] = regstart[mcnt] - string; + regs->end[mcnt] = regend[mcnt] - string; + } + } + FREE_VARIABLES(); + FREE_AND_RETURN(stackb, (d - pos - string)); + } + + /* Otherwise match next pattern command. */ #ifdef SWITCH_ENUM_BUG - switch ((int)((enum regexpcode)*p++)) + switch ((int)((enum regexpcode)*p++)) #else switch ((enum regexpcode)*p++) #endif { - /* ( [or `(', as appropriate] is represented by start_memory, - ) by stop_memory. Both of those commands are followed by - a register number in the next byte. The text matched - within the ( and ) is recorded under that number. */ + /* ( [or `(', as appropriate] is represented by start_memory, + ) by stop_memory. Both of those commands are followed by + 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. */ + /* 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); + 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]; - regstart[*p] = d; - IS_ACTIVE(reg_info[*p]) = 1; - MATCHED_SOMETHING(reg_info[*p]) = 0; - p += 2; + /* 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]; + regstart[*p] = d; + IS_ACTIVE(reg_info[*p]) = 1; + MATCHED_SOMETHING(reg_info[*p]) = 0; + p += 2; 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]; + /* 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]; - regend[*p] = d; - IS_ACTIVE(reg_info[*p]) = 0; + regend[*p] = d; + IS_ACTIVE(reg_info[*p]) = 0; - /* If just failed to match something this time around with a sub- + /* 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 && + 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; - } + 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 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) + && (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])) + /* 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 ((int)old_regend[r] >= (int)regstart[r]) - regend[r] = old_regend[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 ((int)old_regend[r] >= (int)regstart[r]) + regend[r] = old_regend[r]; + } + } p1++; - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - PUSH_FAILURE_POINT(p1 + mcnt, d); - goto fail; - } - } - p += 2; + EXTRACT_NUMBER_AND_INCR(mcnt, p1); + PUSH_FAILURE_POINT(p1 + mcnt, d); + goto fail; + } + } + p += 2; continue; case stop_paren: break; - /* \ has been turned into a `duplicate' command which is - followed by the numeric value of as the register number. */ - case duplicate: + /* \ has been turned into a `duplicate' command which is + followed by the numeric value of as the register number. */ + case duplicate: { int regno = *p++; /* Get which register to match against */ register unsigned char *d2, *dend2; @@ -3508,15 +3514,15 @@ re_match(bufp, string_arg, size, pos, regs) if (IS_ACTIVE(reg_info[regno])) break; /* Where in input to try to start matching. */ - d2 = regstart[regno]; + d2 = regstart[regno]; if (REG_UNSET(d2)) break; - /* Where to stop matching; if both the place to start and - the place to stop matching are in the same string, then - set to the place to stop, otherwise, for now have to use - the end of the first string. */ + /* Where to stop matching; if both the place to start and + the place to stop matching are in the same string, then + set to the place to stop, otherwise, for now have to use + the end of the first string. */ - dend2 = regend[regno]; + dend2 = regend[regno]; if (REG_UNSET(dend2)) break; for (;;) { @@ -3530,15 +3536,15 @@ re_match(bufp, string_arg, size, pos, regs) mcnt = dend - d; /* Want how many consecutive characters we can match in - one shot, so, if necessary, adjust the count. */ - if (mcnt > dend2 - d2) + one shot, so, if necessary, adjust the count. */ + if (mcnt > dend2 - d2) mcnt = dend2 - d2; /* Compare that many; failure if mismatch, else move - past them. */ + past them. */ if ((options & RE_OPTION_IGNORECASE) - ? memcmp_translate(d, d2, mcnt) - : memcmp((char*)d, (char*)d2, mcnt)) + ? memcmp_translate(d, d2, mcnt) + : memcmp((char*)d, (char*)d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; } @@ -3546,7 +3552,7 @@ re_match(bufp, string_arg, size, pos, regs) break; case start_nowidth: - PUSH_FAILURE_POINT(0, d); + PUSH_FAILURE_POINT(0, d); EXTRACT_NUMBER_AND_INCR(mcnt, p); STORE_NUMBER(p+mcnt, stackp - stackb); continue; @@ -3566,18 +3572,18 @@ re_match(bufp, string_arg, size, pos, regs) case anychar: PREFETCH; - /* Match anything but a newline, maybe even a null. */ if (ismbchar(*d)) { - if (d + mbclen(*d) > dend || d[1] == '\n' || d[1] == '\0') + if (d + mbclen(*d) > dend) goto fail; SET_REGS_MATCHED; d += mbclen(*d); break; } - if (((TRANSLATE_P()) ? translate[*d] : *d) == '\n') + if (((TRANSLATE_P()) ? translate[*d] : *d) == + ((options&RE_OPTION_POSIX) ? '\0' : '\n')) goto fail; SET_REGS_MATCHED; - d++; + d++; break; case charset: @@ -3600,7 +3606,7 @@ re_match(bufp, string_arg, size, pos, regs) part = not = is_in_list(c, p); if (*(p - 1) == (unsigned char)charset_not) { - not = !not; + not = !not; } if (!not) goto fail; @@ -3612,80 +3618,83 @@ re_match(bufp, string_arg, size, pos, regs) } case begline: - if (size == 0 - || AT_STRINGS_BEG(d) - || (d && d[-1] == '\n')) - break; - else - goto fail; - - case endline: - if (AT_STRINGS_END(d) || *d == '\n') + if (size == 0 || AT_STRINGS_BEG(d)) + break; + if (d[-1] == '\n' && !AT_STRINGS_END(d)) break; goto fail; - /* Match at the very beginning of the string. */ - case begbuf: - if (AT_STRINGS_BEG(d)) - break; - goto fail; + case endline: + if (AT_STRINGS_END(d)) { + if (size == 0 || d[-1] != '\n') + break; + } + else if (*d == '\n') + break; + goto fail; - /* Match at the very end of the data. */ - case endbuf: + /* Match at the very beginning of the string. */ + case begbuf: + if (AT_STRINGS_BEG(d)) + break; + goto fail; + + /* Match at the very end of the data. */ + case endbuf: if (AT_STRINGS_END(d)) break; - goto fail; + goto fail; - /* Match at the very end of the data. */ - case endbuf2: + /* Match at the very end of the data. */ + case endbuf2: if (AT_STRINGS_END(d)) break; /* .. or newline just before the end of the data. */ if (*d == '\n' && AT_STRINGS_END(d+1)) break; - goto fail; + goto fail; - /* `or' constructs are handled by starting each alternative with - an on_failure_jump that points to the start of the next - alternative. Each alternative except the last ends with a - jump to the joining point. (Actually, each jump except for - the last one really jumps to the following jump, because - tensioning the jumps is a hassle.) */ + /* `or' constructs are handled by starting each alternative with + an on_failure_jump that points to the start of the next + alternative. Each alternative except the last ends with a + jump to the joining point. (Actually, each jump except for + the last one really jumps to the following jump, because + tensioning the jumps is a hassle.) */ - /* The start of a stupid repeat has an on_failure_jump that points - past the end of the repeat text. This makes a failure point so - that on failure to match a repetition, matching restarts past - as many repetitions have been found with no way to fail and - look for another one. */ + /* The start of a stupid repeat has an on_failure_jump that points + past the end of the repeat text. This makes a failure point so + that on failure to match a repetition, matching restarts past + as many repetitions have been found with no way to fail and + look for another one. */ - /* A smart repeat is similar but loops back to the on_failure_jump - so that each repetition makes another failure point. */ + /* A smart repeat is similar but loops back to the on_failure_jump + so that each repetition makes another failure point. */ case on_failure_jump: - on_failure: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - PUSH_FAILURE_POINT(p + mcnt, d); - continue; + on_failure: + EXTRACT_NUMBER_AND_INCR(mcnt, p); + PUSH_FAILURE_POINT(p + mcnt, d); + continue; /* The end of a smart repeat has a maybe_finalize_jump back. Change it either to a finalize_jump or an ordinary jump. */ case maybe_finalize_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); + 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. */ + /* 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) { @@ -3711,19 +3720,19 @@ re_match(bufp, string_arg, size, pos, regs) 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; + 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; + } } } p -= 2; /* Point at relative address again. */ @@ -3732,87 +3741,87 @@ re_match(bufp, string_arg, size, pos, regs) p[-1] = (unsigned char)jump; goto nofinalize; } - /* Note fall through. */ + /* Note fall through. */ - /* The end of a stupid repeat has a finalize_jump back to the - start, where another failure point will be made which will - point to after all the repetitions found so far. */ + /* The end of a stupid repeat has a finalize_jump back to the + start, where another failure point will be made which will + point to after all the repetitions found so far. */ - /* Take off failure points put on by matching on_failure_jump - because didn't fail. Also remove the register information - put on by the on_failure_jump. */ - case finalize_jump: + /* Take off failure points put on by matching on_failure_jump + because didn't fail. Also remove the register information + put on by the on_failure_jump. */ + case finalize_jump: if (stackp[-2] == d) { p = stackp[-3]; POP_FAILURE_POINT(); continue; } - POP_FAILURE_POINT(); + POP_FAILURE_POINT(); /* Note fall through. */ - /* Jump without taking off any failure points. */ - case jump: + /* Jump without taking off any failure points. */ + case jump: nofinalize: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - p += mcnt; - continue; + EXTRACT_NUMBER_AND_INCR(mcnt, p); + 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; + /* 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 - finalize_jump, also, and with a pattern of, say, `a+', we - are skipping over the on_failure_jump, so we have to push - something meaningless for finalize_jump to pop. */ - PUSH_FAILURE_POINT(0, 0); - 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 + finalize_jump, also, and with a pattern of, say, `a+', we + are skipping over the on_failure_jump, so we have to push + something meaningless for finalize_jump to pop. */ + PUSH_FAILURE_POINT(0, 0); + goto nofinalize; - /* At the end of an alternative, we need to push a dummy failure - point in case we are followed by a `finalize_jump', because - we don't want the failure point for the alternative to be - popped. For example, matching `(a|ab)*' against `aab' - requires that we match the `ab' alternative. */ - case push_dummy_failure: - /* See comments just above at `dummy_failure_jump' about the - two zeroes. */ - PUSH_FAILURE_POINT(0, 0); - break; + /* At the end of an alternative, we need to push a dummy failure + point in case we are followed by a `finalize_jump', because + we don't want the failure point for the alternative to be + popped. For example, matching `(a|ab)*' against `aab' + requires that we match the `ab' alternative. */ + case push_dummy_failure: + /* See comments just above at `dummy_failure_jump' about the + two zeroes. */ + PUSH_FAILURE_POINT(0, 0); + break; - /* Have to succeed matching what follows at least n times. Then - just handle like an on_failure_jump. */ - case succeed_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we HAVE to succeed. */ - if (mcnt > 0) - { - mcnt--; - p += 2; - STORE_NUMBER_AND_INCR(p, mcnt); - PUSH_FAILURE_POINT(0, 0); - } + /* Have to succeed matching what follows at least n times. Then + just handle like an on_failure_jump. */ + case succeed_n: + EXTRACT_NUMBER(mcnt, p + 2); + /* Originally, this is how many times we HAVE to succeed. */ + if (mcnt > 0) + { + mcnt--; + p += 2; + STORE_NUMBER_AND_INCR(p, mcnt); + PUSH_FAILURE_POINT(0, 0); + } else if (mcnt == 0) - { + { p[2] = unused; - p[3] = unused; - goto on_failure; - } + p[3] = unused; + goto on_failure; + } continue; - case jump_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we CAN jump. */ - if (mcnt) - { - mcnt--; - STORE_NUMBER(p + 2, mcnt); - goto nofinalize; /* Do the jump without taking off - any failure points. */ - } - /* If don't have to jump any more, skip over the rest of command. */ + case jump_n: + EXTRACT_NUMBER(mcnt, p + 2); + /* Originally, this is how many times we CAN jump. */ + if (mcnt) + { + mcnt--; + STORE_NUMBER(p + 2, mcnt); + goto nofinalize; /* Do the jump without taking off + any failure points. */ + } + /* If don't have to jump any more, skip over the rest of command. */ else p += 4; continue; @@ -3834,16 +3843,16 @@ re_match(bufp, string_arg, size, pos, regs) continue; case finalize_push: - POP_FAILURE_POINT(); + POP_FAILURE_POINT(); EXTRACT_NUMBER_AND_INCR(mcnt, p); - PUSH_FAILURE_POINT(p + mcnt, d); + PUSH_FAILURE_POINT(p + mcnt, d); stackp[-1] = (unsigned char*)1; continue; case finalize_push_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we CAN jump. */ - if (mcnt) { + EXTRACT_NUMBER(mcnt, p + 2); + /* Originally, this is how many times we CAN jump. */ + if (mcnt) { int pos, i; mcnt--; @@ -3857,25 +3866,33 @@ re_match(bufp, string_arg, size, pos, regs) stackp[-1] = (unsigned char*)1; p += 2; /* skip n */ } - /* If don't have to push any more, skip over the rest of command. */ + /* If don't have to push any more, skip over the rest of command. */ else p += 4; continue; - /* Ignore these. Used to ignore the n of succeed_n's which - currently have n == 0. */ - case unused: + /* Ignore these. Used to ignore the n of succeed_n's which + currently have n == 0. */ + case unused: continue; - case casefold_on: + case casefold_on: options |= RE_OPTION_IGNORECASE; continue; - case casefold_off: + case casefold_off: options &= ~RE_OPTION_IGNORECASE; continue; - case wordbound: + case posix_on: + options |= RE_OPTION_POSIX; + continue; + + case posix_off: + options &= ~RE_OPTION_POSIX; + continue; + + case wordbound: if (AT_STRINGS_BEG(d)) { if (IS_A_LETTER(d)) break; else goto fail; @@ -3904,18 +3921,18 @@ re_match(bufp, string_arg, size, pos, regs) case wordbeg: if (IS_A_LETTER(d) && (AT_STRINGS_BEG(d) || !PREV_IS_A_LETTER(d))) break; - goto fail; + goto fail; case wordend: if (!AT_STRINGS_BEG(d) && PREV_IS_A_LETTER(d) - && (!IS_A_LETTER(d) || AT_STRINGS_END(d))) + && (!IS_A_LETTER(d) || AT_STRINGS_END(d))) break; - goto fail; + goto fail; case wordchar: PREFETCH; - if (!IS_A_LETTER(d)) - goto fail; + if (!IS_A_LETTER(d)) + goto fail; if (ismbchar(*d) && d + mbclen(*d) - 1 < dend) d += mbclen(*d) - 1; d++; @@ -3925,11 +3942,11 @@ re_match(bufp, string_arg, size, pos, regs) case notwordchar: PREFETCH; if (IS_A_LETTER(d)) - goto fail; + goto fail; if (ismbchar(*d) && d + mbclen(*d) - 1 < dend) d += mbclen(*d) - 1; d++; - SET_REGS_MATCHED; + SET_REGS_MATCHED; break; case exactn: @@ -3937,8 +3954,8 @@ re_match(bufp, string_arg, size, pos, regs) mcnt is how many characters to match. */ mcnt = *p++; /* This is written out as an if-else so we don't waste time - testing `translate' inside the loop. */ - if (TRANSLATE_P()) + testing `translate' inside the loop. */ + if (TRANSLATE_P()) { do { @@ -3985,94 +4002,91 @@ re_match(bufp, string_arg, size, pos, regs) while (--mcnt); } SET_REGS_MATCHED; - break; + break; } #if 0 - while (stackp != stackb && (int)stackp[-1] == 1) - POP_FAILURE_POINT(); + while (stackp != stackb && (int)stackp[-1] == 1) + POP_FAILURE_POINT(); #endif - continue; /* Successfully executed one pattern command; keep going. */ + continue; /* Successfully executed one pattern command; keep going. */ /* Jump here if any matching operation fails. */ - fail: - if (stackp != stackb) - /* A restart point is known. Restart there and pop it. */ - { - short last_used_reg, this_reg; + fail: + if (stackp != stackb) + /* A restart point is known. Restart there and pop it. */ + { + short last_used_reg, this_reg; - /* If this failure point is from a dummy_failure_point, just - skip it. */ - if (stackp[-3] == 0) { - POP_FAILURE_POINT(); - goto fail; - } - stackp--; /* discard flag */ - d = *--stackp; - p = *--stackp; - /* Restore register info. */ - last_used_reg = (long)*--stackp; + /* If this failure point is from a dummy_failure_point, just + skip it. */ + if (stackp[-3] == 0) { + POP_FAILURE_POINT(); + goto fail; + } + stackp--; /* discard flag */ + d = *--stackp; + p = *--stackp; + /* Restore register info. */ + last_used_reg = (long)*--stackp; - /* Make the ones that weren't saved -1 or 0 again. */ - for (this_reg = num_regs - 1; this_reg > last_used_reg; this_reg--) - { - regend[this_reg] = REG_UNSET_VALUE; - regstart[this_reg] = REG_UNSET_VALUE; - IS_ACTIVE(reg_info[this_reg]) = 0; - MATCHED_SOMETHING(reg_info[this_reg]) = 0; - } + /* Make the ones that weren't saved -1 or 0 again. */ + for (this_reg = num_regs - 1; this_reg > last_used_reg; this_reg--) { + regend[this_reg] = REG_UNSET_VALUE; + regstart[this_reg] = REG_UNSET_VALUE; + IS_ACTIVE(reg_info[this_reg]) = 0; + MATCHED_SOMETHING(reg_info[this_reg]) = 0; + } - /* And restore the rest from the stack. */ - for ( ; this_reg > 0; this_reg--) - { - reg_info[this_reg].word = *--stackp; - regend[this_reg] = *--stackp; - regstart[this_reg] = *--stackp; - } - if (p < pend) - { - int is_a_jump_n = 0; - int failed_paren = 0; + /* And restore the rest from the stack. */ + for ( ; this_reg > 0; this_reg--) { + reg_info[this_reg].word = *--stackp; + regend[this_reg] = *--stackp; + regstart[this_reg] = *--stackp; + } + if (p < pend) { + int is_a_jump_n = 0; + int failed_paren = 0; - p1 = p; - /* If failed to a backwards jump that's part of a repetition - loop, need to pop this failure point and use the next one. */ - pop_loop: - switch ((enum regexpcode)*p1) { - case stop_paren: - failed_paren = 1; + p1 = p; + /* If failed to a backwards jump that's part of a repetition + loop, need to pop this failure point and use the next one. */ + pop_loop: + switch ((enum regexpcode)*p1) { + case stop_paren: + failed_paren = 1; + p1++; + goto pop_loop; + + case jump_n: + case finalize_push_n: + is_a_jump_n = 1; + case maybe_finalize_jump: + case finalize_jump: + case finalize_push: + case jump: + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + + if (p1 >= pend) break; + if (( is_a_jump_n && (enum regexpcode)*p1 == succeed_n) || + (!is_a_jump_n && (enum regexpcode)*p1 == on_failure_jump)) { + if (failed_paren) { p1++; - goto pop_loop; - - case jump_n: - case finalize_push_n: - is_a_jump_n = 1; - case maybe_finalize_jump: - case finalize_jump: - case finalize_push: - case jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - - if (p1 >= pend) break; - if (( is_a_jump_n && (enum regexpcode)*p1 == succeed_n) || - (!is_a_jump_n && (enum regexpcode)*p1 == on_failure_jump)) { - if (failed_paren) { - p1++; - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - PUSH_FAILURE_POINT(p1 + mcnt, d); - } - goto fail; - } - break; - default: - /* do nothing */ ; + EXTRACT_NUMBER_AND_INCR(mcnt, p1); + PUSH_FAILURE_POINT(p1 + mcnt, d); } - } - } - else - break; /* Matching at this starting point really fails. */ - } + goto fail; + } + break; + default: + /* do nothing */ ; + } + } + } + else + break; /* Matching at this starting point really fails. */ + } if (best_regs_set) goto restore_best_regs; @@ -4082,10 +4096,10 @@ 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. @@ -4093,103 +4107,99 @@ re_match(bufp, string_arg, size, pos, regs) static int group_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *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': + 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. */ - /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 + 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); - So, we have to first go through the first (n-1) - alternatives and then deal with the last one separately. */ + /* 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. */ + /* 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. */ + 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; + 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; + /* 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; + /* 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; - } - } + /* 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); + /* 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; + 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; + 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 */ + 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 */ @@ -4198,34 +4208,32 @@ group_match_null_string_p (p, end, reg_info) /* 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; + 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 */ + + 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 */ @@ -4233,87 +4241,85 @@ alt_match_null_string_p (p, end, reg_info) /* 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; + 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: + 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: + case before_dot: + case at_dot: + case after_dot: #endif - break; + 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. */ + case start_memory: + reg_no = *p1; + ret = group_match_null_string_p (&p1, end, reg_info); - if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; + /* Have to set this here in case we're checking a group which + contains a group and a back reference to it. */ - 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; + if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; - 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. */ + 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; @@ -4327,22 +4333,21 @@ memcmp_translate(s1, s2, len) register int len; { register unsigned char *p1 = s1, *p2 = s2, c; - while (len) - { - c = *p1++; - if (ismbchar(c)) { - int n; + while (len) { + c = *p1++; + if (ismbchar(c)) { + int n; - if (c != *p2++) return 1; - for (n = mbclen(c) - 1; n > 0; n--) - if (!--len || *p1++ != *p2++) - return 1; - } - else - if (translate[c] != translate[*p2++]) + if (c != *p2++) return 1; + for (n = mbclen(c) - 1; n > 0; n--) + if (!--len || *p1++ != *p2++) return 1; - len--; } + else + if (translate[c] != translate[*p2++]) + return 1; + len--; + } return 0; } @@ -4350,33 +4355,33 @@ void re_copy_registers(regs1, regs2) struct re_registers *regs1, *regs2; { - int i; + int i; - if (regs1 == regs2) return; - if (regs1->allocated == 0) { - regs1->beg = TMALLOC(regs2->num_regs, int); - regs1->end = TMALLOC(regs2->num_regs, int); - regs1->allocated = regs2->num_regs; - } - else if (regs1->allocated < regs2->num_regs) { - TREALLOC(regs1->beg, regs2->num_regs, int); - TREALLOC(regs1->end, regs2->num_regs, int); - regs1->allocated = regs2->num_regs; - } - for (i=0; inum_regs; i++) { - regs1->beg[i] = regs2->beg[i]; - regs1->end[i] = regs2->end[i]; - } - regs1->num_regs = regs2->num_regs; + if (regs1 == regs2) return; + if (regs1->allocated == 0) { + regs1->beg = TMALLOC(regs2->num_regs, int); + regs1->end = TMALLOC(regs2->num_regs, int); + regs1->allocated = regs2->num_regs; + } + else if (regs1->allocated < regs2->num_regs) { + TREALLOC(regs1->beg, regs2->num_regs, int); + TREALLOC(regs1->end, regs2->num_regs, int); + regs1->allocated = regs2->num_regs; + } + for (i=0; inum_regs; i++) { + regs1->beg[i] = regs2->beg[i]; + regs1->end[i] = regs2->end[i]; + } + regs1->num_regs = regs2->num_regs; } void re_free_registers(regs) struct re_registers *regs; { - if (regs->allocated == 0) return; - if (regs->beg) free(regs->beg); - if (regs->end) free(regs->end); + if (regs->allocated == 0) return; + if (regs->beg) free(regs->beg); + if (regs->end) free(regs->end); } /* Functions for multi-byte support. diff --git a/regex.h b/regex.h index 66ee23aa5a..a3c3c784b7 100644 --- a/regex.h +++ b/regex.h @@ -59,12 +59,17 @@ If not set, then character classes are not supported. */ #define RE_CHAR_CLASSES (1L << 9) -#define RE_OPTION_EXTENDED (1L<<0) +/* match will be done case insensetively */ #define RE_OPTION_IGNORECASE (1L<<1) -#define RE_MAY_IGNORECASE (1L<<2) -#define RE_OPTIMIZE_ANCHOR (1L<<4) -#define RE_OPTIMIZE_EXACTN (1L<<5) -#define RE_OPTIMIZE_NO_BM (1L<<6) +/* perl-style extended pattern available */ +#define RE_OPTION_EXTENDED (RE_OPTION_IGNORECASE<<1) +/* newline will be included for . and invert charclass matches */ +#define RE_OPTION_POSIX (RE_OPTION_EXTENDED<<1) + +#define RE_MAY_IGNORECASE (RE_OPTION_POSIX<<1) +#define RE_OPTIMIZE_ANCHOR (RE_MAY_IGNORECASE<<1) +#define RE_OPTIMIZE_EXACTN (RE_OPTIMIZE_ANCHOR<<1) +#define RE_OPTIMIZE_NO_BM (RE_OPTIMIZE_ANCHOR<<1) /* For multi-byte char support */ #define MBCTYPE_ASCII 0 @@ -151,22 +156,22 @@ typedef struct #ifdef __STDC__ -extern char *re_compile_pattern (char *, int, struct re_pattern_buffer *); +extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *); void re_free_pattern (struct re_pattern_buffer *); /* Is this really advertised? */ extern void re_compile_fastmap (struct re_pattern_buffer *); -extern int re_search (struct re_pattern_buffer *, char*, int, int, int, +extern int re_search (struct re_pattern_buffer *, const char*, int, int, int, struct re_registers *); -extern int re_match (struct re_pattern_buffer *, char *, int, int, +extern int re_match (struct re_pattern_buffer *, const char *, int, int, struct re_registers *); -extern void re_set_casetable (char *table); +extern void re_set_casetable (const char *table); extern void re_copy_registers (struct re_registers*, struct re_registers*); extern void re_free_registers (struct re_registers*); #ifndef RUBY /* 4.2 bsd compatibility. */ -extern char *re_comp (char *); -extern int re_exec (char *); +extern char *re_comp (const char *); +extern int re_exec (const char *); #endif #else /* !__STDC__ */ diff --git a/ruby.c b/ruby.c index 4f2ed550e1..493aafd1eb 100644 --- a/ruby.c +++ b/ruby.c @@ -34,9 +34,9 @@ #endif #ifndef HAVE_STRING_H -char *strchr _((char*,char)); -char *strrchr _((char*,char)); -char *strstr _((char*,char*)); +char *strchr _((const char*,const char)); +char *strrchr _((const char*,const char)); +char *strstr _((const char*,const char*)); #endif #include "util.h" @@ -52,14 +52,16 @@ VALUE ruby_verbose = Qfalse; static int sflag = Qfalse; char *ruby_inplace_mode = Qfalse; +# ifndef strdup char *strdup(); +# endif extern int yydebug; static int xflag = Qfalse; static void load_stdin _((void)); static void load_file _((char *, int)); -static void forbid_setid _((char *)); +static void forbid_setid _((const char *)); static VALUE do_loop = Qfalse, do_print = Qfalse; static VALUE do_check = Qfalse, do_line = Qfalse; @@ -72,7 +74,7 @@ static char **origargv; static void usage(name) - char *name; + const char *name; { /* This message really ought to be max 23 lines. * Removed -h because the user already knows that opton. Others? */ @@ -124,7 +126,7 @@ static char *e_tmpname; static void addpath(path) - char *path; + const char *path; { const char sep = RUBY_PATH_SEP[0]; @@ -137,7 +139,7 @@ addpath(path) } #endif if (strchr(path, sep)) { - char *p, *s; + const char *p, *s; VALUE ary = rb_ary_new(); p = path; @@ -160,14 +162,14 @@ addpath(path) } struct req_list { - char *name; + const char *name; struct req_list *next; } req_list_head; struct req_list *req_list_last = &req_list_head; static void add_modules(mod) - char *mod; + const char *mod; { struct req_list *list; @@ -602,10 +604,10 @@ load_file(fname, script) if (RSTRING(line)->ptr[RSTRING(line)->len-2] == '\r') RSTRING(line)->ptr[RSTRING(line)->len-2] = '\0'; if (p = strstr(p, " -")) { - int argc; char *argv[2]; char **argvp = argv; + int argc; char *argv[3]; char **argvp = argv; char *s = ++p; - argc = 2; argv[0] = 0; + argc = 2; argv[0] = argv[2] = 0; while (*p == '-') { while (*s && !ISSPACE(*s)) s++; @@ -733,7 +735,7 @@ init_ids() static void forbid_setid(s) - char *s; + const char *s; { if (euid != uid) rb_raise(rb_eSecurityError, "No %s allowed while running setuid", s); diff --git a/ruby.h b/ruby.h index 49169d94cb..5f3d61ee75 100644 --- a/ruby.h +++ b/ruby.h @@ -51,19 +51,16 @@ extern "C" { #ifndef __STDC__ # define volatile -# ifdef __GNUC__ -# define const __const__ -# else -# define const -# endif #endif +#undef _ #ifdef HAVE_PROTOTYPES # define _(args) args #else # define _(args) () #endif +#undef __ #ifdef HAVE_STDARG_PROTOTYPES # define __(args) args #else @@ -84,9 +81,11 @@ extern "C" { #if defined(DLLIMPORT) #include "import.h" #else +#if !defined(__CYGWIN__) #define environ (*__imp___cygwin_environ) #endif #endif +#endif #ifdef _AIX #pragma alloca @@ -371,30 +370,30 @@ void *xrealloc _((void*,size_t)); #define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n)) #define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n)) -VALUE rb_define_class _((char*,VALUE)); -VALUE rb_define_module _((char*)); -VALUE rb_define_class_under _((VALUE, char *, VALUE)); -VALUE rb_define_module_under _((VALUE, char *)); +VALUE rb_define_class _((const char*,VALUE)); +VALUE rb_define_module _((const char*)); +VALUE rb_define_class_under _((VALUE, const char*, VALUE)); +VALUE rb_define_module_under _((VALUE, const char*)); void rb_include_module _((VALUE,VALUE)); void rb_extend_object _((VALUE,VALUE)); -void rb_define_variable _((char*,VALUE*)); -void rb_define_virtual_variable _((char*,VALUE(*)(),void(*)())); -void rb_define_hooked_variable _((char*,VALUE*,VALUE(*)(),void(*)())); -void rb_define_readonly_variable _((char*,VALUE*)); -void rb_define_const _((VALUE,char*,VALUE)); -void rb_define_global_const _((char*,VALUE)); +void rb_define_variable _((const char*,VALUE*)); +void rb_define_virtual_variable _((const char*,VALUE(*)(),void(*)())); +void rb_define_hooked_variable _((const char*,VALUE*,VALUE(*)(),void(*)())); +void rb_define_readonly_variable _((const char*,VALUE*)); +void rb_define_const _((VALUE,const char*,VALUE)); +void rb_define_global_const _((const char*,VALUE)); -void rb_define_method _((VALUE,char*,VALUE(*)(),int)); -void rb_define_module_function _((VALUE,char*,VALUE(*)(),int)); -void rb_define_global_function _((char*,VALUE(*)(),int)); +void rb_define_method _((VALUE,const char*,VALUE(*)(),int)); +void rb_define_module_function _((VALUE,const char*,VALUE(*)(),int)); +void rb_define_global_function _((const char*,VALUE(*)(),int)); -void rb_undef_method _((VALUE,char*)); -void rb_define_alias _((VALUE,char*,char*)); -void rb_define_attr _((VALUE,char*,int,int)); +void rb_undef_method _((VALUE,const char*)); +void rb_define_alias _((VALUE,const char*,const char*)); +void rb_define_attr _((VALUE,const char*,int,int)); -ID rb_intern _((char*)); +ID rb_intern _((const char*)); char *rb_id2name _((ID)); ID rb_to_id _((VALUE)); @@ -402,13 +401,13 @@ char *rb_class2name _((VALUE)); void rb_p _((VALUE)); -VALUE rb_eval_string _((char*)); -VALUE rb_eval_string_protect _((char*, int*)); +VALUE rb_eval_string _((const char*)); +VALUE rb_eval_string_protect _((const char*, int*)); VALUE rb_funcall __((VALUE, ID, int, ...)); -int rb_scan_args __((int, VALUE*, char*, ...)); +int rb_scan_args __((int, VALUE*, const char*, ...)); -VALUE rb_iv_get _((VALUE, char *)); -VALUE rb_iv_set _((VALUE, char *, VALUE)); +VALUE rb_iv_get _((VALUE, const char*)); +VALUE rb_iv_set _((VALUE, const char*, VALUE)); VALUE rb_const_get _((VALUE, ID)); VALUE rb_const_get_at _((VALUE, ID)); void rb_const_set _((VALUE, ID, VALUE)); @@ -420,16 +419,16 @@ EXTERN VALUE ruby_verbose, ruby_debug; int rb_safe_level _((void)); void rb_set_safe_level _((int)); -void rb_raise __((VALUE, char*, ...)) NORETURN; -void rb_fatal __((char*, ...)) NORETURN; -void rb_bug __((char*, ...)) NORETURN; -void rb_sys_fail _((char*)) NORETURN; +void rb_raise __((VALUE, const char*, ...)) NORETURN; +void rb_fatal __((const char*, ...)) NORETURN; +void rb_bug __((const char*, ...)) NORETURN; +void rb_sys_fail _((const char*)) NORETURN; void rb_iter_break _((void)) NORETURN; void rb_exit _((int)) NORETURN; void rb_notimplement _((void)) NORETURN; -void rb_warn __((char*, ...)); -void rb_warning __((char*, ...)); /* reports if `-w' specified */ +void rb_warn __((const char*, ...)); +void rb_warning __((const char*, ...)); /* reports if `-w' specified */ VALUE rb_each _((VALUE)); VALUE rb_yield _((VALUE)); @@ -437,8 +436,8 @@ int rb_iterator_p _((void)); VALUE rb_iterate _((VALUE(*)(),VALUE,VALUE(*)(),VALUE)); VALUE rb_rescue _((VALUE(*)(),VALUE,VALUE(*)(),VALUE)); VALUE rb_ensure _((VALUE(*)(),VALUE,VALUE(*)(),VALUE)); -VALUE rb_catch _((char*,VALUE(*)(),VALUE)); -void rb_throw _((char*,VALUE)) NORETURN; +VALUE rb_catch _((const char*,VALUE(*)(),VALUE)); +void rb_throw _((const char*,VALUE)) NORETURN; void ruby_init _((void)); void ruby_options _((int, char**)); @@ -483,6 +482,7 @@ EXTERN VALUE rb_eException; EXTERN VALUE rb_eStandardError; EXTERN VALUE rb_eSystemExit; EXTERN VALUE rb_eInterrupt; +EXTERN VALUE rb_eSignal; EXTERN VALUE rb_eFatal; EXTERN VALUE rb_eArgError; EXTERN VALUE rb_eEOFError; diff --git a/rubyio.h b/rubyio.h index 036f24426c..77c37fc45f 100644 --- a/rubyio.h +++ b/rubyio.h @@ -48,8 +48,8 @@ typedef struct OpenFile { #define GetReadFile(fptr) ((fptr)->f) #define GetWriteFile(fptr) (((fptr)->f2) ? (fptr)->f2 : (fptr)->f) -FILE *rb_fopen _((char *, char *)); -FILE *rb_fdopen _((int, char *)); +FILE *rb_fopen _((const char*, const char*)); +FILE *rb_fdopen _((int, const char*)); void rb_io_check_writable _((OpenFile *)); void rb_io_check_readable _((OpenFile *)); void rb_io_fptr_finalize _((OpenFile *)); diff --git a/rubysig.h b/rubysig.h index 6c6ce571e3..aadc869bd9 100644 --- a/rubysig.h +++ b/rubysig.h @@ -22,7 +22,6 @@ extern int rb_prohibit_interrupt; extern int rb_trap_pending; void rb_trap_restore_mask _((void)); -#ifdef USE_THREAD extern int rb_thread_critical; void rb_thread_schedule _((void)); #if defined(HAVE_SETITIMER) && !defined(__BOW__) @@ -31,11 +30,11 @@ extern int rb_thread_pending; if (rb_trap_pending) rb_trap_exec();\ if (rb_thread_pending && !rb_thread_critical) rb_thread_schedule();\ } -# else +#else /* pseudo preemptive thread switching */ extern int rb_thread_tick; #define THREAD_TICK 500 -# define CHECK_INTS if (!rb_prohibit_interrupt) {\ +#define CHECK_INTS if (!rb_prohibit_interrupt) {\ if (rb_trap_pending) rb_trap_exec();\ if (!rb_thread_critical) {\ if (rb_thread_tick-- <= 0) {\ @@ -44,11 +43,6 @@ extern int rb_thread_tick; }\ }\ } -# endif -#else -# define CHECK_INTS if (!rb_prohibit_interrupt) {\ - if (rb_trap_pending) rb_trap_exec();\ -} #endif #endif diff --git a/sample/cal.rb b/sample/cal.rb index 50865dbb8f..c65f7a70f8 100644 --- a/sample/cal.rb +++ b/sample/cal.rb @@ -1,7 +1,7 @@ #! /usr/local/bin/ruby # cal.rb (bsd compatible version): Written by Tadayoshi Funaba 1998, 1999 -# $Id: bsdcal.rb,v 1.3 1999/02/06 08:52:21 tadf Exp $ +# $Id: bsdcal.rb,v 1.4 1999/03/06 02:05:59 tadf Exp $ require 'date2' @@ -70,10 +70,10 @@ end while /^-([^-].*)$/no =~ $*[0] a = $1 - if /^c(.+)?$/no =~ a then - if $1 then + if /^c(.+)?$/no =~ a + if $1 $cc = $1.downcase - elsif $*.length >= 2 then + elsif $*.length >= 2 $cc = $*[1].downcase $*.shift else @@ -109,7 +109,7 @@ end usage unless m.nil? or (1..12) === m usage unless y >= -4712 $w = if $jd then 3 else 2 end -unless $yr then +unless $yr print cal(m, y, gs) else print y.to_s.center(((($w + 1) * 7) - 1) * diff --git a/sample/from.rb b/sample/from.rb index 93b6c4bade..c458b4ea95 100644 --- a/sample/from.rb +++ b/sample/from.rb @@ -17,6 +17,8 @@ class String len += 1 me = self[0, len].ljust(len) if me =~ /.$/ and $&.size == 2 + p me[-2..-1] + me[-2..-1] = ' ' me[-2, 2] = ' ' end me.chop! diff --git a/sample/mine.rb b/sample/mine.rb index f18d6c6b03..fd326482a5 100644 --- a/sample/mine.rb +++ b/sample/mine.rb @@ -168,6 +168,6 @@ begin end end ensure - system("stty -raw echo") + system("stty -raw echo") end print "\n" diff --git a/sample/sieve.rb b/sample/sieve.rb index 5e9f792d81..359c185f20 100644 --- a/sample/sieve.rb +++ b/sample/sieve.rb @@ -1,17 +1,14 @@ # sieve of Eratosthenes -sieve = [] max = Integer(ARGV.shift || 100) +sieve = [] +for i in 2 .. max + sieve[i] = i +end -print "1" -for i in 2 .. max - begin - for d in sieve - fail if i % d == 0 - end - print ", " - print i - sieve.push(i) - rescue +for i in 2 .. Math.sqrt(max) + next unless sieve[i] + (i*i).step(max, i) do |j| + sieve[j] = nil end end -print "\n" +puts sieve.compact.join ", " diff --git a/signal.c b/signal.c index 285cf07405..8978ac0f77 100644 --- a/signal.c +++ b/signal.c @@ -179,6 +179,18 @@ signm2signo(nm) return 0; } +static char* +signo2signm(no) + int no; +{ + struct signals *sigs; + + for (sigs = siglist; sigs->signm; sigs++) + if (sigs->signo == no) + return sigs->signm; + return 0; +} + VALUE rb_f_kill(argc, argv) int argc; @@ -284,30 +296,61 @@ posix_signal(signum, handler) sigact.sa_flags = 0; sigaction(signum, &sigact, 0); } +#define ruby_signal(sig,handle) posix_signal((sig),(handle)) +#else +#define ruby_signal(sig,handle) signal((sig),(handle)) #endif -#ifdef USE_THREAD -# define rb_interrupt rb_thread_interrupt -# define rb_trap_eval rb_thread_trap_eval +static int +signal_exec(sig) + int sig; +{ + if (trap_list[sig] == 0) { + switch (sig) { + case SIGINT: + rb_thread_interrupt(); + break; + case SIGHUP: + case SIGTERM: +#ifdef SIGPIPE + case SIGPIPE: #endif +#ifdef SIGQUIT + case SIGQUIT: +#endif +#ifdef SIGALRM + case SIGALRM: +#endif +#ifdef SIGUSR1 + case SIGUSR1: +#endif +#ifdef SIGUSR2 + case SIGUSR2: +#endif + rb_thread_signal_raise(signo2signm(sig)); + break; + } + } + else { + rb_thread_trap_eval(trap_list[sig], sig); + } +} static RETSIGTYPE sighandle(sig) int sig; { - if (sig >= NSIG ||(sig != SIGINT && !trap_list[sig])) + if (sig >= NSIG) { rb_bug("trap_handler: Bad signal %d", sig); + } #if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL) - signal(sig, sighandle); + ruby_signal(sig, sighandle); #endif if (rb_trap_immediate) { rb_trap_immediate = 0; - if (sig == SIGINT && !trap_list[SIGINT]) { - rb_interrupt(); - } - rb_trap_eval(trap_list[sig], sig); + signal_exec(sig); rb_trap_immediate = 1; } else { @@ -353,11 +396,7 @@ rb_trap_exec() for (i=0; i NSIG) { rb_raise(rb_eArgError, "invalid signal number (%d)", sig); } -#if defined(USE_THREAD) && defined(HAVE_SETITIMER) && !defined(__BOW__) +#if defined(HAVE_SETITIMER) && !defined(__BOW__) if (sig == SIGVTALRM) { rb_raise(rb_eArgError, "SIGVTALRM reserved for Thread; cannot set handler"); } @@ -454,6 +493,23 @@ trap(arg) if (func == SIG_DFL) { switch (sig) { case SIGINT: + case SIGHUP: + case SIGTERM: +#ifdef SIGQUIT + case SIGQUIT: +#endif +#ifdef SIGALRM + case SIGALRM: +#endif +#ifdef SIGUSR1 + case SIGUSR1: +#endif +#ifdef SIGUSR2 + case SIGUSR2: +#endif +#ifdef SIGPIPE + case SIGPIPE: +#endif func = sighandle; break; #ifdef SIGBUS @@ -468,11 +524,7 @@ trap(arg) #endif } } -#ifdef POSIX_SIGNAL - posix_signal(sig, func); -#else - signal(sig, func); -#endif + ruby_signal(sig, func); old = trap_list[sig]; if (!old) old = Qnil; @@ -556,16 +608,30 @@ Init_signal() { #ifndef MACOS_UNUSE_SIGNAL rb_define_global_function("trap", rb_f_trap, -1); -#ifdef POSIX_SIGNAL - posix_signal(SIGINT, sighandle); -#else - signal(SIGINT, sighandle); + ruby_signal(SIGINT, sighandle); + ruby_signal(SIGHUP, sighandle); + ruby_signal(SIGTERM, sighandle); +#ifdef SIGPIPE + ruby_signal(SIGPIPE, sighandle); #endif +#ifdef SIGQUIT + ruby_signal(SIGQUIT, sighandle); +#endif +#ifdef SIGALRM + ruby_signal(SIGALRM, sighandle); +#endif +#ifdef SIGUSR1 + ruby_signal(SIGUSR1, sighandle); +#endif +#ifdef SIGUSR2 + ruby_signal(SIGUSR2, sighandle); +#endif + #ifdef SIGBUS - signal(SIGBUS, sigbus); + ruby_signal(SIGBUS, sigbus); #endif #ifdef SIGSEGV - signal(SIGSEGV, sigsegv); + ruby_signal(SIGSEGV, sigsegv); #endif #endif /* MACOS_UNUSE_SIGNAL */ } diff --git a/sprintf.c b/sprintf.c index 71e5488bce..0370453f09 100644 --- a/sprintf.c +++ b/sprintf.c @@ -594,7 +594,7 @@ rb_f_sprintf(argc, argv) } sprint_exit: - if (RTEST(ruby_verbose) && argc > 1) { + if (RTEST(ruby_verbose) && argc > 0) { rb_raise(rb_eArgError, "too many argument for format string"); } result = rb_str_new(buf, blen); diff --git a/string.c b/string.c index e8afb55ff0..4d7928ff40 100644 --- a/string.c +++ b/string.c @@ -35,7 +35,7 @@ extern VALUE rb_rs; VALUE rb_str_new(ptr, len) - char *ptr; + const char *ptr; int len; { NEWOBJ(str, struct RString); @@ -54,14 +54,14 @@ rb_str_new(ptr, len) VALUE rb_str_new2(ptr) - char *ptr; + const char *ptr; { return rb_str_new(ptr, strlen(ptr)); } VALUE rb_tainted_str_new(ptr, len) - char *ptr; + const char *ptr; int len; { VALUE str = rb_str_new(ptr, len); @@ -72,7 +72,7 @@ rb_tainted_str_new(ptr, len) VALUE rb_tainted_str_new2(ptr) - char *ptr; + const char *ptr; { VALUE str = rb_str_new2(ptr); @@ -300,61 +300,32 @@ rb_str_format(str, arg) } VALUE -rb_str_substr(str, start, len) +rb_str_substr(str, beg, len) VALUE str; - int start, len; + int beg, len; { VALUE str2; - if (len == 0) return rb_str_new(0,0); + if (len < 0) return Qnil; + if (beg > RSTRING(str)->len) return Qnil; + if (beg < 0) { + beg += RSTRING(str)->len; + if (beg < 0) return Qnil; + } + if (beg + len > RSTRING(str)->len) { + len = RSTRING(str)->len - beg; + } if (len < 0) { - rb_raise(rb_eIndexError, "negative length %d", len); - } - if (start < 0) { - start = RSTRING(str)->len + start; - } - if (RSTRING(str)->len <= start) { - return rb_str_new(0,0); - } - if (RSTRING(str)->len < start + len) { - len = RSTRING(str)->len - start; + len = 0; } + if (len == 0) return rb_str_new(0,0); - str2 = rb_str_new(RSTRING(str)->ptr+start, len); + str2 = rb_str_new(RSTRING(str)->ptr+beg, len); if (OBJ_TAINTED(str)) OBJ_TAINT(str2); return str2; } -static VALUE -rb_str_subseq(str, beg, end) - VALUE str; - int beg, end; -{ - int b, e, len; - - b = beg; e = end; - if (beg < 0) { - beg = RSTRING(str)->len + beg; - } - if (end < 0) { - end = RSTRING(str)->len + end; - } - if (beg > end) { - if (e != -1) { - rb_raise(rb_eIndexError, "end smaller than beg [%d..%d]", b, e); - } - return rb_str_new(0, 0); - } - - if (beg >= RSTRING(str)->len) { - len = 0; - } - - len = end - beg + 1; - return rb_str_substr(str, beg, len); -} - void rb_str_modify(str) VALUE str; @@ -424,7 +395,7 @@ rb_str_resize(str, len) VALUE rb_str_cat(str, ptr, len) VALUE str; - char *ptr; + const char *ptr; int len; { if (len > 0) { @@ -572,11 +543,16 @@ rb_str_index(str, sub, offset) char *s, *e, *p; int len; + if (offset < 0) { + offset += RSTRING(str)->len; + if (offset < 0) return -1; + } if (RSTRING(str)->len - offset < RSTRING(sub)->len) return -1; s = RSTRING(str)->ptr+offset; p = RSTRING(sub)->ptr; len = RSTRING(sub)->len; - e = s + RSTRING(str)->len - len + 1; + if (len == 0) return offset; + e = RSTRING(str)->ptr + RSTRING(str)->len - len + 1; while (s < e) { if (*s == *(RSTRING(sub)->ptr) && memcmp(s, p, len) == 0) { return (s-(RSTRING(str)->ptr)); @@ -761,20 +737,20 @@ rb_str_succ_bang(str) } VALUE -rb_str_upto(beg, end) +rb_str_upto(beg, end, excl) VALUE beg, end; + int excl; { VALUE current; if (TYPE(end) != T_STRING) end = rb_str_to_str(end); - if (RTEST(rb_funcall(beg, '>', 1, end))) - return Qnil; current = beg; for (;;) { rb_yield(current); - if (rb_str_equal(current, end)) break; + if (!excl && rb_str_equal(current, end)) break; current = rb_str_succ(current); + if (excl && rb_str_equal(current, end)) break; if (RSTRING(current)->len > RSTRING(end)->len) break; } @@ -782,6 +758,13 @@ rb_str_upto(beg, end) return Qnil; } +static VALUE +rb_str_upto_method(beg, end) + VALUE beg, end; +{ + return rb_str_upto(beg, end, 0); +} + static VALUE rb_str_aref(str, indx) VALUE str; @@ -813,9 +796,14 @@ rb_str_aref(str, indx) default: /* check if indx is Range */ { - int beg, end; - if (rb_range_beg_end(indx, &beg, &end)) { - return rb_str_subseq(str, beg, end); + int beg, len; + switch (rb_range_beg_len(indx, &beg, &len, RSTRING(str)->len, 0)) { + case Qfalse: + break; + case Qnil: + return Qnil; + default: + return rb_str_substr(str, beg, len); } } rb_raise(rb_eIndexError, "invalid index for string"); @@ -861,37 +849,6 @@ rb_str_replace(str, beg, len, val) RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; } -/* rb_str_replace2() understands negative offset */ -static void -rb_str_replace2(str, beg, end, val) - VALUE str, val; - int beg, end; -{ - int b, e, len; - - b = beg; e = end; - if (beg < 0) { - beg = RSTRING(str)->len + beg; - } - if (end < 0) { - end = RSTRING(str)->len + end; - } - if (beg > end) { - if (e != -1) { - rb_raise(rb_eIndexError, "end smaller than beg [%d..%d]", b, e); - } - end = beg - 1; - } - if (beg >= RSTRING(str)->len) { - beg = RSTRING(str)->len; - len = 0; - } - else { - len = end - beg + 1; - } - rb_str_replace(str, beg, len, val); -} - static VALUE rb_str_sub_bang _((int, VALUE*, VALUE)); static VALUE @@ -904,19 +861,23 @@ rb_str_aset(str, indx, val) switch (TYPE(indx)) { case T_FIXNUM: - idx = NUM2INT(indx); + beg = idx = NUM2INT(indx); if (idx < 0) { - idx = RSTRING(str)->len + idx; + idx += RSTRING(str)->len; } - if (idx < 0 || RSTRING(str)->len <= idx) { - rb_raise(rb_eIndexError, "index %d out of range [0..%d]", idx, - RSTRING(str)->len - 1); + if (idx < 0 || RSTRING(str)->len < idx) { + rb_raise(rb_eIndexError, "index %d out of string", NUM2INT(beg)); } - if (TYPE(val) == T_STRING) { - rb_str_replace(str, idx, 1, val); + if (FIXNUM_P(val)) { + if (RSTRING(str)->len == idx) { + RSTRING(str)->len += 1; + REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len); + } + RSTRING(str)->ptr[idx] = NUM2INT(val) & 0xff; } else { - RSTRING(str)->ptr[idx] = NUM2INT(val) & 0xff; + if (TYPE(val) != T_STRING) val = rb_str_to_str(val); + rb_str_replace(str, idx, 1, val); } return val; @@ -932,18 +893,18 @@ rb_str_aset(str, indx, val) case T_STRING: beg = rb_str_index(str, indx, 0); if (beg != -1) { - end = beg + RSTRING(indx)->len - 1; - rb_str_replace2(str, beg, end, val); + if (TYPE(val) != T_STRING) val = rb_str_to_str(val); + rb_str_replace(str, beg, RSTRING(indx)->len, val); } return val; default: /* check if indx is Range */ { - int beg, end; - if (rb_range_beg_end(indx, &beg, &end)) { + int 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_replace2(str, beg, end, val); + rb_str_replace(str, beg, len, val); return val; } } @@ -962,17 +923,21 @@ rb_str_aset_method(argc, argv, str) rb_str_modify(str); if (rb_scan_args(argc, argv, "21", &arg1, &arg2, &arg3) == 3) { - int beg; - int len; + int beg, len; if (TYPE(arg3) != T_STRING) arg3 = rb_str_to_str(arg3); beg = NUM2INT(arg1); - if (beg < 0) { - beg = RSTRING(str)->len + beg; - if (beg < 0) beg = 0; - } len = NUM2INT(arg2); if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len); + if (beg < 0) { + beg += RSTRING(str)->len; + } + if (beg < 0 || RSTRING(str)->len < beg) { + if (beg < 0) { + beg -= RSTRING(str)->len; + } + rb_raise(rb_eIndexError, "index %d out of string", beg); + } if (beg + len > RSTRING(str)->len) { len = RSTRING(str)->len - beg; } @@ -2069,14 +2034,14 @@ rb_str_split_method(argc, argv, str) if (BEG(idx) == END(idx)) tmp = rb_str_new(0, 0); else - tmp = rb_str_subseq(str, BEG(idx), END(idx)-1); + tmp = rb_str_substr(str, BEG(idx), END(idx)-BEG(idx)); rb_ary_push(result, tmp); } if (!NIL_P(limit) && lim <= ++i) break; } } if (!NIL_P(limit) || RSTRING(str)->len > beg || lim < 0) { - rb_ary_push(result, rb_str_subseq(str, beg, -1)); + rb_ary_push(result, rb_str_substr(str, beg, RSTRING(str)->len-beg)); } if (NIL_P(limit) && lim == 0) { while (RARRAY(result)->len > 0 && @@ -2090,7 +2055,7 @@ rb_str_split_method(argc, argv, str) VALUE rb_str_split(str, sep0) VALUE str; - char *sep0; + const char *sep0; { VALUE sep; @@ -2579,7 +2544,7 @@ Init_String() rb_define_method(rb_cString, "succ!", rb_str_succ_bang, 0); rb_define_method(rb_cString, "next", rb_str_succ, 0); rb_define_method(rb_cString, "next!", rb_str_succ_bang, 0); - rb_define_method(rb_cString, "upto", rb_str_upto, 1); + rb_define_method(rb_cString, "upto", rb_str_upto_method, 1); rb_define_method(rb_cString, "index", rb_str_index_method, -1); rb_define_method(rb_cString, "rindex", rb_str_rindex, -1); rb_define_method(rb_cString, "replace", rb_str_replace_method, 1); diff --git a/struct.c b/struct.c index ccdaa3aed4..794b58792e 100644 --- a/struct.c +++ b/struct.c @@ -179,10 +179,10 @@ make_struct(name, member, klass) VALUE #ifdef HAVE_STDARG_PROTOTYPES -rb_struct_define(char *name, ...) +rb_struct_define(const char *name, ...) #else rb_struct_define(name, va_alist) - char *name; + const char *name; va_dcl #endif { diff --git a/time.c b/time.c index 92981b6037..8cdeb55317 100644 --- a/time.c +++ b/time.c @@ -48,9 +48,7 @@ static VALUE S_Tms; struct time_object { struct timeval tv; struct tm tm; -#ifndef HAVE_TM_ZONE int gmt; -#endif int tm_got; }; @@ -193,7 +191,7 @@ time_arg(argc, argv, tm) tm->tm_year = obj2long(v[0]); if (tm->tm_year < 69) tm->tm_year += 100; - if (tm->tm_year > 1900) tm->tm_year -= 1900; + if (tm->tm_year >= 1000) tm->tm_year -= 1900; if (NIL_P(v[1])) { tm->tm_mon = 0; } @@ -239,6 +237,7 @@ time_arg(argc, argv, tm) static VALUE time_gmtime _((VALUE)); static VALUE time_localtime _((VALUE)); +static VALUE time_get_tm _((VALUE, int)); static time_t make_time_t(tptr, fn) @@ -258,29 +257,30 @@ make_time_t(tptr, fn) tm = (*fn)(&guess); if (!tm) goto error; t = tptr->tm_year; + if (t < 69) goto out_of_range; while (diff = t - (tm->tm_year)) { guess += diff * 364 * 24 * 3600; - if (guess < 0) goto too_future; + if (diff > 0 && guess < 0) goto out_of_range; tm = (*fn)(&guess); if (!tm) goto error; } t = tptr->tm_mon; while (diff = t - tm->tm_mon) { guess += diff * 27 * 24 * 3600; - if (guess < 0) goto too_future; tm = (*fn)(&guess); if (!tm) goto error; + if (tptr->tm_year != tm->tm_year) goto out_of_range; } guess += (tptr->tm_mday - tm->tm_mday) * 3600 * 24; guess += (tptr->tm_hour - tm->tm_hour) * 3600; guess += (tptr->tm_min - tm->tm_min) * 60; - guess += tptr->tm_sec - tm->tm_sec; - if (guess < 0) goto too_future; + guess += tptr->tm_sec - tm->tm_sec; + if (guess < 0) goto out_of_range; return guess; - too_future: - rb_raise(rb_eArgError, "too far future"); + out_of_range: + rb_raise(rb_eArgError, "time out of range"); error: rb_raise(rb_eArgError, "gmtime/localtime error"); @@ -416,6 +416,17 @@ time_eql(time1, time2) return Qfalse; } +static VALUE +time_gmt_p(time) + VALUE time; +{ + struct time_object *tobj; + + GetTimeval(time, tobj); + if (tobj->gmt) return Qtrue; + return Qfalse; +} + static VALUE time_hash(time) VALUE time; @@ -428,6 +439,21 @@ time_hash(time) return INT2FIX(hash); } +static VALUE +time_clone(time) + VALUE time; +{ + VALUE obj; + struct time_object *tobj, *newtobj; + + GetTimeval(time, tobj); + obj = Data_Make_Struct(0, struct time_object, 0, free, newtobj); + CLONESETUP(obj, time); + MEMCPY(newtobj, tobj, struct time_object, 1); + + return obj; +} + static VALUE time_localtime(time) VALUE time; @@ -439,9 +465,7 @@ time_localtime(time) tm_tmp = localtime((const time_t*)&tobj->tv.tv_sec); tobj->tm = *tm_tmp; tobj->tm_got = 1; -#ifndef HAVE_TM_ZONE tobj->gmt = 0; -#endif return time; } @@ -456,12 +480,19 @@ time_gmtime(time) tm_tmp = gmtime((const time_t*)&tobj->tv.tv_sec); tobj->tm = *tm_tmp; tobj->tm_got = 1; -#ifndef HAVE_TM_ZONE tobj->gmt = 1; -#endif return time; } +static VALUE +time_get_tm(time, gmt) + VALUE time; + int gmt; +{ + if (gmt) return time_gmtime(time); + return time_localtime(time); +} + static VALUE time_asctime(time) VALUE time; @@ -471,7 +502,7 @@ time_asctime(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } s = asctime(&(tobj->tm)); if (s[24] == '\n') s[24] = '\0'; @@ -489,7 +520,7 @@ time_to_s(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } #ifndef HAVE_TM_ZONE if (tobj->gmt == 1) { @@ -507,58 +538,67 @@ static VALUE time_plus(time1, time2) VALUE time1, time2; { - struct time_object *tobj1, *tobj2; + struct time_object *tobj; time_t sec, usec; double f; - GetTimeval(time1, tobj1); + GetTimeval(time1, tobj); -#if 0 if (rb_obj_is_kind_of(time2, rb_cTime)) { rb_raise(rb_eTypeError, "time + time?"); } -#endif f = NUM2DBL(time2); sec = (time_t)f; - usec = tobj1->tv.tv_usec + (time_t)((f - (double)sec)*1e6); - sec = tobj1->tv.tv_sec + sec; + usec = tobj->tv.tv_usec + (time_t)((f - (double)sec)*1e6); + sec = tobj->tv.tv_sec + sec; if (usec >= 1000000) { /* usec overflow */ sec++; usec -= 1000000; } - return rb_time_new(sec, usec); + time2 = rb_time_new(sec, usec); + if (tobj->gmt) { + GetTimeval(time2, tobj); + tobj->gmt = 1; + } + return time2; } static VALUE time_minus(time1, time2) VALUE time1, time2; { - struct time_object *tobj1, *tobj2; + struct time_object *tobj; time_t sec, usec; double f; - GetTimeval(time1, tobj1); + GetTimeval(time1, tobj); if (rb_obj_is_instance_of(time2, rb_cTime)) { + struct time_object *tobj2; GetTimeval(time2, tobj2); - f = tobj1->tv.tv_sec - tobj2->tv.tv_sec; - f += (tobj1->tv.tv_usec - tobj2->tv.tv_usec)*1e-6; + f = tobj->tv.tv_sec - tobj2->tv.tv_sec; + f += (tobj->tv.tv_usec - tobj2->tv.tv_usec)*1e-6; return rb_float_new(f); } else { f = NUM2DBL(time2); sec = (time_t)f; - usec = tobj1->tv.tv_usec - (time_t)((f - (double)sec)*1e6); - sec = tobj1->tv.tv_sec - sec; + usec = tobj->tv.tv_usec - (time_t)((f - (double)sec)*1e6); + sec = tobj->tv.tv_sec - sec; } if (usec < 0) { /* usec underflow */ sec--; usec += 1000000; } - return rb_time_new(sec, usec); + time2 = rb_time_new(sec, usec); + if (tobj->gmt) { + GetTimeval(time2, tobj); + tobj->gmt = 1; + } + return time2; } static VALUE @@ -569,7 +609,7 @@ time_sec(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_sec); } @@ -582,7 +622,7 @@ time_min(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_min); } @@ -595,7 +635,7 @@ time_hour(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_hour); } @@ -608,7 +648,7 @@ time_mday(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_mday); } @@ -621,7 +661,7 @@ time_mon(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_mon+1); } @@ -634,7 +674,7 @@ time_year(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_year+1900); } @@ -647,7 +687,7 @@ time_wday(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_wday); } @@ -660,7 +700,7 @@ time_yday(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return INT2FIX(tobj->tm.tm_yday+1); } @@ -673,7 +713,7 @@ time_isdst(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return tobj->tm.tm_isdst?Qtrue:Qfalse; } @@ -688,7 +728,7 @@ time_zone(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } len = strftime(buf, 64, "%Z", &(tobj->tm)); @@ -703,7 +743,7 @@ time_to_a(time) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } return rb_ary_new3(10, INT2FIX(tobj->tm.tm_sec), @@ -765,7 +805,7 @@ time_strftime(time, format) GetTimeval(time, tobj); if (tobj->tm_got == 0) { - time_localtime(time); + time_get_tm(time, tobj->gmt); } fmt = str2cstr(format, &len); if (len == 0) { @@ -842,7 +882,7 @@ time_dump(argc, argv, time) rb_scan_args(argc, argv, "01", &dummy); GetTimeval(time, tobj); - tm = gmtime(&tobj->tv.tv_sec); + tm = gmtime((const time_t*)&tobj->tv.tv_sec); p = 0x1 << 31 | /* 1 */ tm->tm_year << 14 | /* 17 */ @@ -892,7 +932,7 @@ time_load(klass, str) return time_new_internal(klass, sec, usec); } p &= ~(1<<31); - tm.tm_year = (p >> 14) & 0x3ffff; + tm.tm_year = (p >> 14) & 0x1ffff; tm.tm_mon = (p >> 10) & 0xf; tm.tm_mday = (p >> 5) & 0x1f; tm.tm_hour = p & 0x1f; @@ -925,6 +965,7 @@ Init_Time() rb_define_method(rb_cTime, "<=>", time_cmp, 1); rb_define_method(rb_cTime, "eql?", time_eql, 1); rb_define_method(rb_cTime, "hash", time_hash, 0); + rb_define_method(rb_cTime, "clone", time_clone, 0); rb_define_method(rb_cTime, "localtime", time_localtime, 0); rb_define_method(rb_cTime, "gmtime", time_gmtime, 0); @@ -950,6 +991,8 @@ Init_Time() rb_define_method(rb_cTime, "isdst", time_isdst, 0); rb_define_method(rb_cTime, "zone", time_zone, 0); + rb_define_method(rb_cTime, "gmt?", time_gmt_p, 0); + rb_define_method(rb_cTime, "tv_sec", time_to_i, 0); rb_define_method(rb_cTime, "tv_usec", time_usec, 0); rb_define_method(rb_cTime, "usec", time_usec, 0); diff --git a/util.c b/util.c index 33d9b3d6f1..df3837bbe4 100644 --- a/util.c +++ b/util.c @@ -73,11 +73,11 @@ char *strchr _((char*,char)); unsigned long scan_oct(start, len, retlen) -char *start; +const char *start; int len; int *retlen; { - register char *s = start; + register const char *s = start; register unsigned long retval = 0; while (len-- && *s >= '0' && *s <= '7') { @@ -90,12 +90,12 @@ int *retlen; unsigned long scan_hex(start, len, retlen) -char *start; +const char *start; int len; int *retlen; { static char hexdigit[] = "0123456789abcdef0123456789ABCDEFx"; - register char *s = start; + register const char *s = start; register unsigned long retval = 0; char *tmp; @@ -329,7 +329,6 @@ valid_filename(char *s) #endif #ifdef DJGPP -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include /* For FILENAME_MAX */ diff --git a/util.h b/util.h index 675df9aaa7..fcd4a7cc59 100644 --- a/util.h +++ b/util.h @@ -21,13 +21,13 @@ #endif #define scan_oct ruby_scan_oct -unsigned long scan_oct _((char*, int, int*)); +unsigned long scan_oct _((const char*, int, int*)); #define scan_hex ruby_scan_hex -unsigned long scan_hex _((char*, int, int*)); +unsigned long scan_hex _((const char*, int, int*)); #if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT) +void ruby_add_suffix(); #define add_suffix ruby_add_suffix -void add_suffix(); #endif char *ruby_mktemp _((void)); @@ -37,5 +37,9 @@ void ruby_qsort _((void*, int, int, int (*)())); void ruby_setenv _((char*, char*)); void ruby_unsetenv _((char*)); +#undef setenv +#undef unsetenv +#define setenv(name,val) ruby_setenv((name),(val)) +#define unsetenv(name,val) ruby_unsetenv((name)); #endif /* UTIL_H */ diff --git a/variable.c b/variable.c index 348b4d5989..966e4877ce 100644 --- a/variable.c +++ b/variable.c @@ -14,7 +14,7 @@ #include "st.h" #ifdef USE_CWGUSI -char* strdup(char*); +char* strdup(const char*); #endif static st_table *rb_global_tbl; @@ -176,7 +176,7 @@ rb_class_path(klass) void rb_set_class_path(klass, under, name) VALUE klass, under; - char *name; + const char *name; { VALUE str; @@ -193,7 +193,7 @@ rb_set_class_path(klass, under, name) VALUE rb_path2class(path) - char *path; + const char *path; { if (path[0] == '#') { rb_raise(rb_eArgError, "can't retrieve anonymous class %s", path); @@ -214,7 +214,7 @@ static st_table *autoload_tbl = 0; static void rb_autoload_id(id, filename) ID id; - char *filename; + const char *filename; { if (!rb_is_const_id(id)) { rb_raise(rb_eNameError, "autoload must be constant name", @@ -229,7 +229,7 @@ rb_autoload_id(id, filename) void rb_autoload(klass, filename) - char *klass, *filename; + const char *klass, *filename; { rb_autoload_id(rb_intern(klass), filename); } @@ -414,7 +414,7 @@ rb_gc_mark_global_tbl() static ID global_id(name) - char *name; + const char *name; { ID id; @@ -430,7 +430,7 @@ global_id(name) void rb_define_hooked_variable(name, var, getter, setter) - char *name; + const char *name; VALUE *var; VALUE (*getter)(); void (*setter)(); @@ -447,7 +447,7 @@ rb_define_hooked_variable(name, var, getter, setter) void rb_define_variable(name, var) - char *name; + const char *name; VALUE *var; { rb_define_hooked_variable(name, var, 0, 0); @@ -455,7 +455,7 @@ rb_define_variable(name, var) void rb_define_readonly_variable(name, var) - char *name; + const char *name; VALUE *var; { rb_define_hooked_variable(name, var, 0, readonly_setter); @@ -463,7 +463,7 @@ rb_define_readonly_variable(name, var) void rb_define_virtual_variable(name, getter, setter) - char *name; + const char *name; VALUE (*getter)(); void (*setter)(); { @@ -631,7 +631,7 @@ rb_gvar_set(entry, val) VALUE rb_gvar_set2(name, val) - char *name; + const char *name; VALUE val; { struct global_entry *entry; @@ -1073,7 +1073,7 @@ rb_mod_remove_const(mod, name) static int autoload_i(key, name, ary) ID key; - char *name; + const char *name; VALUE ary; { VALUE kval = rb_str_new2(rb_id2name(key)); @@ -1188,7 +1188,7 @@ rb_const_set(klass, id, val) void rb_define_const(klass, name, val) VALUE klass; - char *name; + const char *name; VALUE val; { ID id = rb_intern(name); @@ -1204,7 +1204,7 @@ rb_define_const(klass, name, val) void rb_define_global_const(name, val) - char *name; + const char *name; VALUE val; { rb_define_const(rb_cObject, name, val); @@ -1213,7 +1213,7 @@ rb_define_global_const(name, val) VALUE rb_iv_get(obj, name) VALUE obj; - char *name; + const char *name; { ID id = rb_intern(name); @@ -1223,7 +1223,7 @@ rb_iv_get(obj, name) VALUE rb_iv_set(obj, name, val) VALUE obj; - char *name; + const char *name; VALUE val; { ID id = rb_intern(name); diff --git a/version.c b/version.c index 0e21322ab4..28970cd4fe 100644 --- a/version.c +++ b/version.c @@ -19,13 +19,14 @@ void Init_version() { rb_define_global_const("VERSION", rb_str_new2(RUBY_VERSION)); + rb_define_global_const("RELEASE_DATE", rb_str_new2(RUBY_RELEASE_DATE)); rb_define_global_const("PLATFORM", rb_str_new2(RUBY_PLATFORM)); } void ruby_show_version() { - fprintf(stderr, "ruby %s(%s) [%s]\n", RUBY_VERSION, VERSION_DATE, RUBY_PLATFORM); + fprintf(stderr, "ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM); } void diff --git a/version.h b/version.h index 7d3f771002..1f44e4caa8 100644 --- a/version.h +++ b/version.h @@ -1,2 +1,2 @@ #define RUBY_VERSION "1.3.1" -#define VERSION_DATE "99/02/25" +#define RUBY_RELEASE_DATE "1999-03-24" diff --git a/win32/config.h b/win32/config.h index a4de1bfd70..9486750ff9 100644 --- a/win32/config.h +++ b/win32/config.h @@ -1,4 +1,3 @@ -#define USE_THREAD 1 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_VOIDP 4 diff --git a/win32/ruby.def b/win32/ruby.def index 748a2cbfe1..06820c8cf9 100644 --- a/win32/ruby.def +++ b/win32/ruby.def @@ -32,7 +32,6 @@ EXPORTS ;hash.c: rb_cHash ruby_setenv - ruby_setenv2 ruby_unsetenv ;io.c: rb_cIO @@ -319,7 +318,6 @@ EXPORTS rb_syswait ; range.c rb_range_new - rb_range_beg_end ; re.c rb_str_cicmp rb_reg_search