mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y: yyparse #defines moved from intern.h
* ruby.c (proc_options): access prefixed "ruby_yydebug". * applied modifies to pacify some of gcc -Wall warnings. * parse.y (arg): no more ugly hack for "**", so that "-2**2" to be parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed as "-(2**2)". * parse.y (yylex): '-2' to be literal fixnum. [new] * time.c (time_succ): new method for Range support. * time.c (time_arg): nil test against v[6] (usec). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
99551555c8
commit
4ab1577db3
19 changed files with 166 additions and 59 deletions
24
ChangeLog
24
ChangeLog
|
@ -2,6 +2,22 @@ Wed May 29 13:45:15 2002 Wakou Aoyama <wakou@ruby-lang.org>
|
||||||
|
|
||||||
* lib/cgi.rb: not use const if GET, HEAD. check multipart form head.
|
* lib/cgi.rb: not use const if GET, HEAD. check multipart form head.
|
||||||
|
|
||||||
|
Tue May 28 17:56:02 2002 Sean Chittenden <sean@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y: yyparse #defines moved from intern.h
|
||||||
|
|
||||||
|
* ruby.c (proc_options): access prefixed "ruby_yydebug".
|
||||||
|
|
||||||
|
* applied modifies to pacify some of gcc -Wall warnings.
|
||||||
|
|
||||||
|
Tue May 28 14:07:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (arg): no more ugly hack for "**", so that "-2**2" to be
|
||||||
|
parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed
|
||||||
|
as "-(2**2)".
|
||||||
|
|
||||||
|
* parse.y (yylex): '-2' to be literal fixnum. [new]
|
||||||
|
|
||||||
Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* eval.c (scope_node): trick to keep the node has a scope.
|
* eval.c (scope_node): trick to keep the node has a scope.
|
||||||
|
@ -16,6 +32,14 @@ Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* node.h (NEW_DASGN, NEW_DASGN_CURR): remove surplus semicolons.
|
* node.h (NEW_DASGN, NEW_DASGN_CURR): remove surplus semicolons.
|
||||||
|
|
||||||
|
Mon May 27 04:31:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_succ): new method for Range support.
|
||||||
|
|
||||||
|
Fri May 24 09:06:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_arg): nil test against v[6] (usec).
|
||||||
|
|
||||||
Thu May 23 16:39:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Thu May 23 16:39:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* ruby.c (proc_options): option parsing problem.
|
* ruby.c (proc_options): option parsing problem.
|
||||||
|
|
4
doc/NEWS
4
doc/NEWS
|
@ -1,3 +1,7 @@
|
||||||
|
: parser
|
||||||
|
|
||||||
|
Digits preceded minus sign is a literal integer.
|
||||||
|
|
||||||
: IO::sysopen
|
: IO::sysopen
|
||||||
|
|
||||||
a new method to get a raw file descriptor.
|
a new method to get a raw file descriptor.
|
||||||
|
|
26
eval.c
26
eval.c
|
@ -3075,6 +3075,7 @@ rb_eval(self, n)
|
||||||
ruby_errinfo = Qnil;
|
ruby_errinfo = Qnil;
|
||||||
ruby_sourceline = nd_line(node);
|
ruby_sourceline = nd_line(node);
|
||||||
ruby_in_eval++;
|
ruby_in_eval++;
|
||||||
|
rb_dvar_push(0, 0);
|
||||||
list->nd_head = compile(list->nd_head->nd_lit,
|
list->nd_head = compile(list->nd_head->nd_lit,
|
||||||
ruby_sourcefile,
|
ruby_sourcefile,
|
||||||
ruby_sourceline);
|
ruby_sourceline);
|
||||||
|
@ -6627,7 +6628,7 @@ proc_to_s(self, other)
|
||||||
|
|
||||||
Data_Get_Struct(self, struct BLOCK, data);
|
Data_Get_Struct(self, struct BLOCK, data);
|
||||||
str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:nul */
|
str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:nul */
|
||||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx>", cname, data->tag);
|
sprintf(RSTRING(str)->ptr, "#<%s:0x%p>", cname, data->tag);
|
||||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||||
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
|
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
|
||||||
|
|
||||||
|
@ -6641,6 +6642,28 @@ proc_to_proc(proc)
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
proc_binding(proc)
|
||||||
|
VALUE proc;
|
||||||
|
{
|
||||||
|
struct BLOCK *orig, *data;
|
||||||
|
VALUE bind;
|
||||||
|
|
||||||
|
Data_Get_Struct(proc, struct BLOCK, orig);
|
||||||
|
bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
|
||||||
|
MEMCPY(data, orig, struct BLOCK, 1);
|
||||||
|
frame_dup(&data->frame);
|
||||||
|
|
||||||
|
if (data->iter) {
|
||||||
|
blk_copy_prev(data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data->prev = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bind;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
block_pass(self, node)
|
block_pass(self, node)
|
||||||
VALUE self;
|
VALUE self;
|
||||||
|
@ -7149,6 +7172,7 @@ Init_Proc()
|
||||||
rb_define_method(rb_cProc, "==", proc_eq, 1);
|
rb_define_method(rb_cProc, "==", proc_eq, 1);
|
||||||
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
|
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
|
||||||
rb_define_method(rb_cProc, "to_proc", proc_to_proc, 0);
|
rb_define_method(rb_cProc, "to_proc", proc_to_proc, 0);
|
||||||
|
rb_define_method(rb_cProc, "binding", proc_binding, 0);
|
||||||
rb_define_global_function("proc", rb_f_lambda, 0);
|
rb_define_global_function("proc", rb_f_lambda, 0);
|
||||||
rb_define_global_function("lambda", rb_f_lambda, 0);
|
rb_define_global_function("lambda", rb_f_lambda, 0);
|
||||||
rb_define_global_function("binding", rb_f_binding, 0);
|
rb_define_global_function("binding", rb_f_binding, 0);
|
||||||
|
|
|
@ -25,16 +25,17 @@
|
||||||
|
|
||||||
static VALUE sPasswd, sGroup;
|
static VALUE sPasswd, sGroup;
|
||||||
|
|
||||||
|
char *getenv();
|
||||||
|
char *getlogin();
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
etc_getlogin(obj)
|
etc_getlogin(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
char *getenv();
|
|
||||||
char *login;
|
char *login;
|
||||||
|
|
||||||
|
rb_secure(4);
|
||||||
#ifdef HAVE_GETLOGIN
|
#ifdef HAVE_GETLOGIN
|
||||||
char *getlogin();
|
|
||||||
|
|
||||||
login = getlogin();
|
login = getlogin();
|
||||||
if (!login) login = getenv("USER");
|
if (!login) login = getenv("USER");
|
||||||
#else
|
#else
|
||||||
|
@ -91,11 +92,12 @@ etc_getpwuid(argc, argv, obj)
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GETPWENT
|
#if defined(HAVE_GETPWENT)
|
||||||
VALUE id;
|
VALUE id, ary;
|
||||||
int uid;
|
int uid;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
rb_secure(4);
|
||||||
if (rb_scan_args(argc, argv, "01", &id) == 1) {
|
if (rb_scan_args(argc, argv, "01", &id) == 1) {
|
||||||
uid = NUM2INT(id);
|
uid = NUM2INT(id);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +119,7 @@ etc_getpwnam(obj, nam)
|
||||||
#ifdef HAVE_GETPWENT
|
#ifdef HAVE_GETPWENT
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
StringValue(nam);
|
SafeStringValue(nam);
|
||||||
pwd = getpwnam(RSTRING(nam)->ptr);
|
pwd = getpwnam(RSTRING(nam)->ptr);
|
||||||
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING(nam)->ptr);
|
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING(nam)->ptr);
|
||||||
return setup_passwd(pwd);
|
return setup_passwd(pwd);
|
||||||
|
@ -126,6 +128,29 @@ etc_getpwnam(obj, nam)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETPWENT
|
||||||
|
static int passwd_blocking = 0;
|
||||||
|
static VALUE
|
||||||
|
passwd_ensure()
|
||||||
|
{
|
||||||
|
passwd_blocking = Qfalse;
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
passwd_iterate()
|
||||||
|
{
|
||||||
|
struct passwd *pw;
|
||||||
|
|
||||||
|
setpwent();
|
||||||
|
while (pw = getpwent()) {
|
||||||
|
rb_yield(setup_passwd(pw));
|
||||||
|
}
|
||||||
|
endpwent();
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
etc_passwd(obj)
|
etc_passwd(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -133,13 +158,13 @@ etc_passwd(obj)
|
||||||
#ifdef HAVE_GETPWENT
|
#ifdef HAVE_GETPWENT
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
|
rb_secure(4);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
setpwent();
|
if (passwd_blocking) {
|
||||||
while (pw = getpwent()) {
|
rb_raise(rb_eRuntimeError, "parallel passwd iteration");
|
||||||
rb_yield(setup_passwd(pw));
|
|
||||||
}
|
}
|
||||||
endpwent();
|
passwd_blocking = Qtrue;
|
||||||
return obj;
|
rb_ensure(passwd_iterate, 0, passwd_ensure, 0);
|
||||||
}
|
}
|
||||||
if (pw = getpwent()) {
|
if (pw = getpwent()) {
|
||||||
return setup_passwd(pw);
|
return setup_passwd(pw);
|
||||||
|
@ -178,6 +203,7 @@ etc_getgrgid(obj, id)
|
||||||
int gid;
|
int gid;
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
|
|
||||||
|
rb_secure(4);
|
||||||
gid = NUM2INT(id);
|
gid = NUM2INT(id);
|
||||||
grp = getgrgid(gid);
|
grp = getgrgid(gid);
|
||||||
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
|
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
|
||||||
|
@ -194,7 +220,8 @@ etc_getgrnam(obj, nam)
|
||||||
#ifdef HAVE_GETGRENT
|
#ifdef HAVE_GETGRENT
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
|
|
||||||
StringValue(nam);
|
rb_secure(4);
|
||||||
|
SafeStringValue(nam);
|
||||||
grp = getgrnam(RSTRING(nam)->ptr);
|
grp = getgrnam(RSTRING(nam)->ptr);
|
||||||
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING(nam)->ptr);
|
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING(nam)->ptr);
|
||||||
return setup_group(grp);
|
return setup_group(grp);
|
||||||
|
@ -203,6 +230,29 @@ etc_getgrnam(obj, nam)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETGRENT
|
||||||
|
static int group_blocking = 0;
|
||||||
|
static VALUE
|
||||||
|
group_ensure()
|
||||||
|
{
|
||||||
|
group_blocking = Qfalse;
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
group_iterate()
|
||||||
|
{
|
||||||
|
struct group *pw;
|
||||||
|
|
||||||
|
setpwent();
|
||||||
|
while (pw = getgrent()) {
|
||||||
|
rb_yield(setup_group(pw));
|
||||||
|
}
|
||||||
|
endpwent();
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
etc_group(obj)
|
etc_group(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -210,13 +260,13 @@ etc_group(obj)
|
||||||
#ifdef HAVE_GETGRENT
|
#ifdef HAVE_GETGRENT
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
|
|
||||||
|
rb_secure(4);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
setgrent();
|
if (group_blocking) {
|
||||||
while (grp = getgrent()) {
|
rb_raise(rb_eRuntimeError, "parallel group iteration");
|
||||||
rb_yield(setup_group(grp));
|
|
||||||
}
|
}
|
||||||
endgrent();
|
group_blocking = Qtrue;
|
||||||
return obj;
|
rb_ensure(group_iterate, 0, group_ensure, 0);
|
||||||
}
|
}
|
||||||
if (grp = getgrent()) {
|
if (grp = getgrent()) {
|
||||||
return setup_group(grp);
|
return setup_group(grp);
|
||||||
|
@ -258,7 +308,7 @@ Init_etc()
|
||||||
"age",
|
"age",
|
||||||
#endif
|
#endif
|
||||||
#ifdef PW_CLASS
|
#ifdef PW_CLASS
|
||||||
"class",
|
"uclass",
|
||||||
#endif
|
#endif
|
||||||
#ifdef PW_COMMENT
|
#ifdef PW_COMMENT
|
||||||
"comment",
|
"comment",
|
||||||
|
|
6
file.c
6
file.c
|
@ -294,7 +294,7 @@ rb_stat_inspect(self)
|
||||||
{
|
{
|
||||||
VALUE str;
|
VALUE str;
|
||||||
int i;
|
int i;
|
||||||
struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
VALUE (*func)();
|
VALUE (*func)();
|
||||||
} member[] = {
|
} member[] = {
|
||||||
|
@ -329,13 +329,13 @@ rb_stat_inspect(self)
|
||||||
if (i == 2) { /* mode */
|
if (i == 2) { /* mode */
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
sprintf(buf, "0%o", NUM2INT(v));
|
sprintf(buf, "0%lo", NUM2INT(v));
|
||||||
rb_str_buf_cat2(str, buf);
|
rb_str_buf_cat2(str, buf);
|
||||||
}
|
}
|
||||||
else if (i == 0 || i == 6) { /* dev/rdev */
|
else if (i == 0 || i == 6) { /* dev/rdev */
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
sprintf(buf, "0x%x", NUM2ULONG(v));
|
sprintf(buf, "0x%lx", NUM2ULONG(v));
|
||||||
rb_str_buf_cat2(str, buf);
|
rb_str_buf_cat2(str, buf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
13
hash.c
13
hash.c
|
@ -55,19 +55,6 @@ eql(args)
|
||||||
return (VALUE)rb_eql(args[0], args[1]);
|
return (VALUE)rb_eql(args[0], args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
eql_failed()
|
|
||||||
{
|
|
||||||
return Qfalse;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
any_eql(args)
|
|
||||||
VALUE *args;
|
|
||||||
{
|
|
||||||
return rb_rescue(eql, (VALUE)args, eql_failed, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_any_cmp(a, b)
|
rb_any_cmp(a, b)
|
||||||
VALUE a, b;
|
VALUE a, b;
|
||||||
|
|
6
intern.h
6
intern.h
|
@ -284,12 +284,6 @@ double rb_str_to_dbl _((VALUE, int));
|
||||||
/* parse.y */
|
/* parse.y */
|
||||||
EXTERN int ruby_sourceline;
|
EXTERN int ruby_sourceline;
|
||||||
EXTERN char *ruby_sourcefile;
|
EXTERN char *ruby_sourcefile;
|
||||||
#define yyparse ruby_yyparse
|
|
||||||
#define yylex ruby_yylex
|
|
||||||
#define yyerror ruby_yyerror
|
|
||||||
#define yylval ruby_yylval
|
|
||||||
#define yychar ruby_yychar
|
|
||||||
#define yydebug ruby_yydebug
|
|
||||||
int yyparse _((void));
|
int yyparse _((void));
|
||||||
ID rb_id_attrset _((ID));
|
ID rb_id_attrset _((ID));
|
||||||
void rb_parser_append_print _((void));
|
void rb_parser_append_print _((void));
|
||||||
|
|
4
io.c
4
io.c
|
@ -2081,7 +2081,7 @@ io_reopen(io, nfile)
|
||||||
OpenFile *fptr, *orig;
|
OpenFile *fptr, *orig;
|
||||||
char *mode;
|
char *mode;
|
||||||
int fd;
|
int fd;
|
||||||
off_t pos;
|
off_t pos = 0;
|
||||||
|
|
||||||
nfile = rb_io_get_io(nfile);
|
nfile = rb_io_get_io(nfile);
|
||||||
if (rb_safe_level() >= 4 && (!OBJ_TAINTED(io) || !OBJ_TAINTED(nfile))) {
|
if (rb_safe_level() >= 4 && (!OBJ_TAINTED(io) || !OBJ_TAINTED(nfile))) {
|
||||||
|
@ -3508,7 +3508,7 @@ argf_read(argc, argv)
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
{
|
{
|
||||||
VALUE tmp, str;
|
VALUE tmp, str;
|
||||||
int len;
|
int len = 0;
|
||||||
|
|
||||||
if (argc == 1) len = NUM2INT(argv[0]);
|
if (argc == 1) len = NUM2INT(argv[0]);
|
||||||
str = Qnil;
|
str = Qnil;
|
||||||
|
|
|
@ -215,6 +215,7 @@ end
|
||||||
|
|
||||||
class SizedQueue<Queue
|
class SizedQueue<Queue
|
||||||
def initialize(max)
|
def initialize(max)
|
||||||
|
raise ArgumentError, "queue size must be positive" unless max > 0
|
||||||
@max = max
|
@max = max
|
||||||
@queue_wait = []
|
@queue_wait = []
|
||||||
@queue_wait.taint # enable tainted comunication
|
@queue_wait.taint # enable tainted comunication
|
||||||
|
|
2
node.h
2
node.h
|
@ -138,7 +138,7 @@ typedef struct RNode {
|
||||||
union {
|
union {
|
||||||
struct RNode *node;
|
struct RNode *node;
|
||||||
ID id;
|
ID id;
|
||||||
long argc;
|
int argc;
|
||||||
VALUE value;
|
VALUE value;
|
||||||
} u2;
|
} u2;
|
||||||
union {
|
union {
|
||||||
|
|
4
pack.c
4
pack.c
|
@ -1549,7 +1549,7 @@ pack_unpack(str, fmt)
|
||||||
{
|
{
|
||||||
VALUE str = infected_str_new(0, (send - s)*3/4, str);
|
VALUE str = infected_str_new(0, (send - s)*3/4, str);
|
||||||
char *ptr = RSTRING(str)->ptr;
|
char *ptr = RSTRING(str)->ptr;
|
||||||
int a,b,c,d;
|
int a,b,c = 0,d;
|
||||||
static int first = 1;
|
static int first = 1;
|
||||||
static int b64_xtable[256];
|
static int b64_xtable[256];
|
||||||
|
|
||||||
|
@ -1834,7 +1834,7 @@ utf8_to_uv(p, lenp)
|
||||||
if (n != 0) {
|
if (n != 0) {
|
||||||
uv &= (1<<(BYTEWIDTH-2-n)) - 1;
|
uv &= (1<<(BYTEWIDTH-2-n)) - 1;
|
||||||
while (n--) {
|
while (n--) {
|
||||||
uv = uv << 6 | *p++ & ((1<<6)-1);
|
uv = uv << 6 | (*p++ & ((1<<6)-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return uv;
|
return uv;
|
||||||
|
|
9
parse.y
9
parse.y
|
@ -13,14 +13,23 @@
|
||||||
%{
|
%{
|
||||||
|
|
||||||
#define YYDEBUG 1
|
#define YYDEBUG 1
|
||||||
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
|
#include "intern.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "st.h"
|
#include "st.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define yyparse ruby_yyparse
|
||||||
|
#define yylex ruby_yylex
|
||||||
|
#define yyerror ruby_yyerror
|
||||||
|
#define yylval ruby_yylval
|
||||||
|
#define yychar ruby_yychar
|
||||||
|
#define yydebug ruby_yydebug
|
||||||
|
|
||||||
#define ID_SCOPE_SHIFT 3
|
#define ID_SCOPE_SHIFT 3
|
||||||
#define ID_SCOPE_MASK 0x07
|
#define ID_SCOPE_MASK 0x07
|
||||||
#define ID_LOCAL 0x01
|
#define ID_LOCAL 0x01
|
||||||
|
|
4
range.c
4
range.c
|
@ -22,9 +22,9 @@ static VALUE
|
||||||
range_check(args)
|
range_check(args)
|
||||||
VALUE *args;
|
VALUE *args;
|
||||||
{
|
{
|
||||||
rb_funcall(args[0], id_cmp, 1, args[1]);
|
|
||||||
if (!FIXNUM_P(args[0]) && !rb_obj_is_kind_of(args[0], rb_cNumeric)) {
|
if (!FIXNUM_P(args[0]) && !rb_obj_is_kind_of(args[0], rb_cNumeric)) {
|
||||||
rb_funcall(args[0], id_succ, 0, 0);
|
rb_funcall(args[0], id_cmp, 1, args[1]);
|
||||||
|
/* rb_funcall(args[0], id_succ, 0, 0); */
|
||||||
}
|
}
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
6
ruby.c
6
ruby.c
|
@ -46,7 +46,7 @@ VALUE ruby_debug = Qfalse;
|
||||||
VALUE ruby_verbose = Qfalse;
|
VALUE ruby_verbose = Qfalse;
|
||||||
static int sflag = 0;
|
static int sflag = 0;
|
||||||
static int xflag = 0;
|
static int xflag = 0;
|
||||||
extern int yydebug;
|
extern int ruby_yydebug;
|
||||||
|
|
||||||
char *ruby_inplace_mode = Qfalse;
|
char *ruby_inplace_mode = Qfalse;
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ proc_options(argc, argv)
|
||||||
goto reswitch;
|
goto reswitch;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
yydebug = 1;
|
ruby_yydebug = 1;
|
||||||
s++;
|
s++;
|
||||||
goto reswitch;
|
goto reswitch;
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ proc_options(argc, argv)
|
||||||
ruby_verbose = Qtrue;
|
ruby_verbose = Qtrue;
|
||||||
}
|
}
|
||||||
else if (strcmp("yydebug", s) == 0)
|
else if (strcmp("yydebug", s) == 0)
|
||||||
yydebug = 1;
|
ruby_yydebug = 1;
|
||||||
else if (strcmp("help", s) == 0) {
|
else if (strcmp("help", s) == 0) {
|
||||||
usage(origargv[0]);
|
usage(origargv[0]);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
2
st.c
2
st.c
|
@ -1,6 +1,6 @@
|
||||||
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
|
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
|
||||||
|
|
||||||
static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible";
|
/* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
2
string.c
2
string.c
|
@ -2444,7 +2444,7 @@ rb_str_split_m(argc, argv, str)
|
||||||
VALUE spat;
|
VALUE spat;
|
||||||
VALUE limit;
|
VALUE limit;
|
||||||
int char_sep = -1;
|
int char_sep = -1;
|
||||||
long beg, end, i;
|
long beg, end, i = 0;
|
||||||
int lim = 0;
|
int lim = 0;
|
||||||
VALUE result, tmp;
|
VALUE result, tmp;
|
||||||
|
|
||||||
|
|
14
time.c
14
time.c
|
@ -254,7 +254,7 @@ time_arg(argc, argv, tm, usec)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_scan_args(argc, argv, "16", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5],&v[6]);
|
rb_scan_args(argc, argv, "16", &v[0],&v[1],&v[2],&v[3],&v[4],&v[5],&v[6]);
|
||||||
*usec = (argc == 7) ? NUM2INT(v[6]) : 0;
|
*usec = NIL_P(v[6]) ? 0 : obj2long(v[6]);
|
||||||
tm->tm_isdst = -1;
|
tm->tm_isdst = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,6 +688,16 @@ time_usec(time)
|
||||||
return INT2NUM(tobj->tv.tv_usec);
|
return INT2NUM(tobj->tv.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
time_succ(time)
|
||||||
|
VALUE time;
|
||||||
|
{
|
||||||
|
struct time_object *tobj;
|
||||||
|
|
||||||
|
GetTimeval(time, tobj);
|
||||||
|
return rb_time_new(tobj->tv.tv_sec + 1, tobj->tv.tv_usec);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
time_cmp(time1, time2)
|
time_cmp(time1, time2)
|
||||||
VALUE time1, time2;
|
VALUE time1, time2;
|
||||||
|
@ -1437,6 +1447,8 @@ Init_Time()
|
||||||
rb_define_method(rb_cTime, "hash", time_hash, 0);
|
rb_define_method(rb_cTime, "hash", time_hash, 0);
|
||||||
rb_define_method(rb_cTime, "clone", time_clone, 0);
|
rb_define_method(rb_cTime, "clone", time_clone, 0);
|
||||||
rb_define_method(rb_cTime, "dup", time_dup, 0);
|
rb_define_method(rb_cTime, "dup", time_dup, 0);
|
||||||
|
rb_define_method(rb_cTime, "succ", time_succ, 0);
|
||||||
|
rb_define_method(rb_cTime, "next", time_succ, 0);
|
||||||
|
|
||||||
rb_define_method(rb_cTime, "localtime", time_localtime, 0);
|
rb_define_method(rb_cTime, "localtime", time_localtime, 0);
|
||||||
rb_define_method(rb_cTime, "gmtime", time_gmtime, 0);
|
rb_define_method(rb_cTime, "gmtime", time_gmtime, 0);
|
||||||
|
|
8
util.c
8
util.c
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -747,8 +748,9 @@ ruby_strtod(string, endPtr)
|
||||||
* Strip off leading blanks and check for a sign.
|
* Strip off leading blanks and check for a sign.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
p = string;
|
p = string;
|
||||||
while (isspace(*p)) {
|
while (ISSPACE(*p)) {
|
||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
if (*p == '-') {
|
if (*p == '-') {
|
||||||
|
@ -770,7 +772,7 @@ ruby_strtod(string, endPtr)
|
||||||
decPt = -1;
|
decPt = -1;
|
||||||
for (mantSize = 0; ; mantSize += 1) {
|
for (mantSize = 0; ; mantSize += 1) {
|
||||||
c = *p;
|
c = *p;
|
||||||
if (!isdigit(c)) {
|
if (!ISDIGIT(c)) {
|
||||||
if ((c != '.') || (decPt >= 0)) {
|
if ((c != '.') || (decPt >= 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -848,7 +850,7 @@ ruby_strtod(string, endPtr)
|
||||||
}
|
}
|
||||||
expSign = FALSE;
|
expSign = FALSE;
|
||||||
}
|
}
|
||||||
while (isdigit(*p)) {
|
while (ISDIGIT(*p)) {
|
||||||
exp = exp * 10 + (*p - '0');
|
exp = exp * 10 + (*p - '0');
|
||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.7.2"
|
#define RUBY_VERSION "1.7.2"
|
||||||
#define RUBY_RELEASE_DATE "2002-05-28"
|
#define RUBY_RELEASE_DATE "2002-05-29"
|
||||||
#define RUBY_VERSION_CODE 172
|
#define RUBY_VERSION_CODE 172
|
||||||
#define RUBY_RELEASE_CODE 20020528
|
#define RUBY_RELEASE_CODE 20020529
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue