diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | Makefile.in | 34 | ||||
-rw-r--r-- | README.EXT | 64 | ||||
-rw-r--r-- | README.EXT.jp | 2 | ||||
-rw-r--r-- | bignum.c | 1 | ||||
-rw-r--r-- | configure | 44 | ||||
-rw-r--r-- | configure.in | 8 | ||||
-rw-r--r-- | ext/extmk.rb.in | 13 | ||||
-rw-r--r-- | instruby.rb | 3 | ||||
-rw-r--r-- | io.c | 70 | ||||
-rw-r--r-- | lib/cgi-lib.rb | 43 | ||||
-rw-r--r-- | lib/date2.rb | 24 | ||||
-rw-r--r-- | lib/mkmf.rb | 3 | ||||
-rw-r--r-- | numeric.c | 11 | ||||
-rw-r--r-- | parse.c | 4 | ||||
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | regex.c | 20 | ||||
-rw-r--r-- | rubytest.rb | 6 | ||||
-rw-r--r-- | sample/cal.rb | 7 | ||||
-rw-r--r-- | sample/uumerge.rb | 4 | ||||
-rw-r--r-- | version.h | 2 |
21 files changed, 229 insertions, 154 deletions
@@ -1,3 +1,19 @@ +Wed Feb 10 15:20:03 1999 Yukihiro Matsumoto <matz@netlab.co.jp> + + * regex.c (re_match): empty pattern should not cause infinite + pattern match loop. + + * regex.c (re_compile_pattern): RE_OPTIMIZE_ANCHOR for /.*/, not + for /(.|\n)/. + + * numeric.c (fix_pow): `fixnum**nil' should raise TypeError. + + * bignum.c (rb_big_pow): need to normalize results. + +Wed Feb 10 01:42:41 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> + + * numeric.c (fix_pow): `(5**1).type' should be Integer. + Tue Feb 9 01:22:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * parse.y (yylex): do not ignore newlines in mbchars. diff --git a/Makefile.in b/Makefile.in index 15649a24f3..937e97205a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,12 +2,6 @@ SHELL = /bin/sh #### Start of system configuration section. #### -MAJOR= @MAJOR@ -MINOR= @MINOR@ -TEENY= @TEENY@ - -RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ - srcdir = @srcdir@ VPATH = @srcdir@:@srcdir@/missing @@ -27,10 +21,16 @@ LDSHARED = @LDSHARED@ DLDFLAGS = @DLDFLAGS@ SOLIBS = @SOLIBS@ +RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ binsuffix = @binsuffix@ +PROGRAM=$(RUBY_INSTALL_NAME)$(binsuffix) #### End of system configuration section. #### +MAJOR= @MAJOR@ +MINOR= @MINOR@ +TEENY= @TEENY@ + LIBRUBY_A = @LIBRUBY_A@ LIBRUBY_SO = @LIBRUBY_SO@ LIBRUBY_ALIASES= @LIBRUBY_ALIASES@ @@ -58,13 +58,13 @@ OBJS = array.o \ inits.o \ io.o \ marshal.o \ - prec.o \ math.o \ numeric.o \ object.o \ pack.o \ parse.o \ process.o \ + prec.o \ random.o \ range.o \ re.o \ @@ -84,11 +84,11 @@ OBJS = array.o \ all: miniruby$(binsuffix) rbconfig.rb @./miniruby$(binsuffix) -Xext extmk.rb @EXTSTATIC@ -miniruby$(binsuffix): $(LIBRUBY_A) $(MAINOBJ) dmyext.o +miniruby$(binsuffix): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.o @rm -f $@ $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) dmyext.o $(LIBRUBY_A) $(LIBS) -o $@ -ruby$(binsuffix): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) +$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) @rm -f $@ $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ @@ -98,26 +98,22 @@ $(LIBRUBY_A): $(OBJS) dmyext.o $(LIBRUBY_SO): $(OBJS) dmyext.o $(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.o -o $@ - @for alias in $(LIBRUBY_ALIASES); do \ - rm -f $$alias \ - && @LN_S@ $(LIBRUBY_SO) $$alias \ - && echo ln @LN_S@ $(LIBRUBY_SO) $$alias; \ - done + @-./miniruby -e 'ARGV.each{|link| File.delete link if File.exist? link; \ + File.symlink "$(LIBRUBY_SO)", link}' \ + $(LIBRUBY_ALIASES) || true install: rbconfig.rb ./miniruby$(binsuffix) $(srcdir)/instruby.rb $(DESTDIR) clean:; @rm -f $(OBJS) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES) $(MAINOBJ) rbconfig.rb @rm -f ext/extinit.c ext/extinit.o dmyext.o - @if test -f ./miniruby$(binsuffix); then \ - ./miniruby$(binsuffix) -Xext extmk.rb clean; \ - fi + @-./miniruby$(binsuffix) -Xext extmk.rb clean 2> /dev/null || true distclean: clean @rm -f Makefile ext/extmk.rb config.h @rm -f ext/config.cache config.cache config.log config.status @rm -f parse.c *~ core *.core gmon.out y.tab.c y.output - @rm -f ruby$(binsuffix) miniruby$(binsuffix) + @rm -f $(PROGRAM) miniruby$(binsuffix) realclean: distclean @rm -f lex.c @@ -125,7 +121,7 @@ realclean: distclean test: miniruby$(binsuffix) @./miniruby$(binsuffix) $(srcdir)/rubytest.rb -rbconfig.rb: config.status miniruby$(binsuffix) +rbconfig.rb: miniruby$(binsuffix) @./miniruby$(binsuffix) $(srcdir)/mkconfig.rb rbconfig.rb config.status: $(srcdir)/configure diff --git a/README.EXT b/README.EXT index 2f90c69423..9a56bd99e8 100644 --- a/README.EXT +++ b/README.EXT @@ -113,7 +113,7 @@ To convert C data to the values of Ruby: * FIXNUM - right shift 1 bit, and turn on LSB. + left shift 1 bit, and turn on LSB. * Other pointer values @@ -726,11 +726,11 @@ const: nil object Qtrue -const: Qtrue object(default true value) +const: true object(default true value) Qfalse -const: Qfalse object +const: false object ** C pointer wrapping @@ -744,12 +744,13 @@ Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ Data_Make_Struct(class, type, mark, free, sval) -type型のメモリをmallocし,変数svalに代入した後,それをカプセ -ル化したデータを返すマクロ. +This macro allocates memory using malloc(), assigns it to the variable +sval, and returns the DATA encapsulating the pointer to memory region. Data_Get_Struct(data, type, sval) -dataからtype型のポインタを取り出し変数svalに代入するマクロ. +This macro retrieves the pointer value from DATA, and assigns it to +the variable sval. ** defining class/module @@ -905,48 +906,54 @@ Sets the value of the instance variable. VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) -func2をブロックとして設定し, func1をイテレータとして呼ぶ. -func1には arg1が引数として渡され, func2には第1引数にイテレー -タから与えられた値, 第2引数にarg2が渡される. +Calls the function func1, supplying func2 as the block. func1 will be +called with the argument arg1. func2 receives the value from yield as +the first argument, arg2 as the second argument. + VALUE rb_yield(VALUE val) -valを値としてイテレータブロックを呼び出す. +Evaluates the block with value val. VALUE rb_rescue(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) -関数func1をarg1を引数に呼び出す.func1の実行中に例外が発生し -た時には func2をarg2を引数として呼ぶ.戻り値は例外が発生しな -かった時はfunc1の戻り値, 例外が発生した時にはfunc2の戻り値で -ある. +Calls the function func1, with arg1 as the argument. If exception +occurs during func1, it calls func2 with arg2 as the argument. The +return value of rb_rescue() is the return value from func1 if no +exception occurs, from func2 otherwise. VALUE rb_ensure(VALUE (*func1)(), void *arg1, void (*func2)(), void *arg2) -関数func1をarg1を引数として実行し, 実行終了後(たとえ例外が発 -生しても) func2をarg2を引数として実行する.戻り値はfunc1の戻 -り値である(例外が発生した時は戻らない). +Calls the function func1 with arg1 as the argument, then calls func2 +with arg2, whenever execution terminated. The return value from +rb_ensure() is that of func1. + +** Exceptions and Errors + + void rb_warn(char *fmt, ...) -** 例外・エラー +Prints warning message according to the printf-like format. void rb_warning(char *fmt, ...) -rb_verbose時に標準エラー出力に警告情報を表示する.引数はprintf()と同じ. +Prints warning message according to the printf-like format, if +$VERBOSE is true. - void rb_raise(rb_eRuntimeError, char *fmt, ...) + void rb_raise(VALUE exception, char *fmt, ...) -例外を発生させる.引数はprintf()と同じ. +Raises an exception of class exception. The fmt is the format string +just like printf(). void rb_fatal(char *fmt, ...) -致命的例外を発生させる.通常の例外処理は行なわれず, インター -プリタが終了する(ただしensureで指定されたコードは終了前に実 -行される). +Raises fatal error, terminates the interpreter. No exception handling +will be done for fatal error, but ensure blocks will be executed. void rb_bug(char *fmt, ...) -インタープリタなどプログラムのバグでしか発生するはずのない状 -況の時呼ぶ.インタープリタはコアダンプし直ちに終了する.例外 -処理は一切行なわれない. +Termintates the interpreter immediately. This function should be +called under the situation caused by the bug in the interpreter. No +exception handling nor ensure execution will be done. ** Initialize and Starts the Interpreter @@ -966,8 +973,7 @@ Specifies the name of the script ($0). Appendix B. Functions Available in extconf.rb -extconf.rbの中では利用可能なコンパイル条件チェックの関数は以 -下の通りである. +These functions are available in extconf.rb: have_library(lib, func) diff --git a/README.EXT.jp b/README.EXT.jp index 6adeab3f0b..f838b02b40 100644 --- a/README.EXT.jp +++ b/README.EXT.jp @@ -134,7 +134,7 @@ VALUEの実際の構造は * FIXNUMの場合 - 1bit右シフトして,LSBを立てる. + 1bit左シフトして,LSBを立てる. * その他のポインタの場合 @@ -943,6 +943,7 @@ rb_big_pow(x, y) } z = rb_big_mul(z, x); } + if (!FIXNUM_P(z)) z = bignorm(z); return z; } d = (double)yy; @@ -3787,6 +3787,7 @@ echo "configure:3765: checking whether OS depend dynamic link works" >&5 LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; solaris*) LDSHARED='ld -G' + LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; @@ -3799,8 +3800,8 @@ echo "configure:3765: checking whether OS depend dynamic link works" >&5 linux*) LDSHARED="gcc -shared" rb_cv_dlopen=yes ;; freebsd*) LDSHARED="gcc -shared" - if test -x /usr/bin/objformat -a \ - `/usr/bin/objformat` = "elf" ; then + if test -x /usr/bin/objformat && \ + test `/ust/bin/objformat` = "elf" ; then LDFLAGS="-rdynamic" DLDFLAGS='-Wl,-soname,$(.TARGET)' rb_cv_freebsd_elf=yes @@ -3854,12 +3855,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:3858: checking whether matz's dln works" >&5 +echo "configure:3859: 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 <<EOF -#line 3863 "configure" +#line 3864 "configure" #include "confdefs.h" #define USE_DLN_A_OUT @@ -3869,7 +3870,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -3971,7 +3972,7 @@ fi case "$host_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:3975: checking for _harderr in -lsignal" >&5 +echo "configure:3976: 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 @@ -3979,7 +3980,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <<EOF -#line 3983 "configure" +#line 3984 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3990,7 +3991,7 @@ int main() { _harderr() ; return 0; } EOF -if { (eval echo configure:3994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3995: \"$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 @@ -4018,7 +4019,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:4022: checking for hmemset in -lhmem" >&5 +echo "configure:4023: 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 @@ -4026,7 +4027,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <<EOF -#line 4030 "configure" +#line 4031 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4037,7 +4038,7 @@ int main() { hmemset() ; return 0; } EOF -if { (eval echo configure:4041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4042: \"$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 @@ -4067,12 +4068,12 @@ fi for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4071: checking for $ac_func" >&5 +echo "configure:4072: 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 <<EOF -#line 4076 "configure" +#line 4077 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4095,7 +4096,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4100: \"$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 @@ -4120,7 +4121,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:4124: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:4125: 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 @@ -4128,7 +4129,7 @@ else rb_cv_missing__dtos18=no else cat > conftest.$ac_ext <<EOF -#line 4132 "configure" +#line 4133 "configure" #include "confdefs.h" #include <stdio.h> @@ -4140,7 +4141,7 @@ main () } EOF -if { (eval echo configure:4144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4145: \"$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 @@ -4162,7 +4163,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:4166: checking whether PD libc fconvert fail to round" >&5 +echo "configure:4167: 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 @@ -4170,7 +4171,7 @@ else rb_cv_missing_fconvert=no else cat > conftest.$ac_ext <<EOF -#line 4174 "configure" +#line 4175 "configure" #include "confdefs.h" #include <stdio.h> @@ -4183,7 +4184,7 @@ main () } EOF -if { (eval echo configure:4187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4188: \"$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 @@ -4310,7 +4311,8 @@ 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_INSTALL_NAME}/${MAJOR}.${MINOR}" +RUBY_LIB_PATH="${prefix}/lib/ruby/${MAJOR}.${MINOR}" cat >> confdefs.h <<EOF #define RUBY_LIB "${RUBY_LIB_PATH}" EOF diff --git a/configure.in b/configure.in index e778bb6161..95bbe7d210 100644 --- a/configure.in +++ b/configure.in @@ -402,6 +402,7 @@ if test "$with_dln_a_out" != yes; then LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; solaris*) LDSHARED='ld -G' + LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; @@ -414,8 +415,8 @@ if test "$with_dln_a_out" != yes; then linux*) LDSHARED="gcc -shared" rb_cv_dlopen=yes ;; freebsd*) LDSHARED="gcc -shared" - if test -x /usr/bin/objformat -a \ - `/usr/bin/objformat` = "elf" ; then + if test -x /usr/bin/objformat && \ + test `/ust/bin/objformat` = "elf" ; then LDFLAGS="-rdynamic" DLDFLAGS='-Wl,-soname,$(.TARGET)' rb_cv_freebsd_elf=yes @@ -685,7 +686,8 @@ 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_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") AC_SUBST(arch)dnl diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 6ddd45231b..d422b32322 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -294,13 +294,14 @@ LDSHARED = @LDSHARED@ mfile.printf "\ -program_transform_name = -e @program_transform_name@ -RUBY_INSTALL_NAME = `t='$(program_transform_name)'; echo @RUBY_INSTALL_NAME@ | sed $$t` +#program_transform_name = -e @program_transform_name@ +#RUBY_INSTALL_NAME = `t='$(program_transform_name)'; echo @RUBY_INSTALL_NAME@ | sed $$t` prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ -pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)/@MAJOR@.@MINOR@ +#pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)/@MAJOR@.@MINOR@ +pkglibdir = $(libdir)/ruby/@MAJOR@.@MINOR@ archdir = $(pkglibdir)/@arch@ @SET_MAKE@ @@ -560,9 +561,9 @@ if $extlist.size > 0 system format('make ruby@binsuffix@ EXTOBJS="%s" EXTLIBS="%s"', $extobjs, $extlibs) else Dir.chdir ".." - if older("ruby@binsuffix@", "miniruby@binsuffix@") - `rm -f ruby@binsuffix@` - system("make ruby@binsuffix@") + if older("@RUBY_INSTALL_NAME@@binsuffix@", "miniruby@binsuffix@") + `rm -f @RUBY_INSTALL_NAME@@binsuffix@` + system("make @RUBY_INSTALL_NAME@@binsuffix@") end end diff --git a/instruby.rb b/instruby.rb index f06b212957..f01dae9004 100644 --- a/instruby.rb +++ b/instruby.rb @@ -17,7 +17,8 @@ end ruby_install_name = CONFIG["ruby_install_name"] bindir = destdir+CONFIG["bindir"] libdir = destdir+CONFIG["libdir"] -pkglibdir = libdir + "/" + ruby_install_name+"/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] +#pkglibdir = libdir + "/" + ruby_install_name+"/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] +pkglibdir = libdir + "/ruby/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] archdir = pkglibdir + "/" + CONFIG["arch"] mandir = destdir+CONFIG["mandir"] + "/man1" wdir = Dir.getwd @@ -1088,6 +1088,39 @@ rb_io_mode_flags2(mode) return flags; } +static char* +rb_io_flags_mode(flags) + int flags; +{ + static char mode[4]; + char *p = mode; + + switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) { + case O_RDONLY: + *p++ = 'r'; + break; + case O_WRONLY: + *p++ = 'w'; + break; + case O_RDWR: + *p++ = 'w'; + *p++ = '+'; + break; + } + *p++ = '\0'; +#ifdef O_BINARY + if (flags & O_BINARY) { + if (mode[1] == '+') { + mode[1] = 'b'; mode[2] = '+'; mode[3] = '\0'; + } + else { + mode[1] = 'b'; mode[2] = '\0'; + } + } +#endif + return mode; +} + static int rb_open(fname, flag, mode) char *fname; @@ -1171,6 +1204,12 @@ rb_file_sysopen(fname, flags, mode) char *fname; int flags, mode; { +#ifdef USE_CWGUSI + if (mode != 0666) { + rb_warn("can't specify file mode on this platform"); + } + return rb_file_open(fname, rb_io_flags_mode(flags)); +#else OpenFile *fptr; int fd; char *m; @@ -1185,6 +1224,7 @@ rb_file_sysopen(fname, flags, mode) rb_obj_call_init((VALUE)port); return (VALUE)port; +#endif } #if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) || defined(__human68k__) @@ -1476,33 +1516,7 @@ rb_f_open(argc, argv) mode = "r"; } else if (FIXNUM_P(pmode)) { - int flags = FIX2INT(pmode); - char *p; - - mode = p = ALLOCA_N(char, 4); - switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) { - case O_RDONLY: - *p++ = 'r'; - break; - case O_WRONLY: - *p++ = 'w'; - break; - case O_RDWR: - *p++ = 'w'; - *p++ = '+'; - break; - } - *p++ = '\0'; -#ifdef O_BINARY - if (flags & O_BINARY) { - if (mode[1] == '+') { - mode[1] = 'b'; mode[2] = '+'; mode[3] = '\0'; - } - else { - mode[1] = 'b'; mode[2] = '\0'; - } - } -#endif + mode = rb_io_flags_mode(FIX2INT(pmode)); } else { int len; @@ -1513,7 +1527,7 @@ rb_f_open(argc, argv) rb_raise(rb_eArgError, "illegal access mode %s", mode); } - port = pipe_open(RSTRING(pname)->ptr, mode); + port = pipe_open(RSTRING(pname)->ptr+1, mode); if (rb_iterator_p()) { return rb_ensure(rb_yield, port, rb_io_close, port); } diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb index 2089a9c9a5..83ea6118b9 100644 --- a/lib/cgi-lib.rb +++ b/lib/cgi-lib.rb @@ -38,6 +38,11 @@ # CGI.tag("HR") # } # } +# +# print HTTP header and strings to STDOUT +# CGI.print{ "string" } # add HTTP header "Content-Type: text/html" +# CGI.print("Content-Type: text/plain"){ "string" } +# CGI.print("HTTP/1.0 200 OK", "Content-Type: text/html"){ "string" } # if running on Windows(IIS or PWS) then change cwd. @@ -150,25 +155,33 @@ class CGI < SimpleDelegator (iterator? ? yield.to_s + "</" + escapeHTML(element) + ">" : "") end - def CGI.message(msg, title = "", header = ["Content-Type: text/html"]) - print CGI.header(*header) - print "<html><head><title>" - print title - print "</title></head><body>\n" - print msg - print "</body></html>\n" + def CGI.print(*header) + header.push("Content-Type: text/html") if header.empty? + STDOUT.print CGI.header(*header) + yield.to_s + end + + 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 } + } + } TRUE end def CGI.error - m = $!.to_s.dup - m.gsub!(/&/, '&') - m.gsub!(/</, '<') - m.gsub!(/>/, '>') - msgs = ["<pre>ERROR: <strong>#{m}</strong>"] - msgs << $@ - msgs << "</pre>" - CGI.message(msgs.join("\n"), "ERROR") + CGI.message({'title'=>'ERROR', 'body'=> + CGI.tag("PRE"){ + "ERROR: " + CGI.tag("STRONG"){ escapeHTML($!.to_s) } + "\n" + + escapeHTML($@.join("\n")) + } + }) exit end end diff --git a/lib/date2.rb b/lib/date2.rb index 50c2ccfbd9..6e87824b38 100644 --- a/lib/date2.rb +++ b/lib/date2.rb @@ -1,11 +1,11 @@ -# date.rb: Written by Tadayoshi Funaba 1998 -# $Id: date.rb,v 1.4 1998/06/01 12:52:33 tadf Exp $ +# date.rb: Written by Tadayoshi Funaba 1998, 1999 +# $Id: date.rb,v 1.5 1999/02/06 08:51:56 tadf Exp $ class Date include Comparable - MONTHNAMES = [ '', 'January', 'February', 'March', 'April', 'May', 'June', + MONTHNAMES = [ nil, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] DAYNAMES = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', @@ -162,26 +162,24 @@ class Date end def + (other) - if other.kind_of? Numeric then - return Date.new(@jd + other, @gs) + case other + when Numeric; return Date.new(@jd + other, @gs) end fail TypeError, 'expected numeric' end def - (other) - if other.kind_of? Numeric then - return Date.new(@jd - other, @gs) - elsif other.kind_of? Date then - return @jd - other.jd + case other + when Numeric; return Date.new(@jd - other, @gs) + when Date; return @jd - other.jd end fail TypeError, 'expected numeric or date' end def <=> (other) - if other.kind_of? Numeric then - return @jd <=> other - elsif other.kind_of? Date then - return @jd <=> other.jd + case other + when Numeric; return @jd <=> other + when Date; return @jd <=> other.jd end fail TypeError, 'expected numeric or date' end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 0e7595531f..52b4ed20a9 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -31,7 +31,8 @@ if File.exist?($config_cache) then end $srcdir = CONFIG["srcdir"] -$libdir = CONFIG["libdir"]+"/"+CONFIG["ruby_install_name"] +#$libdir = CONFIG["libdir"]+"/"+CONFIG["ruby_install_name"] +$libdir = CONFIG["libdir"]+"/ruby" $libdir += "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"] $archdir = $libdir+"/"+CONFIG["arch"] $install = CONFIG["INSTALL_PROGRAM"] @@ -13,6 +13,9 @@ #include "ruby.h" #include <math.h> #include <stdio.h> +#ifdef __FreeBSD__ +#include <floatingpoint.h> +#endif static ID coerce; static ID to_i; @@ -985,15 +988,13 @@ fix_pow(x, y) b = FIX2LONG(y); if (b == 0) return INT2FIX(1); + if (b == 1) return x; a = FIX2LONG(x); if (b > 0) { return rb_big_pow(rb_int2big(a), y); } return rb_float_new(pow((double)a, (double)b)); } - else if (NIL_P(y)) { - return INT2FIX(1); - } return rb_num_coerce_bin(x, y); } @@ -1402,6 +1403,10 @@ fix_zero_p(num) void Init_Numeric() { +#ifdef __FreeBSD__ + /* allow divide by zero -- Inf */ + fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV)); +#endif coerce = rb_intern("coerce"); to_i = rb_intern("to_i"); @@ -5719,7 +5719,7 @@ retry: yylval.val = rb_str2inum(tok(), 2); return tINTEGER; } - else if (c >= '0' && c <= '7' || c == '_') { + if (c >= '0' && c <= '7' || c == '_') { /* octal */ do { if (c == '_') continue; @@ -5731,7 +5731,7 @@ retry: yylval.val = rb_str2inum(tok(), 8); return tINTEGER; } - else if (c > '7' && c <= '9') { + if (c > '7' && c <= '9') { yyerror("Illegal octal digit"); } else if (c == '.') { @@ -2808,7 +2808,7 @@ retry: yylval.val = rb_str2inum(tok(), 2); return tINTEGER; } - else if (c >= '0' && c <= '7' || c == '_') { + if (c >= '0' && c <= '7' || c == '_') { /* octal */ do { if (c == '_') continue; @@ -2820,7 +2820,7 @@ retry: yylval.val = rb_str2inum(tok(), 8); return tINTEGER; } - else if (c > '7' && c <= '9') { + if (c > '7' && c <= '9') { yyerror("Illegal octal digit"); } else if (c == '.') { @@ -2069,7 +2069,16 @@ re_compile_pattern(pattern, size, bufp) laststart++; EXTRACT_NUMBER_AND_INCR(mcnt, laststart); if (mcnt == 4 && *laststart == anychar) { - bufp->options |= RE_OPTIMIZE_ANCHOR; + 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; + } } else if (*laststart == charset || *laststart == charset_not) { p0 = laststart; @@ -3692,8 +3701,13 @@ re_match(bufp, string_arg, size, pos, regs) because didn't fail. Also remove the register information put on by the on_failure_jump. */ case finalize_jump: - POP_FAILURE_POINT(); - /* Note fall through. */ + if (stackp[-2] == d) { + p = stackp[-3]; + POP_FAILURE_POINT(); + continue; + } + POP_FAILURE_POINT(); + /* Note fall through. */ /* Jump without taking off any failure points. */ case jump: diff --git a/rubytest.rb b/rubytest.rb index cf583c1dfb..3bf11b3ba5 100644 --- a/rubytest.rb +++ b/rubytest.rb @@ -1,11 +1,15 @@ #! ./miniruby -I. +x = ENV["LD_LIBRARY_PATH"] +x = x ? x+":." : "." +ENV["LD_LIBRARY_PATH"] = x + require 'rbconfig' include Config $stderr.reopen($stdout) error = '' -`./ruby #{CONFIG["srcdir"]}/sample/test.rb`.each do |line| +`./#{CONFIG["ruby_install_name"]} #{CONFIG["srcdir"]}/sample/test.rb`.each do |line| if line =~ /^end of test/ print "test succeeded\n" exit 0 diff --git a/sample/cal.rb b/sample/cal.rb index a5f4b4db18..50865dbb8f 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 -# $Id: bsdcal.rb,v 1.2 1998/12/01 13:47:40 tadf Exp $ +# 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 $ require 'date2' @@ -68,7 +68,7 @@ def zip(xs) yr end -while /^-(.*)$/no =~ $*[0] +while /^-([^-].*)$/no =~ $*[0] a = $1 if /^c(.+)?$/no =~ a then if $1 then @@ -90,6 +90,7 @@ while /^-(.*)$/no =~ $*[0] end $*.shift end +$*.shift if /^--/no =~ $*[0] usage if (gs = $tab[$cc]).nil? case $*.length when 0 diff --git a/sample/uumerge.rb b/sample/uumerge.rb index 26f28923d5..418323c439 100644 --- a/sample/uumerge.rb +++ b/sample/uumerge.rb @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby if ARGV[0] == "-c" out_stdout = 1 @@ -18,7 +18,7 @@ while gets() out = open($file, "w") if $file != "" end out.binmode - next + break end end @@ -1,2 +1,2 @@ #define RUBY_VERSION "1.3.1" -#define VERSION_DATE "99/02/09" +#define VERSION_DATE "99/02/10" |