mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-05-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3e51a5b1b5
commit
a62935cf06
14 changed files with 260 additions and 108 deletions
|
@ -25,6 +25,15 @@ Wed May 17 00:40:15 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
|||
|
||||
* win32/ruby.def: add symbol "rb_big_divmod".
|
||||
|
||||
May 16 19:45:32 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||
|
||||
* intern.h: use EXTERN instead of extern.
|
||||
|
||||
* win32/ruby.h: add rb_defout, rb_stdout, ruby_errinfo,
|
||||
ruby_sourceline, ruby_sourcefile to work with eruby
|
||||
reported by Hiroshi Saito <HiroshiSaito@pob.org>.
|
||||
Export both ruby_xmalloc and xmalloc etc.
|
||||
|
||||
Tue May 16 17:00:05 2000 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
|
||||
|
||||
* eval.c (rb_thread_select): should check whether fds are null.
|
||||
|
|
11
ToDo
11
ToDo
|
@ -87,6 +87,7 @@ Extension Libraries
|
|||
Ruby Libraries
|
||||
|
||||
- net/http.rb
|
||||
* add uri.rb
|
||||
* urllib.rb, nttplib.rb, etc.
|
||||
* format like perl's
|
||||
|
||||
|
@ -99,3 +100,13 @@ Misc
|
|||
|
||||
- publish Ruby books
|
||||
* publish Ruby books in English
|
||||
|
||||
Things To Do Before 1.6
|
||||
|
||||
* fix spec. for the following:
|
||||
|
||||
* alternative for $! (exception? in? into? =>?)
|
||||
* alternative for interator?
|
||||
* regex - /p, /m
|
||||
* odd? even?
|
||||
* mkmf.rb - create_makefile("net/socket")
|
||||
|
|
48
eval.c
48
eval.c
|
@ -67,6 +67,8 @@ struct timeval {
|
|||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
VALUE rb_cProc;
|
||||
static VALUE rb_cBinding;
|
||||
static VALUE proc_call _((VALUE,VALUE));
|
||||
|
@ -6284,6 +6286,7 @@ struct thread {
|
|||
fd_set readfds;
|
||||
fd_set writefds;
|
||||
fd_set exceptfds;
|
||||
int select_value;
|
||||
double delay;
|
||||
thread_t join;
|
||||
|
||||
|
@ -6681,6 +6684,23 @@ intersect_fds(dst, src, max)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static int
|
||||
find_bad_fds(dst, src, max)
|
||||
fd_set *dst, *src;
|
||||
int max;
|
||||
{
|
||||
struct stat s;
|
||||
int i, test = Qfalse;
|
||||
|
||||
for (i=0; i<=max; i++) {
|
||||
if (FD_ISSET(i, src) && !FD_ISSET(i, dst)) {
|
||||
FD_CLR(i, src);
|
||||
test = Qtrue;
|
||||
}
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
void
|
||||
rb_thread_schedule()
|
||||
{
|
||||
|
@ -6738,7 +6758,7 @@ rb_thread_schedule()
|
|||
copy_fds(&exceptfds, &th->exceptfds, th->fd);
|
||||
if (max < th->fd) max = th->fd;
|
||||
need_select = 1;
|
||||
th->fd = 0;
|
||||
th->select_value = 0;
|
||||
}
|
||||
if (th->wait_for & WAIT_TIME) {
|
||||
if (th->delay <= now) {
|
||||
|
@ -6777,15 +6797,21 @@ rb_thread_schedule()
|
|||
n = select(max+1, &readfds, &writefds, &exceptfds, delay_ptr);
|
||||
if (n < 0) {
|
||||
if (rb_trap_pending) rb_trap_exec();
|
||||
switch (errno) {
|
||||
case EBADF:
|
||||
/* xxx */
|
||||
case ENOMEM:
|
||||
n = 0;
|
||||
break;
|
||||
default:
|
||||
goto select_err;
|
||||
if (errno = EINTR) goto select_err;
|
||||
FOREACH_THREAD(th) {
|
||||
if (th->wait_for & WAIT_SELECT) {
|
||||
int v = 0;
|
||||
|
||||
v |= find_bad_fds(&readfds, &th->readfds, th->fd);
|
||||
v |= find_bad_fds(&writefds, &th->writefds, th->fd);
|
||||
v |= find_bad_fds(&exceptfds, &th->exceptfds, th->fd);
|
||||
if (v) {
|
||||
th->select_value = n;
|
||||
n = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
END_FOREACH(th);
|
||||
}
|
||||
if (n > 0) {
|
||||
/* Some descriptors are ready.
|
||||
|
@ -6809,7 +6835,7 @@ rb_thread_schedule()
|
|||
intersect_fds(&readfds, &th->readfds, max);
|
||||
intersect_fds(&writefds, &th->writefds, max);
|
||||
intersect_fds(&exceptfds, &th->exceptfds, max);
|
||||
th->fd = n;
|
||||
th->select_value = n;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
@ -7018,7 +7044,7 @@ rb_thread_select(max, read, write, except, timeout)
|
|||
if (read) *read = curr_thread->readfds;
|
||||
if (write) *write = curr_thread->writefds;
|
||||
if (except) *except = curr_thread->exceptfds;
|
||||
return curr_thread->fd;
|
||||
return curr_thread->select_value;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#md5
|
||||
#pty
|
||||
#sdbm
|
||||
#socket
|
||||
socket
|
||||
#tk
|
||||
#tcltklib
|
||||
#gtk
|
||||
|
|
|
@ -2,9 +2,10 @@ require "mkmf"
|
|||
|
||||
dir_config("readline")
|
||||
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
|
||||
have_library("termcap", "tgetnum") or
|
||||
have_library("curses", "tgetnum") or
|
||||
have_library("ncurses", "tgetnum")
|
||||
have_library("ncurses", "tgetnum") or
|
||||
have_library("termcap", "tgetnum") or
|
||||
have_library("curses", "tgetnum")
|
||||
|
||||
if have_header("readline/readline.h") and
|
||||
have_header("readline/history.h") and
|
||||
have_library("readline", "readline")
|
||||
|
|
|
@ -99,6 +99,10 @@ EOF
|
|||
$ipv6lib="inet6"
|
||||
$ipv6libdir="/usr/local/v6/lib"
|
||||
$CFLAGS="-DINET6 "+$CFLAGS
|
||||
else
|
||||
$ipv6lib=with_config("ipv6-lib", nil)
|
||||
$ipv6libdir=with_config("ipv6-libdir", nil)
|
||||
$CFLAGS="-DINET6 "+$CFLAGS
|
||||
end
|
||||
|
||||
if $ipv6lib
|
||||
|
@ -273,6 +277,20 @@ EOS
|
|||
exit
|
||||
end
|
||||
|
||||
case with_config("ipv6-lookup-order", "INET")
|
||||
when "INET"
|
||||
$CFLAGS="-DDEFAULT_LOOKUP_ORDER_INET "+$CFLAGS
|
||||
when "INET6"
|
||||
$CFLAGS="-DDEFAULT_LOOKUP_ORDER_INET6 "+$CFLAGS
|
||||
when "UNSPEC"
|
||||
$CFLAGS="-DDEFAULT_LOOKUP_ORDER_UNSPEC "+$CFLAGS
|
||||
else
|
||||
print <<EOS
|
||||
|
||||
Fatal: invalid --ipv6-lookup-order (expected INET, INET6 or UNSPEC)
|
||||
EOS
|
||||
exit
|
||||
end
|
||||
|
||||
$objs = ["socket.#{$OBJEXT}"]
|
||||
|
||||
|
|
|
@ -104,6 +104,91 @@ struct sockaddr_storage {
|
|||
};
|
||||
#endif
|
||||
|
||||
#define LOOKUP_ORDER_INET 0
|
||||
#define LOOKUP_ORDER_INET6 1
|
||||
#define LOOKUP_ORDER_UNSPEC 2
|
||||
|
||||
#if defined(DEFAULT_LOOKUP_ORDER_UNSPEC)
|
||||
# define LOOKUP_ORDER_DEFAULT LOOKUP_ORDER_UNSPEC
|
||||
#elif defined(DEFAULT_LOOKUP_ORDER_INET)
|
||||
# define LOOKUP_ORDER_DEFAULT LOOKUP_ORDER_INET
|
||||
#elif defined(DEFAULT_LOOKUP_ORDER_INET6)
|
||||
# define LOOKUP_ORDER_DEFAULT LOOKUP_ORDER_INET6
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
#define LOOKUP_ORDERS 3
|
||||
int lookup_order_table[LOOKUP_ORDERS][LOOKUP_ORDERS] = {
|
||||
{PF_UNSPEC, PF_UNSPEC, PF_UNSPEC}, /* 0:unspec */
|
||||
{PF_INET, PF_INET6, PF_UNSPEC}, /* 1:inet inet6 */
|
||||
{PF_INET6, PF_INET, PF_UNSPEC} /* 2:inet6 inet */
|
||||
};
|
||||
|
||||
static int lookup_order = LOOKUP_ORDER_DEFAULT;
|
||||
|
||||
static VALUE
|
||||
lookup_order_get(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX(lookup_order);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
lookup_order_set(self, order)
|
||||
VALUE self, order;
|
||||
{
|
||||
int n = NUM2INT(order);
|
||||
|
||||
if (n < 0 || LOOKUP_ORDERS <= n) {
|
||||
rb_raise(rb_eRuntimeError, "invalid value for lookup_order");
|
||||
}
|
||||
lookup_order = n;
|
||||
return order;
|
||||
}
|
||||
|
||||
static int
|
||||
rb_getaddrinfo(nodename, servname, hints, res)
|
||||
char *nodename;
|
||||
char *servname;
|
||||
struct addrinfo *hints;
|
||||
struct addrinfo **res;
|
||||
{
|
||||
struct addrinfo tmp_hints;
|
||||
int i, af, error;
|
||||
|
||||
for (i = 0; i < LOOKUP_ORDERS; i++) {
|
||||
af = lookup_order_table[lookup_order][i];
|
||||
MEMCPY(&tmp_hints, hints, struct addrinfo, 1);
|
||||
tmp_hints.ai_family = af;
|
||||
error = getaddrinfo(nodename, servname, &tmp_hints, res);
|
||||
if (error) {
|
||||
if (tmp_hints.ai_family == PF_UNSPEC) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
lookup_order_get(self)
|
||||
VALUE self;
|
||||
{
|
||||
return INT2FIX(LOOKUP_ORDER_DEFAULT);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
lookup_order_set(self, order)
|
||||
VALUE self, order;
|
||||
{
|
||||
return order;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NT
|
||||
static void
|
||||
sock_finalize(fptr)
|
||||
|
@ -553,7 +638,11 @@ ip_addrsetup(host, port)
|
|||
MEMZERO(&hints, struct addrinfo, 1);
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
#ifndef INET6
|
||||
error = getaddrinfo(hostp, portp, &hints, &res);
|
||||
#else
|
||||
error = rb_getaddrinfo(hostp, portp, &hints, &res);
|
||||
#endif
|
||||
if (error) {
|
||||
if (hostp && hostp[strlen(hostp)-1] == '\n') {
|
||||
rb_raise(rb_eSocket, "newline at the end of hostname");
|
||||
|
@ -637,6 +726,17 @@ ruby_socket(domain, type, proto)
|
|||
return fd;
|
||||
}
|
||||
|
||||
static void
|
||||
thread_write_select(fd)
|
||||
int fd;
|
||||
{
|
||||
fd_set fds;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
rb_thread_select(fd+1, 0, &fds, 0, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
ruby_connect(fd, sockaddr, len, socks)
|
||||
int fd;
|
||||
|
@ -681,7 +781,7 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||
#ifdef EINPROGRESS
|
||||
case EINPROGRESS:
|
||||
#endif
|
||||
rb_thread_fd_writable(fd);
|
||||
thread_write_select(fd);
|
||||
continue;
|
||||
|
||||
#ifdef EISCONN
|
||||
|
@ -733,7 +833,11 @@ open_inet(class, h, serv, type)
|
|||
if (type == INET_SERVER) {
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
}
|
||||
#ifndef INET6
|
||||
error = getaddrinfo(host, portp, &hints, &res0);
|
||||
#else
|
||||
error = rb_getaddrinfo(host, portp, &hints, &res0);
|
||||
#endif
|
||||
if (error) {
|
||||
rb_raise(rb_eSocket, "%s", gai_strerror(error));
|
||||
}
|
||||
|
@ -1205,7 +1309,7 @@ udp_send(argc, argv, sock)
|
|||
#if EAGAIN != EWOULDBLOCK
|
||||
case EAGAIN:
|
||||
#endif
|
||||
thread_write_select(fileno(f));
|
||||
rb_thread_fd_writable(fileno(f));
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
@ -1728,8 +1832,7 @@ sock_s_getaddrinfo(argc, argv)
|
|||
int error;
|
||||
|
||||
host = port = family = socktype = protocol = flags = Qnil;
|
||||
rb_scan_args(argc, argv, "24", &host, &port, &family, &socktype, &protocol,
|
||||
&flags);
|
||||
rb_scan_args(argc, argv, "24", &host, &port, &family, &socktype, &protocol, &flags);
|
||||
if (NIL_P(host)) {
|
||||
hptr = NULL;
|
||||
}
|
||||
|
@ -1755,9 +1858,11 @@ sock_s_getaddrinfo(argc, argv)
|
|||
if (!NIL_P(family)) {
|
||||
hints.ai_family = NUM2INT(family);
|
||||
}
|
||||
#ifndef INET6
|
||||
else {
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
}
|
||||
#endif
|
||||
if (!NIL_P(socktype)) {
|
||||
hints.ai_socktype = NUM2INT(socktype);
|
||||
}
|
||||
|
@ -1767,7 +1872,16 @@ sock_s_getaddrinfo(argc, argv)
|
|||
if (!NIL_P(flags)) {
|
||||
hints.ai_flags = NUM2INT(flags);
|
||||
}
|
||||
#ifndef INET6
|
||||
error = getaddrinfo(hptr, pptr, &hints, &res);
|
||||
#else
|
||||
if (!NIL_P(family)) {
|
||||
error = getaddrinfo(hptr, pptr, &hints, &res);
|
||||
}
|
||||
else {
|
||||
error = rb_getaddrinfo(hptr, pptr, &hints, &res);
|
||||
}
|
||||
#endif
|
||||
if (error) {
|
||||
rb_raise(rb_eSocket, "%s", gai_strerror(error));
|
||||
}
|
||||
|
@ -2040,6 +2154,12 @@ Init_socket()
|
|||
sock_define_const("PF_INET6", PF_INET6);
|
||||
#endif
|
||||
|
||||
sock_define_const("LOOKUP_INET", LOOKUP_ORDER_INET);
|
||||
sock_define_const("LOOKUP_INET6", LOOKUP_ORDER_INET6);
|
||||
sock_define_const("LOOKUP_UNSPEC", LOOKUP_ORDER_UNSPEC);
|
||||
rb_define_singleton_method(rb_cBasicSocket, "lookup_order", lookup_order_get, 0);
|
||||
rb_define_singleton_method(rb_cBasicSocket, "lookup_order=", lookup_order_set, 1);
|
||||
|
||||
sock_define_const("MSG_OOB", MSG_OOB);
|
||||
#ifdef MSG_PEEK
|
||||
sock_define_const("MSG_PEEK", MSG_PEEK);
|
||||
|
|
14
intern.h
14
intern.h
|
@ -189,11 +189,11 @@ VALUE rb_hash_aset _((VALUE, VALUE, VALUE));
|
|||
int rb_path_check _((char *));
|
||||
int rb_env_path_tainted _((void));
|
||||
/* io.c */
|
||||
extern VALUE rb_fs;
|
||||
extern VALUE rb_output_fs;
|
||||
extern VALUE rb_rs;
|
||||
extern VALUE rb_default_rs;
|
||||
extern VALUE rb_output_rs;
|
||||
EXTERN VALUE rb_fs;
|
||||
EXTERN VALUE rb_output_fs;
|
||||
EXTERN VALUE rb_rs;
|
||||
EXTERN VALUE rb_default_rs;
|
||||
EXTERN VALUE rb_output_rs;
|
||||
VALUE rb_io_write _((VALUE, VALUE));
|
||||
VALUE rb_io_gets _((VALUE));
|
||||
VALUE rb_io_getc _((VALUE));
|
||||
|
@ -230,8 +230,8 @@ VALUE rb_Float _((VALUE));
|
|||
VALUE rb_String _((VALUE));
|
||||
VALUE rb_Array _((VALUE));
|
||||
/* parse.y */
|
||||
extern int ruby_sourceline;
|
||||
extern char *ruby_sourcefile;
|
||||
EXTERN int ruby_sourceline;
|
||||
EXTERN char *ruby_sourcefile;
|
||||
#define yyparse rb_yyparse
|
||||
#define yylex rb_yylex
|
||||
#define yyerror rb_yyerror
|
||||
|
|
2
parse.y
2
parse.y
|
@ -2257,6 +2257,8 @@ parse_regx(term, paren)
|
|||
options |= RE_OPTION_EXTENDED;
|
||||
break;
|
||||
case 'p': /* /p is obsolete, works as /m */
|
||||
yyerror("/p option is obsolete; use /m\n\tnote: /m does not change ^, $ behavior");
|
||||
break;
|
||||
case 'm':
|
||||
options |= RE_OPTION_MULTILINE;
|
||||
break;
|
||||
|
|
2
re.c
2
re.c
|
@ -90,7 +90,6 @@ rb_str_cicmp(str1, str2)
|
|||
#define REG_CASESTATE FL_USER0
|
||||
#define REG_IGNORECASE FL_USER1
|
||||
#define REG_EXTENDED FL_USER2
|
||||
#define REG_POSIXLINE FL_USER3
|
||||
#define REG_MULTILINE FL_USER3
|
||||
|
||||
#define KCODE_NONE 0
|
||||
|
@ -1297,7 +1296,6 @@ Init_Regexp()
|
|||
|
||||
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE));
|
||||
rb_define_const(rb_cRegexp, "EXTENDED", INT2FIX(RE_OPTION_EXTENDED));
|
||||
rb_define_const(rb_cRegexp, "POSIXLINE", INT2FIX(RE_OPTION_POSIXLINE));
|
||||
rb_define_const(rb_cRegexp, "MULTILINE", INT2FIX(RE_OPTION_MULTILINE));
|
||||
|
||||
rb_global_variable(®_cache);
|
||||
|
|
92
regex.c
92
regex.c
|
@ -350,8 +350,6 @@ enum regexpcode
|
|||
stop_paren, /* Place holder at the end of (?:..). */
|
||||
casefold_on, /* Turn on casefold flag. */
|
||||
casefold_off, /* Turn off casefold flag. */
|
||||
posix_on, /* Turn on POSIXified line match (match with newlines). */
|
||||
posix_off, /* Turn off POSIXified line match. */
|
||||
mline_on, /* Turn on multi line match (match with newlines). */
|
||||
mline_off, /* Turn off multi line match. */
|
||||
start_nowidth, /* Save string point to the stack. */
|
||||
|
@ -766,14 +764,6 @@ print_partial_compiled_pattern(start, end)
|
|||
printf("/casefold_off");
|
||||
break;
|
||||
|
||||
case posix_on:
|
||||
printf("/posix_on");
|
||||
break;
|
||||
|
||||
case posix_off:
|
||||
printf("/posix_off");
|
||||
break;
|
||||
|
||||
case mline_on:
|
||||
printf("/mline_on");
|
||||
break;
|
||||
|
@ -1035,8 +1025,6 @@ calculate_must_string(start, end)
|
|||
case push_dummy_failure:
|
||||
case start_paren:
|
||||
case stop_paren:
|
||||
case posix_on:
|
||||
case posix_off:
|
||||
case mline_on:
|
||||
case mline_off:
|
||||
break;
|
||||
|
@ -1288,29 +1276,21 @@ re_compile_pattern(pattern, size, bufp)
|
|||
|
||||
switch (c) {
|
||||
case '$':
|
||||
if (bufp->options & RE_OPTION_POSIXLINE) {
|
||||
BUFPUSH(endbuf);
|
||||
}
|
||||
else {
|
||||
p0 = p;
|
||||
/* When testing what follows the $,
|
||||
look past the \-constructs that don't consume anything. */
|
||||
p0 = p;
|
||||
/* When testing what follows the $,
|
||||
look past the \-constructs that don't consume anything. */
|
||||
|
||||
while (p0 != pend) {
|
||||
if (*p0 == '\\' && p0 + 1 != pend
|
||||
&& (p0[1] == 'b' || p0[1] == 'B'))
|
||||
p0 += 2;
|
||||
else
|
||||
break;
|
||||
}
|
||||
BUFPUSH(endline);
|
||||
while (p0 != pend) {
|
||||
if (*p0 == '\\' && p0 + 1 != pend
|
||||
&& (p0[1] == 'b' || p0[1] == 'B'))
|
||||
p0 += 2;
|
||||
else
|
||||
break;
|
||||
}
|
||||
BUFPUSH(endline);
|
||||
break;
|
||||
case '^':
|
||||
if (bufp->options & RE_OPTION_POSIXLINE)
|
||||
BUFPUSH(begbuf);
|
||||
else
|
||||
BUFPUSH(begline);
|
||||
BUFPUSH(begline);
|
||||
break;
|
||||
|
||||
case '+':
|
||||
|
@ -1689,18 +1669,11 @@ re_compile_pattern(pattern, size, bufp)
|
|||
else
|
||||
options |= RE_OPTION_EXTENDED;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (negative) {
|
||||
if (options&RE_OPTION_POSIXLINE) {
|
||||
options &= ~RE_OPTION_POSIXLINE;
|
||||
BUFPUSH(posix_off);
|
||||
}
|
||||
}
|
||||
else if (!(options&RE_OPTION_POSIXLINE)) {
|
||||
options |= RE_OPTION_POSIXLINE;
|
||||
BUFPUSH(posix_on);
|
||||
}
|
||||
FREE_AND_RETURN(stackb, "(?p) is deprecated");
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
if (negative) {
|
||||
if (options&RE_OPTION_MULTILINE) {
|
||||
|
@ -1823,11 +1796,8 @@ re_compile_pattern(pattern, size, bufp)
|
|||
if ((options ^ stackp[-1]) & RE_OPTION_IGNORECASE) {
|
||||
BUFPUSH((options&RE_OPTION_IGNORECASE)?casefold_off:casefold_on);
|
||||
}
|
||||
if ((options ^ stackp[-1]) & RE_OPTION_POSIXLINE) {
|
||||
BUFPUSH((options&RE_OPTION_POSIXLINE)?posix_off:posix_on);
|
||||
}
|
||||
if ((options ^ stackp[-1]) & RE_OPTION_MULTILINE) {
|
||||
BUFPUSH((options&RE_OPTION_POSIXLINE)?mline_off:mline_on);
|
||||
BUFPUSH((options&RE_OPTION_MULTILINE)?mline_off:mline_on);
|
||||
}
|
||||
pending_exact = 0;
|
||||
if (fixup_alt_jump) {
|
||||
|
@ -2193,11 +2163,9 @@ re_compile_pattern(pattern, size, bufp)
|
|||
break;
|
||||
|
||||
case 'Z':
|
||||
if ((bufp->options & RE_OPTION_POSIXLINE) == 0) {
|
||||
BUFPUSH(endbuf2);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
BUFPUSH(endbuf2);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
BUFPUSH(endbuf);
|
||||
break;
|
||||
|
@ -2787,11 +2755,6 @@ re_compile_fastmap(bufp)
|
|||
options ^= RE_OPTION_IGNORECASE;
|
||||
continue;
|
||||
|
||||
case posix_on:
|
||||
case posix_off:
|
||||
options ^= RE_OPTION_POSIXLINE;
|
||||
continue;
|
||||
|
||||
case mline_on:
|
||||
case mline_off:
|
||||
options ^= RE_OPTION_MULTILINE;
|
||||
|
@ -2802,7 +2765,7 @@ re_compile_fastmap(bufp)
|
|||
fastmap[translate['\n']] = 1;
|
||||
else
|
||||
fastmap['\n'] = 1;
|
||||
if ((options & RE_OPTION_POSIXLINE) == 0 && bufp->can_be_null == 0)
|
||||
if (bufp->can_be_null == 0)
|
||||
bufp->can_be_null = 2;
|
||||
break;
|
||||
|
||||
|
@ -2887,7 +2850,7 @@ re_compile_fastmap(bufp)
|
|||
case anychar_repeat:
|
||||
case anychar:
|
||||
for (j = 0; j < (1 << BYTEWIDTH); j++) {
|
||||
if (j != '\n' || (options & RE_OPTION_POSIXLINE))
|
||||
if (j != '\n')
|
||||
fastmap[j] = 1;
|
||||
}
|
||||
if (bufp->can_be_null) {
|
||||
|
@ -3165,9 +3128,6 @@ re_search(bufp, string, size, startpos, range, regs)
|
|||
}
|
||||
}
|
||||
if (bufp->options & RE_OPTIMIZE_ANCHOR) {
|
||||
if (bufp->options&RE_OPTION_POSIXLINE) {
|
||||
goto begbuf_match;
|
||||
}
|
||||
anchor = 1;
|
||||
}
|
||||
|
||||
|
@ -3781,7 +3741,7 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
d += mbclen(*d);
|
||||
break;
|
||||
}
|
||||
if (!(options&RE_OPTION_POSIXLINE) &&
|
||||
if (!(options&RE_OPTION_MULTILINE) &&
|
||||
(TRANSLATE_P() ? translate[*d] : *d) == '\n')
|
||||
goto fail;
|
||||
SET_REGS_MATCHED;
|
||||
|
@ -3799,7 +3759,7 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
d += mbclen(*d);
|
||||
continue;
|
||||
}
|
||||
if (!(options&RE_OPTION_POSIXLINE) &&
|
||||
if (!(options&RE_OPTION_MULTILINE) &&
|
||||
(TRANSLATE_P() ? translate[*d] : *d) == '\n')
|
||||
goto fail;
|
||||
SET_REGS_MATCHED;
|
||||
|
@ -4129,14 +4089,6 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
options &= ~RE_OPTION_IGNORECASE;
|
||||
continue;
|
||||
|
||||
case posix_on:
|
||||
options |= RE_OPTION_POSIXLINE;
|
||||
continue;
|
||||
|
||||
case posix_off:
|
||||
options &= ~RE_OPTION_POSIXLINE;
|
||||
continue;
|
||||
|
||||
case mline_on:
|
||||
options |= RE_OPTION_MULTILINE;
|
||||
continue;
|
||||
|
|
6
regex.h
6
regex.h
|
@ -69,12 +69,10 @@
|
|||
#define RE_OPTION_IGNORECASE (1L)
|
||||
/* perl-style extended pattern available */
|
||||
#define RE_OPTION_EXTENDED (RE_OPTION_IGNORECASE<<1)
|
||||
/* newline will be included for ., ^, $ does not handle newline - obsolete */
|
||||
#define RE_OPTION_POSIXLINE (RE_OPTION_EXTENDED<<1)
|
||||
/* newline will be included for . */
|
||||
#define RE_OPTION_MULTILINE (RE_OPTION_POSIXLINE<<1)
|
||||
#define RE_OPTION_MULTILINE (RE_OPTION_EXTENDED<<1)
|
||||
/* search for longest match, in accord with POSIX regexp */
|
||||
#define RE_OPTION_LONGEST (RE_OPTION_POSIXLINE<<1)
|
||||
#define RE_OPTION_LONGEST (RE_OPTION_MULTILINE<<1)
|
||||
|
||||
#define RE_MAY_IGNORECASE (RE_OPTION_LONGEST<<1)
|
||||
#define RE_OPTIMIZE_ANCHOR (RE_MAY_IGNORECASE<<1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.5.4"
|
||||
#define RUBY_RELEASE_DATE "2000-05-17"
|
||||
#define RUBY_RELEASE_DATE "2000-05-18"
|
||||
#define RUBY_VERSION_CODE 154
|
||||
#define RUBY_RELEASE_CODE 20000517
|
||||
#define RUBY_RELEASE_CODE 20000518
|
||||
|
|
|
@ -36,6 +36,7 @@ EXPORTS
|
|||
;eval.c
|
||||
rb_cProc
|
||||
ruby_safe_level
|
||||
ruby_errinfo
|
||||
ruby_frame
|
||||
rb_cThread
|
||||
rb_thread_tick
|
||||
|
@ -51,6 +52,14 @@ EXPORTS
|
|||
rb_cIO
|
||||
rb_eEOFError
|
||||
rb_eIOError
|
||||
rb_stdin
|
||||
rb_stdout
|
||||
rb_stderr
|
||||
rb_defout
|
||||
rb_output_fs
|
||||
rb_rs
|
||||
rb_output_rs
|
||||
rb_default_rs
|
||||
;math.c
|
||||
rb_mMath
|
||||
;numeric.c
|
||||
|
@ -69,6 +78,9 @@ EXPORTS
|
|||
rb_cTrueClass
|
||||
rb_cFalseClass
|
||||
rb_cSymbol
|
||||
;parse.c
|
||||
ruby_sourcefile
|
||||
ruby_sourceline
|
||||
;prec.c
|
||||
rb_mPrecision
|
||||
;process.c
|
||||
|
@ -314,6 +326,7 @@ EXPORTS
|
|||
rb_thread_wakeup
|
||||
rb_thread_run
|
||||
rb_thread_stop
|
||||
rb_thread_polling
|
||||
rb_thread_sleep
|
||||
rb_thread_sleep_forever
|
||||
rb_thread_create
|
||||
|
@ -332,10 +345,10 @@ EXPORTS
|
|||
rb_find_file
|
||||
rb_path_check
|
||||
;gc.c
|
||||
xmalloc
|
||||
xfree
|
||||
xcalloc
|
||||
xrealloc
|
||||
ruby_xmalloc
|
||||
ruby_xcalloc
|
||||
ruby_xrealloc
|
||||
ruby_xfree
|
||||
rb_global_variable
|
||||
rb_newobj
|
||||
rb_data_object_alloc
|
||||
|
@ -348,6 +361,10 @@ EXPORTS
|
|||
rb_gc_mark_frame
|
||||
rb_gc
|
||||
rb_gc_call_finalizer_at_exit
|
||||
xmalloc
|
||||
xcalloc
|
||||
xrealloc
|
||||
xfree
|
||||
;hash.c
|
||||
rb_hash_freeze
|
||||
rb_hash
|
||||
|
|
Loading…
Reference in a new issue