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

* re.c (Init_Regexp): to_s to be alias to inspect.

* parse.y (yylex): should support 'keyword='.

* ruby.c (proc_options): should not adjust argc/argv if -e option
  is supplied.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-09-05 06:54:57 +00:00
parent 393f665e33
commit 2e2786ccab
9 changed files with 232 additions and 47 deletions

View file

@ -1,7 +1,20 @@
Tue Sep 4 01:03:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (Init_Regexp): to_s to be alias to inspect.
Mon Sep 3 22:46:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (yylex): should support 'keyword='.
Mon Sep 3 20:26:08 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* intern.h (rb_find_file_ext): changed from rb_find_file_noext().
Mon Sep 3 15:12:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* ruby.c (proc_options): should not adjust argc/argv if -e option
is supplied.
Mon Sep 3 14:11:17 2001 Akinori MUSHA <knu@iDaemons.org>
* error.c: unbreak the build on *BSD with gcc 3.0.1 by removing
@ -171,6 +184,12 @@ Fri Aug 17 00:49:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (parse_regx): handle backslash escaping of delimiter here.
Thu Aug 16 23:03:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
* io.c: prevent recursive malloc calls on NEC UX/4800.
* ext/socket/socket.c: ditto.
Thu Aug 16 13:54:04 2001 Usaku Nakamura <usa@ruby-lang.org>
* ext/socket/socket.c (s_recvfrom): fix typo.

10
ToDo
View file

@ -50,7 +50,6 @@ Hacking Interpreter
* Built-in Interactive Ruby.
* trap every method invocation, which can be enabled by e.g. trap_call :method.
* unify Errno exceptions of same errno, or new exception comparison scheme.
* signal list (Signal::trap, Signal::list??).
* 2.times{|i| if i==0 then a = 15 else puts eval("a") end} should print nil.
Standard Libraries
@ -63,7 +62,9 @@ Standard Libraries
- Process::Status
- File::lchown, File::lchmod; xxx - still need work for non existing platforms
- move Time::times to Process.
* Enumerable#sort_by for Schwartzian transformation
- Enumerable#sort_by for Schwartzian transformation
- fork_and_kill_other_threads.
- signal list (Signal::trap, Signal::list).
* String#scanf(?)
* Object#fmt(?)
* Integer#{bin,oct,hex,heX}
@ -77,17 +78,16 @@ Standard Libraries
* introduce Boolean class; super of TrueClass, FalseClass
* synchronized method - synchronized{...}, synchronized :foo, :bar
* Array#&, Array#| to allow duplication. ???
* fork_and_kill_other_threads.
* 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)
* warn, warning for Ruby level
* hash etc. should handle self referenceing array/hash
* move NameError under StandardError.
* library to load per-user profile seeking .ruby_profile or ruby.ini file.
* warning framework
* warning framework (warn, warning for Ruby level)
* marshal should not depend on sprintf/strtod (works bad for locale).
* ternary arg - a.pow(b,c) == a**b%c
Extension Libraries

View file

@ -437,8 +437,8 @@ s_recvfrom(sock, argc, argv, from)
str = rb_tainted_str_new(0, NUM2INT(len));
rb_thread_wait_fd(fd);
retry:
rb_thread_wait_fd(fd);
TRAP_BEG;
RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags,
(struct sockaddr*)buf, &alen);
@ -454,7 +454,6 @@ s_recvfrom(sock, argc, argv, from)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
rb_thread_wait_fd(fd);
goto retry;
}
rb_sys_fail("recvfrom(2)");
@ -1102,9 +1101,13 @@ s_accept(class, fd, sockaddr, len)
rb_secure(3);
retry:
rb_thread_wait_fd(fd);
#if defined(_nec_ews)
fd2 = accept(fd, sockaddr, len);
#else
TRAP_BEG;
fd2 = accept(fd, sockaddr, len);
TRAP_END;
#endif
if (fd2 < 0) {
switch (errno) {
case EMFILE:
@ -1121,7 +1124,6 @@ s_accept(class, fd, sockaddr, len)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
rb_thread_wait_fd(fd);
goto retry;
}
rb_sys_fail(0);
@ -2313,6 +2315,165 @@ Init_socket()
sock_define_const("SOL_UDP", SOL_UDP);
#endif
#ifdef IPPROTO_IP
sock_define_const("IPPROTO_IP", IPPROTO_IP);
#else
sock_define_const("IPPROTO_IP", 0);
#endif
#ifdef IPPROTO_ICMP
sock_define_const("IPPROTO_ICMP", IPPROTO_ICMP);
#else
sock_define_const("IPPROTO_ICMP", 1);
#endif
#ifdef IPPROTO_IGMP
sock_define_const("IPPROTO_IGMP", IPPROTO_IGMP);
#endif
#ifdef IPPROTO_GGP
sock_define_const("IPPROTO_GGP", IPPROTO_GGP);
#endif
#ifdef IPPROTO_TCP
sock_define_const("IPPROTO_TCP", IPPROTO_TCP);
#else
sock_define_const("IPPROTO_TCP", 6);
#endif
#ifdef IPPROTO_EGP
sock_define_const("IPPROTO_EGP", IPPROTO_EGP);
#endif
#ifdef IPPROTO_PUP
sock_define_const("IPPROTO_PUP", IPPROTO_PUP);
#endif
#ifdef IPPROTO_UDP
sock_define_const("IPPROTO_UDP", IPPROTO_UDP);
#else
sock_define_const("IPPROTO_UDP", 17);
#endif
#ifdef IPPROTO_IDP
sock_define_const("IPPROTO_IDP", IPPROTO_IDP);
#endif
#ifdef IPPROTO_HELLO
sock_define_const("IPPROTO_HELLO", IPPROTO_HELLO);
#endif
#ifdef IPPROTO_ND
sock_define_const("IPPROTO_ND", IPPROTO_ND);
#endif
#ifdef IPPROTO_TP
sock_define_const("IPPROTO_TP", IPPROTO_TP);
#endif
#ifdef IPPROTO_XTP
sock_define_const("IPPROTO_XTP", IPPROTO_XTP);
#endif
#ifdef IPPROTO_EON
sock_define_const("IPPROTO_EON", IPPROTO_EON);
#endif
#ifdef IPPROTO_BIP
sock_define_const("IPPROTO_BIP", IPPROTO_BIP);
#endif
/**/
#ifdef IPPROTO_RAW
sock_define_const("IPPROTO_RAW", IPPROTO_RAW);
#else
sock_define_const("IPPROTO_RAW", 255);
#endif
#ifdef IPPROTO_MAX
sock_define_const("IPPROTO_MAX", IPPROTO_MAX);
#endif
/* Some port configuration */
#ifdef IPPORT_RESERVED
sock_define_const("IPPORT_RESERVED", IPPORT_RESERVED);
#else
sock_define_const("IPPORT_RESERVED", 1024);
#endif
#ifdef IPPORT_USERRESERVED
sock_define_const("IPPORT_USERRESERVED", IPPORT_USERRESERVED);
#else
sock_define_const("IPPORT_USERRESERVED", 5000);
#endif
/* Some reserved IP v.4 addresses */
#ifdef INADDR_ANY
sock_define_const("INADDR_ANY", INADDR_ANY);
#else
sock_define_const("INADDR_ANY", 0x00000000);
#endif
#ifdef INADDR_BROADCAST
sock_define_const("INADDR_BROADCAST", INADDR_BROADCAST);
#else
sock_define_const("INADDR_BROADCAST", 0xffffffff);
#endif
#ifdef INADDR_LOOPBACK
sock_define_const("INADDR_LOOPBACK", INADDR_LOOPBACK);
#else
sock_define_const("INADDR_LOOPBACK", 0x7F000001);
#endif
#ifdef INADDR_UNSPEC_GROUP
sock_define_const("INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP);
#else
sock_define_const("INADDR_UNSPEC_GROUP", 0xe0000000);
#endif
#ifdef INADDR_ALLHOSTS_GROUP
sock_define_const("INADDR_ALLHOSTS_GROUP", INADDR_ALLHOSTS_GROUP);
#else
sock_define_const("INADDR_ALLHOSTS_GROUP", 0xe0000001);
#endif
#ifdef INADDR_MAX_LOCAL_GROUP
sock_define_const("INADDR_MAX_LOCAL_GROUP", INADDR_MAX_LOCAL_GROUP);
#else
sock_define_const("INADDR_MAX_LOCAL_GROUP", 0xe00000ff);
#endif
#ifdef INADDR_NONE
sock_define_const("INADDR_NONE", INADDR_NONE);
#else
sock_define_const("INADDR_NONE", 0xffffffff);
#endif
/* IP [gs]etsockopt options */
#ifdef IP_OPTIONS
sock_define_const("IP_OPTIONS", IP_OPTIONS);
#endif
#ifdef IP_HDRINCL
sock_define_const("IP_HDRINCL", IP_HDRINCL);
#endif
#ifdef IP_TOS
sock_define_const("IP_TOS", IP_TOS);
#endif
#ifdef IP_TTL
sock_define_const("IP_TTL", IP_TTL);
#endif
#ifdef IP_RECVOPTS
sock_define_const("IP_RECVOPTS", IP_RECVOPTS);
#endif
#ifdef IP_RECVRETOPTS
sock_define_const("IP_RECVRETOPTS", IP_RECVRETOPTS);
#endif
#ifdef IP_RECVDSTADDR
sock_define_const("IP_RECVDSTADDR", IP_RECVDSTADDR);
#endif
#ifdef IP_RETOPTS
sock_define_const("IP_RETOPTS", IP_RETOPTS);
#endif
#ifdef IP_MULTICAST_IF
sock_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
#endif
#ifdef IP_MULTICAST_TTL
sock_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
#endif
#ifdef IP_MULTICAST_LOOP
sock_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
#endif
#ifdef IP_ADD_MEMBERSHIP
sock_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
#endif
#ifdef IP_DROP_MEMBERSHIP
sock_define_const("IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP);
#endif
#ifdef IP_DEFAULT_MULTICAST_TTL
sock_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
#endif
#ifdef IP_DEFAULT_MULTICAST_LOOP
sock_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
#endif
#ifdef IP_MAX_MEMBERSHIPS
sock_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
#endif
#ifdef SO_DEBUG
sock_define_const("SO_DEBUG", SO_DEBUG);
#endif

View file

@ -2233,7 +2233,7 @@ class TkObject<TkKernel
def cget(slot)
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
tk_call path, 'cget', "-#{slot}"
else
tk_tcl2ruby tk_call path, 'cget', "-#{slot}"
@ -2273,7 +2273,7 @@ class TkObject<TkKernel
else
if slot
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_send('configure', "-#{slot}") )
else
conf = tk_split_list(tk_send('configure', "-#{slot}") )
@ -2285,7 +2285,7 @@ class TkObject<TkKernel
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')

View file

@ -279,7 +279,7 @@ class TkText<TkTextWin
def tag_cget(tag, key)
case key
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
tk_call @path, 'tag', 'cget', tag, "-#{key}"
else
tk_tcl2ruby tk_call @path, 'tag', 'cget', tag, "-#{key}"
@ -308,7 +308,7 @@ class TkText<TkTextWin
def tag_configinfo(tag, key=nil)
if key
case key
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_send('tag','configure',tag,"-#{key}"))
else
conf = tk_split_list(tk_send('tag','configure',tag,"-#{key}"))
@ -320,7 +320,7 @@ class TkText<TkTextWin
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')
@ -712,7 +712,7 @@ class TkTextTag<TkObject
def cget(key)
case key
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
else
tk_tcl2ruby tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
@ -896,7 +896,7 @@ class TkTextWindow<TkObject
def cget(slot)
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
else
tk_tcl2ruby tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
@ -947,7 +947,7 @@ class TkTextWindow<TkObject
def configinfo(slot = nil)
if slot
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_call @t.path, 'window', 'configure',
@index, "-#{slot}")
else
@ -962,7 +962,7 @@ class TkTextWindow<TkObject
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')
@ -1017,7 +1017,7 @@ class TkTextImage<TkObject
def cget(slot)
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
else
tk_tcl2ruby tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
@ -1046,7 +1046,7 @@ class TkTextImage<TkObject
def configinfo(slot = nil)
if slot
case slot
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_call @t.path, 'image', 'configure',
@index, "-#{slot}")
else
@ -1061,7 +1061,7 @@ class TkTextImage<TkObject
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'flie'
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')

3
io.c
View file

@ -27,7 +27,7 @@
# define NO_LONG_FNAME
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(sun)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(sun) || defined(_nec_ews)
# define USE_SETVBUF
#endif
@ -1380,6 +1380,7 @@ rb_io_mode_binmode(mode)
static char*
rb_io_binmode_mode(flags, mode)
int flags;
char *mode;
{
char *p = mode;

47
parse.y
View file

@ -2897,7 +2897,6 @@ yylex()
register int c;
int space_seen = 0;
int cmd_state;
struct kwtable *kw;
cmd_state = command_start;
command_start = Qfalse;
@ -3714,8 +3713,33 @@ yylex()
else
result = tIVAR;
break;
default:
if (toklast() == '!' || toklast() == '?') {
result = tFID;
}
else {
if (lex_state == EXPR_FNAME) {
if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
(!peek('=') || lex_p + 1 < lex_pend && lex_p[1] == '>')) {
result = tIDENTIFIER;
tokadd(c);
}
else {
pushback(c);
}
}
if (result == 0 && ISUPPER(tok()[0])) {
result = tCONSTANT;
}
else {
result = tIDENTIFIER;
}
}
if (lex_state != EXPR_DOT) {
struct kwtable *kw;
/* See if it is a reserved word. */
kw = rb_reserved_word(tok(), toklen());
if (kw) {
@ -3740,27 +3764,6 @@ yylex()
}
}
if (toklast() == '!' || toklast() == '?') {
result = tFID;
}
else {
if (lex_state == EXPR_FNAME) {
if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
(!peek('=') || lex_p + 1 < lex_pend && lex_p[1] == '>')) {
result = tIDENTIFIER;
tokadd(c);
}
else {
pushback(c);
}
}
if (result == 0 && ISUPPER(tok()[0])) {
result = tCONSTANT;
}
else {
result = tIDENTIFIER;
}
}
if (lex_state == EXPR_BEG ||
lex_state == EXPR_DOT ||
lex_state == EXPR_ARG ||

3
re.c
View file

@ -1397,6 +1397,7 @@ Init_Regexp()
rb_define_method(rb_cRegexp, "===", rb_reg_match, 1);
rb_define_method(rb_cRegexp, "~", rb_reg_match2, 0);
rb_define_method(rb_cRegexp, "match", rb_reg_match_m, 1);
rb_define_method(rb_cRegexp, "to_s", rb_reg_inspect, 0);
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);
@ -1425,6 +1426,6 @@ Init_Regexp()
rb_define_method(rb_cMatch, "pre_match", rb_reg_match_pre, 0);
rb_define_method(rb_cMatch, "post_match", rb_reg_match_post, 0);
rb_define_method(rb_cMatch, "to_s", match_to_s, 0);
rb_define_method(rb_cMatch, "string", match_string, 0);
rb_define_method(rb_cMatch, "inspect", rb_any_to_s, 0);
rb_define_method(rb_cMatch, "string", match_string, 0);
}

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.1"
#define RUBY_RELEASE_DATE "2001-09-03"
#define RUBY_RELEASE_DATE "2001-09-05"
#define RUBY_VERSION_CODE 171
#define RUBY_RELEASE_CODE 20010903
#define RUBY_RELEASE_CODE 20010905