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

aix shlib link

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-04-26 09:42:44 +00:00
parent f6e04e38cd
commit e67e5adf4e
14 changed files with 2353 additions and 2190 deletions

View file

@ -1,3 +1,21 @@
Mon Apr 26 16:46:59 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* sprintf.c (rb_f_sprintf): should allocate proper sized buffer
for float numbers.
Sat Apr 24 00:00:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (operation): syntax like `a.[]=(1,2)' is allowed.
Fri Apr 23 23:54:09 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (argf_binmode): binmode method added to ARGF.
Fri Apr 23 13:55:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* string.c (rb_f_chomp): should assign the result to $_. or maybe
sub/gsub/chop/chomp should NOT assign $_ altogether.
Thu Apr 22 16:50:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_callcc): call scope_dup() for all scopes in

42
configure vendored
View file

@ -4007,9 +4007,11 @@ echo "configure:3935: checking whether OS depend dynamic link works" >&5
LDFLAGS=""
DLDFLAGS="$ARCH_FLAG"
rb_cv_dlopen=yes ;;
aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
XLDFLAGS="-Wl,-bE:ext/ruby.imp"
aix*) LDSHARED='/usr/ccs/bin/ld'
XLDFLAGS="-Wl,-bE:ruby.imp"
DLDFLAGS="-eInit_$(TARGET) -bI:$(ruby_inc)/ruby.imp -bM:SRE -T512 -H512 -lc"
rb_cv_dlopen=yes ;;
human*) DLDFLAGS=''
LDSHARED=''
LDFLAGS=''
@ -4039,12 +4041,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:4043: checking whether matz's dln works" >&5
echo "configure:4045: 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 4048 "configure"
#line 4050 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@ -4054,7 +4056,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:4058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_dln_a_out=yes
else
@ -4161,7 +4163,7 @@ fi
case "$host_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
echo "configure:4165: checking for _harderr in -lsignal" >&5
echo "configure:4167: 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
@ -4169,7 +4171,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4173 "configure"
#line 4175 "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
@ -4180,7 +4182,7 @@ int main() {
_harderr()
; return 0; }
EOF
if { (eval echo configure:4184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4186: \"$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
@ -4208,7 +4210,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
echo "configure:4212: checking for hmemset in -lhmem" >&5
echo "configure:4214: 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
@ -4216,7 +4218,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4220 "configure"
#line 4222 "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
@ -4227,7 +4229,7 @@ int main() {
hmemset()
; return 0; }
EOF
if { (eval echo configure:4231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4233: \"$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
@ -4257,12 +4259,12 @@ fi
for ac_func in select
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4261: checking for $ac_func" >&5
echo "configure:4263: 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 4266 "configure"
#line 4268 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -4285,7 +4287,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:4289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4291: \"$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
@ -4310,7 +4312,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
echo "configure:4314: checking whether PD libc _dtos18 fail to convert big number" >&5
echo "configure:4316: 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
@ -4318,7 +4320,7 @@ else
rb_cv_missing__dtos18=no
else
cat > conftest.$ac_ext <<EOF
#line 4322 "configure"
#line 4324 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4330,7 +4332,7 @@ main ()
}
EOF
if { (eval echo configure:4334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4336: \"$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
@ -4352,7 +4354,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
echo "configure:4356: checking whether PD libc fconvert fail to round" >&5
echo "configure:4358: 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
@ -4360,7 +4362,7 @@ else
rb_cv_missing_fconvert=no
else
cat > conftest.$ac_ext <<EOF
#line 4364 "configure"
#line 4366 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4373,7 +4375,7 @@ main ()
}
EOF
if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4379: \"$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

View file

@ -448,9 +448,11 @@ if test "$with_dln_a_out" != yes; then
LDFLAGS=""
DLDFLAGS="$ARCH_FLAG"
rb_cv_dlopen=yes ;;
aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
XLDFLAGS="-Wl,-bE:ext/ruby.imp"
aix*) LDSHARED='/usr/ccs/bin/ld'
XLDFLAGS="-Wl,-bE:ruby.imp"
DLDFLAGS="-eInit_$(TARGET) -bI:$(ruby_inc)/ruby.imp -bM:SRE -T512 -H512 -lc"
rb_cv_dlopen=yes ;;
human*) DLDFLAGS=''
LDSHARED=''
LDFLAGS=''

35
ext/aix_mksym.rb Normal file
View file

@ -0,0 +1,35 @@
def uniq(data)
last=nil
data.delete_if do |name|
if last == name
TRUE
else
last = name
FALSE
end
end
end
def extract(nm, out)
data = nm.readlines.collect{|line|
line = line.split
case line[1]
when "B", "D"
line[0]
else
next
end
}.compact!.sort!
uniq(data)
exp = open(out, "w")
exp.printf "#!\n"
for line in data
exp.printf "%s\n", line
end
exp.close
nm.close
end
if older("../ruby.imp", "../miniruby")
extract(open("|/usr/ccs/bin/nm -p ../*.o"), "../ruby.imp")
end

View file

@ -1,7 +1,6 @@
#! /usr/local/bin/ruby
$".push 'mkmf.rb' #"
load '@top_srcdir@/lib/find.rb'
if ARGV[0] == 'static'
$force_static = TRUE
@ -31,6 +30,9 @@ if $topdir !~ "^/"
# get absolute path
$topdir = File.expand_path($topdir)
end
$ruby_inc = "@top_srcdir@"
load '@top_srcdir@/lib/find.rb'
## drive letter
if PLATFORM == "i386-os2_emx" then
@ -302,6 +304,7 @@ libdir = @libdir@
#pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)/@MAJOR@.@MINOR@
pkglibdir = $(libdir)/ruby/@MAJOR@.@MINOR@
archdir = $(pkglibdir)/@arch@
ruby_inc = #{$ruby_inc}
@SET_MAKE@
#### End of system configuration section. ####
@ -322,14 +325,15 @@ archdir = $(pkglibdir)/@arch@
mfile.printf "\n"
mfile.printf <<EOS
TARGET = #{target}.#{$static ? "a" : "@DLEXT@"}
TARGET = #{target}
DLLIB = $(TARGET).#{$static ? "a" : "@DLEXT@"}
INSTALL = #{$dots}@INSTALL@
INSTALL_DATA = @INSTALL_DATA@
binsuffix = @binsuffix@
all: $(TARGET)
all: $(DLLIB)
clean:; @rm -f *.o *.a *.so *.sl
@rm -f Makefile extconf.h conftest.*
@ -347,7 +351,7 @@ install:
EOS
if !$static
mfile.printf "\
$(INSTALL) $(TARGET) $(DESTDIR)$(archdir)/$(TARGET)
$(INSTALL) $(DLLIB) $(DESTDIR)$(archdir)/$(DLLIB)
"
end
install_rb(mfile)
@ -355,30 +359,30 @@ EOS
if $static
mfile.printf "\
$(TARGET): $(OBJS)
@AR@ cru $(TARGET) $(OBJS)
@-@RANLIB@ $(TARGET) 2> /dev/null || true
$(DLLIB): $(OBJS)
@AR@ cru $(DLLIB) $(OBJS)
@-@RANLIB@ $(DLLIB) 2> /dev/null || true
"
elsif "@DLEXT@" != "o"
mfile.printf "\
$(TARGET): $(OBJS)
$(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LIBS) $(LOCAL_LIBS)
$(DLLIB): $(OBJS)
$(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)
"
elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc")
if PLATFORM == "m68k-human"
mfile.printf "\
$(TARGET): $(OBJS)
ar cru $(TARGET) $(OBJS)
$(DLLIB): $(OBJS)
ar cru $(DLLIB) $(OBJS)
"
elsif PLATFORM =~ "-nextstep" || PLATFORM =~ "-openstep" || PLATFORM =~ "-rhapsody"
mfile.printf "\
$(TARGET): $(OBJS)
cc -r $(CFLAGS) -o $(TARGET) $(OBJS)
$(DLLIB): $(OBJS)
cc -r $(CFLAGS) -o $(DLLIB) $(OBJS)
"
else
mfile.printf "\
$(TARGET): $(OBJS)
ld $(DLDFLAGS) -r -o $(TARGET) $(OBJS)
$(DLLIB): $(OBJS)
ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)
"
end
end
@ -493,6 +497,9 @@ for d in Dir["#{$top_srcdir}/ext/*"]
print "cleaning ", d, "\n"
else
print "compiling ", d, "\n"
if PLATFORM =~ /ibm-aix/
load './aix_mksym.rb'
end
end
extmake(d)
end

View file

@ -247,11 +247,11 @@ class TkText<TkTextWin
private :_tag_bind_core
def tag_bind(tag, seq, cmd=Proc.new, args=nil)
_tag_bind_core('', tag, seq, cmd=Proc.new, args=nil)
_tag_bind_core('', tag, seq, cmd, args=nil)
end
def tag_bind_append(tag, seq, cmd=Proc.new, args=nil)
_tag_bind_core('+', tag, seq, cmd=Proc.new, args=nil)
_tag_bind_core('+', tag, seq, cmd, args=nil)
end
def tag_bindinfo(tag, context=nil)

View file

@ -60,6 +60,9 @@ Find.find("lib") do |f|
File.install f, dir, 0644, true
end
if PLATFORM =~ /ibm-aix/
File.install "ruby.imp", archdir, 0644, true
end
for f in Dir["*.h"]
File.install f, archdir, 0644, true
end

102
io.c
View file

@ -702,7 +702,7 @@ lineno_setter(val, id, var)
}
static VALUE
arg_set_lineno(argf, val)
argf_set_lineno(argf, val)
VALUE argf, val;
{
gets_lineno = NUM2INT(val);
@ -710,7 +710,7 @@ arg_set_lineno(argf, val)
}
static VALUE
arg_lineno()
argf_lineno()
{
return lineno;
}
@ -2065,6 +2065,16 @@ rb_io_s_new(argc, argv, klass)
return prep_stdio(rb_fdopen(NUM2INT(fnum), m), rb_io_mode_flags(m), klass);
}
static int binmode = 0;
static VALUE
argf_binmode()
{
rb_io_binmode(file);
binmode = 1;
return argf;
}
static int
next_argv()
{
@ -2153,6 +2163,7 @@ next_argv()
}
file = prep_stdio(fr, FMODE_READABLE, rb_cFile);
}
rb_io_binmode(file);
}
else {
init_p = 0;
@ -2741,13 +2752,13 @@ rb_io_s_readlines(argc, argv, io)
}
static VALUE
arg_tell()
argf_tell()
{
return rb_io_tell(file);
}
static VALUE
arg_seek(self, offset, ptrname)
argf_seek(self, offset, ptrname)
VALUE self, offset, ptrname;
{
if (!next_argv()) {
@ -2758,7 +2769,7 @@ arg_seek(self, offset, ptrname)
}
static VALUE
arg_set_pos(self, offset)
argf_set_pos(self, offset)
VALUE self, offset;
{
if (!next_argv()) {
@ -2769,25 +2780,25 @@ arg_set_pos(self, offset)
}
static VALUE
arg_rewind()
argf_rewind()
{
return rb_io_rewind(file);
}
static VALUE
arg_fileno()
argf_fileno()
{
return rb_io_fileno(file);
}
static VALUE
arg_to_io()
argf_to_io()
{
return file;
}
static VALUE
arg_read(argc, argv)
argf_read(argc, argv)
int argc;
VALUE *argv;
{
@ -2821,7 +2832,7 @@ arg_read(argc, argv)
}
static VALUE
arg_getc()
argf_getc()
{
VALUE byte;
@ -2838,7 +2849,7 @@ arg_getc()
}
static VALUE
arg_readchar()
argf_readchar()
{
VALUE c = rb_io_getc(file);
@ -2849,7 +2860,7 @@ arg_readchar()
}
static VALUE
arg_eof()
argf_eof()
{
if (init_p == 0 && !next_argv())
return Qtrue;
@ -2864,11 +2875,11 @@ static VALUE
rb_f_eof()
{
rb_warn("eof? is obsolete; use ARGF.eof? instead");
return arg_eof();
return argf_eof();
}
static VALUE
arg_each_line(argc, argv)
argf_each_line(argc, argv)
int argc;
VALUE *argv;
{
@ -2881,30 +2892,30 @@ arg_each_line(argc, argv)
}
static VALUE
arg_each_byte()
argf_each_byte()
{
VALUE byte;
while (!NIL_P(byte = arg_getc())) {
while (!NIL_P(byte = argf_getc())) {
rb_yield(byte);
}
return Qnil;
}
static VALUE
arg_filename()
argf_filename()
{
return filename;
}
static VALUE
arg_file()
argf_file()
{
return file;
}
static VALUE
arg_skip()
argf_skip()
{
if (next_p != -1) {
rb_io_close(file);
@ -2914,7 +2925,7 @@ arg_skip()
}
static VALUE
arg_close()
argf_close()
{
rb_io_close(file);
if (next_p != -1) {
@ -2925,7 +2936,7 @@ arg_close()
}
static VALUE
arg_closed()
argf_closed()
{
return rb_io_closed(file);
}
@ -3081,37 +3092,38 @@ Init_IO()
rb_define_readonly_variable("$<", &argf);
rb_define_global_const("ARGF", argf);
rb_define_singleton_method(argf, "fileno", arg_fileno, 0);
rb_define_singleton_method(argf, "to_i", arg_fileno, 0);
rb_define_singleton_method(argf, "to_io", arg_to_io, 0);
rb_define_singleton_method(argf, "each", arg_each_line, -1);
rb_define_singleton_method(argf, "each_line", arg_each_line, -1);
rb_define_singleton_method(argf, "each_byte", arg_each_byte, 0);
rb_define_singleton_method(argf, "fileno", argf_fileno, 0);
rb_define_singleton_method(argf, "to_i", argf_fileno, 0);
rb_define_singleton_method(argf, "to_io", argf_to_io, 0);
rb_define_singleton_method(argf, "each", argf_each_line, -1);
rb_define_singleton_method(argf, "each_line", argf_each_line, -1);
rb_define_singleton_method(argf, "each_byte", argf_each_byte, 0);
rb_define_singleton_method(argf, "read", arg_read, -1);
rb_define_singleton_method(argf, "read", argf_read, -1);
rb_define_singleton_method(argf, "readlines", rb_f_readlines, -1);
rb_define_singleton_method(argf, "to_a", rb_f_readlines, -1);
rb_define_singleton_method(argf, "gets", rb_f_gets, -1);
rb_define_singleton_method(argf, "readline", rb_f_readline, -1);
rb_define_singleton_method(argf, "getc", arg_getc, 0);
rb_define_singleton_method(argf, "readchar", arg_readchar, 0);
rb_define_singleton_method(argf, "tell", arg_tell, 0);
rb_define_singleton_method(argf, "seek", arg_seek, 2);
rb_define_singleton_method(argf, "rewind", arg_rewind, 0);
rb_define_singleton_method(argf, "pos", arg_tell, 0);
rb_define_singleton_method(argf, "pos=", arg_set_pos, 1);
rb_define_singleton_method(argf, "eof", arg_eof, 0);
rb_define_singleton_method(argf, "eof?", arg_eof, 0);
rb_define_singleton_method(argf, "getc", argf_getc, 0);
rb_define_singleton_method(argf, "readchar", argf_readchar, 0);
rb_define_singleton_method(argf, "tell", argf_tell, 0);
rb_define_singleton_method(argf, "seek", argf_seek, 2);
rb_define_singleton_method(argf, "rewind", argf_rewind, 0);
rb_define_singleton_method(argf, "pos", argf_tell, 0);
rb_define_singleton_method(argf, "pos=", argf_set_pos, 1);
rb_define_singleton_method(argf, "eof", argf_eof, 0);
rb_define_singleton_method(argf, "eof?", argf_eof, 0);
rb_define_singleton_method(argf, "binmode", argf_binmode, 0);
rb_define_singleton_method(argf, "to_s", arg_filename, 0);
rb_define_singleton_method(argf, "filename", arg_filename, 0);
rb_define_singleton_method(argf, "file", arg_file, 0);
rb_define_singleton_method(argf, "skip", arg_skip, 0);
rb_define_singleton_method(argf, "close", arg_close, 0);
rb_define_singleton_method(argf, "closed?", arg_closed, 0);
rb_define_singleton_method(argf, "to_s", argf_filename, 0);
rb_define_singleton_method(argf, "filename", argf_filename, 0);
rb_define_singleton_method(argf, "file", argf_file, 0);
rb_define_singleton_method(argf, "skip", argf_skip, 0);
rb_define_singleton_method(argf, "close", argf_close, 0);
rb_define_singleton_method(argf, "closed?", argf_closed, 0);
rb_define_singleton_method(argf, "lineno", arg_lineno, 0);
rb_define_singleton_method(argf, "lineno=", arg_set_lineno, 1);
rb_define_singleton_method(argf, "lineno", argf_lineno, 0);
rb_define_singleton_method(argf, "lineno=", argf_set_lineno, 1);
file = rb_stdin;
rb_global_variable(&file);

View file

@ -37,6 +37,7 @@ $libdir += "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
$archdir = $libdir+"/"+CONFIG["arch"]
$install = CONFIG["INSTALL_PROGRAM"]
$install_data = CONFIG["INSTALL_DATA"]
$ruby_inc = $archdir
if $install =~ %r!^[^\s/]+/! then
$install = CONFIG["srcdir"]+"/"+$install
$install_data = CONFIG["srcdir"]+"/"+$install_data
@ -291,7 +292,6 @@ hdrdir = #{$hdrdir}
CC = #{CONFIG["CC"]}
prefix = #{CONFIG["prefix"]}
CFLAGS = #{CONFIG["CCDLFLAGS"]} -I$(hdrdir) -I#{CONFIG["includedir"]} #{CFLAGS} #{$CFLAGS} #{$defs.join(" ")}
CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
@ -301,6 +301,7 @@ prefix = #{CONFIG["prefix"]}
exec_prefix = #{CONFIG["exec_prefix"]}
libdir = #{$libdir}
archdir = #{$archdir}
ruby_inc = #{$ruby_inc}
#### End of system configuration section. ####

View file

@ -63,7 +63,7 @@ File.foreach "config.status" do |$_|
end
print v_fast, v_others
print " CONFIG[\"compile_dir\"] = \"#{File.expand_path($0)}\"\n"
print " CONFIG[\"compile_dir\"] = \"#{File.expand_path(File.dirname($0))}\"\n"
print "end\n"
config.close
# vi:set sw=2:

4218
parse.c

File diff suppressed because it is too large Load diff

51
parse.y
View file

@ -54,8 +54,7 @@ static enum lex_state {
EXPR_MID, /* newline significant, +/- is a sign. */
EXPR_END, /* newline significant, +/- is a operator. */
EXPR_ARG, /* newline significant, +/- is a operator. */
EXPR_FNAME, /* ignore newline, +/- is a operator, no reserved words. */
EXPR_DOT, /* immediate after `.', no reserved words. */
EXPR_FNAME, /* ignore newline, no reserved words. */
EXPR_CLASS, /* immediate after `class', no here document. */
} lex_state;
@ -180,7 +179,7 @@ static void top_local_setup();
%type <node> array assoc_list assocs assoc undef_list backref
%type <node> block_var opt_block_var brace_block do_block lhs none
%type <node> mlhs mlhs_head mlhs_tail mlhs_basic mlhs_entry mlhs_item mlhs_node
%type <id> variable symbol operation operation2
%type <id> variable symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg
%type <num> f_arg
%token tUPLUS /* unary+ */
@ -420,13 +419,13 @@ command_call : operation call_args
$$ = new_fcall($1, $2);
fixpos($$, $2);
}
| primary '.' operation call_args
| primary '.' operation2 call_args
{
value_expr($1);
$$ = new_call($1, $3, $4);
fixpos($$, $1);
}
| primary tCOLON2 operation call_args
| primary tCOLON2 operation2 call_args
{
value_expr($1);
$$ = new_call($1, $3, $4);
@ -543,11 +542,6 @@ fname : tIDENTIFIER
lex_state = EXPR_END;
$$ = $1;
}
| reswords
{
lex_state = EXPR_END;
$$ = $<id>1;
}
undef_list : fname
{
@ -586,14 +580,6 @@ op : tDOT2 { $$ = tDOT2; }
| tASET { $$ = tASET; }
| '`' { $$ = '`'; }
reswords : k__LINE__ | k__FILE__ | klBEGIN | klEND
| kALIAS | kAND | kBEGIN | kBREAK | kCASE | kCLASS | kDEF
| kDEFINED | kDO | kELSE | kELSIF | kEND | kENSURE | kFALSE
| kFOR | kIF_MOD | kIN | kMODULE | kNEXT | kNIL | kNOT
| kOR | kREDO | kRESCUE | kRETRY | kRETURN | kSELF | kSUPER
| kTHEN | kTRUE | kUNDEF | kUNLESS_MOD | kUNTIL_MOD | kWHEN
| kWHILE_MOD | kYIELD
arg : lhs '=' arg
{
value_expr($3);
@ -1288,25 +1274,25 @@ method_call : operation '(' opt_call_args ')'
$$ = new_fcall($1, $3);
fixpos($$, $3);
}
| primary '.' operation '(' opt_call_args ')'
| primary '.' operation2 '(' opt_call_args ')'
{
value_expr($1);
$$ = new_call($1, $3, $5);
fixpos($$, $1);
}
| primary '.' operation
| primary '.' operation2
{
value_expr($1);
$$ = new_call($1, $3, 0);
fixpos($$, $1);
}
| primary tCOLON2 operation '(' opt_call_args ')'
| primary tCOLON2 operation2 '(' opt_call_args ')'
{
value_expr($1);
$$ = new_call($1, $3, $5);
fixpos($$, $1);
}
| primary tCOLON2 operation2
| primary tCOLON2 operation3
{
value_expr($1);
$$ = new_call($1, $3, 0);
@ -1370,6 +1356,7 @@ ensure : none
literal : numeric
| tSYMBEG symbol
{
lex_state = EXPR_END;
$$ = INT2FIX($2);
}
| tREGEXP
@ -1571,7 +1558,13 @@ operation : tIDENTIFIER
| tFID
operation2 : tIDENTIFIER
| tCONSTANT
| tFID
| op
operation3 : tIDENTIFIER
| tFID
| op
dot_or_colon : '.'
| tCOLON2
@ -2421,7 +2414,6 @@ yylex()
switch (lex_state) {
case EXPR_BEG:
case EXPR_FNAME:
case EXPR_DOT:
goto retry;
default:
break;
@ -2695,7 +2687,7 @@ yylex()
}
pushback(c);
if (!ISDIGIT(c)) {
lex_state = EXPR_DOT;
lex_state = EXPR_FNAME;
return '.';
}
c = '.';
@ -2854,7 +2846,7 @@ yylex()
lex_state = EXPR_BEG;
return tCOLON3;
}
lex_state = EXPR_DOT;
lex_state = EXPR_FNAME;
return tCOLON2;
}
pushback(c);
@ -3144,14 +3136,11 @@ yylex()
result = tIVAR;
break;
default:
if (lex_state != EXPR_DOT) {
if (lex_state != EXPR_FNAME) {
/* See if it is a reserved word. */
kw = rb_reserved_word(tok(), toklen());
if (kw) {
enum lex_state state = lex_state;
if (lex_state == EXPR_FNAME) {
yylval.id = rb_intern(kw->name);
}
lex_state = kw->state;
return kw->id[state != EXPR_BEG];
}
@ -3165,7 +3154,7 @@ yylex()
} else {
result = tIDENTIFIER;
if (lex_state == EXPR_FNAME) {
lex_state = EXPR_END;
/* lex_state = EXPR_END; */
if ((c = nextc()) == '=') {
tokadd(c);
}
@ -3175,7 +3164,7 @@ yylex()
}
}
if (lex_state == EXPR_BEG ||
lex_state == EXPR_DOT ||
lex_state == EXPR_FNAME ||
lex_state == EXPR_ARG){
lex_state = EXPR_ARG;
}

View file

@ -12,6 +12,9 @@
#include "ruby.h"
#include <ctype.h>
#include <math.h>
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
#ifndef atof
double strtod();
@ -562,6 +565,7 @@ rb_f_sprintf(argc, argv)
{
VALUE val = GETARG();
double fval;
int i, need = 6;
char fbuf[32];
switch (TYPE(val)) {
@ -583,8 +587,19 @@ rb_f_sprintf(argc, argv)
}
fmt_setup(fbuf, *p, flags, width, prec);
need = 0;
if (*p != 'e' && *p != 'E') {
i = INT_MIN;
frexp(fval, &i);
if (i > 0)
need = BIT_DIGITS(i);
}
need += (flags&FPREC) ? prec : 6;
if ((flags&FWIDTH) && need < width)
need = width;
need += 20;
CHECK(22);
CHECK(need);
sprintf(&buf[blen], fbuf, fval);
blen += strlen(&buf[blen]);
}

View file

@ -2186,7 +2186,7 @@ rb_f_chop()
VALUE str = rb_str_dup(uscore_get());
VALUE val = rb_str_chop_bang(str);
if (NIL_P(str)) return str;
if (NIL_P(val)) return str;
rb_lastline_set(val);
return val;
}
@ -2261,6 +2261,9 @@ rb_f_chomp(argc, argv)
{
VALUE str = rb_str_dup(uscore_get());
VALUE val = rb_str_chomp_bang(argc, argv, str);
if (NIL_P(val)) return str;
rb_lastline_set(val);
return val;
}