mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1.1b9_14
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
089d61b424
commit
e429f1c584
16 changed files with 152 additions and 47 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Wed Apr 22 16:52:37 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* experimental release 1.1b9_14.
|
||||||
|
|
||||||
|
* string.c (str_modify): check for embedded pointer reference.
|
||||||
|
|
||||||
|
* gc.c (obj_free): ditto.
|
||||||
|
|
||||||
|
* pack.c (pack_pack): p/P template to embed pointers.
|
||||||
|
|
||||||
|
Wed Apr 22 00:07:10 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
|
||||||
|
|
||||||
|
* array.c (ary_rindex): embarrassing typo.
|
||||||
|
|
||||||
Tue Apr 21 12:31:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Apr 21 12:31:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* experimental release 1.1b9_13.
|
* experimental release 1.1b9_13.
|
||||||
|
|
|
@ -10,7 +10,8 @@ YACC = @YACC@
|
||||||
PURIFY =
|
PURIFY =
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@ -I@srcdir@
|
prefix = @prefix@
|
||||||
|
CFLAGS = @CFLAGS@ -I@includedir@ -I@srcdir@
|
||||||
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
|
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
|
||||||
LIBS = @LIBS@ $(EXTLIBS)
|
LIBS = @LIBS@ $(EXTLIBS)
|
||||||
MISSING = @LIBOBJS@ @ALLOCA@
|
MISSING = @LIBOBJS@ @ALLOCA@
|
||||||
|
|
2
array.c
2
array.c
|
@ -416,7 +416,7 @@ ary_rindex(ary, val)
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
VALUE val;
|
VALUE val;
|
||||||
{
|
{
|
||||||
int i = i<RARRAY(ary)->len;
|
int i = RARRAY(ary)->len;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (rb_equal(RARRAY(ary)->ptr[i], val))
|
if (rb_equal(RARRAY(ary)->ptr[i], val))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require 'mkmf'
|
||||||
$CFLAGS="-I/usr/include/ncurses -I/usr/local/include/ncurses"
|
$CFLAGS="-I/usr/include/ncurses -I/usr/local/include/ncurses"
|
||||||
$LDFLAGS="-L/usr/local/lib"
|
$LDFLAGS="-L/usr/local/lib"
|
||||||
make=FALSE
|
make=FALSE
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require 'mkmf'
|
||||||
$LDFLAGS = "-L/usr/local/lib"
|
$LDFLAGS = "-L/usr/local/lib"
|
||||||
have_library("gdbm", "dbm_open") or have_library("dbm", "dbm_open")
|
have_library("gdbm", "dbm_open") or have_library("dbm", "dbm_open")
|
||||||
if have_func("dbm_open")
|
if have_func("dbm_open")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require 'mkmf'
|
||||||
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
|
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
|
||||||
a = have_func("getlogin")
|
a = have_func("getlogin")
|
||||||
b = have_func("getpwent")
|
b = have_func("getpwent")
|
||||||
|
|
|
@ -59,13 +59,11 @@ end
|
||||||
|
|
||||||
if PLATFORM == "m68k-human"
|
if PLATFORM == "m68k-human"
|
||||||
CFLAGS = "@CFLAGS@".gsub(/-c..-stack=[0-9]+ */, '')
|
CFLAGS = "@CFLAGS@".gsub(/-c..-stack=[0-9]+ */, '')
|
||||||
LINK = "@CC@ -o conftest -I#{$topdir} " + CFLAGS + " %s @LDFLAGS@ %s conftest.c @LIBS@ %s"
|
|
||||||
CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} " + CFLAGS + " %s conftest.c"
|
|
||||||
else
|
else
|
||||||
CFLAGS = "@CFLAGS@"
|
CFLAGS = "@CFLAGS@"
|
||||||
LINK = "@CC@ -o conftest -I#{$topdir} " + CFLAGS + " %s @LDFLAGS@ %s conftest.c %s"
|
|
||||||
CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} " + CFLAGS + " %s conftest.c"
|
|
||||||
end
|
end
|
||||||
|
LINK = "@CC@ -o conftest -I#{$topdir} " + CFLAGS + " %s @LDFLAGS@ %s conftest.c @LIBS@ %s"
|
||||||
|
CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} " + CFLAGS + " %s conftest.c"
|
||||||
|
|
||||||
if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM
|
if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM
|
||||||
$null = open("nul", "w")
|
$null = open("nul", "w")
|
||||||
|
@ -76,6 +74,9 @@ end
|
||||||
$orgerr = $stderr.dup
|
$orgerr = $stderr.dup
|
||||||
$orgout = $stdout.dup
|
$orgout = $stdout.dup
|
||||||
def xsystem command
|
def xsystem command
|
||||||
|
if $DEBUG
|
||||||
|
return system(command)
|
||||||
|
end
|
||||||
$stderr.reopen($null)
|
$stderr.reopen($null)
|
||||||
$stdout.reopen($null)
|
$stdout.reopen($null)
|
||||||
r = system(command)
|
r = system(command)
|
||||||
|
@ -238,7 +239,8 @@ hdrdir = #{$topdir}
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
|
||||||
CFLAGS = %s -I#{$topdir} %s #$CFLAGS %s
|
prefix = @prefix@
|
||||||
|
CFLAGS = %s -I@includedir@ -I#{$topdir} %s #$CFLAGS %s
|
||||||
DLDFLAGS = @DLDFLAGS@ #$LDFLAGS
|
DLDFLAGS = @DLDFLAGS@ #$LDFLAGS
|
||||||
LDSHARED = @LDSHARED@
|
LDSHARED = @LDSHARED@
|
||||||
", if $static then "" else "@CCDLFLAGS@" end, CFLAGS, $defs.join(" ")
|
", if $static then "" else "@CCDLFLAGS@" end, CFLAGS, $defs.join(" ")
|
||||||
|
@ -274,6 +276,7 @@ libdir = @libdir@/$(RUBY_INSTALL_NAME)/@arch@
|
||||||
TARGET = %s.%s
|
TARGET = %s.%s
|
||||||
|
|
||||||
INSTALL = %s@INSTALL@
|
INSTALL = %s@INSTALL@
|
||||||
|
INSTALL_DATA = %s@INSTALL_DATA@
|
||||||
|
|
||||||
binsuffix = @binsuffix@
|
binsuffix = @binsuffix@
|
||||||
|
|
||||||
|
@ -285,7 +288,7 @@ clean:; @rm -f *.o *.so *.sl
|
||||||
|
|
||||||
realclean: clean
|
realclean: clean
|
||||||
", target,
|
", target,
|
||||||
if $static then "o" else "@DLEXT@" end, $dots
|
if $static then "o" else "@DLEXT@" end, $dots, $dots
|
||||||
|
|
||||||
mfile.printf "\
|
mfile.printf "\
|
||||||
|
|
||||||
|
@ -298,7 +301,7 @@ install:
|
||||||
"
|
"
|
||||||
end
|
end
|
||||||
for rb in Dir["lib/*.rb"]
|
for rb in Dir["lib/*.rb"]
|
||||||
mfile.printf "\t$(INSTALL) %s @libdir@/$(RUBY_INSTALL_NAME)\n", rb
|
mfile.printf "\t$(INSTALL_DATA) %s @libdir@/$(RUBY_INSTALL_NAME)\n", rb
|
||||||
end
|
end
|
||||||
mfile.printf "\n"
|
mfile.printf "\n"
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require 'mkmf'
|
||||||
$LDFLAGS = "-L/usr/local/lib"
|
$LDFLAGS = "-L/usr/local/lib"
|
||||||
case PLATFORM
|
case PLATFORM
|
||||||
when /mswin32/
|
when /mswin32/
|
||||||
|
|
9
gc.c
9
gc.c
|
@ -418,6 +418,11 @@ gc_mark(ptr)
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case NODE_METHOD: /* 2 */
|
case NODE_METHOD: /* 2 */
|
||||||
case NODE_NOT:
|
case NODE_NOT:
|
||||||
|
case NODE_GASGN:
|
||||||
|
case NODE_LASGN:
|
||||||
|
case NODE_DASGN:
|
||||||
|
case NODE_IASGN:
|
||||||
|
case NODE_CASGN:
|
||||||
obj = RANY(obj->as.node.u2.node);
|
obj = RANY(obj->as.node.u2.node);
|
||||||
goto Top;
|
goto Top;
|
||||||
|
|
||||||
|
@ -652,7 +657,9 @@ obj_free(obj)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
if (!RANY(obj)->as.string.orig) free(RANY(obj)->as.string.ptr);
|
#define STR_NO_ORIG FL_USER3 /* copied from string.c */
|
||||||
|
if (!RANY(obj)->as.string.orig && FL_TEST(obj, STR_NO_ORIG))
|
||||||
|
free(RANY(obj)->as.string.ptr);
|
||||||
break;
|
break;
|
||||||
case T_ARRAY:
|
case T_ARRAY:
|
||||||
if (RANY(obj)->as.array.ptr) free(RANY(obj)->as.array.ptr);
|
if (RANY(obj)->as.array.ptr) free(RANY(obj)->as.array.ptr);
|
||||||
|
|
1
intern.h
1
intern.h
|
@ -187,7 +187,6 @@ VALUE rb_inspect _((VALUE));
|
||||||
VALUE obj_is_instance_of _((VALUE, VALUE));
|
VALUE obj_is_instance_of _((VALUE, VALUE));
|
||||||
VALUE obj_is_kind_of _((VALUE, VALUE));
|
VALUE obj_is_kind_of _((VALUE, VALUE));
|
||||||
VALUE obj_alloc _((VALUE));
|
VALUE obj_alloc _((VALUE));
|
||||||
int rb_obj2int _((VALUE));
|
|
||||||
VALUE rb_Integer _((VALUE));
|
VALUE rb_Integer _((VALUE));
|
||||||
VALUE rb_Float _((VALUE));
|
VALUE rb_Float _((VALUE));
|
||||||
VALUE rb_String _((VALUE));
|
VALUE rb_String _((VALUE));
|
||||||
|
|
41
lib/mkmf.rb
41
lib/mkmf.rb
|
@ -36,6 +36,7 @@ $install = CONFIG["INSTALL_PROGRAM"]
|
||||||
$install_data = CONFIG["INSTALL_DATA"]
|
$install_data = CONFIG["INSTALL_DATA"]
|
||||||
if $install !~ /^\// then
|
if $install !~ /^\// then
|
||||||
$install = CONFIG["srcdir"]+"/"+$install
|
$install = CONFIG["srcdir"]+"/"+$install
|
||||||
|
$install_data = CONFIG["srcdir"]+"/"+$install_data
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.exist? $archdir + "/ruby.h"
|
if File.exist? $archdir + "/ruby.h"
|
||||||
|
@ -47,25 +48,38 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
nul = "> /dev/null"
|
|
||||||
|
|
||||||
CFLAGS = CONFIG["CFLAGS"]
|
CFLAGS = CONFIG["CFLAGS"]
|
||||||
if PLATFORM == "m68k-human"
|
if PLATFORM == "m68k-human"
|
||||||
nul = "> nul"
|
|
||||||
CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
|
CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
|
||||||
end
|
end
|
||||||
if $DEBUG
|
if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM
|
||||||
nul = ""
|
$null = open("nul", "w")
|
||||||
|
else
|
||||||
|
$null = open("/dev/null", "w")
|
||||||
|
end
|
||||||
|
LINK = "#{CONFIG['CC']} -o conftest } -I#{CONFIG['includedir']} -I#{$srcdir} #{CFLAGS} %s #{CONFIG['LDFLAGS']} %s conftest.c #{CONFIG['LIBS']} %s"
|
||||||
|
CPP = "#{CONFIG['CPP']} -E -I#{CONFIG['includedir']} -I#{$srcdir} #{CFLAGS} %s conftest.c"
|
||||||
|
|
||||||
|
$orgerr = $stderr.dup
|
||||||
|
$orgout = $stdout.dup
|
||||||
|
def xsystem command
|
||||||
|
if $DEBUG
|
||||||
|
return system(command)
|
||||||
|
end
|
||||||
|
$stderr.reopen($null)
|
||||||
|
$stdout.reopen($null)
|
||||||
|
r = system(command)
|
||||||
|
$stderr.reopen($orgerr)
|
||||||
|
$stdout.reopen($orgout)
|
||||||
|
return r
|
||||||
end
|
end
|
||||||
LINK = CONFIG["CC"]+" -o conftest -I#{$srcdir} " + CFLAGS + " %s " + CONFIG["LDFLAGS"] + " %s conftest.c " + CONFIG["LIBS"] + "%s " + nul + " 2>&1"
|
|
||||||
CPP = CONFIG["CPP"] + " -E -I#{$srcdir} " + CFLAGS + " %s conftest.c " + nul + " 2>&1"
|
|
||||||
|
|
||||||
def try_link(libs)
|
def try_link(libs)
|
||||||
system(format(LINK, $CFLAGS, $LDFLAGS, libs))
|
xsystem(format(LINK, $CFLAGS, $LDFLAGS, libs))
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_cpp
|
def try_cpp
|
||||||
system(format(CPP, $CFLAGS))
|
xsystem(format(CPP, $CFLAGS))
|
||||||
end
|
end
|
||||||
|
|
||||||
def have_library(lib, func)
|
def have_library(lib, func)
|
||||||
|
@ -241,7 +255,8 @@ hdrdir = #{$hdrdir}
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
CFLAGS = #{CONFIG["CCDLFLAGS"]} -I#{$hdrdir} #{CFLAGS} #{$CFLAGS} #{$defs.join(" ")}
|
prefix = #{CONFIG["prefix"]}
|
||||||
|
CFLAGS = #{CONFIG["CCDLFLAGS"]} -I#{CONFIG["includedir"]} -I#{$hdrdir} #{CFLAGS} #{$CFLAGS} #{$defs.join(" ")}
|
||||||
DLDFLAGS = #{CONFIG["DLDFLAGS"]} #{$LDFLAGS}
|
DLDFLAGS = #{CONFIG["DLDFLAGS"]} #{$LDFLAGS}
|
||||||
LDSHARED = #{CONFIG["LDSHARED"]}
|
LDSHARED = #{CONFIG["LDSHARED"]}
|
||||||
|
|
||||||
|
@ -258,6 +273,7 @@ OBJS = #{$objs}
|
||||||
TARGET = #{target}.#{CONFIG["DLEXT"]}
|
TARGET = #{target}.#{CONFIG["DLEXT"]}
|
||||||
|
|
||||||
INSTALL = #{$install}
|
INSTALL = #{$install}
|
||||||
|
INSTALL_DATA = #{$install_data}
|
||||||
|
|
||||||
binsuffix = #{CONFIG["binsuffix"]}
|
binsuffix = #{CONFIG["binsuffix"]}
|
||||||
|
|
||||||
|
@ -276,7 +292,7 @@ $(libdir)/$(TARGET): $(TARGET)
|
||||||
$(INSTALL) $(TARGET) $(libdir)/$(TARGET)
|
$(INSTALL) $(TARGET) $(libdir)/$(TARGET)
|
||||||
EOMF
|
EOMF
|
||||||
for rb in Dir["lib/*.rb"]
|
for rb in Dir["lib/*.rb"]
|
||||||
mfile.printf "\t$(INSTALL) %s %s\n", rb, $libdir
|
mfile.printf "\t$(INSTALL_DATA) %s %s\n", rb, $libdir
|
||||||
end
|
end
|
||||||
mfile.printf "\n"
|
mfile.printf "\n"
|
||||||
|
|
||||||
|
@ -335,9 +351,8 @@ EOMF
|
||||||
end
|
end
|
||||||
|
|
||||||
$local_libs = nil
|
$local_libs = nil
|
||||||
$libs = nil
|
$libs = PLATFORM =~ /cygwin32/ ? nil : "-lc"
|
||||||
$objs = nil
|
$objs = nil
|
||||||
$CFLAGS = nil
|
$CFLAGS = nil
|
||||||
$LDFLAGS = nil
|
$LDFLAGS = nil
|
||||||
$defs = []
|
$defs = []
|
||||||
|
|
||||||
|
|
8
object.c
8
object.c
|
@ -743,14 +743,6 @@ rb_Integer(val)
|
||||||
return f_integer(Qnil, val);
|
return f_integer(Qnil, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
rb_obj2int(obj)
|
|
||||||
VALUE obj;
|
|
||||||
{
|
|
||||||
VALUE i = f_integer(Qnil, obj);
|
|
||||||
return NUM2INT(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
to_flo(val)
|
to_flo(val)
|
||||||
VALUE val;
|
VALUE val;
|
||||||
|
|
58
pack.c
58
pack.c
|
@ -83,6 +83,18 @@ static char *toofew = "too few arguments";
|
||||||
|
|
||||||
static void encodes();
|
static void encodes();
|
||||||
|
|
||||||
|
static void
|
||||||
|
pack_add_ptr(str, add)
|
||||||
|
VALUE str, add;
|
||||||
|
{
|
||||||
|
#define STR_NO_ORIG FL_USER3 /* copied from string.c */
|
||||||
|
if (!RSTRING(str)->orig) {
|
||||||
|
RSTRING(str)->orig = ary_new();
|
||||||
|
FL_SET(str, STR_NO_ORIG);
|
||||||
|
}
|
||||||
|
ary_push(RSTRING(str)->orig, add);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
pack_pack(ary, fmt)
|
pack_pack(ary, fmt)
|
||||||
VALUE ary, fmt;
|
VALUE ary, fmt;
|
||||||
|
@ -463,6 +475,22 @@ pack_pack(ary, fmt)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
len = 1;
|
||||||
|
/* FALL THROUGH */
|
||||||
|
case 'p':
|
||||||
|
while (len-- > 0) {
|
||||||
|
char *t;
|
||||||
|
from = NEXTFROM;
|
||||||
|
if (NIL_P(from)) t = "";
|
||||||
|
else {
|
||||||
|
t = STR2CSTR(from);
|
||||||
|
pack_add_ptr(res, from);
|
||||||
|
}
|
||||||
|
str_cat(res, (char*)&t, sizeof(char*));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -926,6 +954,36 @@ pack_unpack(str, fmt)
|
||||||
s += len;
|
s += len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
if (sizeof(char *) <= send - s) {
|
||||||
|
char *t;
|
||||||
|
VALUE str = str_new(0, 0);
|
||||||
|
memcpy(&t, s, sizeof(char *));
|
||||||
|
s += sizeof(char *);
|
||||||
|
if (t)
|
||||||
|
str_cat(str, t, len);
|
||||||
|
ary_push(ary, str);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
if (len > (send - s) / sizeof(char *))
|
||||||
|
len = (send - s) / sizeof(char *);
|
||||||
|
while (len-- > 0) {
|
||||||
|
if (send - s < sizeof(char *))
|
||||||
|
break;
|
||||||
|
else {
|
||||||
|
char *t;
|
||||||
|
VALUE str = str_new(0, 0);
|
||||||
|
memcpy(&t, s, sizeof(char *));
|
||||||
|
s += sizeof(char *);
|
||||||
|
if (t)
|
||||||
|
str_cat(str, t, strlen(t));
|
||||||
|
ary_push(ary, str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
17
string.c
17
string.c
|
@ -28,6 +28,7 @@ VALUE cString;
|
||||||
|
|
||||||
#define STR_FREEZE FL_USER1
|
#define STR_FREEZE FL_USER1
|
||||||
#define STR_TAINT FL_USER2
|
#define STR_TAINT FL_USER2
|
||||||
|
#define STR_NO_ORIG FL_USER3
|
||||||
void reg_prepare_re _((VALUE));
|
void reg_prepare_re _((VALUE));
|
||||||
void kcode_reset_option _((void));
|
void kcode_reset_option _((void));
|
||||||
|
|
||||||
|
@ -84,12 +85,12 @@ VALUE
|
||||||
str_new4(orig)
|
str_new4(orig)
|
||||||
VALUE orig;
|
VALUE orig;
|
||||||
{
|
{
|
||||||
if (RSTRING(orig)->orig) {
|
if (FL_TEST(orig, STR_FREEZE)) {
|
||||||
return str_freeze(RSTRING(orig)->orig);
|
|
||||||
}
|
|
||||||
else if (FL_TEST(orig, STR_FREEZE)) {
|
|
||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
else if (RSTRING(orig)->orig && !FL_TEST(orig, STR_NO_ORIG)) {
|
||||||
|
return str_freeze(RSTRING(orig)->orig);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
NEWOBJ(str, struct RString);
|
NEWOBJ(str, struct RString);
|
||||||
OBJSETUP(str, cString, T_STRING);
|
OBJSETUP(str, cString, T_STRING);
|
||||||
|
@ -110,7 +111,7 @@ str_assign(str, str2)
|
||||||
VALUE str, str2;
|
VALUE str, str2;
|
||||||
{
|
{
|
||||||
if (NIL_P(str2) || str == str2) return;
|
if (NIL_P(str2) || str == str2) return;
|
||||||
if (!RSTRING(str)->orig && RSTRING(str)->ptr)
|
if ((!RSTRING(str)->orig||FL_TEST(str, STR_NO_ORIG)) && RSTRING(str)->ptr)
|
||||||
free(RSTRING(str)->ptr);
|
free(RSTRING(str)->ptr);
|
||||||
RSTRING(str)->ptr = RSTRING(str2)->ptr;
|
RSTRING(str)->ptr = RSTRING(str2)->ptr;
|
||||||
RSTRING(str)->len = RSTRING(str2)->len;
|
RSTRING(str)->len = RSTRING(str2)->len;
|
||||||
|
@ -143,7 +144,7 @@ str_clone(orig)
|
||||||
{
|
{
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
|
||||||
if (RSTRING(orig)->orig)
|
if (RSTRING(orig)->orig && !FL_TEST(orig, STR_NO_ORIG))
|
||||||
str = str_new3(RSTRING(orig)->orig);
|
str = str_new3(RSTRING(orig)->orig);
|
||||||
else
|
else
|
||||||
str = str_new(RSTRING(orig)->ptr, RSTRING(orig)->len);
|
str = str_new(RSTRING(orig)->ptr, RSTRING(orig)->len);
|
||||||
|
@ -336,7 +337,7 @@ str_modify(str)
|
||||||
}
|
}
|
||||||
if (FL_TEST(str, STR_FREEZE))
|
if (FL_TEST(str, STR_FREEZE))
|
||||||
TypeError("can't modify frozen string");
|
TypeError("can't modify frozen string");
|
||||||
if (!RSTRING(str)->orig) return;
|
if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return;
|
||||||
ptr = RSTRING(str)->ptr;
|
ptr = RSTRING(str)->ptr;
|
||||||
RSTRING(str)->ptr = ALLOC_N(char, RSTRING(str)->len+1);
|
RSTRING(str)->ptr = ALLOC_N(char, RSTRING(str)->len+1);
|
||||||
if (RSTRING(str)->ptr) {
|
if (RSTRING(str)->ptr) {
|
||||||
|
@ -367,7 +368,7 @@ VALUE
|
||||||
str_dup_frozen(str)
|
str_dup_frozen(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
if (RSTRING(str)->orig) {
|
if (RSTRING(str)->orig && !FL_TEST(str, STR_NO_ORIG)) {
|
||||||
return str_freeze(RSTRING(str)->orig);
|
return str_freeze(RSTRING(str)->orig);
|
||||||
}
|
}
|
||||||
if (FL_TEST(str, STR_FREEZE))
|
if (FL_TEST(str, STR_FREEZE))
|
||||||
|
|
21
time.c
21
time.c
|
@ -150,6 +150,17 @@ static char *months [12] = {
|
||||||
"jul", "aug", "sep", "oct", "nov", "dec",
|
"jul", "aug", "sep", "oct", "nov", "dec",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
obj2int(obj)
|
||||||
|
VALUE obj;
|
||||||
|
{
|
||||||
|
if (TYPE(obj) == T_STRING) {
|
||||||
|
obj = str2inum(RSTRING(obj)->ptr, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NUM2INT(obj);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
time_arg(argc, argv, args)
|
time_arg(argc, argv, args)
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -171,7 +182,7 @@ time_arg(argc, argv, args)
|
||||||
rb_scan_args(argc, argv, "15", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5]);
|
rb_scan_args(argc, argv, "15", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
args[0] = rb_obj2int(v[0]);
|
args[0] = obj2int(v[0]);
|
||||||
if (args[0] < 70) args[0] += 100;
|
if (args[0] < 70) args[0] += 100;
|
||||||
if (args[0] > 1900) args[0] -= 1900;
|
if (args[0] > 1900) args[0] -= 1900;
|
||||||
if (NIL_P(v[1])) {
|
if (NIL_P(v[1])) {
|
||||||
|
@ -189,25 +200,25 @@ time_arg(argc, argv, args)
|
||||||
char c = RSTRING(v[1])->ptr[0];
|
char c = RSTRING(v[1])->ptr[0];
|
||||||
|
|
||||||
if ('0' <= c && c <= '9') {
|
if ('0' <= c && c <= '9') {
|
||||||
args[1] = rb_obj2int(v[1])-1;
|
args[1] = obj2int(v[1])-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args[1] = rb_obj2int(v[1]) - 1;
|
args[1] = obj2int(v[1]) - 1;
|
||||||
}
|
}
|
||||||
if (NIL_P(v[2])) {
|
if (NIL_P(v[2])) {
|
||||||
args[2] = 1;
|
args[2] = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args[2] = rb_obj2int(v[2]);
|
args[2] = obj2int(v[2]);
|
||||||
}
|
}
|
||||||
for (i=3;i<6;i++) {
|
for (i=3;i<6;i++) {
|
||||||
if (NIL_P(v[i])) {
|
if (NIL_P(v[i])) {
|
||||||
args[i] = 0;
|
args[i] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
args[i] = rb_obj2int(v[i]);
|
args[i] = obj2int(v[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define RUBY_VERSION "1.1b9_13"
|
#define RUBY_VERSION "1.1b9_14"
|
||||||
#define VERSION_DATE "98/04/21"
|
#define VERSION_DATE "98/04/22"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue