1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

*** empty log message ***

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-02-10 08:44:29 +00:00
parent d148ffef29
commit 997ff23758
21 changed files with 229 additions and 154 deletions

View file

@ -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.

View file

@ -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

View file

@ -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
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)

View file

@ -134,7 +134,7 @@ VALUE
* FIXNUMの場合
1bitシフトしてLSBを立てる
1bitシフトしてLSBを立てる
* その他のポインタの場合

View file

@ -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;

44
configure vendored
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

70
io.c
View file

@ -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);
}

View file

@ -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!(/&/, '&amp;')
m.gsub!(/</, '&lt;')
m.gsub!(/>/, '&gt;')
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

View file

@ -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

View file

@ -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"]

View file

@ -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");

View file

@ -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 == '.') {

View file

@ -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 == '.') {

20
regex.c
View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,2 +1,2 @@
#define RUBY_VERSION "1.3.1"
#define VERSION_DATE "99/02/09"
#define VERSION_DATE "99/02/10"