mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
19991201
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40517ecac8
commit
a3f29338ad
13 changed files with 336 additions and 108 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
Wed Dec 1 09:47:33 1999 Kazunori NISHI <kazunori@swlab.csce.kyushu-u.ac.jp>
|
||||
|
||||
* string.c (rb_str_split_method): should increment end too.
|
||||
|
||||
Tue Nov 30 18:00:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* marshal.c: MARSHAL_MINOR incremented; format version is 4.2.
|
||||
|
||||
* marshal.c (w_object): distinguish class and module.
|
||||
|
||||
* marshal.c (w_object): save hash's default value.
|
||||
|
||||
* marshal.c (r_object): restore hash's default value.
|
||||
|
||||
Tue Nov 30 01:46:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* re.c (rb_reg_source): generated source string must be tainted if
|
||||
regex is tainted.
|
||||
|
||||
* file.c (rb_file_s_basename): basename should not be tainted
|
||||
unless the original path is tainted.
|
||||
|
||||
* file.c (rb_file_s_dirname): ditto.
|
||||
|
||||
Mon Nov 29 20:42:13 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* file.c (stat_new): Struct::Stat -> File::Stat; Stat is no longer
|
||||
a Struct.
|
||||
|
||||
Mon Nov 29 15:28:52 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* variable.c (rb_path2class): evaluated value from path should be
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -20,7 +20,7 @@ typedef unsigned short USHORT;
|
|||
#define BIGRAD (1L << BITSPERDIG)
|
||||
#define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short)))
|
||||
#define BIGUP(x) ((unsigned long)(x) << BITSPERDIG)
|
||||
#define BIGDN(x) (((x)<0) ? ~((~(x))>>BITSPERDIG) : (x)>>BITSPERDIG)
|
||||
#define BIGDN(x) RSHIFT(x,BITSPERDIG)
|
||||
#define BIGLO(x) ((USHORT)((x) & (BIGRAD-1)))
|
||||
|
||||
static VALUE
|
||||
|
|
1
error.c
1
error.c
|
@ -325,6 +325,7 @@ exc_to_s(exc)
|
|||
VALUE mesg = rb_iv_get(exc, "mesg");
|
||||
|
||||
if (NIL_P(mesg)) return rb_class_path(CLASS_OF(exc));
|
||||
if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
|
||||
return mesg;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ class TkEntry<TkLabel
|
|||
def create_self
|
||||
tk_call 'entry', @path
|
||||
end
|
||||
def scrollcommand(cmd)
|
||||
configure 'scrollcommand', cmd
|
||||
def xscrollcommand(cmd=Proc.new)
|
||||
configure_cmd 'xscrollcommand', cmd
|
||||
end
|
||||
|
||||
def delete(s, e=None)
|
||||
|
@ -45,7 +45,7 @@ class TkEntry<TkLabel
|
|||
tk_send 'selection', 'adjust', index
|
||||
end
|
||||
def selection_clear
|
||||
tk_send 'selection', 'clear', 'end'
|
||||
tk_send 'selection', 'clear'
|
||||
end
|
||||
def selection_from(index)
|
||||
tk_send 'selection', 'from', index
|
||||
|
|
282
file.c
282
file.c
|
@ -70,7 +70,7 @@ char *strrchr _((const char*,const char));
|
|||
|
||||
VALUE rb_cFile;
|
||||
VALUE rb_mFileTest;
|
||||
static VALUE sStat;
|
||||
static VALUE rb_cStat;
|
||||
|
||||
static int
|
||||
apply2files(func, vargs, arg)
|
||||
|
@ -118,33 +118,139 @@ static VALUE
|
|||
stat_new(st)
|
||||
struct stat *st;
|
||||
{
|
||||
struct stat *nst;
|
||||
if (!st) rb_bug("stat_new() called with bad value");
|
||||
return rb_struct_new(sStat,
|
||||
INT2FIX((int)st->st_dev),
|
||||
INT2FIX((int)st->st_ino),
|
||||
INT2FIX((int)st->st_mode),
|
||||
INT2FIX((int)st->st_nlink),
|
||||
INT2FIX((int)st->st_uid),
|
||||
INT2FIX((int)st->st_gid),
|
||||
|
||||
nst = ALLOC(struct stat);
|
||||
*nst = *st;
|
||||
return Data_Wrap_Struct(rb_cStat, NULL, free, nst);
|
||||
}
|
||||
|
||||
static struct stat*
|
||||
get_stat(self)
|
||||
VALUE self;
|
||||
{
|
||||
struct stat* st;
|
||||
Data_Get_Struct(self, struct stat, st);
|
||||
if (!st) rb_bug("collapsed File::Stat");
|
||||
return st;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_cmp(self, other)
|
||||
VALUE self, other;
|
||||
{
|
||||
time_t t1 = get_stat(self)->st_mtime;
|
||||
time_t t2 = get_stat(other)->st_mtime;
|
||||
if (t1 == t2)
|
||||
return INT2FIX(0);
|
||||
else if (t1 < t2)
|
||||
return INT2FIX(-1);
|
||||
else
|
||||
return INT2FIX(1);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_dev(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_dev);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_ino(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_ino);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_mode(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_mode);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_nlink(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_nlink);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_uid(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_uid);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_gid(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_gid);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_rdev(self)
|
||||
VALUE self;
|
||||
{
|
||||
#ifdef HAVE_ST_RDEV
|
||||
INT2FIX((int)st->st_rdev),
|
||||
return INT2FIX((int)get_stat(self)->st_rdev);
|
||||
#else
|
||||
INT2FIX(0),
|
||||
return INT2FIX(0);
|
||||
#endif
|
||||
INT2FIX((int)st->st_size),
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_size(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX((int)get_stat(self)->st_size);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_blksize(self)
|
||||
VALUE self;
|
||||
{
|
||||
#ifdef HAVE_ST_BLKSIZE
|
||||
INT2FIX((int)st->st_blksize),
|
||||
return INT2FIX((int)get_stat(self)->st_blksize);
|
||||
#else
|
||||
INT2FIX(0),
|
||||
return INT2FIX(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_blocks(self)
|
||||
VALUE self;
|
||||
{
|
||||
#ifdef HAVE_ST_BLOCKS
|
||||
INT2FIX((int)st->st_blocks),
|
||||
return INT2FIX((int)get_stat(self)->st_blocks);
|
||||
#else
|
||||
INT2FIX(0),
|
||||
return INT2FIX(0);
|
||||
#endif
|
||||
rb_time_new(st->st_atime, 0),
|
||||
rb_time_new(st->st_mtime, 0),
|
||||
rb_time_new(st->st_ctime, 0));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_atime(self)
|
||||
VALUE self;
|
||||
{
|
||||
return rb_time_new(get_stat(self)->st_atime, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_mtime(self)
|
||||
VALUE self;
|
||||
{
|
||||
return rb_time_new(get_stat(self)->st_mtime, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_ctime(self)
|
||||
VALUE self;
|
||||
{
|
||||
return rb_time_new(get_stat(self)->st_ctime, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1211,7 +1317,7 @@ rb_file_s_basename(argc, argv)
|
|||
int argc;
|
||||
VALUE *argv;
|
||||
{
|
||||
VALUE fname, fext;
|
||||
VALUE fname, fext, basename;
|
||||
char *name, *p, *ext;
|
||||
int f;
|
||||
|
||||
|
@ -1232,7 +1338,9 @@ rb_file_s_basename(argc, argv)
|
|||
f = rmext(p, ext);
|
||||
if (f) return rb_str_new(p, f);
|
||||
}
|
||||
return rb_tainted_str_new2(p);
|
||||
basename = rb_str_new2(p);
|
||||
if (OBJ_TAINTED(fname)) OBJ_TAINT(basename);
|
||||
return basename;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1240,6 +1348,7 @@ rb_file_s_dirname(obj, fname)
|
|||
VALUE obj, fname;
|
||||
{
|
||||
char *name, *p;
|
||||
VALUE dirname;
|
||||
|
||||
name = STR2CSTR(fname);
|
||||
p = strrchr(name, '/');
|
||||
|
@ -1248,7 +1357,9 @@ rb_file_s_dirname(obj, fname)
|
|||
}
|
||||
if (p == name)
|
||||
p++;
|
||||
return rb_tainted_str_new(name, p - name);
|
||||
dirname = rb_str_new(name, p - name);
|
||||
if (OBJ_TAINTED(fname)) OBJ_TAINT(dirname);
|
||||
return dirname;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1549,25 +1660,18 @@ rb_f_test(argc, argv)
|
|||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
static ID rb_st_mode;
|
||||
static ID rb_st_size;
|
||||
static ID rb_st_uid;
|
||||
static ID rb_st_gid;
|
||||
|
||||
#define ST_MODE(obj) FIX2INT(rb_funcall3((obj), rb_st_mode, 0, 0))
|
||||
|
||||
static VALUE
|
||||
rb_stat_ftype(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
return rb_file_ftype(ST_MODE(obj));
|
||||
return rb_file_ftype(get_stat(obj)->st_mode);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_d(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (S_ISDIR(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISDIR(get_stat(obj)->st_mode)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1576,7 +1680,7 @@ rb_stat_p(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_IFIFO
|
||||
if (S_ISFIFO(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISFIFO(get_stat(obj)->st_mode)) return Qtrue;
|
||||
|
||||
#endif
|
||||
return Qfalse;
|
||||
|
@ -1587,7 +1691,7 @@ rb_stat_l(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_ISLNK
|
||||
if (S_ISLNK(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISLNK(get_stat(obj)->st_mode)) return Qtrue;
|
||||
|
||||
#endif
|
||||
return Qfalse;
|
||||
|
@ -1598,7 +1702,7 @@ rb_stat_S(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_ISSOCK
|
||||
if (S_ISSOCK(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISSOCK(get_stat(obj)->st_mode)) return Qtrue;
|
||||
|
||||
#endif
|
||||
return Qfalse;
|
||||
|
@ -1609,7 +1713,7 @@ rb_stat_b(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_ISBLK
|
||||
if (S_ISBLK(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISBLK(get_stat(obj)->st_mode)) return Qtrue;
|
||||
|
||||
#endif
|
||||
return Qfalse;
|
||||
|
@ -1619,7 +1723,7 @@ static VALUE
|
|||
rb_stat_c(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (S_ISBLK(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISBLK(get_stat(obj)->st_mode)) return Qtrue;
|
||||
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -1628,7 +1732,7 @@ static VALUE
|
|||
rb_stat_owned(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (FIX2INT(rb_funcall3(obj, rb_st_uid, 0, 0)) == geteuid()) return Qtrue;
|
||||
if (get_stat(obj)->st_uid == geteuid()) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1636,7 +1740,7 @@ static VALUE
|
|||
rb_stat_rowned(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (FIX2INT(rb_funcall3(obj, rb_st_uid, 0, 0)) == getuid()) return Qtrue;
|
||||
if (get_stat(obj)->st_uid == getuid()) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1645,7 +1749,7 @@ rb_stat_grpowned(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifndef NT
|
||||
if (FIX2INT(rb_funcall3(obj, rb_st_gid, 0, 0)) == getegid()) return Qtrue;
|
||||
if (get_stat(obj)->st_gid == getegid()) return Qtrue;
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -1654,7 +1758,7 @@ static VALUE
|
|||
rb_stat_r(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_owned(obj))
|
||||
|
@ -1674,14 +1778,14 @@ static VALUE
|
|||
rb_stat_R(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_rowned(obj))
|
||||
return mode & S_IRUSR ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IRGRP
|
||||
if (group_member(FIX2INT(rb_funcall3(obj, rb_st_gid, 0, 0))))
|
||||
if (group_member(get_stat(obj)->st_gid))
|
||||
return mode & S_IRGRP ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IROTH
|
||||
|
@ -1694,7 +1798,7 @@ static VALUE
|
|||
rb_stat_w(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_owned(obj))
|
||||
|
@ -1714,14 +1818,14 @@ static VALUE
|
|||
rb_stat_W(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_rowned(obj))
|
||||
return mode & S_IWUSR ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IRGRP
|
||||
if (group_member(FIX2INT(rb_funcall3(obj, rb_st_gid, 0, 0))))
|
||||
if (group_member(get_stat(obj)->st_gid))
|
||||
return mode & S_IWGRP ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IROTH
|
||||
|
@ -1734,7 +1838,7 @@ static VALUE
|
|||
rb_stat_x(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_owned(obj))
|
||||
|
@ -1754,14 +1858,14 @@ static VALUE
|
|||
rb_stat_X(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
mode_t mode = ST_MODE(obj);
|
||||
mode_t mode = get_stat(obj)->st_mode;
|
||||
|
||||
#ifdef S_IRUSR
|
||||
if (rb_stat_rowned(obj))
|
||||
return mode & S_IXUSR ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IRGRP
|
||||
if (group_member(FIX2INT(rb_funcall3(obj, rb_st_gid, 0, 0))))
|
||||
if (group_member(get_stat(obj)->st_gid))
|
||||
return mode & S_IXGRP ? Qtrue : Qfalse;
|
||||
#endif
|
||||
#ifdef S_IROTH
|
||||
|
@ -1774,7 +1878,7 @@ static VALUE
|
|||
rb_stat_f(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (S_ISREG(ST_MODE(obj))) return Qtrue;
|
||||
if (S_ISREG(get_stat(obj)->st_mode)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1782,7 +1886,7 @@ static VALUE
|
|||
rb_stat_z(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
if (rb_funcall3(obj, rb_st_size, 0, 0) == INT2FIX(0)) return Qtrue;
|
||||
if (get_stat(obj)->st_size == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1790,10 +1894,10 @@ static VALUE
|
|||
rb_stat_s(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE size = rb_funcall3(obj, rb_st_size, 0, 0);
|
||||
int size = get_stat(obj)->st_size;
|
||||
|
||||
if (size == INT2FIX(0)) return Qnil;
|
||||
return size;
|
||||
if (size == 0) return Qnil;
|
||||
return INT2FIX(size);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1801,7 +1905,7 @@ rb_stat_suid(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_ISUID
|
||||
if (ST_MODE(obj) & S_ISUID) return Qtrue;
|
||||
if (get_stat(obj)->st_mode & S_ISUID) return Qtrue;
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -1811,7 +1915,7 @@ rb_stat_sgid(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifndef NT
|
||||
if (ST_MODE(obj) & S_ISGID) return Qtrue;
|
||||
if (get_stat(obj)->st_mode & S_ISGID) return Qtrue;
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -1821,7 +1925,7 @@ rb_stat_sticky(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef S_ISVTX
|
||||
if (ST_MODE(obj) & S_ISVTX) return Qtrue;
|
||||
if (get_stat(obj)->st_mode & S_ISVTX) return Qtrue;
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1934,39 +2038,49 @@ Init_File()
|
|||
|
||||
rb_define_global_function("test", rb_f_test, -1);
|
||||
|
||||
sStat = rb_struct_define("Stat", "dev", "ino", "mode",
|
||||
"nlink", "uid", "gid", "rdev",
|
||||
"size", "blksize", "blocks",
|
||||
"atime", "mtime", "ctime", 0);
|
||||
rb_cStat = rb_define_class_under(rb_cFile, "Stat", rb_cObject);
|
||||
|
||||
rb_st_mode = rb_intern("mode");
|
||||
rb_st_size = rb_intern("size");
|
||||
rb_st_uid = rb_intern("uid");
|
||||
rb_st_gid = rb_intern("gid");
|
||||
rb_include_module(rb_cStat, rb_mComparable);
|
||||
|
||||
rb_define_method(sStat, "ftype", rb_stat_ftype, 0);
|
||||
rb_define_method(rb_cStat, "<=>", rb_stat_cmp, 1);
|
||||
|
||||
rb_define_method(sStat, "directory?", rb_stat_d, 0);
|
||||
rb_define_method(sStat, "readable?", rb_stat_r, 0);
|
||||
rb_define_method(sStat, "readable_real?", rb_stat_R, 0);
|
||||
rb_define_method(sStat, "writable?", rb_stat_w, 0);
|
||||
rb_define_method(sStat, "writable_real?", rb_stat_W, 0);
|
||||
rb_define_method(sStat, "executable?", rb_stat_x, 0);
|
||||
rb_define_method(sStat, "executable_real?", rb_stat_X, 0);
|
||||
rb_define_method(sStat, "file?", rb_stat_f, 0);
|
||||
rb_define_method(sStat, "zero?", rb_stat_z, 0);
|
||||
rb_define_method(sStat, "size?", rb_stat_s, 0);
|
||||
rb_define_method(sStat, "owned?", rb_stat_owned, 0);
|
||||
rb_define_method(sStat, "grpowned?", rb_stat_grpowned, 0);
|
||||
rb_define_method(rb_cStat, "dev", rb_stat_dev, 0);
|
||||
rb_define_method(rb_cStat, "ino", rb_stat_ino, 0);
|
||||
rb_define_method(rb_cStat, "mode", rb_stat_mode, 0);
|
||||
rb_define_method(rb_cStat, "nlink", rb_stat_nlink, 0);
|
||||
rb_define_method(rb_cStat, "uid", rb_stat_uid, 0);
|
||||
rb_define_method(rb_cStat, "gid", rb_stat_gid, 0);
|
||||
rb_define_method(rb_cStat, "rdev", rb_stat_rdev, 0);
|
||||
rb_define_method(rb_cStat, "size", rb_stat_size, 0);
|
||||
rb_define_method(rb_cStat, "blksize", rb_stat_blksize, 0);
|
||||
rb_define_method(rb_cStat, "blocks", rb_stat_blocks, 0);
|
||||
rb_define_method(rb_cStat, "atime", rb_stat_atime, 0);
|
||||
rb_define_method(rb_cStat, "mtime", rb_stat_mtime, 0);
|
||||
rb_define_method(rb_cStat, "ctime", rb_stat_ctime, 0);
|
||||
|
||||
rb_define_method(sStat, "pipe?", rb_stat_p, 0);
|
||||
rb_define_method(sStat, "symlink?", rb_stat_l, 0);
|
||||
rb_define_method(sStat, "socket?", rb_stat_S, 0);
|
||||
rb_define_method(rb_cStat, "ftype", rb_stat_ftype, 0);
|
||||
|
||||
rb_define_method(sStat, "blockdev?", rb_stat_b, 0);
|
||||
rb_define_method(sStat, "chardev?", rb_stat_c, 0);
|
||||
rb_define_method(rb_cStat, "directory?", rb_stat_d, 0);
|
||||
rb_define_method(rb_cStat, "readable?", rb_stat_r, 0);
|
||||
rb_define_method(rb_cStat, "readable_real?", rb_stat_R, 0);
|
||||
rb_define_method(rb_cStat, "writable?", rb_stat_w, 0);
|
||||
rb_define_method(rb_cStat, "writable_real?", rb_stat_W, 0);
|
||||
rb_define_method(rb_cStat, "executable?", rb_stat_x, 0);
|
||||
rb_define_method(rb_cStat, "executable_real?", rb_stat_X, 0);
|
||||
rb_define_method(rb_cStat, "file?", rb_stat_f, 0);
|
||||
rb_define_method(rb_cStat, "zero?", rb_stat_z, 0);
|
||||
rb_define_method(rb_cStat, "size?", rb_stat_s, 0);
|
||||
rb_define_method(rb_cStat, "owned?", rb_stat_owned, 0);
|
||||
rb_define_method(rb_cStat, "grpowned?", rb_stat_grpowned, 0);
|
||||
|
||||
rb_define_method(sStat, "setuid?", rb_stat_suid, 0);
|
||||
rb_define_method(sStat, "setgid?", rb_stat_sgid, 0);
|
||||
rb_define_method(sStat, "sticky?", rb_stat_sticky, 0);
|
||||
rb_define_method(rb_cStat, "pipe?", rb_stat_p, 0);
|
||||
rb_define_method(rb_cStat, "symlink?", rb_stat_l, 0);
|
||||
rb_define_method(rb_cStat, "socket?", rb_stat_S, 0);
|
||||
|
||||
rb_define_method(rb_cStat, "blockdev?", rb_stat_b, 0);
|
||||
rb_define_method(rb_cStat, "chardev?", rb_stat_c, 0);
|
||||
|
||||
rb_define_method(rb_cStat, "setuid?", rb_stat_suid, 0);
|
||||
rb_define_method(rb_cStat, "setgid?", rb_stat_sgid, 0);
|
||||
rb_define_method(rb_cStat, "sticky?", rb_stat_sticky, 0);
|
||||
}
|
||||
|
|
8
hash.c
8
hash.c
|
@ -689,8 +689,12 @@ static VALUE
|
|||
hash_to_s(hash)
|
||||
VALUE hash;
|
||||
{
|
||||
VALUE str;
|
||||
|
||||
if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
|
||||
return rb_ary_to_s(rb_hash_to_a(hash));
|
||||
str = rb_ary_to_s(rb_hash_to_a(hash));
|
||||
if (OBJ_TAINTED(hash)) OBJ_TAINT(str);
|
||||
return hash;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -798,7 +802,7 @@ equal_i(key, val1, data)
|
|||
{
|
||||
VALUE val2;
|
||||
|
||||
if (val1 == Qnil) return ST_CONTINUE;
|
||||
if (key == Qnil) return ST_CONTINUE;
|
||||
if (!st_lookup(data->tbl, key, &val2)) {
|
||||
data->result = Qfalse;
|
||||
return ST_STOP;
|
||||
|
|
36
lib/cgi.rb
36
lib/cgi.rb
|
@ -5,7 +5,7 @@ $Date$
|
|||
|
||||
CGI.rb
|
||||
|
||||
Version 1.00
|
||||
Version 1.01
|
||||
|
||||
Copyright (C) 1999 Network Applied Communication Laboratory, Inc.
|
||||
|
||||
|
@ -182,7 +182,7 @@ class CGI
|
|||
EOL = CR + LF
|
||||
v = $-v
|
||||
$-v = false
|
||||
VERSION = "1.00"
|
||||
VERSION = "1.01"
|
||||
RELEASE_DATE = "$Date$"
|
||||
$-v = v
|
||||
|
||||
|
@ -958,6 +958,7 @@ convert string charset, and set language to "ja".
|
|||
# - -
|
||||
def nn_element_def(element)
|
||||
<<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase)
|
||||
attributes.delete_if{|k,v| v == nil }
|
||||
"<element.upcase" + attributes.collect{|name, value|
|
||||
" " + CGI::escapeHTML(name) +
|
||||
if true == value
|
||||
|
@ -978,6 +979,7 @@ convert string charset, and set language to "ja".
|
|||
# - O EMPTY
|
||||
def nOE_element_def(element)
|
||||
<<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase)
|
||||
attributes.delete_if{|k,v| v == nil }
|
||||
"<element.upcase" + attributes.collect{|name, value|
|
||||
" " + CGI::escapeHTML(name) +
|
||||
if true == value
|
||||
|
@ -992,7 +994,8 @@ convert string charset, and set language to "ja".
|
|||
# O O or - O
|
||||
def nO_element_def(element)
|
||||
<<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase)
|
||||
"<element.upcase" + attributes.collect{|name, value|
|
||||
attributes.delete_if{|k,v| v == nil }
|
||||
"<element.upcase" + attributes.collect{|name, value|
|
||||
" " + CGI::escapeHTML(name) +
|
||||
if true == value
|
||||
""
|
||||
|
@ -1834,9 +1837,26 @@ convert string charset, and set language to "ja".
|
|||
|
||||
|
||||
def initialize(type = "query")
|
||||
@params = nil
|
||||
@cookies = nil
|
||||
@output_cookies = nil
|
||||
@output_hidden = nil
|
||||
|
||||
extend QueryExtension
|
||||
initialize_query()
|
||||
# @params, @cookies initialized in initialize_query
|
||||
|
||||
#if defined? CGI::PARAMS
|
||||
# @params = "C" + (CGI::PARAMS.nil? ? nil : CGI::PARAMS.dup).inspect
|
||||
# @cookies = "C" + (CGI::COOKIES.nil? ? nil : CGI::COOKIES.dup).inspect
|
||||
#else
|
||||
initialize_query()
|
||||
# @params, @cookies initialized in initialize_query
|
||||
# eval "PARAMS = @params.nil? ? nil : @params.dup"
|
||||
# eval "COOKIES = @cookies.nil? ? nil : @cookies.dup"
|
||||
# at_exit {
|
||||
# remove_const(PARAMS)
|
||||
# remove_const(COOKIES)
|
||||
# }
|
||||
#end
|
||||
|
||||
case type
|
||||
when "html3"
|
||||
|
@ -1860,6 +1880,12 @@ end
|
|||
|
||||
== HISTRY
|
||||
|
||||
=== Version 1.01 - wakou
|
||||
|
||||
1999/11/29 21:35:58
|
||||
|
||||
- support for ruby 1.5.0 (1999-11-20)
|
||||
|
||||
=== Version 1.00 - wakou
|
||||
|
||||
1999/09/13 23:00:58
|
||||
|
|
58
marshal.c
58
marshal.c
|
@ -17,7 +17,7 @@ double strtod();
|
|||
#endif
|
||||
|
||||
#define MARSHAL_MAJOR 4
|
||||
#define MARSHAL_MINOR 1
|
||||
#define MARSHAL_MINOR 2
|
||||
|
||||
#define TYPE_NIL '0'
|
||||
#define TYPE_TRUE 'T'
|
||||
|
@ -33,8 +33,11 @@ double strtod();
|
|||
#define TYPE_REGEXP '/'
|
||||
#define TYPE_ARRAY '['
|
||||
#define TYPE_HASH '{'
|
||||
#define TYPE_HASH_DEF '}'
|
||||
#define TYPE_STRUCT 'S'
|
||||
#define TYPE_MODULE 'M'
|
||||
#define TYPE_MODULE_OLD 'M'
|
||||
#define TYPE_CLASS 'c'
|
||||
#define TYPE_MODULE 'm'
|
||||
|
||||
#define TYPE_SYMBOL ':'
|
||||
#define TYPE_SYMLINK ';'
|
||||
|
@ -260,8 +263,15 @@ w_object(obj, arg, limit)
|
|||
}
|
||||
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_MODULE:
|
||||
case T_CLASS:
|
||||
w_byte(TYPE_CLASS, arg);
|
||||
{
|
||||
VALUE path = rb_class_path(obj);
|
||||
w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg);
|
||||
}
|
||||
return;
|
||||
|
||||
case T_MODULE:
|
||||
w_byte(TYPE_MODULE, arg);
|
||||
{
|
||||
VALUE path = rb_class_path(obj);
|
||||
|
@ -320,9 +330,17 @@ w_object(obj, arg, limit)
|
|||
|
||||
case T_HASH:
|
||||
w_uclass(obj, rb_cHash, arg);
|
||||
w_byte(TYPE_HASH, arg);
|
||||
if (!NIL_P(RHASH(obj)->ifnone)) {
|
||||
w_byte(TYPE_HASH_DEF, arg);
|
||||
}
|
||||
else {
|
||||
w_byte(TYPE_HASH, arg);
|
||||
}
|
||||
w_long(RHASH(obj)->tbl->num_entries, arg);
|
||||
st_foreach(RHASH(obj)->tbl, hash_each, &c_arg);
|
||||
if (!NIL_P(RHASH(obj)->ifnone)) {
|
||||
w_object(RHASH(obj)->ifnone, arg, limit);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_STRUCT:
|
||||
|
@ -706,6 +724,7 @@ r_object(arg)
|
|||
}
|
||||
|
||||
case TYPE_HASH:
|
||||
case TYPE_HASH_DEF:
|
||||
{
|
||||
int len = r_long(arg);
|
||||
|
||||
|
@ -716,6 +735,9 @@ r_object(arg)
|
|||
VALUE value = r_object(arg);
|
||||
rb_hash_aset(v, key, value);
|
||||
}
|
||||
if (type = TYPE_HASH_DEF) {
|
||||
RHASH(v)->ifnone = r_object(arg);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -788,13 +810,39 @@ r_object(arg)
|
|||
}
|
||||
break;
|
||||
|
||||
case TYPE_MODULE:
|
||||
case TYPE_MODULE_OLD:
|
||||
{
|
||||
char *buf;
|
||||
r_bytes(buf, arg);
|
||||
return r_regist(rb_path2class(buf), arg);
|
||||
}
|
||||
|
||||
case TYPE_CLASS:
|
||||
{
|
||||
VALUE c;
|
||||
|
||||
char *buf;
|
||||
r_bytes(buf, arg);
|
||||
c = rb_path2class(buf);
|
||||
if (TYPE(c) != T_CLASS) {
|
||||
rb_raise(rb_eTypeError, "%s is not a class", buf);
|
||||
}
|
||||
return r_regist(c, arg);
|
||||
}
|
||||
|
||||
case TYPE_MODULE:
|
||||
{
|
||||
VALUE m;
|
||||
|
||||
char *buf;
|
||||
r_bytes(buf, arg);
|
||||
m = rb_path2class(buf);
|
||||
if (TYPE(m) != T_CLASS) {
|
||||
rb_raise(rb_eTypeError, "%s is not a module", buf);
|
||||
}
|
||||
return r_regist(m, arg);
|
||||
}
|
||||
|
||||
default:
|
||||
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
|
||||
break;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
;;; "Mode for editing ruby source files")
|
||||
;;; (setq auto-mode-alist
|
||||
;;; (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
|
||||
;;; (setq interpreter-mode-alist (append '(("^#!.*ruby" . ruby-mode))
|
||||
;;; (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
|
||||
;;; interpreter-mode-alist))
|
||||
;;;
|
||||
;;; (2) set to road inf-ruby and set inf-ruby key definition in ruby-mode.
|
||||
|
@ -35,9 +35,12 @@
|
|||
;;; HISTORY
|
||||
;;; senda - 8 Apr 1998: Created.
|
||||
;;; $Log$
|
||||
;;; Revision 1.3 1999/12/01 09:24:18 matz
|
||||
;;; 19991201
|
||||
;;;
|
||||
;;; Revision 1.2 1999/08/13 05:45:18 matz
|
||||
;;; 1.4.0
|
||||
;;;
|
||||
;;;
|
||||
;;; Revision 1.1.1.1.2.1 1999/07/15 07:59:59 matz
|
||||
;;; 990715
|
||||
;;;
|
||||
|
|
7
re.c
7
re.c
|
@ -275,7 +275,9 @@ static VALUE
|
|||
rb_reg_source(re)
|
||||
VALUE re;
|
||||
{
|
||||
return rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len);
|
||||
VALUE str = rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len);
|
||||
if (OBJ_TAINTED(re)) OBJ_TAINT(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -715,7 +717,8 @@ match_to_s(match)
|
|||
{
|
||||
VALUE str = rb_reg_last_match(match);
|
||||
|
||||
if (NIL_P(str)) return rb_str_new(0,0);
|
||||
if (NIL_P(str)) str = rb_str_new(0,0);
|
||||
if (OBJ_TAINTED(match)) OBJ_TAINT(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class Board
|
|||
elsif y < 0 then 0
|
||||
elsif y >= @hi then 0
|
||||
else
|
||||
@data[x*@wi+y]
|
||||
@data[y*@wi+x]
|
||||
end
|
||||
end
|
||||
def count(x,y)
|
||||
|
|
2
string.c
2
string.c
|
@ -2055,7 +2055,7 @@ rb_str_split_method(argc, argv, str)
|
|||
if (!NIL_P(limit) && lim <= ++i) break;
|
||||
}
|
||||
end++;
|
||||
if (ismbchar(*ptr)) ptr++;
|
||||
if (ismbchar(*ptr)) {ptr++; end++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.5.0"
|
||||
#define RUBY_RELEASE_DATE "1999-11-17"
|
||||
#define RUBY_RELEASE_DATE "1999-12-01"
|
||||
#define RUBY_VERSION_CODE 150
|
||||
#define RUBY_RELEASE_CODE 19991117
|
||||
#define RUBY_RELEASE_CODE 19991201
|
||||
|
|
Loading…
Reference in a new issue