mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parse_quotedwords): %w should allow parenthesis escape.
* parse.y (parse_qstring): %q should allow terminator escape. * re.c (rb_reg_options): new method to give an option values. * parse.y (cond0): disable special treating of integer literal in conditional unless option -e is supplied. changes current behavior. experimental. * parse.y (cond0): give warning for string/integer literals and dot operators in conditionals unless option -e is supplied. * re.c (rb_reg_equal): all option flags should be same to be equal. * error.c (Init_Exception): make Interrupt a subclass of SignalException. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b576f57aa0
commit
ed520cf6e9
19 changed files with 196 additions and 61 deletions
53
ChangeLog
53
ChangeLog
|
@ -16,6 +16,25 @@ Wed Feb 7 16:27:27 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||
|
||||
* lib/net/protocol.rb: Socket#reopen takes arg, open_timeout.
|
||||
|
||||
Wed Feb 7 16:05:22 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* parse.y (parse_quotedwords): %w should allow parenthesis escape.
|
||||
|
||||
Wed Feb 7 00:57:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (parse_qstring): %q should allow terminator escape.
|
||||
|
||||
* re.c (rb_reg_options): new method to give an option values.
|
||||
|
||||
* parse.y (cond0): disable special treating of integer literal in
|
||||
conditional unless option -e is supplied. changes current
|
||||
behavior. experimental.
|
||||
|
||||
* parse.y (cond0): give warning for string/integer literals and
|
||||
dot operators in conditionals unless option -e is supplied.
|
||||
|
||||
* re.c (rb_reg_equal): all option flags should be same to be equal.
|
||||
|
||||
Tue Feb 6 21:30:44 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||
|
||||
* lib/net/http.rb: call on_connect() on re-opening socket.
|
||||
|
@ -32,6 +51,40 @@ Tue Feb 6 20:19:10 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||
|
||||
* lib/net/protocol.rb: add Protocol#on_connect,on_disconnect.
|
||||
|
||||
Mon Feb 5 23:15:46 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* error.c (Init_Exception): make Interrupt a subclass of
|
||||
SignalException.
|
||||
|
||||
Mon Feb 5 00:39:06 2001 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
|
||||
|
||||
* dir.c: use ISXXX() instead of isxxx().
|
||||
|
||||
* dln.c (aix_loaderror): ditto.
|
||||
|
||||
* file.c (rb_file_s_expand_path): ditto.
|
||||
|
||||
* string.c (rb_str_upcase_bang): ditto.
|
||||
|
||||
* win32/win32.c (do_spawn): ditto.
|
||||
|
||||
* win32/win32.c (NtMakeCmdVector): ditto.
|
||||
|
||||
* win32/win32.c (opendir): ditto.
|
||||
|
||||
Sat Feb 3 14:44:53 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* configure.in (AC_C_INLINE): check inline attribute.
|
||||
|
||||
* gc.c (is_pointer_to_heap): use inline rather than __inline__.
|
||||
|
||||
* pack.c (hex2num): ditto.
|
||||
|
||||
* ruby.h (rb_class_of, rb_type, rb_special_const_p): ditto.
|
||||
|
||||
* util.c (rb_class_of, rb_type, rb_special_const_p): defined in
|
||||
ruby.h.
|
||||
|
||||
Fri Feb 2 16:14:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (rb_ary_sort_bang): returns self, even if its length is
|
||||
|
|
2
MANIFEST
2
MANIFEST
|
@ -144,6 +144,8 @@ lib/profile.rb
|
|||
lib/pstore.rb
|
||||
lib/rational.rb
|
||||
lib/readbytes.rb
|
||||
lib/resolv.rb
|
||||
lib/resolv-replace.rb
|
||||
lib/shellwords.rb
|
||||
lib/singleton.rb
|
||||
lib/sync.rb
|
||||
|
|
3
ToDo
3
ToDo
|
@ -1,5 +1,6 @@
|
|||
Language Spec.
|
||||
|
||||
- %q!\!! => "!" (not "\\!")
|
||||
* operator !! for rescue. ???
|
||||
* objectify characters
|
||||
* ../... outside condition invokes operator method too.
|
||||
|
@ -72,6 +73,8 @@ Standard Libraries
|
|||
* way to specify immortal (fork endurance) thread;
|
||||
* or raise ForkException to every thread but fork caller.
|
||||
* Hash::new{default} or recommend Hash#fetch?
|
||||
* new user-defined marshal scheme. _dump(dumper), _load(restorer)
|
||||
* lchown, lchmod, etc.
|
||||
|
||||
Extension Libraries
|
||||
|
||||
|
|
2
dir.c
2
dir.c
|
@ -69,7 +69,7 @@ char *strchr _((char*,char));
|
|||
#define FNM_NOMATCH 1
|
||||
#define FNM_ERROR 2
|
||||
|
||||
#define downcase(c) (nocase && isupper(c) ? tolower(c) : (c))
|
||||
#define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c))
|
||||
|
||||
#if defined DOSISH
|
||||
#define isdirsep(c) ((c) == '/' || (c) == '\\')
|
||||
|
|
2
dln.c
2
dln.c
|
@ -1204,7 +1204,7 @@ aix_loaderror(const char *pathname)
|
|||
if (nerr == load_errtab[i].errno && load_errtab[i].errstr)
|
||||
ERRBUF_APPEND(load_errtab[i].errstr);
|
||||
}
|
||||
while (isdigit(*message[i])) message[i]++;
|
||||
while (ISDIGIT(*message[i])) message[i]++;
|
||||
ERRBUF_APPEND(message[i]);
|
||||
ERRBUF_APPEND("\n");
|
||||
}
|
||||
|
|
2
error.c
2
error.c
|
@ -555,8 +555,8 @@ Init_Exception()
|
|||
|
||||
rb_eSystemExit = rb_define_class("SystemExit", rb_eException);
|
||||
rb_eFatal = rb_define_class("fatal", rb_eException);
|
||||
rb_eInterrupt = rb_define_class("Interrupt", rb_eException);
|
||||
rb_eSignal = rb_define_class("SignalException", rb_eException);
|
||||
rb_eInterrupt = rb_define_class("Interrupt", rb_eSignal);
|
||||
|
||||
rb_eStandardError = rb_define_class("StandardError", rb_eException);
|
||||
rb_eTypeError = rb_define_class("TypeError", rb_eStandardError);
|
||||
|
|
7
eval.c
7
eval.c
|
@ -4473,7 +4473,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
|
|||
struct cache_entry *ent;
|
||||
|
||||
if (!klass) {
|
||||
rb_raise(rb_eNotImpError, "method call on terminated obejct");
|
||||
rb_raise(rb_eNotImpError, "method call on terminated object");
|
||||
}
|
||||
/* is it in the method cache? */
|
||||
ent = cache + EXPR1(klass, mid);
|
||||
|
@ -5998,9 +5998,10 @@ blk_copy_prev(block)
|
|||
while (block->prev) {
|
||||
tmp = ALLOC_N(struct BLOCK, 1);
|
||||
MEMCPY(tmp, block->prev, struct BLOCK, 1);
|
||||
if (tmp->frame.argc > 0) {
|
||||
if (tmp->frame.argc > 0 && !(tmp->frame.flags & FRAME_MALLOC)) {
|
||||
tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc);
|
||||
MEMCPY(tmp->frame.argv, block->prev->frame.argv, VALUE, tmp->frame.argc);
|
||||
tmp->frame.flags |= FRAME_MALLOC;
|
||||
}
|
||||
scope_dup(tmp->scope);
|
||||
tmp->tag->flags |= BLOCK_DYNAMIC;
|
||||
|
@ -6017,7 +6018,7 @@ frame_dup(frame)
|
|||
struct FRAME *tmp;
|
||||
|
||||
for (;;) {
|
||||
if (frame->argc > 0) {
|
||||
if (frame->argc > 0 && !(frame->flags & FRAME_MALLOC)) {
|
||||
argv = ALLOC_N(VALUE, frame->argc);
|
||||
MEMCPY(argv, frame->argv, VALUE, frame->argc);
|
||||
frame->argv = argv;
|
||||
|
|
|
@ -518,7 +518,7 @@ static VALUE
|
|||
fgdbm_has_key(obj, keystr)
|
||||
VALUE obj, keystr;
|
||||
{
|
||||
datum key, val;
|
||||
datum key;
|
||||
struct dbmdata *dbmp;
|
||||
GDBM_FILE dbm;
|
||||
|
||||
|
@ -528,8 +528,8 @@ fgdbm_has_key(obj, keystr)
|
|||
|
||||
GetDBM(obj, dbmp);
|
||||
dbm = dbmp->di_dbm;
|
||||
val = gdbm_fetch(dbm, key);
|
||||
if (val.dptr) return Qtrue;
|
||||
if (gdbm_exists(dbm, key))
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
|
|
@ -776,18 +776,17 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
open_inet(class, h, serv, type)
|
||||
VALUE class, h, serv;
|
||||
load_addr_info(h, serv, type, res)
|
||||
VALUE h, serv;
|
||||
int type;
|
||||
struct addrinfo **res;
|
||||
{
|
||||
struct addrinfo hints, *res, *res0;
|
||||
int fd, status;
|
||||
char *syscall;
|
||||
char pbuf[1024], *portp;
|
||||
char *host;
|
||||
char pbuf[1024], *portp;
|
||||
struct addrinfo hints;
|
||||
int error;
|
||||
|
||||
if (h) {
|
||||
if (!NIL_P(h)) {
|
||||
Check_SafeStr(h);
|
||||
host = RSTRING(h)->ptr;
|
||||
}
|
||||
|
@ -811,13 +810,32 @@ open_inet(class, h, serv, type)
|
|||
if (type == INET_SERVER) {
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
}
|
||||
error = getaddrinfo(host, portp, &hints, &res0);
|
||||
error = getaddrinfo(host, portp, &hints, res);
|
||||
if (error) {
|
||||
rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
|
||||
}
|
||||
|
||||
}
|
||||
static VALUE
|
||||
open_inet(class, remote_host, remote_serv, local_host, local_serv, type)
|
||||
VALUE class, remote_host, remote_serv, local_host, local_serv;
|
||||
int type;
|
||||
{
|
||||
struct addrinfo hints, *res, *res_remote, *res_local = NULL;
|
||||
int fd, status;
|
||||
char *syscall;
|
||||
|
||||
load_addr_info(remote_host, remote_serv, type, &res_remote);
|
||||
|
||||
/*
|
||||
* Maybe also accept a local address
|
||||
*/
|
||||
|
||||
if (type != INET_SERVER && (!NIL_P(local_host) || !NIL_P(local_serv)))
|
||||
load_addr_info(local_host, local_serv, type, &res_local);
|
||||
|
||||
fd = -1;
|
||||
for (res = res0; res; res = res->ai_next) {
|
||||
for (res = res_remote; res; res = res->ai_next) {
|
||||
status = ruby_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
|
||||
syscall = "socket(2)";
|
||||
fd = status;
|
||||
|
@ -832,9 +850,16 @@ open_inet(class, h, serv, type)
|
|||
syscall = "bind(2)";
|
||||
}
|
||||
else {
|
||||
status = ruby_connect(fd, res->ai_addr, res->ai_addrlen,
|
||||
(type == INET_SOCKS));
|
||||
syscall = "connect(2)";
|
||||
if (res_local) {
|
||||
status = bind(fd, res_local->ai_addr, res_local->ai_addrlen);
|
||||
syscall = "bind(2)";
|
||||
}
|
||||
|
||||
if (status >= 0) {
|
||||
status = ruby_connect(fd, res->ai_addr, res->ai_addrlen,
|
||||
(type == INET_SOCKS));
|
||||
syscall = "connect(2)";
|
||||
}
|
||||
}
|
||||
|
||||
if (status < 0) {
|
||||
|
@ -855,7 +880,10 @@ open_inet(class, h, serv, type)
|
|||
#else
|
||||
close(fd);
|
||||
#endif
|
||||
freeaddrinfo(res0);
|
||||
freeaddrinfo(res_remote);
|
||||
if (res_local) {
|
||||
freeaddrinfo(res_local);
|
||||
}
|
||||
rb_sys_fail(syscall);
|
||||
}
|
||||
|
||||
|
@ -863,16 +891,38 @@ open_inet(class, h, serv, type)
|
|||
listen(fd, 5);
|
||||
|
||||
/* create new instance */
|
||||
freeaddrinfo(res0);
|
||||
if (res_local)
|
||||
freeaddrinfo(res_local);
|
||||
freeaddrinfo(res_remote);
|
||||
return sock_new(class, fd);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
tcp_s_open(class, host, serv)
|
||||
VALUE class, host, serv;
|
||||
tcp_s_open(argc, argv, class)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
VALUE class;
|
||||
{
|
||||
Check_SafeStr(host);
|
||||
return open_inet(class, host, serv, INET_CLIENT);
|
||||
VALUE remote_host, remote_serv;
|
||||
VALUE local_host, local_serv;
|
||||
|
||||
int pcount = rb_scan_args(argc, argv, "22",
|
||||
&remote_host, &remote_serv,
|
||||
&local_host, &local_serv);
|
||||
|
||||
Check_SafeStr(remote_host);
|
||||
|
||||
|
||||
if (!NIL_P(local_host)) {
|
||||
Check_SafeStr(local_host);
|
||||
}
|
||||
|
||||
if (NIL_P(local_serv)) {
|
||||
local_serv = INT2NUM(0);
|
||||
}
|
||||
|
||||
return open_inet(class, remote_host, remote_serv,
|
||||
local_host, local_serv, INET_CLIENT);
|
||||
}
|
||||
|
||||
#ifdef SOCKS
|
||||
|
@ -888,7 +938,7 @@ socks_s_open(class, host, serv)
|
|||
}
|
||||
|
||||
Check_SafeStr(host);
|
||||
return open_inet(class, host, serv, INET_SOCKS);
|
||||
return open_inet(class, host, serv, Qnil, Qnil, INET_SOCKS);
|
||||
}
|
||||
|
||||
#ifdef SOCKS5
|
||||
|
@ -1031,9 +1081,9 @@ tcp_svr_s_open(argc, argv, class)
|
|||
VALUE arg1, arg2;
|
||||
|
||||
if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2)
|
||||
return open_inet(class, arg1, arg2, INET_SERVER);
|
||||
return open_inet(class, arg1, arg2, NULL, Qnil, INET_SERVER);
|
||||
else
|
||||
return open_inet(class, 0, arg1, INET_SERVER);
|
||||
return open_inet(class, Qnil, arg1, NULL, Qnil, INET_SERVER);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -2053,8 +2103,8 @@ Init_socket()
|
|||
|
||||
rb_cTCPSocket = rb_define_class("TCPSocket", rb_cIPSocket);
|
||||
rb_define_global_const("TCPsocket", rb_cTCPSocket);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "open", tcp_s_open, 2);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "new", tcp_s_open, 2);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "open", tcp_s_open, -1);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "new", tcp_s_open, -1);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "gethostbyname", tcp_s_gethostbyname, 1);
|
||||
|
||||
#ifdef SOCKS
|
||||
|
|
2
file.c
2
file.c
|
@ -1252,7 +1252,7 @@ rb_file_s_expand_path(argc, argv)
|
|||
}
|
||||
#if defined DOSISH
|
||||
/* skip drive letter */
|
||||
else if (isalpha(s[0]) && s[1] == ':' && isdirsep(s[2])) {
|
||||
else if (ISALPHA(s[0]) && s[1] == ':' && isdirsep(s[2])) {
|
||||
while (*s && !isdirsep(*s)) {
|
||||
*p++ = *s++;
|
||||
}
|
||||
|
|
2
gc.c
2
gc.c
|
@ -1215,7 +1215,6 @@ run_final(obj)
|
|||
}
|
||||
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
|
||||
for (i=0; i<RARRAY(table)->len; i++) {
|
||||
printf("n finals=>%d\n", finalizer_table->num_entries);
|
||||
args[0] = RARRAY(table)->ptr[i];
|
||||
rb_protect(run_single_final, (VALUE)args, &status);
|
||||
}
|
||||
|
@ -1244,7 +1243,6 @@ rb_gc_call_finalizer_at_exit()
|
|||
if (FL_TEST(p, FL_FINALIZE)) {
|
||||
FL_UNSET(p, FL_FINALIZE);
|
||||
p->as.basic.klass = 0;
|
||||
printf("%p\n", p);
|
||||
run_final((VALUE)p);
|
||||
}
|
||||
p++;
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
|
||||
for k,v in ENV
|
||||
next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k
|
||||
v = v.gsub(/\\/) {|s| '\\'+s}
|
||||
eval <<EOS
|
||||
$#{k} = %q!#{v}!
|
||||
$#{k} = %q\0#{v}\0
|
||||
trace_var "$#{k}", proc{|v|
|
||||
ENV[%q!#{k}!] = v;
|
||||
$#{k} = %q!#{v}!
|
||||
ENV[%q!#{k}!] = v
|
||||
$#{k} = v
|
||||
if v == nil
|
||||
untrace_var "$#{k}"
|
||||
end
|
||||
|
|
|
@ -62,6 +62,7 @@ shortlen(len, ds)
|
|||
#define TYPE_UCLASS 'C'
|
||||
#define TYPE_OBJECT 'o'
|
||||
#define TYPE_USERDEF 'u'
|
||||
#define TYPE_USRMARHAL 'U'
|
||||
#define TYPE_FLOAT 'f'
|
||||
#define TYPE_BIGNUM 'l'
|
||||
#define TYPE_STRING '"'
|
||||
|
|
|
@ -749,7 +749,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
'("^\\s *def\\s +\\([^( ]+\\)"
|
||||
1 font-lock-function-name-face)
|
||||
;; symbols
|
||||
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
|
||||
'("\\(^\\|[^:]\\)\\(:\\([-+/%&|^~`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|\\[\\]\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b\\)\\)\\)"
|
||||
2 font-lock-reference-face))
|
||||
"*Additional expressions to highlight in ruby mode."))
|
||||
|
||||
|
|
42
parse.y
42
parse.y
|
@ -2545,13 +2545,12 @@ parse_qstring(term, paren)
|
|||
c = '\\';
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
if (term == '\'') {
|
||||
c = '\'';
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
/* fall through */
|
||||
if (c == term || (paren && c == paren)) {
|
||||
tokadd(c);
|
||||
continue;
|
||||
}
|
||||
tokadd('\\');
|
||||
}
|
||||
}
|
||||
|
@ -2606,7 +2605,7 @@ parse_quotedwords(term, paren)
|
|||
c = '\\';
|
||||
break;
|
||||
default:
|
||||
if (c == term) {
|
||||
if (c == term || (paren && c == paren)) {
|
||||
tokadd(c);
|
||||
continue;
|
||||
}
|
||||
|
@ -4436,12 +4435,26 @@ assign_in_cond(node)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
e_option_supplied()
|
||||
{
|
||||
if (strcmp(ruby_sourcefile, "-e") == 0)
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
static void
|
||||
warn_unless_e_option(str)
|
||||
const char *str;
|
||||
{
|
||||
if (strcmp(ruby_sourcefile, "-e") != 0)
|
||||
rb_warning(str);
|
||||
if (e_option_supplied()) rb_warn(str);
|
||||
}
|
||||
|
||||
static void
|
||||
warning_unless_e_option(str)
|
||||
const char *str;
|
||||
{
|
||||
if (e_option_supplied()) rb_warning(str);
|
||||
}
|
||||
|
||||
static NODE*
|
||||
|
@ -4456,12 +4469,15 @@ cond0(node, logop)
|
|||
case NODE_DSTR:
|
||||
if (logop) break;
|
||||
nd_set_type(node, NODE_DREGX);
|
||||
/* fall through */
|
||||
warn_unless_e_option("string literal in condition");
|
||||
goto dregex;
|
||||
|
||||
case NODE_DREGX:
|
||||
case NODE_DREGX_ONCE:
|
||||
warning_unless_e_option("regex literal in condition");
|
||||
dregex:
|
||||
local_cnt('_');
|
||||
local_cnt('~');
|
||||
warn_unless_e_option("string/regex literal in condition");
|
||||
return NEW_MATCH2(node, NEW_GVAR(rb_intern("$_")));
|
||||
|
||||
case NODE_DOT2:
|
||||
|
@ -4477,20 +4493,22 @@ cond0(node, logop)
|
|||
case NODE_STR:
|
||||
if (logop) break;
|
||||
node->nd_lit = rb_reg_new(RSTRING(node->nd_lit)->ptr,RSTRING(node->nd_lit)->len,0);
|
||||
warn_unless_e_option("string literal in condition");
|
||||
goto regexp;
|
||||
|
||||
case NODE_LIT:
|
||||
switch (TYPE(node->nd_lit)) {
|
||||
case T_REGEXP:
|
||||
warning_unless_e_option("regex literal in condition");
|
||||
regexp:
|
||||
nd_set_type(node, NODE_MATCH);
|
||||
local_cnt('_');
|
||||
local_cnt('~');
|
||||
warn_unless_e_option("string/regex literal in condition");
|
||||
break;
|
||||
|
||||
case T_FIXNUM:
|
||||
if (logop) break;
|
||||
if (!e_option_supplied()) break;
|
||||
warn_unless_e_option("integer literal in condition");
|
||||
return call_op(node,tEQ,1,NEW_GVAR(rb_intern("$.")));
|
||||
}
|
||||
|
|
12
re.c
12
re.c
|
@ -363,6 +363,14 @@ rb_reg_casefold_p(re)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_reg_options_m(re)
|
||||
VALUE re;
|
||||
{
|
||||
rb_reg_check(re);
|
||||
return INT2NUM(RREGEXP(re)->ptr->options);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_reg_kcode_m(re)
|
||||
VALUE re;
|
||||
|
@ -915,8 +923,7 @@ rb_reg_equal(re1, re2)
|
|||
if (min > RREGEXP(re2)->len) min = RREGEXP(re2)->len;
|
||||
if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, min) == 0 &&
|
||||
rb_reg_cur_kcode(re1) == rb_reg_cur_kcode(re2) &&
|
||||
!((RREGEXP(re1)->ptr->options & RE_OPTION_IGNORECASE) ^
|
||||
(RREGEXP(re2)->ptr->options & RE_OPTION_IGNORECASE))) {
|
||||
RREGEXP(re1)->ptr->options == RREGEXP(re2)->ptr->options) {
|
||||
return Qtrue;
|
||||
}
|
||||
return Qfalse;
|
||||
|
@ -1379,6 +1386,7 @@ Init_Regexp()
|
|||
rb_define_method(rb_cRegexp, "inspect", rb_reg_inspect, 0);
|
||||
rb_define_method(rb_cRegexp, "source", rb_reg_source, 0);
|
||||
rb_define_method(rb_cRegexp, "casefold?", rb_reg_casefold_p, 0);
|
||||
rb_define_method(rb_cRegexp, "options", rb_reg_options_m, 0);
|
||||
rb_define_method(rb_cRegexp, "kcode", rb_reg_kcode_m, 0);
|
||||
|
||||
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE));
|
||||
|
|
2
string.c
2
string.c
|
@ -1662,7 +1662,7 @@ rb_str_upcase_bang(str)
|
|||
if (ismbchar(*s)) {
|
||||
s+=mbclen(*s) - 1;
|
||||
}
|
||||
else if (islower(*s)) {
|
||||
else if (ISLOWER(*s)) {
|
||||
*s = toupper(*s);
|
||||
modify = 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.0"
|
||||
#define RUBY_RELEASE_DATE "2001-01-31"
|
||||
#define RUBY_RELEASE_DATE "2001-02-02"
|
||||
#define RUBY_VERSION_CODE 170
|
||||
#define RUBY_RELEASE_CODE 20010131
|
||||
#define RUBY_RELEASE_CODE 20010202
|
||||
|
|
|
@ -779,7 +779,7 @@ char *cmd;
|
|||
strcpy(cmd2, cmd);
|
||||
a = argv;
|
||||
for (s = cmd2; *s;) {
|
||||
while (*s && isspace(*s)) s++;
|
||||
while (*s && ISSPACE(*s)) s++;
|
||||
if (*s == '"') {
|
||||
quote = *s;
|
||||
*(a++) = s++;
|
||||
|
@ -797,7 +797,7 @@ char *cmd;
|
|||
}
|
||||
else if (*s) {
|
||||
*(a++) = s;
|
||||
while (*s && !isspace(*s)) s++;
|
||||
while (*s && !ISSPACE(*s)) s++;
|
||||
}
|
||||
if (*s)
|
||||
*s++ = '\0';
|
||||
|
@ -1083,7 +1083,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
|
|||
//
|
||||
|
||||
ptr = cmdline+(cmdlen - 1);
|
||||
while(ptr >= cmdline && isspace(*ptr))
|
||||
while(ptr >= cmdline && ISSPACE(*ptr))
|
||||
--ptr;
|
||||
*++ptr = '\0';
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
|
|||
// zap any leading whitespace
|
||||
//
|
||||
|
||||
while(isspace(*ptr))
|
||||
while(ISSPACE(*ptr))
|
||||
ptr++;
|
||||
base = ptr;
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ opendir(char *filename)
|
|||
|
||||
if ((stat (filename, &sbuf) < 0 ||
|
||||
sbuf.st_mode & _S_IFDIR == 0) &&
|
||||
(!isalpha(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
|
||||
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
|
||||
((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue