1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-12-22 03:22:25 +00:00
parent 31c53aaa7d
commit 0e47c138c9
15 changed files with 284 additions and 148 deletions

View file

@ -2,6 +2,30 @@ Thu Dec 21 13:01:46 2000 Tanaka Akira <akr@m17n.org>
* lib/net/ftp.rb (makeport): don't use TCPsocket.getaddress.
Wed Dec 20 12:00:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (rb_big_lshift): should cast up to BDIGIT_DBL.
* parse.y (yylex): disallow trailin '_' for numeric litrals.
* bignum.c (rb_cstr2inum): allow `_' within converting string.
* eval.c (specific_eval): should take no argument if block is
supplied.
Tue Dec 19 13:44:50 2000 K.Kosako <kosako@sofnec.co.jp>
* io.c (rb_f_p): should flush rb_defout, not stdout.
Tue Dec 19 00:57:10 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_minus): usec might overflow (ruby-bugs-ja:#PR#35).
* eval.c (rb_obj_extend): Object#extend should take at least one
argument.
* parse.y (mrhs_basic): should check value_expr($3), not $1.
Mon Dec 18 23:18:39 2000 WATANABE Hirofumi <eban@ruby-lang.org>
* util.c (mblen, __crt0_glob_function): add for multibyte

View file

@ -231,7 +231,9 @@ rb_cstr2inum(str, base)
}
}
if (base == 8) {
while (str[0] == '0') str++;
while (*str == '0') str++;
if (!*str) return INT2FIX(0);
while (*str == '_') str++;
len = 3*strlen(str)*sizeof(char);
}
else { /* base == 10, 2 or 16 */
@ -249,6 +251,7 @@ rb_cstr2inum(str, base)
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
unsigned long val = strtoul((char*)str, &end, base);
if (*end == '_') goto bigparse;
if (badcheck) {
if (end == str) goto bad; /* no number */
while (*end && ISSPACE(*end)) end++;
@ -271,7 +274,9 @@ rb_cstr2inum(str, base)
return big;
}
}
bigparse:
len = (len/BITSPERDIG)+1;
if (badcheck && *str == '_') goto bad;
z = bignew(len, sign);
zds = BDIGITS(z);
@ -290,6 +295,8 @@ rb_cstr2inum(str, base)
case 'D': case 'E': case 'F':
c = c - 'A' + 10;
break;
case '_':
continue;
default:
if (badcheck) {
if (ISSPACE(c)) {
@ -317,6 +324,7 @@ rb_cstr2inum(str, base)
break;
}
}
if (badcheck && s+2 < str && str[-2] == '_') goto bad;
return bignorm(z);
}
@ -1252,7 +1260,7 @@ rb_big_lshift(x, y)
}
xds = BDIGITS(x);
for (i=0; i<len; i++) {
num = num | *xds++<<s2;
num = num | (BDIGIT_DBL)*xds++<<s2;
*zds++ = BIGLO(num);
num = BIGDN(num);
}

50
eval.c
View file

@ -4943,33 +4943,34 @@ specific_eval(argc, argv, klass, self)
VALUE *argv;
VALUE klass, self;
{
char *file = "(eval)";
int line = 1;
int iter = rb_block_given_p();
if (argc > 0) {
if (ruby_safe_level >= 4) {
Check_Type(argv[0], T_STRING);
if (rb_block_given_p()) {
if (argc > 0) {
rb_raise(rb_eArgError, "wrong # of arguments (%d for 0)", argc);
}
else {
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 {
char *file = "(eval)";
int line = 1;
if (argc == 0) {
rb_raise(rb_eArgError, "block not supplied");
}
else {
if (ruby_safe_level >= 4) {
Check_Type(argv[0], T_STRING);
}
else {
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]);
}
return eval_under(klass, self, argv[0], file, line);
}
}
@ -5551,6 +5552,9 @@ rb_obj_extend(argc, argv, obj)
{
int i;
if (argc == 0) {
rb_raise(rb_eArgError, "wrong # of arguments(0 for 1)");
}
for (i=0; i<argc; i++) Check_Type(argv[i], T_MODULE);
for (i=0; i<argc; i++) {
rb_funcall(argv[i], rb_intern("extend_object"), 1, obj);

View file

@ -1,6 +1,8 @@
#! /usr/local/bin/ruby
# -*- ruby -*-
$".push 'mkmf.rb'
ORIG_LIBPATH = ENV['LIB']
if ARGV[0] == 'static'
$force_static = true
@ -90,7 +92,19 @@ def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
xsystem(format(LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
ldflags = $LDFLAGS
if /mswin32/ =~ RUBY_PLATFORM and !$LIBPATH.empty?
ENV['LIB'] = ($LIBPATH + [ORIG_LIBPATH]).compact.join(';')
else
$LDFLAGS = ldflags.dup
$LIBPATH.each {|d| $LDFLAGS << " -L" + d}
end
begin
xsystem(format(LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
ensure
$LDFLAGS = ldflags
ENV['LIB'] = ORIG_LIBPATH if /mswin32/ =~ RUBY_PLATFORM
end
end
def try_link(src, opt="")
@ -205,17 +219,17 @@ SRC
end
def find_library(lib, func, *paths)
ldflags = $LDFLAGS
libpath = $LIBPATH
libs = append_library($libs, lib)
until try_link(<<"SRC", libs)
int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
if paths.size == 0
$LDFLAGS = ldflags
$LIBPATH = libpath
return false
end
$LDFLAGS = ldflags + " -L"+paths.shift
$LIBPATH = libpath | [paths.shift]
end
$libs = libs
return true
@ -270,7 +284,7 @@ def arg_config(config, default=nil)
$configure_args = {}
args = "@configure_args@"
if /mswin32|mingw/ =~ RUBY_PLATFORM and ENV["CONFIGURE_ARGS"]
args = args + " " + ENV["CONFIGURE_ARGS"]
args << " " << ENV["CONFIGURE_ARGS"]
end
for arg in args.split
next unless /^--/ =~ arg
@ -321,19 +335,18 @@ def dir_config(target, idefault=nil, ldefault=nil)
dir = with_config("%s-dir"%target, default)
if dir
idir = " -I"+dir+"/include"
ldir = " -L"+dir+"/lib"
ldir = dir+"/lib"
end
unless idir
dir = with_config("%s-include"%target, idefault)
idir = " -I"+dir if dir
end
unless ldir
dir = with_config("%s-lib"%target, ldefault)
ldir = " -L"+dir if dir
ldir = with_config("%s-lib"%target, ldefault)
end
$CFLAGS += idir if idir
$LDFLAGS += ldir if ldir
$CPPFLAGS += idir if idir
$LIBPATH |= [ldir] if ldir
end
def create_makefile(target)
@ -355,9 +368,9 @@ def create_makefile(target)
$DLDFLAGS = '@DLDFLAGS@'
if $configure_args['--enable-shared'] or /cygwin|mingw/ === RUBY_PLATFORM
if $configure_args['--enable-shared'] or "@LIBRUBY@" != "@LIBRUBY_A@"
$libs = "@LIBRUBYARG@ " + $libs
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
$LIBPATH |= [$topdir]
end
defflag = ''
@ -368,6 +381,12 @@ def create_makefile(target)
defflag = "--def=" + target + ".def"
end
if RUBY_PLATFORM =~ /mswin32/
libpath = $LIBPATH.join(';')
else
$LIBPATH.each {|d| $DLDFLAGS << " -L" << d}
end
$srcdir = $top_srcdir + "/ext/" + $mdir
mfile = open("Makefile", "w")
mfile.binmode if /mingw/ =~ RUBY_PLATFORM
@ -389,6 +408,9 @@ CPPFLAGS = -I$(topdir) -I$(hdrdir) -I@includedir@ %s #$CPPFLAGS
DLDFLAGS = #$DLDFLAGS #$LDFLAGS
LDSHARED = @LDSHARED@ #{defflag}
", if $static then "" else "@CCDLFLAGS@" end, $defs.join(" ")
mfile.puts "LIBPATH = #{libpath}" if libpath
mfile.puts ".SUFFIXES: .@OBJEXT@" unless "@OBJEXT@" == "o"
mfile.printf "\
@ -425,9 +447,8 @@ archdir = $(pkglibdir)/@arch@
mfile.printf "\n"
ruby_interpreter = "$(topdir)/miniruby@EXEEXT@"
if /mswin32/ =~ RUBY_PLATFORM
ruby_interpreter = $topdir + "/miniruby@EXEEXT@"
ruby_interpreter.gsub!("/", "\\")
if /nmake/i =~ $make
ruby_interpreter = '$(topdir:/=\)\miniruby@EXEEXT@'
end
if defined? CROSS_COMPILING
ruby_interpreter = "@MINIRUBY@"
@ -467,18 +488,23 @@ EOS
install_rb(mfile, $srcdir)
mfile.printf "\n"
if /mswin32/ =~ RUBY_PLATFORM
mfile.puts "
.c.obj:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
{$(srcdir)}.c{}.obj:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\\)
"
else
if /mswin32/ !~ RUBY_PLATFORM
mfile.puts "
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
"
elsif /nmake/i =~ $make
mfile.print "
{$(srcdir)}.c{}.@OBJEXT@:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\\)
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\\)
"
else
mfile.print "
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
"
end
@ -496,10 +522,15 @@ $(DLLIB): $(OBJS)
"
end
elsif "@DLEXT@" != $OBJEXT
mfile.printf "\
$(DLLIB): $(OBJS)
$(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)
"
mfile.print "$(DLLIB): $(OBJS)\n"
if /mswin32/ =~ RUBY_PLATFORM
if /nmake/i =~ $make
mfile.print "\tset LIB=$(LIBPATH:/=\\);$(LIB)\n"
else
mfile.print "\tenv LIB='$(subst /,\\\\,$(LIBPATH));$(LIB)' \\\n"
end
end
mfile.print "\t$(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)\n"
elsif RUBY_PLATFORM == "m68k-human"
mfile.printf "\
$(DLLIB): $(OBJS)
@ -517,7 +548,7 @@ $(DLLIB): $(OBJS)
mfile.printf "###\n"
while line = dfile.gets()
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1$(srcdir)/\2') if /mswin32/ =~ RUBY_PLATFORM
line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1$(srcdir)/\2') if /nmake/i =~ $make
mfile.printf "%s", line.gsub('\$\(hdrdir\)/config.h', '$(topdir)/config.h')
end
dfile.close
@ -543,26 +574,26 @@ def extmake(target)
$local_flags = ""
if /mswin32/ =~ RUBY_PLATFORM
$LIBEXT = "lib"
$local_flags = "$(topdir)/$(RUBY_SO_NAME).lib -link /EXPORT:Init_$(TARGET)"
$local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)"
end
$LOCAL_LIBS = "" # to be assigned in extconf.rb
dir = with_config("opt-dir")
if dir
idir = "-I"+dir+"/include"
ldir = "-L"+dir+"/lib"
ldir = dir+"/lib"
end
unless idir
dir = with_config("opt-include")
idir = "-I"+dir if dir
end
unless ldir
dir = with_config("opt-lib")
ldir = "-L"+dir if dir
ldir = with_config("opt-lib")
end
$CFLAGS = ""
$CPPFLAGS = idir || ""
$LDFLAGS = ldir || ""
$LDFLAGS = ""
$LIBPATH = [ldir].compact
begin
Dir.mkdir target unless File.directory?(target)

View file

@ -1,6 +1,7 @@
require 'mkmf'
$LDFLAGS += " -L/usr/local/lib" if File.directory?("/usr/local/lib")
$CFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
$LIBPATH << "/usr/local/lib" if File.directory?("/usr/local/lib")
$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
case RUBY_PLATFORM
when /mswin32|mingw/

1
gc.c
View file

@ -411,7 +411,6 @@ rb_gc_mark(ptr)
register RVALUE *obj = RANY(ptr);
Top:
if (FIXNUM_P(obj)) return; /* fixnum not marked */
if (rb_special_const_p((VALUE)obj)) return; /* special const not marked */
if (obj->as.basic.flags == 0) return; /* free cell */
if (obj->as.basic.flags & FL_MARK) return; /* already marked */

2
io.c
View file

@ -2156,7 +2156,7 @@ rb_f_p(argc, argv)
for (i=0; i<argc; i++) {
rb_p(argv[i]);
}
fflush(stdout);
rb_io_flush(rb_defout);
return Qnil;
}

View file

@ -5,6 +5,7 @@ require 'rbconfig'
require 'find'
CONFIG = Config::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB']
SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
@ -25,7 +26,7 @@ else
exit 1
end
$topdir = $hdrdir
$hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/
# $hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/
CFLAGS = CONFIG["CFLAGS"]
if RUBY_PLATFORM == "m68k-human"
@ -75,7 +76,19 @@ def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
ldflags = $LDFLAGS
if /mswin32/ =~ RUBY_PLATFORM and !$LIBPATH.empty?
ENV['LIB'] = ($LIBPATH + [ORIG_LIBPATH]).compact.join(';')
else
$LDFLAGS = ldflags.dup
$LIBPATH.each {|d| $LDFLAGS << " -L" + d}
end
begin
xsystem(format(LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
ensure
$LDFLAGS = ldflags
ENV['LIB'] = ORIG_LIBPATH if /mswin32/ =~ RUBY_PLATFORM
end
end
def try_link(src, opt="")
@ -198,18 +211,18 @@ def find_library(lib, func, *paths)
printf "checking for %s() in -l%s... ", func, lib
STDOUT.flush
ldflags = $LDFLAGS
libpath = $LIBPATH
libs = append_library($libs, lib)
until try_link(<<"SRC", libs)
int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
if paths.size == 0
$LDFLAGS = ldflags
$LIBPATH = libpath
print "no\n"
return false
end
$LDFLAGS = ldflags + " -L"+paths.shift
$LIBPATH = libpath | [paths.shift]
end
$libs = libs
print "yes\n"
@ -264,7 +277,7 @@ SRC
print "no\n"
return false
end
header.tr!("a-z\055./", "A-Z___")
header.tr!("a-z./\055", "A-Z___")
$defs.push(format("-DHAVE_%s", header))
print "yes\n"
return true
@ -324,22 +337,21 @@ def dir_config(target, idefault=nil, ldefault=nil)
dir = with_config("%s-dir"%target, default)
if dir
idir = " -I"+dir+"/include"
ldir = " -L"+dir+"/lib"
ldir = dir+"/lib"
end
unless idir
dir = with_config("%s-include"%target, idefault)
idir = " -I"+dir if dir
end
unless ldir
dir = with_config("%s-lib"%target, ldefault)
ldir = " -L"+dir if dir
ldir = with_config("%s-lib"%target, ldefault)
end
$CFLAGS += idir if idir
$LDFLAGS += ldir if ldir
$CPPFLAGS += idir if idir
$LIBPATH |= [ldir] if ldir
end
def create_makefile(target)
def create_makefile(target, srcdir = File.dirname($0))
print "creating Makefile\n"
rm_f "conftest*"
STDOUT.flush
@ -358,9 +370,9 @@ def create_makefile(target)
end
$DLDFLAGS = CONFIG["DLDFLAGS"]
if $configure_args['--enable-shared'] or /cygwin|mingw/ == RUBY_PLATFORM
if $configure_args['--enable-shared'] or CONFIG['LIBRUBY'] != CONFIG['LIBRUBY_A']
$libs = CONFIG["LIBRUBYARG"] + " " + $libs
$DLDFLAGS += " -L" + CONFIG["libdir"]
$LIBPATH |= ["$(topdir)", CONFIG["libdir"]]
end
defflag = ''
@ -371,9 +383,16 @@ def create_makefile(target)
defflag = "--def=" + target + ".def"
end
if RUBY_PLATFORM =~ /mswin32/
libpath = $LIBPATH.join(';')
else
$LIBPATH.each {|d| $DLDFLAGS << " -L" << d}
end
drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
unless $objs then
$objs = []
for f in Dir["*.{#{SRC_EXT.join(%q{,})}}"]
for f in Dir[File.join(srcdir || ".", "*.{#{SRC_EXT.join(%q{,})}}")]
f = File.basename(f)
f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT)
$objs.push f
@ -392,27 +411,35 @@ SHELL = /bin/sh
#### Start of system configuration section. ####
srcdir = #{$srcdir}
srcdir = #{srcdir || $srcdir}
topdir = #{$topdir}
hdrdir = #{$hdrdir}
VPATH = $(srcdir)
CC = #{CONFIG["CC"]}
CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS}
CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]}
CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]} #{$CPPFLAGS}
CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}
LIBPATH = #{libpath}
RUBY_INSTALL_NAME = #{CONFIG["RUBY_INSTALL_NAME"]}
RUBY_SO_NAME = #{CONFIG["RUBY_SO_NAME"]}
prefix = $(DESTDIR)#{CONFIG["prefix"]}
exec_prefix = $(DESTDIR)#{CONFIG["exec_prefix"]}
libdir = $(DESTDIR)#{$libdir}#{target_prefix}
archdir = $(DESTDIR)#{$archdir}#{target_prefix}
sitelibdir = $(DESTDIR)#{$sitelibdir}#{target_prefix}
sitearchdir = $(DESTDIR)#{$sitearchdir}#{target_prefix}
#{
if destdir = CONFIG["prefix"].scan(drive)[0] and !destdir.empty?
"\nDESTDIR = " + destdir
else
""
end
}
prefix = $(DESTDIR)#{CONFIG["prefix"].sub(drive, '')}
exec_prefix = $(DESTDIR)#{CONFIG["exec_prefix"].sub(drive, '')}
libdir = $(DESTDIR)#{$libdir.sub(drive, '')}#{target_prefix}
archdir = $(DESTDIR)#{$archdir.sub(drive, '')}#{target_prefix}
sitelibdir = $(DESTDIR)#{$sitelibdir.sub(drive, '')}#{target_prefix}
sitearchdir = $(DESTDIR)#{$sitearchdir.sub(drive, '')}#{target_prefix}
#### End of system configuration section. ####
@ -458,26 +485,36 @@ EOMF
install_rb(mfile, "$(sitelibdir)")
mfile.printf "\n"
if /mswin32/ =~ RUBY_PLATFORM
mfile.print "
.c.obj:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
{$(srcdir)}.c.obj:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
"
else
if /mswin32/ !~ RUBY_PLATFORM
mfile.print "
.c.#{$OBJEXT}:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
"
elsif /nmake/i =~ $make
mfile.print "
{$(srcdir)}.c.#{$OBJEXT}:
$(CC) $(CFLAGS) -I$(<D) $(CPPFLAGS) -c $(<:/=\\)
.c.#{$OBJEXT}:
$(CC) $(CFLAGS) -I$(<D) $(CPPFLAGS) -c $(<:/=\\)
"
else
mfile.print "
.SUFFIXES: .#{$OBJEXT}
.c.#{$OBJEXT}:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
"
end
if CONFIG["DLEXT"] != $OBJEXT
mfile.print "$(DLLIB): $(OBJS)\n"
if /mswin32/ =~ RUBY_PLATFORM
mfile.print "\tset LIB=$(topdir:/=\\);$(LIB)\n"
if /nmake/i =~ $make
mfile.print "\tset LIB=$(LIBPATH:/=\\);$(LIB)\n"
else
mfile.print "\tenv LIB='$(subst /,\\\\,$(LIBPATH));$(LIB)' \\\n"
end
end
mfile.print "\t$(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)\n"
elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc")
@ -507,26 +544,26 @@ $libs = CONFIG["DLDLIBS"]
$local_flags = ""
case RUBY_PLATFORM
when /mswin32/
$local_flags = "$(RUBY_SO_NAME).lib -link /EXPORT:Init_$(TARGET)"
$local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)"
end
$LOCAL_LIBS = ""
$defs = []
$make = with_config("make-prog", ENV["MAKE"] || "make")
dir = with_config("opt-dir")
if dir
idir = "-I"+dir+"/include"
ldir = "-L"+dir+"/lib"
ldir = dir+"/lib"
end
unless idir
dir = with_config("opt-include")
idir = "-I"+dir if dir
end
unless ldir
dir = with_config("opt-lib")
ldir = "-L"+dir if dir
ldir = with_config("opt-lib")
end
$CFLAGS = idir || ""
$LDFLAGS = ldir || ""
$hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/
$CFLAGS = with_config("cflags", "")
$CPPFLAGS = [with_config("cppflags", ""), idir].compact.join(" ")
$LDFLAGS = with_config("ldflags", "")
$LIBPATH = [ldir].compact

View file

@ -1,5 +1,5 @@
# parsedate3.rb: Written by Tadayoshi Funaba 2000
# $Id: parsedate3.rb,v 1.2 2000-04-01 12:16:56+09 tadf Exp $
# parsedate.rb: Written by Tadayoshi Funaba 2000
# $Id: parsedate.rb,v 1.2 2000-04-01 12:16:56+09 tadf Exp $
module ParseDate

View file

@ -31,7 +31,10 @@ class Tracer
"call" => ">",
"return" => "<",
"class" => "C",
"end" => "E"}
"end" => "E",
"c-call" => ">",
"c-return" => "<",
}
def initialize
@threads = Hash.new
@ -59,8 +62,8 @@ class Tracer
off
end
else
set_trace_func proc{|event, file, line, id, binding, klass|
trace_func event, file, line, id, binding
set_trace_func proc{|event, file, line, id, binding, klass, *rest|
trace_func event, file, line, id, binding, klass
}
stdout.print "Trace on\n" if Tracer.verbose?
end
@ -85,7 +88,6 @@ class Tracer
end
unless list = LINES__[file]
# stdout.print file if $DEBUG
begin
f = open(file)
begin
@ -112,21 +114,21 @@ class Tracer
end
end
def trace_func(event, file, line, id, binding)
def trace_func(event, file, line, id, binding, klass)
return if file == MY_FILE_NAME
#stdout.printf "Th: %s\n", Thread.current.inspect
for p in @filters
return unless p.call event, file, line, id, binding
return unless p.call event, file, line, id, binding, klass
end
Thread.critical = true
stdout.printf("#%d:%s:%d:%s: %s",
get_thread_no,
file,
line,
EVENT_SYMBOL[event],
get_line(file, line))
stdout.printf("#%d:%s:%d:%s:%s: %s",
get_thread_no,
file,
line,
klass || '',
EVENT_SYMBOL[event],
get_line(file, line))
Thread.critical = false
end

48
parse.y
View file

@ -1022,7 +1022,7 @@ mrhs : arg
mrhs_basic : args ',' arg
{
value_expr($1);
value_expr($3);
$$ = list_append($1, $3);
}
| args ',' tSTAR arg
@ -3126,9 +3126,9 @@ yylex()
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
int is_float, seen_point, seen_e;
int is_float, seen_point, seen_e, seen_uc;
is_float = seen_point = seen_e = 0;
is_float = seen_point = seen_e = seen_uc = 0;
lex_state = EXPR_END;
newtok();
if (c == '-' || c == '+') {
@ -3140,44 +3140,59 @@ yylex()
if (c == 'x' || c == 'X') {
/* hexadecimal */
c = nextc();
if (!ISXDIGIT(c)) {
yyerror("hexadecimal number without hex-digits");
}
do {
if (c == '_') continue;
if (c == '_') {
seen_uc = 1;
continue;
}
if (!ISXDIGIT(c)) break;
seen_uc = 0;
tokadd(c);
} while (c = nextc());
pushback(c);
tokfix();
if (toklen() == 0) {
yyerror("hexadecimal number without hex-digits");
}
else if (seen_uc) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 16);
return tINTEGER;
}
if (c == 'b' || c == 'B') {
/* binary */
c = nextc();
if (c != '0' && c != '1') {
yyerror("numeric literal without digits");
}
do {
if (c == '_') continue;
if (c == '_') {
seen_uc = 1;
continue;
}
if (c != '0'&& c != '1') break;
seen_uc = 0;
tokadd(c);
} while (c = nextc());
pushback(c);
tokfix();
if (toklen() == 0) {
yyerror("numeric literal without digits");
}
else if (seen_uc) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 2);
return tINTEGER;
}
if (c >= '0' && c <= '7' || c == '_') {
/* octal */
do {
if (c == '_') continue;
if (c == '_') {
seen_uc = 1;
continue;
}
if (c < '0' || c > '7') break;
seen_uc = 0;
tokadd(c);
} while (c = nextc());
pushback(c);
tokfix();
if (seen_uc) goto trailing_uc;
yylval.val = rb_cstr2inum(tok(), 8);
return tINTEGER;
}
@ -3198,6 +3213,7 @@ yylex()
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
seen_uc = 0;
tokadd(c);
break;
@ -3217,6 +3233,7 @@ yylex()
tokadd(c);
is_float++;
seen_point++;
seen_uc = 0;
break;
case 'e':
@ -3233,7 +3250,8 @@ yylex()
continue;
break;
case '_': /* `_' in decimal just ignored */
case '_': /* `_' in number just ignored */
seen_uc = 1;
break;
default:
@ -3245,6 +3263,10 @@ yylex()
decode_num:
pushback(c);
tokfix();
if (seen_uc) {
trailing_uc:
yyerror("trailing `_' in number");
}
if (is_float) {
double d = strtod(tok(), 0);
if (errno == ERANGE) {

4
time.c
View file

@ -696,6 +696,10 @@ time_minus(time1, time2)
sec = tobj->tv.tv_sec - sec;
}
if (usec >= 1000000) { /* usec overflow */
sec++;
usec -= 1000000;
}
if (usec < 0) { /* usec underflow */
sec--;
usec += 1000000;

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.2"
#define RUBY_RELEASE_DATE "2000-12-18"
#define RUBY_RELEASE_DATE "2000-12-22"
#define RUBY_VERSION_CODE 162
#define RUBY_RELEASE_CODE 20001218
#define RUBY_RELEASE_CODE 20001222

View file

@ -21,6 +21,7 @@ RUBY_SO_NAME = rubymw
###############
VPATH = $(srcdir):$(srcdir)/missing
.SUFFIXES: .y
CC = cl
YACC = byacc
@ -186,22 +187,25 @@ $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(LIBRUBY_SO).rc: rbconfig.rb
#config.status: $(srcdir)/configure
# $(SHELL) ./config.status --recheck
{$(srcdir)/missing}.c.obj:
$(CC) $(CFLAGS) -I. -I$(<D) $(CPPFLAGS) -c $(<:/=\)
{$(srcdir)/win32}.c.obj:
$(CC) $(CFLAGS) -I. -I$(<D) $(CPPFLAGS) -c $(<:/=\)
{$(srcdir)}.c.obj:
$(CC) $(CFLAGS) -I. -I$(<D) $(CPPFLAGS) -c $(<:/=\)
.c.obj:
$(CC) $(CFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
{$(srcdir)}.c{}.obj:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\)
{$(srcdir)/missing}.c{}.obj:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\)
{$(srcdir)/win32}.c{}.obj:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\)
.rc.res:
$(RC) -I. -I$(<D) -I$(srcdir)/win32 $(RFLAGS) -fo$@ $<
parse.c: $(srcdir)/parse.y
$(YACC) $(YFLAGS) $(srcdir)/parse.y
sed -e "s!^extern char \*getenv();!/* & */!" y.tab.c > parse.c
@rm y.tab.c
{$(srcdir)}.y.c:
$(YACC) $(YFLAGS) $(<:\=/)
sed -e "s!^extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $@
@del y.tab.c
{$(srcdir)}parse.c: parse.y
alloca.obj: $(srcdir)/missing/alloca.c
crypt.obj: $(srcdir)/missing/crypt.c
@ -236,7 +240,7 @@ win32.obj: $(srcdir)/win32/win32.c
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
###
parse.obj: $(srcdir)/parse.c $(srcdir)/ruby.h config.h $(srcdir)/defines.h $(srcdir)/intern.h $(srcdir)/env.h $(srcdir)/node.h $(srcdir)/st.h $(srcdir)/regex.h $(srcdir)/util.h $(srcdir)/lex.c
parse.obj: {$(srcdir)}parse.c $(srcdir)/ruby.h config.h $(srcdir)/defines.h $(srcdir)/intern.h $(srcdir)/env.h $(srcdir)/node.h $(srcdir)/st.h $(srcdir)/regex.h $(srcdir)/util.h $(srcdir)/lex.c
###
array.obj: $(srcdir)/array.c $(srcdir)/ruby.h config.h $(srcdir)/defines.h $(srcdir)/intern.h
bignum.obj: $(srcdir)/bignum.c $(srcdir)/ruby.h config.h $(srcdir)/defines.h $(srcdir)/intern.h

View file

@ -57,7 +57,7 @@ s%@LIBRUBY_A@%lib$(RUBY_INSTALL_NAME).lib%g
s%@LIBRUBY_SO@%%g
s%@LIBRUBY_ALIASES@%%g
s%@LIBRUBY@%$(RUBY_SO_NAME).lib%g
s%@LIBRUBYARG@%$(topdir)/$(RUBY_SO_NAME).lib%g
s%@LIBRUBYARG@%$(RUBY_SO_NAME).lib%g
s%@SOLIBS@%%g
s%@DLDLIBS@%%g
s%@arch@%i586-mswin32%g