mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
990624
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37bcc42c98
commit
031d2e84df
43 changed files with 944 additions and 461 deletions
132
ChangeLog
132
ChangeLog
|
@ -1,5 +1,125 @@
|
|||
Thu Jun 24 13:00:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* regex.c (print_mbc): wrong boundary.
|
||||
|
||||
* pack.c (uv_to_utf8): raises ArgError for too big value.
|
||||
|
||||
Thu Jun 24 11:02:51 1999 Yoshida Masato <yoshidam@yoshidam.net>
|
||||
|
||||
* pack.c (uv_to_utf8): mask needed.
|
||||
|
||||
Wed Jun 23 22:06:26 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
|
||||
|
||||
* pack.c (utf8_to_uv): pack to 7 bytes sequence.
|
||||
|
||||
* pack.c (uv_to_utf8): wrong boundary.
|
||||
|
||||
* pack.c (pack_unpack): should treat as unsigned long.
|
||||
|
||||
Wed Jun 23 15:10:11 1999 Inaba Hiroto <inaba@sdd.tokyo-sc.toshiba.co.jp>
|
||||
|
||||
* parse.y (parse_string): failed to parse nested braces.
|
||||
|
||||
* parse.y (parse_regx): nested braces within #{} available.
|
||||
|
||||
Wed Jun 23 11:18:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* regex.c (slow_search): wrong shift width for mbcs.
|
||||
|
||||
* eval.c (rb_thread_save_context): should not clear th->locals.
|
||||
|
||||
Wed Jun 23 02:06:14 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* parse.y (yylex): UMINUS binds too tight with digits. changed so
|
||||
that -2**2 => -4.
|
||||
|
||||
* parse.y (close_paren): `do' for expr termination now works it
|
||||
used to be.
|
||||
|
||||
Wed Jun 22 18:26:42 1999 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
|
||||
* pack.c (pack_pack): should initialize local variable `j'.
|
||||
|
||||
Wed Jun 22 15:24:59 1999 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
|
||||
* parse.y (here_document): a bug for multiline heredoc.
|
||||
|
||||
Tue Jun 22 15:06:36 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
|
||||
|
||||
* ext/socket/socket.c (ruby_socket): forgot to return fd
|
||||
explicitly.
|
||||
|
||||
Tue Jun 22 13:34:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* rubyio.h (MakeOpenFile): should initialize member `iv_tbl'.
|
||||
|
||||
Wed Jun 22 10:35:51 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||
|
||||
* io.c (rb_io_gets_internal): getc(3) may not set errno on
|
||||
interrupt.
|
||||
|
||||
Mon Jun 21 22:39:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (call_required_libraries): ruby_sourceline should be
|
||||
cleared before loading libraries.
|
||||
|
||||
* io.c (set_stdin): do not use reopen(), so that we don't need to
|
||||
dup original stdin before assigning $stdin.
|
||||
|
||||
Mon Jun 21 18:04:27 1999 Ryo HAYASAKA <hayasaka@univ21.u-aizu.ac.jp>
|
||||
|
||||
* ext/dbm/dbm.c: include <cdefs.h> for solaris 2.6.
|
||||
|
||||
Mon Jun 21 15:59:47 1999 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* ext/socket/socket.c (ip_addrsetup): forgot to put `else'.
|
||||
|
||||
Mon Jun 21 15:38:37 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* io.c (fptr_finalize): remove rb_syswait() invocation to avoid
|
||||
wait4(2) within GC. rb_syswait() moved to rb_io_fptr_close().
|
||||
|
||||
Mon Jun 21 12:05:59 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
|
||||
|
||||
* dir.c (dir_s_glob): remove MAXPATHLEN restriction.
|
||||
|
||||
* ext/md5/md5init.c (md5_hexdigest): should have used "%02x".
|
||||
|
||||
Sun Jun 20 19:50:38 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||
|
||||
* string.c (rb_str_each_line): should have checked string
|
||||
boundary.
|
||||
|
||||
Sat Jun 19 22:24:12 1999 Kenji Nagasawa <kenn@hma.att.ne.jp>
|
||||
|
||||
* OS/2 patch improved.
|
||||
|
||||
Fri Jun 18 08:30:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* marshal.c (r_byte): add data length check.
|
||||
|
||||
* ext/tcltklib/tcltklib.c (_timer_for_tcl): was doing busy-wait.
|
||||
|
||||
Tue Jun 15 10:01:21 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
|
||||
|
||||
* configure.in: remove trailing slash from interpreter embedded
|
||||
shared library path.
|
||||
|
||||
* configure.in (INSTALL_DLLIB): install shared lib with 0555.
|
||||
|
||||
* instruby.rb: changed mode for shared library into 0555.
|
||||
|
||||
Fri Jun 11 23:27:00 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
|
||||
|
||||
* ext/etc/etc.c (etc_passwd): should return nil, not exception for
|
||||
call after last passwd entry.
|
||||
|
||||
Fri Jun 11 15:21:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* gc.c (rb_gc_mark_locations): add safty margin 1.
|
||||
|
||||
* eval.c (ruby_run): should protect toplevel node tree.
|
||||
|
||||
* ext/etc/etc.c (etc_group): dumps core if there's no more group.
|
||||
|
||||
Fri Jun 11 01:50:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
@ -495,7 +615,7 @@ Mon Apr 19 13:49:11 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* eval.c (eval): should restore ruby_dyna_vars.
|
||||
|
||||
Fri Apr 16 21:40:43 1999 Nobuetsu Nokada <gea02117@nifty.ne.jp>
|
||||
Fri Apr 16 21:40:43 1999 Nobuyoshu Nakada <gea02117@nifty.ne.jp>
|
||||
|
||||
* io.c (f_backquote): pipe_open may return nil.
|
||||
|
||||
|
@ -748,7 +868,7 @@ Tue Mar 9 00:19:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* range.c (range_each): no longer use upto for generic cases.
|
||||
|
||||
Sun Mar 7 14:21:32 1999 IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp>
|
||||
Sun Mar 7 14:21:32 1999 IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp>
|
||||
|
||||
* string.c (rb_str_index): wrong end point calculation.
|
||||
|
||||
|
@ -1282,7 +1402,7 @@ Tue Jan 19 05:01:16 1999 Koji Arai <JCA02266@nifty.ne.jp>
|
|||
|
||||
* array.c (beg_len): round range value too much.
|
||||
|
||||
Mon Jan 18 13:02:27 1999 Kuroda Jun <jkuro@dwe.co.j>
|
||||
Mon Jan 18 13:02:27 1999 Kuroda Jun <jkuro@dwe.co.jp>
|
||||
|
||||
* hash.c (env_keys): strchr() may return NULL.
|
||||
|
||||
|
@ -1703,7 +1823,7 @@ Sat Oct 31 23:18:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
* string.c (rb_str_split_method): if LIMIT is unspecified,
|
||||
trailing null fields are stripped.
|
||||
|
||||
Sat Oct 31 04:16:14 1998 Inaba Hiroto <inaba@st.rim.or.jp>
|
||||
Sat Oct 31 04:16:14 1998 Inaba Hiroto <inaba@st.rim.or.jp>
|
||||
|
||||
* string.c (str_aref): regexp index SEGVed.
|
||||
|
||||
|
@ -1965,7 +2085,7 @@ Sat Aug 29 16:31:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* regex.c (re_compile_pattern): mask \nnn over 256.
|
||||
|
||||
Sat Aug 29 02:09:46 1998 1998 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
Sat Aug 29 02:09:46 1998 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
|
||||
* sprintf.c (f_sprintf): wrong buffer size check.
|
||||
|
||||
|
@ -2553,7 +2673,7 @@ Thu May 14 14:03:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* random.c (f_rand): use drand48 if possible.
|
||||
|
||||
Wed May 13 19:05:20 1998 1998 MAEDA shugo <shugo@aianet.ne.jp>
|
||||
Wed May 13 19:05:20 1998 MAEDA shugo <shugo@aianet.ne.jp>
|
||||
|
||||
* BeOS patches for io.c, error.c and config.guess.
|
||||
|
||||
|
|
11
configure.in
11
configure.in
|
@ -83,6 +83,9 @@ AC_PROG_RANLIB
|
|||
AC_SUBST(AR)
|
||||
AC_CHECK_PROGS(AR, ar aal, ar)
|
||||
AC_PROG_INSTALL
|
||||
test -z "$INSTALL_DLLIB" && INSTALL_DLLIB='${INSTALL} -m 555'
|
||||
AC_SUBST(INSTALL_DLLIB)
|
||||
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
|
@ -667,7 +670,7 @@ AC_ARG_ENABLE(enable-shared,
|
|||
[enable_shared=$enableval])
|
||||
if test "$enable_shared" = 'yes'; then
|
||||
LIBRUBY='$(LIBRUBY_SO)'
|
||||
LIBRUBYARG='-L./ -l$(RUBY_INSTALL_NAME)'
|
||||
LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)'
|
||||
CFLAGS="$CFLAGS $CCDLFLAGS"
|
||||
case "$host_os" in
|
||||
sunos4*|linux*)
|
||||
|
@ -688,7 +691,11 @@ if test "$enable_shared" = 'yes'; then
|
|||
*) LIBRUBY_ALIASES= ;; # a.out platforms
|
||||
esac
|
||||
;;
|
||||
solaris*)
|
||||
XLDFLAGS='-R${prefix}/lib'
|
||||
;;
|
||||
hpux*)
|
||||
XLDFLAGS='-Wl,+s,+b,$(prefix)/lib'
|
||||
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)'
|
||||
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).sl'
|
||||
;;
|
||||
|
@ -700,7 +707,7 @@ if test "$enable_shared" = 'yes'; then
|
|||
LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
|
||||
LIBRUBY_DLDFLAGS='-bE:ruby.imp -bM:SRE -bnoentry'
|
||||
fi
|
||||
LIBRUBYARG='-L./ -Wl,lib$(RUBY_INSTALL_NAME).so'
|
||||
LIBRUBYARG='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_NAME).so'
|
||||
SOLIBS='-lm -lc'
|
||||
;;
|
||||
cygwin*)
|
||||
|
|
17
dir.c
17
dir.c
|
@ -482,7 +482,7 @@ push_braces(ary, s)
|
|||
VALUE ary;
|
||||
char *s;
|
||||
{
|
||||
char buf[MAXPATHLEN];
|
||||
char buffer[MAXPATHLEN], *buf = buffer;
|
||||
char *p, *t, *b;
|
||||
char *lbrace, *rbrace;
|
||||
|
||||
|
@ -504,6 +504,9 @@ push_braces(ary, s)
|
|||
}
|
||||
|
||||
if (lbrace) {
|
||||
int len = strlen(s);
|
||||
if (len >= MAXPATHLEN)
|
||||
buf = xmalloc(len + 1);
|
||||
memcpy(buf, s, lbrace-s);
|
||||
b = buf + (lbrace-s);
|
||||
p = lbrace;
|
||||
|
@ -517,6 +520,8 @@ push_braces(ary, s)
|
|||
strcpy(b+(p-t), rbrace+1);
|
||||
push_braces(ary, buf);
|
||||
}
|
||||
if (buf != buffer)
|
||||
free(buf);
|
||||
}
|
||||
else {
|
||||
push_globs(ary, s);
|
||||
|
@ -530,17 +535,15 @@ dir_s_glob(dir, str)
|
|||
VALUE dir, str;
|
||||
{
|
||||
char *p, *pend;
|
||||
char buf[MAXPATHLEN];
|
||||
char buffer[MAXPATHLEN], *buf = buffer;
|
||||
char *t, *t0;
|
||||
int nest;
|
||||
VALUE ary;
|
||||
|
||||
Check_SafeStr(str);
|
||||
if (RSTRING(str)->len > MAXPATHLEN) {
|
||||
rb_raise(rb_eArgError, "pathname too long (%d bytes)",
|
||||
RSTRING(str)->len);
|
||||
}
|
||||
ary = rb_ary_new();
|
||||
if (RSTRING(str)->len >= MAXPATHLEN)
|
||||
buf = xmalloc(RSTRING(str)->len + 1);
|
||||
|
||||
p = RSTRING(str)->ptr;
|
||||
pend = p + RSTRING(str)->len;
|
||||
|
@ -567,6 +570,8 @@ dir_s_glob(dir, str)
|
|||
}
|
||||
/* else unmatched braces */
|
||||
}
|
||||
if (buf != buffer)
|
||||
free(buf);
|
||||
return ary;
|
||||
}
|
||||
|
||||
|
|
7
dln.c
7
dln.c
|
@ -1692,11 +1692,12 @@ dln_find_1(fname, path, exe_flag)
|
|||
#if defined(DJGPP)
|
||||
".btm", ".sh", ".ksh", ".pl", ".sed",
|
||||
#endif
|
||||
#else
|
||||
#if defined(__EMX__)
|
||||
#elif defined(__EMX__) || defined(NT)
|
||||
".exe", ".com", ".cmd", ".bat",
|
||||
/* end of __EMX__ or NT*/
|
||||
#else
|
||||
".r", ".R", ".x", ".X", ".bat", ".BAT",
|
||||
#endif /*__EMX__*/
|
||||
/* __human68k__ */
|
||||
#endif
|
||||
(char *) NULL
|
||||
};
|
||||
|
|
53
eval.c
53
eval.c
|
@ -974,23 +974,32 @@ static void rb_thread_wait_other_threads _((void));
|
|||
|
||||
static int exit_status;
|
||||
|
||||
static void
|
||||
call_required_libraries()
|
||||
{
|
||||
NODE *save;
|
||||
|
||||
ruby_sourcefile = 0;
|
||||
if (!ext_init) Init_ext();
|
||||
save = ruby_eval_tree;
|
||||
ruby_require_libraries();
|
||||
ruby_eval_tree = save;
|
||||
}
|
||||
|
||||
void
|
||||
ruby_run()
|
||||
{
|
||||
int state;
|
||||
static int ex;
|
||||
NODE *save;
|
||||
volatile NODE *tmp;
|
||||
|
||||
if (ruby_nerrs > 0) exit(ruby_nerrs);
|
||||
|
||||
Init_stack(&save);
|
||||
Init_stack(&tmp);
|
||||
PUSH_TAG(PROT_NONE);
|
||||
PUSH_ITER(ITER_NOT);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
if (!ext_init) Init_ext();
|
||||
save = ruby_eval_tree;
|
||||
ruby_require_libraries();
|
||||
ruby_eval_tree = save;
|
||||
call_required_libraries();
|
||||
eval_node(ruby_top_self);
|
||||
}
|
||||
POP_ITER();
|
||||
|
@ -2250,15 +2259,16 @@ rb_eval(self, node)
|
|||
rval = node->nd_args->nd_head;
|
||||
SETUP_ARGS(node->nd_args->nd_next);
|
||||
val = rb_funcall2(recv, aref, argc-1, argv);
|
||||
if (node->nd_mid == 0) { /* OR */
|
||||
if (RTEST(val)) break;
|
||||
switch (node->nd_mid) {
|
||||
case 0: /* OR */
|
||||
if (RTEST(val)) RETURN(val);
|
||||
val = rb_eval(self, rval);
|
||||
}
|
||||
else if (node->nd_mid == 1) { /* AND */
|
||||
if (!RTEST(val)) break;
|
||||
break;
|
||||
case 1: /* AND */
|
||||
if (!RTEST(val)) RETURN(val);
|
||||
val = rb_eval(self, rval);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
|
||||
}
|
||||
argv[argc-1] = val;
|
||||
|
@ -2274,15 +2284,16 @@ rb_eval(self, node)
|
|||
|
||||
recv = rb_eval(self, node->nd_recv);
|
||||
val = rb_funcall(recv, id, 0);
|
||||
if (node->nd_next->nd_mid == 0) { /* OR */
|
||||
if (RTEST(val)) break;
|
||||
switch (node->nd_next->nd_mid) {
|
||||
case 0: /* OR */
|
||||
if (RTEST(val)) RETURN(val);
|
||||
val = rb_eval(self, node->nd_value);
|
||||
}
|
||||
else if (node->nd_next->nd_mid == 1) { /* AND */
|
||||
if (!RTEST(val)) break;
|
||||
break;
|
||||
case 1: /* AND */
|
||||
if (!RTEST(val)) RETURN(val);
|
||||
val = rb_eval(self, node->nd_value);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
val = rb_funcall(val, node->nd_next->nd_mid, 1,
|
||||
rb_eval(self, node->nd_value));
|
||||
}
|
||||
|
@ -6042,8 +6053,6 @@ rb_thread_save_context(th)
|
|||
th->trace = trace_func;
|
||||
th->file = ruby_sourcefile;
|
||||
th->line = ruby_sourceline;
|
||||
|
||||
th->locals = 0;
|
||||
}
|
||||
|
||||
static void rb_thread_restore_context _((thread_t,int));
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
#include "ruby.h"
|
||||
|
||||
#ifdef HAVE_CDEFS_H
|
||||
# include <cdefs.h>
|
||||
#endif
|
||||
#include <ndbm.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -6,6 +6,7 @@ end
|
|||
have_library("gdbm", "dbm_open") or
|
||||
have_library("db", "dbm_open") or
|
||||
have_library("dbm", "dbm_open")
|
||||
have_header("cdefs.h")
|
||||
if have_header("ndbm.h") and have_func("dbm_open")
|
||||
have_func("dbm_clearerr")
|
||||
create_makefile("dbm")
|
||||
|
|
|
@ -125,7 +125,7 @@ static VALUE
|
|||
etc_passwd(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
#if defined(HAVE_GETPWENT)
|
||||
#ifdef HAVE_GETPWENT
|
||||
struct passwd *pw;
|
||||
|
||||
if (rb_iterator_p()) {
|
||||
|
@ -136,12 +136,11 @@ etc_passwd(obj)
|
|||
endpwent();
|
||||
return obj;
|
||||
}
|
||||
pw = getpwent();
|
||||
if (pw == 0) rb_raise(rb_eRuntimeError, "can't fetch next -- /etc/passwd");
|
||||
return setup_passwd(pw);
|
||||
#else
|
||||
return Qnil;
|
||||
if (pw = getpwent()) {
|
||||
return setup_passwd(pw);
|
||||
}
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETGRENT
|
||||
|
|
|
@ -392,6 +392,7 @@ TARGET = #{target}
|
|||
DLLIB = $(TARGET).#{$static ? "a" : "@DLEXT@"}
|
||||
|
||||
INSTALL = #{$dots}@INSTALL@
|
||||
INSTALL_DLLIB = @INSTALL_DLLIB@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
binsuffix = @binsuffix@
|
||||
|
@ -414,7 +415,7 @@ install:
|
|||
EOS
|
||||
if !$static
|
||||
mfile.printf "\
|
||||
$(INSTALL) $(DLLIB) $(DESTDIR)$(archdir)/$(DLLIB)
|
||||
$(INSTALL_DLLIB) $(DLLIB) $(DESTDIR)$(archdir)/$(DLLIB)
|
||||
"
|
||||
end
|
||||
install_rb(mfile)
|
||||
|
|
|
@ -52,8 +52,7 @@ md5_hexdigest(obj)
|
|||
{
|
||||
MD5_CTX *md5, ctx;
|
||||
unsigned char digest[16];
|
||||
char buf[35];
|
||||
char *p = buf;
|
||||
char buf[33];
|
||||
int i;
|
||||
|
||||
Data_Get_Struct(obj, MD5_CTX, md5);
|
||||
|
@ -61,7 +60,7 @@ md5_hexdigest(obj)
|
|||
MD5Final(digest, &ctx);
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(buf+i*2, "%x", digest[i]);
|
||||
sprintf(buf+i*2, "%02x", digest[i]);
|
||||
}
|
||||
return rb_str_new(buf, 32);
|
||||
}
|
||||
|
@ -70,7 +69,6 @@ static VALUE
|
|||
md5_clone(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE clone;
|
||||
MD5_CTX *md5, *md5_new;
|
||||
|
||||
Data_Get_Struct(obj, MD5_CTX, md5);
|
||||
|
@ -86,7 +84,6 @@ md5_new(argc, argv, class)
|
|||
VALUE* argv;
|
||||
VALUE class;
|
||||
{
|
||||
int i;
|
||||
VALUE arg, obj;
|
||||
MD5_CTX *md5;
|
||||
|
||||
|
@ -103,6 +100,7 @@ md5_new(argc, argv, class)
|
|||
return obj;
|
||||
}
|
||||
|
||||
void
|
||||
Init_md5()
|
||||
{
|
||||
cMD5 = rb_define_class("MD5", rb_cObject);
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include <unistd.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -487,7 +487,7 @@ ip_addrsetup(host, port)
|
|||
if (*name == 0) {
|
||||
mkinetaddr(INADDR_ANY, hbuf, sizeof(hbuf));
|
||||
}
|
||||
if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
|
||||
else if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
|
||||
mkinetaddr(INADDR_BROADCAST, hbuf, sizeof(hbuf));
|
||||
}
|
||||
else {
|
||||
|
@ -594,6 +594,7 @@ ruby_socket(domain, type, proto)
|
|||
fd = socket(domain, type, proto);
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -44,8 +44,6 @@ int *tclDummyMathPtr = (int *) matherr;
|
|||
|
||||
/*---- module TclTkLib ----*/
|
||||
|
||||
static VALUE main_thread;
|
||||
|
||||
struct invoke_queue {
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
|
@ -55,35 +53,52 @@ struct invoke_queue {
|
|||
VALUE thread;
|
||||
struct invoke_queue *next;
|
||||
};
|
||||
|
||||
|
||||
static struct invoke_queue *iqueue;
|
||||
static VALUE main_thread;
|
||||
|
||||
/* Tk_ThreadTimer */
|
||||
static Tcl_TimerToken timer_token;
|
||||
|
||||
/* timer callback */
|
||||
static void
|
||||
_timer_for_tcl(clientData)
|
||||
ClientData clientData;
|
||||
{
|
||||
struct invoke_queue *q, *tmp;
|
||||
VALUE thread;
|
||||
|
||||
Tk_DeleteTimerHandler(timer_token);
|
||||
timer_token = Tk_CreateTimerHandler(100, _timer_for_tcl,
|
||||
(ClientData)0);
|
||||
|
||||
CHECK_INTS;
|
||||
q = iqueue;
|
||||
while (q) {
|
||||
tmp = q;
|
||||
q = q->next;
|
||||
if (!tmp->done) {
|
||||
tmp->done = 1;
|
||||
tmp->result = ip_invoke_real(tmp->argc, tmp->argv, tmp->obj);
|
||||
thread = tmp->thread;
|
||||
tmp = tmp->next;
|
||||
rb_thread_run(thread);
|
||||
}
|
||||
}
|
||||
rb_thread_schedule();
|
||||
}
|
||||
|
||||
/* execute Tk_MainLoop */
|
||||
static VALUE
|
||||
lib_mainloop(self)
|
||||
VALUE self;
|
||||
{
|
||||
struct invoke_queue *q, *tmp;
|
||||
VALUE thread;
|
||||
|
||||
timer_token = Tk_CreateTimerHandler(100, _timer_for_tcl,
|
||||
(ClientData)0);
|
||||
DUMP1("start Tk_Mainloop");
|
||||
while (Tk_GetNumMainWindows() > 0) {
|
||||
Tcl_DoOneEvent(TCL_DONT_WAIT);
|
||||
CHECK_INTS;
|
||||
q = iqueue;
|
||||
while (q) {
|
||||
tmp = q;
|
||||
q = q->next;
|
||||
if (!tmp->done) {
|
||||
tmp->done = 1;
|
||||
tmp->result = ip_invoke_real(tmp->argc, tmp->argv, tmp->obj);
|
||||
thread = tmp->thread;
|
||||
tmp = tmp->next;
|
||||
rb_thread_run(thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
Tk_MainLoop();
|
||||
DUMP1("stop Tk_Mainloop");
|
||||
Tk_DeleteTimerHandler(timer_token);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
|
|
@ -2005,11 +2005,9 @@ class TkLabel<TkWindow
|
|||
end
|
||||
|
||||
class TkButton<TkLabel
|
||||
WidgetClassName = 'Button'.freeze
|
||||
TkClassBind::WidgetClassNameTBL[WidgetClassName] = self
|
||||
# def TkButton.to_eval
|
||||
def self.to_eval
|
||||
WidgetClassName
|
||||
TkClassBind::WidgetClassNameTBL['Button'] = self
|
||||
def TkButton.to_eval
|
||||
'Button'
|
||||
end
|
||||
def create_self
|
||||
tk_call 'button', @path
|
||||
|
@ -2023,10 +2021,9 @@ class TkButton<TkLabel
|
|||
end
|
||||
|
||||
class TkRadioButton<TkButton
|
||||
WidgetClassName = 'Radiobutton'.freeze
|
||||
TkClassBind::WidgetClassNameTBL[WidgetClassName] = self
|
||||
TkClassBind::WidgetClassNameTBL['Radiobutton'] = self
|
||||
def TkRadioButton.to_eval
|
||||
WidgetClassName
|
||||
'Radiobutton'
|
||||
end
|
||||
def create_self
|
||||
tk_call 'radiobutton', @path
|
||||
|
|
|
@ -817,6 +817,7 @@ class TkFont
|
|||
#if JAPANIZED_TK
|
||||
if @kanjifont != ""
|
||||
configure_core(@kanjifont, slot, value)
|
||||
configure('size'=>configinfo('size')) # to reflect new configuration
|
||||
else
|
||||
#""
|
||||
configure(slot, value)
|
||||
|
@ -841,10 +842,12 @@ class TkFont
|
|||
|
||||
def latin_replace(ltn)
|
||||
latin_replace_core(ltn)
|
||||
reset_pointadjust
|
||||
end
|
||||
|
||||
def kanji_replace(knj)
|
||||
kanji_replace_core(knj)
|
||||
reset_pointadjust
|
||||
end
|
||||
|
||||
def measure(text)
|
||||
|
@ -891,6 +894,17 @@ class TkFont
|
|||
end
|
||||
end
|
||||
|
||||
def reset_pointadjust
|
||||
begin
|
||||
if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
|
||||
configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
|
||||
kanji_actual.assoc('size')[1].to_f )
|
||||
end
|
||||
rescue
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
###################################
|
||||
# public alias
|
||||
###################################
|
||||
|
|
|
@ -429,7 +429,7 @@ class TkTextTag<TkObject
|
|||
include TkTreatTagFont
|
||||
|
||||
$tk_text_tag = 'tag0000'
|
||||
def initialize(parent, keys=nil)
|
||||
def initialize(parent, *args)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
|
|
2
gc.c
2
gc.c
|
@ -348,7 +348,7 @@ rb_gc_mark_locations(start, end)
|
|||
start = end;
|
||||
end = tmp;
|
||||
}
|
||||
n = end - start;
|
||||
n = end - start + 1;
|
||||
mark_locations_array(start,n);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ end
|
|||
File.makedirs libdir, true
|
||||
for lib in ["libruby.so.LIB", CONFIG["LIBRUBY_SO"]]
|
||||
if File.exist? lib
|
||||
File.install lib, libdir, 0644, true
|
||||
File.install lib, libdir, 0555, true
|
||||
end
|
||||
end
|
||||
Dir.chdir libdir
|
||||
|
|
132
io.c
132
io.c
|
@ -544,7 +544,7 @@ rb_io_gets_internal(argc, argv, io)
|
|||
c = getc(f);
|
||||
TRAP_END;
|
||||
if (c == EOF) {
|
||||
if (errno == EINTR) continue;
|
||||
if (ferror(f) && errno == EINTR) continue;
|
||||
break;
|
||||
}
|
||||
if ((*bp++ = c) == newline) break;
|
||||
|
@ -633,7 +633,7 @@ rb_io_gets(io)
|
|||
c = getc(f);
|
||||
TRAP_END;
|
||||
if (c == EOF) {
|
||||
if (errno == EINTR) continue;
|
||||
if (ferror(f) && errno == EINTR) continue;
|
||||
break;
|
||||
}
|
||||
if ((*bp++ = c) == '\n') break;
|
||||
|
@ -883,10 +883,6 @@ fptr_finalize(fptr)
|
|||
if (fptr->f2 != NULL) {
|
||||
fclose(fptr->f2);
|
||||
}
|
||||
if (fptr->pid) {
|
||||
rb_syswait(fptr->pid);
|
||||
fptr->pid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -903,6 +899,10 @@ rb_io_fptr_close(fptr)
|
|||
}
|
||||
else {
|
||||
fptr_finalize(fptr);
|
||||
if (fptr->pid) {
|
||||
rb_syswait(fptr->pid);
|
||||
fptr->pid = 0;
|
||||
}
|
||||
}
|
||||
fptr->f = fptr->f2 = NULL;
|
||||
rb_thread_fd_close(fd);
|
||||
|
@ -2031,31 +2031,118 @@ rb_io_defset(val, id)
|
|||
rb_defout = val;
|
||||
}
|
||||
|
||||
static int
|
||||
rb_dup(orig)
|
||||
int orig;
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = dup(orig);
|
||||
if (fd < 0) {
|
||||
if (errno == EMFILE || errno == ENFILE) {
|
||||
rb_gc();
|
||||
fd = dup(orig);
|
||||
}
|
||||
if (fd < 0) {
|
||||
rb_sys_fail(0);
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void
|
||||
rb_io_stdio_set(val, id, var)
|
||||
set_stdin(val, id, var)
|
||||
VALUE val;
|
||||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
OpenFile *fptr;
|
||||
int fd;
|
||||
char *mode;
|
||||
|
||||
if (val == *var) return;
|
||||
if (TYPE(val) != T_FILE) {
|
||||
rb_raise(rb_eTypeError, "%s must be IO object", rb_id2name(id));
|
||||
}
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
rb_io_check_readable(fptr);
|
||||
|
||||
GetOpenFile(*var, fptr);
|
||||
mode = rb_io_mode_string(fptr);
|
||||
fd = rb_dup(fileno(fptr->f));
|
||||
if (fileno(fptr->f) > 2) {
|
||||
fclose(fptr->f);
|
||||
}
|
||||
fptr->f = rb_fdopen(fd, mode);
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
dup2(fileno(fptr->f), 0);
|
||||
fclose(fptr->f);
|
||||
fptr->f = stdin;
|
||||
|
||||
*var = val;
|
||||
}
|
||||
|
||||
static void
|
||||
set_outfile(val, id, var, stdf)
|
||||
VALUE val;
|
||||
ID id;
|
||||
VALUE *var;
|
||||
FILE *stdf;
|
||||
{
|
||||
OpenFile *fptr;
|
||||
FILE *f;
|
||||
int fd;
|
||||
char *mode;
|
||||
|
||||
if (val == *var) return;
|
||||
rb_io_flush(*var);
|
||||
|
||||
if (TYPE(val) != T_FILE) {
|
||||
rb_raise(rb_eTypeError, "%s must be IO object", rb_id2name(id));
|
||||
}
|
||||
if (ruby_verbose) {
|
||||
rb_warn("assignment for %s is done by reopen", rb_id2name(id));
|
||||
}
|
||||
GetOpenFile(*var, fptr);
|
||||
fd = fileno(fptr->f);
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
if (fd == 0) {
|
||||
rb_io_check_readable(fptr);
|
||||
rb_io_check_writable(fptr);
|
||||
|
||||
GetOpenFile(*var, fptr);
|
||||
mode = rb_io_mode_string(fptr);
|
||||
f = GetWriteFile(fptr);
|
||||
fd = rb_dup(fileno(f));
|
||||
if (fileno(f) > 2) {
|
||||
fclose(fptr->f);
|
||||
}
|
||||
else {
|
||||
rb_io_check_writable(fptr);
|
||||
}
|
||||
rb_io_reopen(*var, val);
|
||||
f = rb_fdopen(fd, mode);
|
||||
if (fptr->f2) fptr->f2 = f;
|
||||
else fptr->f = f;
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
f = GetWriteFile(fptr);
|
||||
dup2(fileno(f), fileno(stdf));
|
||||
fclose(f);
|
||||
if (fptr->f2) fptr->f2 = stdf;
|
||||
else fptr->f = stdf;
|
||||
|
||||
*var = val;
|
||||
}
|
||||
|
||||
static void
|
||||
set_stdout(val, id, var)
|
||||
VALUE val;
|
||||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
set_outfile(val, id, var, stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
set_stderr(val, id, var)
|
||||
VALUE val;
|
||||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
set_outfile(val, id, var, stderr);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -2330,9 +2417,6 @@ rb_f_backquote(obj, str)
|
|||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef NT
|
||||
#define select(v, w, x, y, z) (-1) /* anytime fail */
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rb_f_select(argc, argv, obj)
|
||||
|
@ -3099,11 +3183,11 @@ Init_IO()
|
|||
rb_define_method(rb_cIO, "fcntl", rb_io_fcntl, -1);
|
||||
|
||||
rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stdin", &rb_stdin, 0, rb_io_stdio_set);
|
||||
rb_define_hooked_variable("$stdin", &rb_stdin, 0, set_stdin);
|
||||
rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stdout", &rb_stdout, 0, rb_io_stdio_set);
|
||||
rb_define_hooked_variable("$stdout", &rb_stdout, 0, set_stdout);
|
||||
rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stderr", &rb_stderr, 0, rb_io_stdio_set);
|
||||
rb_define_hooked_variable("$stderr", &rb_stderr, 0, set_stderr);
|
||||
rb_defout = rb_stdout;
|
||||
rb_define_hooked_variable("$>", &rb_defout, 0, rb_io_defset);
|
||||
|
||||
|
|
|
@ -130,6 +130,9 @@ class DEBUGGER__
|
|||
else
|
||||
lev = 1
|
||||
end
|
||||
unless @frame_pos
|
||||
@frame_pos = @frames.size - 1
|
||||
end
|
||||
if lev >= @frames.size or @frame_pos and @frame_pos+lev >= @frames.size
|
||||
STDOUT.print "at stack bottom\n"
|
||||
@frame_pos = nil
|
||||
|
|
|
@ -34,9 +34,11 @@ $srcdir = CONFIG["srcdir"]
|
|||
$libdir = CONFIG["libdir"]+"/ruby/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
|
||||
$archdir = $libdir+"/"+CONFIG["arch"]
|
||||
$install = CONFIG["INSTALL_PROGRAM"]
|
||||
$install_dllib = CONFIG["INSTALL_DLLIB"]
|
||||
$install_data = CONFIG["INSTALL_DATA"]
|
||||
if $install =~ %r!^[^\s/]+/! then
|
||||
$install = CONFIG["compile_dir"]+"/"+$install
|
||||
$install_dllib = CONFIG["compile_dir"]+"/"+$install_dllib
|
||||
$install_data = CONFIG["compile_dir"]+"/"+$install_data
|
||||
end
|
||||
|
||||
|
@ -371,6 +373,7 @@ TARGET = #{target}
|
|||
DLLIB = $(TARGET).#{CONFIG["DLEXT"]}
|
||||
|
||||
INSTALL = #{$install}
|
||||
INSTALL_DLLIB = #{$install_dllib}
|
||||
INSTALL_DATA = #{$install_data}
|
||||
|
||||
binsuffix = #{CONFIG["binsuffix"]}
|
||||
|
@ -388,7 +391,7 @@ install: $(archdir)/$(DLLIB)
|
|||
$(archdir)/$(DLLIB): $(DLLIB)
|
||||
@test -d $(libdir) || mkdir $(libdir)
|
||||
@test -d $(archdir) || mkdir $(archdir)
|
||||
$(INSTALL) $(DLLIB) $(archdir)/$(DLLIB)
|
||||
$(INSTALL_DLLIB) $(DLLIB) $(archdir)/$(DLLIB)
|
||||
EOMF
|
||||
install_rb(mfile)
|
||||
mfile.printf "\n"
|
||||
|
|
|
@ -46,7 +46,7 @@ module ParseDate
|
|||
if $3
|
||||
year = $3.to_i
|
||||
end
|
||||
elsif date.sub!(/(#{MONTHPAT})\S*\s+(\d+)\S*\s*,?(?:\s+(\d+))?/i, ' ')
|
||||
elsif date.sub!(/(#{MONTHPAT})\S*\s+(\d+)\S*,?(?:\s+(\d+))?/i, ' ')
|
||||
mon = MONTHS[$1.downcase]
|
||||
mday = $2.to_i
|
||||
if $3
|
||||
|
|
|
@ -54,7 +54,7 @@ class Tracer
|
|||
off
|
||||
end
|
||||
else
|
||||
set_trace_func proc{|event, file, line, id, binding|
|
||||
set_trace_func proc{|event, file, line, id, binding, klass|
|
||||
trace_func event, file, line, id, binding
|
||||
}
|
||||
print "Trace on\n" if Tracer.verbose?
|
||||
|
|
22
marshal.c
22
marshal.c
|
@ -253,7 +253,7 @@ w_object(obj, arg, limit)
|
|||
w_unique(rb_class2name(CLASS_OF(obj)), arg);
|
||||
v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
|
||||
if (TYPE(v) != T_STRING) {
|
||||
rb_raise(rb_eTypeError, "_dump_to must return String");
|
||||
rb_raise(rb_eTypeError, "_dump() must return String");
|
||||
}
|
||||
w_bytes(RSTRING(v)->ptr, RSTRING(v)->len, arg);
|
||||
return;
|
||||
|
@ -457,9 +457,19 @@ static int
|
|||
r_byte(arg)
|
||||
struct load_arg *arg;
|
||||
{
|
||||
if (arg->fp) return rb_getc(arg->fp);
|
||||
if (arg->ptr < arg->end) return *(unsigned char*)arg->ptr++;
|
||||
return EOF;
|
||||
int c;
|
||||
|
||||
if (arg->fp) {
|
||||
c = rb_getc(arg->fp);
|
||||
if (c == EOF) rb_eof_error();
|
||||
}
|
||||
else if (arg->ptr < arg->end) {
|
||||
c = *(unsigned char*)arg->ptr++;
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eArgError, "marshal data too short");
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static unsigned short
|
||||
|
@ -604,10 +614,6 @@ r_object(arg)
|
|||
int type = r_byte(arg);
|
||||
|
||||
switch (type) {
|
||||
case EOF:
|
||||
rb_eof_error();
|
||||
return Qnil;
|
||||
|
||||
case TYPE_LINK:
|
||||
if (st_lookup(arg->data, r_long(arg), &v)) {
|
||||
return v;
|
||||
|
|
|
@ -632,17 +632,30 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl)
|
||||
("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun)
|
||||
("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\)\\>[^_]" 1 defun)
|
||||
("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|self\\|nil\\)\\>[^_]" 1 keyword)
|
||||
("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>[^_]" 1 keyword)
|
||||
("\\$\\(.\\|\\sw+\\)" nil type)
|
||||
("[$@].[a-zA-Z_0-9]*" nil struct)
|
||||
("^__END__" nil label))))
|
||||
)
|
||||
(or (boundp 'font-lock-variable-name-face)
|
||||
(setq font-lock-variable-name-face font-lock-type-face))
|
||||
(defvar ruby-font-lock-keywords
|
||||
(list
|
||||
(cons (concat
|
||||
"\\(^\\|[^_:.]\\|\\.\\.\\)\\b\\("
|
||||
|
||||
(or (boundp 'font-lock-variable-name-face)
|
||||
(setq font-lock-variable-name-face font-lock-type-face))
|
||||
|
||||
(defun ruby-font-lock-docs (limit)
|
||||
(if (re-search-forward "^=begin\\s *" limit t)
|
||||
(let (beg)
|
||||
(beginning-of-line)
|
||||
(setq beg (point))
|
||||
(forward-line 1)
|
||||
(if (re-search-forward "^=end\\s *" limit t)
|
||||
(progn
|
||||
(set-match-data (list beg (point)))
|
||||
t)))))
|
||||
|
||||
(defvar ruby-font-lock-keywords
|
||||
(list
|
||||
(cons (concat
|
||||
"\\(^\\|[^_:.]\\|\\.\\.\\)\\b\\("
|
||||
(mapconcat
|
||||
'identity
|
||||
'("alias"
|
||||
|
@ -650,6 +663,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
"begin"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"class"
|
||||
"def"
|
||||
"do"
|
||||
|
@ -671,6 +685,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
"retry"
|
||||
"return"
|
||||
"then"
|
||||
"throw"
|
||||
"self"
|
||||
"super"
|
||||
"unless"
|
||||
|
@ -681,19 +696,25 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
)
|
||||
"\\|")
|
||||
"\\)\\b")
|
||||
2)
|
||||
;; variables
|
||||
'("\\b\\(nil\\|self\\|true\\|false\\)\\b"
|
||||
1 font-lock-variable-name-face)
|
||||
;; variables
|
||||
'("[$@].[a-zA-Z0-9_]*"
|
||||
0 font-lock-variable-name-face)
|
||||
;; constants
|
||||
'("\\(^\\|[^_]\\)\\b\\([A-Z]+[a-zA-Z0-9_]*\\)"
|
||||
2 font-lock-type-face)
|
||||
;; functions
|
||||
'("^\\s *def\\s *\\<\\(\\(\\w\\|\\s_\\)+\\.\\)?\\(\\(\\w\\|\\s_\\)+\\)\\>"
|
||||
3 font-lock-function-name-face t))
|
||||
"*Additional expressions to highlight in ruby mode.")
|
||||
2)
|
||||
;; variables
|
||||
'("\\b\\(nil\\|self\\|true\\|false\\)\\b"
|
||||
1 font-lock-variable-name-face)
|
||||
;; variables
|
||||
'("[$@].\\(\\w\\|_\\)*"
|
||||
0 font-lock-variable-name-face)
|
||||
;; embedded document
|
||||
'(ruby-font-lock-docs
|
||||
0 font-lock-comment-face t)
|
||||
;; constants
|
||||
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
||||
2 font-lock-type-face)
|
||||
;; functions
|
||||
'("^\\s *def\\s *\\<\\(\\(\\w\\|_\\)+\\(\\.\\|::\\)\\)?\\(\\(\\w\\|_\\)+\\??\\)\\>"
|
||||
4 font-lock-function-name-face t)
|
||||
;; symbols
|
||||
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
|
||||
2 font-lock-reference-face t))
|
||||
"*Additional expressions to highlight in ruby mode.")
|
||||
|
||||
(provide 'ruby-mode)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(defvar gud-rubydb-history nil)
|
||||
|
||||
(defun gud-rubydb-massage-args (file args)
|
||||
(cons "-r" (cons "debug" args)))
|
||||
(cons "-r" (cons "debug" (cons file args))))
|
||||
|
||||
;; There's no guarantee that Emacs will hand the filter the entire
|
||||
;; marker at once; it could be broken up across several strings. We
|
||||
|
@ -19,46 +19,46 @@
|
|||
(defvar gud-rubydb-marker-acc "")
|
||||
|
||||
(defun gud-rubydb-marker-filter (string)
|
||||
(setq gud-marker-acc (concat gud-marker-acc string))
|
||||
(setq gud-rubydb-marker-acc (concat gud-rubydb-marker-acc string))
|
||||
(let ((output ""))
|
||||
|
||||
;; Process all the complete markers in this chunk.
|
||||
(while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
|
||||
gud-marker-acc)
|
||||
gud-rubydb-marker-acc)
|
||||
(setq
|
||||
|
||||
;; Extract the frame position from the marker.
|
||||
gud-last-frame
|
||||
(cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
|
||||
(string-to-int (substring gud-marker-acc
|
||||
(cons (substring gud-rubydb-marker-acc (match-beginning 1) (match-end 1))
|
||||
(string-to-int (substring gud-rubydb-marker-acc
|
||||
(match-beginning 2)
|
||||
(match-end 2))))
|
||||
|
||||
;; Append any text before the marker to the output we're going
|
||||
;; to return - we don't include the marker in this text.
|
||||
output (concat output
|
||||
(substring gud-marker-acc 0 (match-beginning 0)))
|
||||
(substring gud-rubydb-marker-acc 0 (match-beginning 0)))
|
||||
|
||||
;; Set the accumulator to the remaining text.
|
||||
gud-marker-acc (substring gud-marker-acc (match-end 0))))
|
||||
gud-rubydb-marker-acc (substring gud-rubydb-marker-acc (match-end 0))))
|
||||
|
||||
;; Does the remaining text look like it might end with the
|
||||
;; beginning of another marker? If it does, then keep it in
|
||||
;; gud-marker-acc until we receive the rest of it. Since we
|
||||
;; gud-rubydb-marker-acc until we receive the rest of it. Since we
|
||||
;; know the full marker regexp above failed, it's pretty simple to
|
||||
;; test for marker starts.
|
||||
(if (string-match "\032.*\\'" gud-marker-acc)
|
||||
(if (string-match "\032.*\\'" gud-rubydb-marker-acc)
|
||||
(progn
|
||||
;; Everything before the potential marker start can be output.
|
||||
(setq output (concat output (substring gud-marker-acc
|
||||
(setq output (concat output (substring gud-rubydb-marker-acc
|
||||
0 (match-beginning 0))))
|
||||
|
||||
;; Everything after, we save, to combine with later input.
|
||||
(setq gud-marker-acc
|
||||
(substring gud-marker-acc (match-beginning 0))))
|
||||
(setq gud-rubydb-marker-acc
|
||||
(substring gud-rubydb-marker-acc (match-beginning 0))))
|
||||
|
||||
(setq output (concat output gud-marker-acc)
|
||||
gud-marker-acc ""))
|
||||
(setq output (concat output gud-rubydb-marker-acc)
|
||||
gud-rubydb-marker-acc ""))
|
||||
|
||||
output))
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
(save-excursion
|
||||
(let ((buf (find-file-noselect f)))
|
||||
(set-buffer buf)
|
||||
(gud-make-debug-menu)
|
||||
;; (gud-make-debug-menu)
|
||||
buf)))
|
||||
|
||||
(defvar rubydb-command-name "ruby"
|
||||
|
@ -85,8 +85,10 @@ and source-file directory for your debugger."
|
|||
nil nil
|
||||
'(gud-rubydb-history . 1))))
|
||||
|
||||
(gud-common-init command-line 'gud-rubydb-massage-args
|
||||
'gud-rubydb-marker-filter 'gud-rubydb-find-file)
|
||||
(gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
|
||||
(gud-marker-filter . gud-rubydb-marker-filter)
|
||||
(gud-find-file . gud-rubydb-find-file)))
|
||||
(gud-common-init command-line rubydb-command-name)
|
||||
|
||||
(gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.")
|
||||
; (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
static double zero() { return 0.0; }
|
||||
static double one() { return 1.0; }
|
||||
static double inf() { return one() / zero(); }
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
#include "ruby.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <process.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
||||
int
|
||||
chown(char *path, int owner, int group)
|
||||
|
@ -11,3 +21,91 @@ link(char *from, char *to)
|
|||
return -1;
|
||||
}
|
||||
|
||||
typedef char* CHARP;
|
||||
|
||||
int
|
||||
do_spawn(cmd)
|
||||
char *cmd;
|
||||
{
|
||||
register char **a;
|
||||
register char *s;
|
||||
char **argv;
|
||||
char *shell, *sw, *cmd2;
|
||||
int status;
|
||||
|
||||
if ((shell = getenv("RUBYSHELL")) != NULL && *shell != '\0') {
|
||||
s = shell;
|
||||
do
|
||||
*s = isupper(*s) ? tolower(*s) : *s;
|
||||
while (*++s);
|
||||
if (strstr(shell, "cmd") || strstr(shell, "4os2"))
|
||||
sw = "/c";
|
||||
else
|
||||
sw = "-c";
|
||||
} else if ((shell = getenv("SHELL")) != NULL && *shell != '\0') {
|
||||
s = shell;
|
||||
do
|
||||
*s = isupper(*s) ? tolower(*s) : *s;
|
||||
while (*++s);
|
||||
if (strstr(shell, "cmd") || strstr(shell, "4os2"))
|
||||
sw = "/c";
|
||||
else
|
||||
sw = "-c";
|
||||
} else if ((shell = getenv("COMSPEC")) != NULL && *shell != '\0') {
|
||||
s = shell;
|
||||
do
|
||||
*s = isupper(*s) ? tolower(*s) : *s;
|
||||
while (*++s);
|
||||
if (strstr(shell, "cmd") || strstr(shell, "4os2"))
|
||||
sw = "/c";
|
||||
else
|
||||
sw = "-c";
|
||||
}
|
||||
/* see if there are shell metacharacters in it */
|
||||
/*SUPPRESS 530*/
|
||||
/* for (s = cmd; *s && isalpha(*s); s++) ;
|
||||
if (*s == '=')
|
||||
goto doshell; */
|
||||
for (s = cmd; *s; s++) {
|
||||
if (*sw == '-' && *s != ' ' &&
|
||||
!isalpha(*s) && index("$&*(){}[]'\";\\|?<>~`\n",*s)) {
|
||||
if (*s == '\n' && !s[1]) {
|
||||
*s = '\0';
|
||||
break;
|
||||
}
|
||||
goto doshell;
|
||||
} else if (*sw == '/' && *s != ' ' &&
|
||||
!isalpha(*s) && index("^()<>|&\n",*s)) {
|
||||
if (*s == '\n' && !s[1]) {
|
||||
*s = '\0';
|
||||
break;
|
||||
}
|
||||
doshell:
|
||||
status = spawnlp(P_WAIT,shell,shell,sw,cmd,(char*)NULL);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
argv = ALLOC_N(CHARP,(strlen(cmd) / 2 + 2));
|
||||
cmd2 = ALLOC_N(char, (strlen(cmd) + 1));
|
||||
strcpy(cmd2, cmd);
|
||||
a = argv;
|
||||
for (s = cmd2; *s;) {
|
||||
while (*s && isspace(*s)) s++;
|
||||
if (*s)
|
||||
*(a++) = s;
|
||||
while (*s && !isspace(*s)) s++;
|
||||
if (*s)
|
||||
*s++ = '\0';
|
||||
}
|
||||
*a = NULL;
|
||||
if (argv[0]) {
|
||||
if ((status = spawnvp(P_WAIT, argv[0], argv)) == -1) {
|
||||
free(argv);
|
||||
free(cmd2);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(cmd2);
|
||||
free(argv);
|
||||
return status;
|
||||
}
|
||||
|
|
92
pack.c
92
pack.c
|
@ -289,8 +289,8 @@ static char *toofew = "too few arguments";
|
|||
static void encodes _((VALUE,char*,int,int));
|
||||
static void qpencode _((VALUE,VALUE,int));
|
||||
|
||||
static long uv_to_utf8 _((char*,long));
|
||||
static long utf8_to_uv _((char*,int*));
|
||||
static int uv_to_utf8 _((char*,unsigned long));
|
||||
static unsigned long utf8_to_uv _((char*,int*));
|
||||
|
||||
static void
|
||||
pack_add_ptr(str, add)
|
||||
|
@ -396,7 +396,7 @@ pack_pack(ary, fmt)
|
|||
case 'b':
|
||||
{
|
||||
int byte = 0;
|
||||
int i, j;
|
||||
int i, j = 0;
|
||||
|
||||
if (len > plen) {
|
||||
j = (len - plen + 1)/2;
|
||||
|
@ -428,7 +428,7 @@ pack_pack(ary, fmt)
|
|||
case 'B':
|
||||
{
|
||||
int byte = 0;
|
||||
int i, j;
|
||||
int i, j = 0;
|
||||
|
||||
if (len > plen) {
|
||||
j = (len - plen + 1)/2;
|
||||
|
@ -459,7 +459,7 @@ pack_pack(ary, fmt)
|
|||
case 'h':
|
||||
{
|
||||
int byte = 0;
|
||||
int i, j;
|
||||
int i, j = 0;
|
||||
|
||||
if (len > plen) {
|
||||
j = (len - plen + 1)/2;
|
||||
|
@ -491,7 +491,7 @@ pack_pack(ary, fmt)
|
|||
case 'H':
|
||||
{
|
||||
int byte = 0;
|
||||
int i, j;
|
||||
int i, j = 0;
|
||||
|
||||
if (len > plen) {
|
||||
j = (len - plen + 1)/2;
|
||||
|
@ -790,14 +790,15 @@ pack_pack(ary, fmt)
|
|||
while (len-- > 0) {
|
||||
unsigned long l;
|
||||
char buf[8];
|
||||
int le;
|
||||
|
||||
from = NEXTFROM;
|
||||
if (NIL_P(from)) l = 0;
|
||||
else {
|
||||
l = NUM2ULONG(from);
|
||||
}
|
||||
l = uv_to_utf8(buf, l);
|
||||
rb_str_cat(res, (char*)&buf, l);
|
||||
le = uv_to_utf8(buf, l);
|
||||
rb_str_cat(res, (char*)&buf, le);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1399,7 +1400,7 @@ pack_unpack(str, fmt)
|
|||
|
||||
l = utf8_to_uv(s, &alen);
|
||||
s += alen;
|
||||
rb_ary_push(ary, INT2NUM(l));
|
||||
rb_ary_push(ary, rb_uint2inum(l));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1585,56 +1586,64 @@ pack_unpack(str, fmt)
|
|||
|
||||
#define BYTEWIDTH 8
|
||||
|
||||
static long
|
||||
static int
|
||||
uv_to_utf8(buf, uv)
|
||||
char *buf;
|
||||
long uv;
|
||||
unsigned long uv;
|
||||
{
|
||||
if (uv < 0x80) {
|
||||
if (uv <= 0x7f) {
|
||||
buf[0] = (char)uv;
|
||||
return 1;
|
||||
}
|
||||
if (uv < 0x7ff) {
|
||||
if (uv <= 0x7ff) {
|
||||
buf[0] = ((uv>>6)&0xff)|0xc0;
|
||||
buf[1] = uv&0x3f;
|
||||
buf[1] = (uv&0x3f)|0x80;
|
||||
return 2;
|
||||
}
|
||||
if (uv < 0xffff) {
|
||||
if (uv <= 0xffff) {
|
||||
buf[0] = ((uv>>12)&0xff)|0xe0;
|
||||
buf[1] = (uv>>6)&0x3f;
|
||||
buf[2] = uv&0x3f;
|
||||
buf[1] = ((uv>>6)&0x3f)|0x80;
|
||||
buf[2] = (uv&0x3f)|0x80;
|
||||
return 3;
|
||||
}
|
||||
if (uv < 0x1fffff) {
|
||||
if (uv <= 0x1fffff) {
|
||||
buf[0] = ((uv>>18)&0xff)|0xf0;
|
||||
buf[1] = (uv>>12)&0x3f;
|
||||
buf[2] = (uv>>6)&0x3f;
|
||||
buf[3] = uv&0x3f;
|
||||
buf[1] = ((uv>>12)&0x3f)|0x80;
|
||||
buf[2] = ((uv>>6)&0x3f)|0x80;
|
||||
buf[3] = (uv&0x3f)|0x80;
|
||||
return 4;
|
||||
}
|
||||
if (uv < 0x3ffffff) {
|
||||
buf[0] = ((uv>>24)&0xff)|0xf0;
|
||||
buf[1] = (uv>>18)&0x3f;
|
||||
buf[2] = (uv>>12)&0x3f;
|
||||
buf[3] = (uv>>6)&0x3f;
|
||||
buf[4] = uv&0x3f;
|
||||
if (uv <= 0x3ffffff) {
|
||||
buf[0] = ((uv>>24)&0xff)|0xf8;
|
||||
buf[1] = ((uv>>18)&0x3f)|0x80;
|
||||
buf[2] = ((uv>>12)&0x3f)|0x80;
|
||||
buf[3] = ((uv>>6)&0x3f)|0x80;
|
||||
buf[4] = (uv&0x3f)|0x80;
|
||||
return 5;
|
||||
}
|
||||
if (uv < 0x7fffffff) {
|
||||
if (uv <= 0x7fffffff) {
|
||||
buf[0] = ((uv>>30)&0xff)|0xfc;
|
||||
buf[1] = (uv>>24)&0x3f;
|
||||
buf[2] = (uv>>18)&0x3f;
|
||||
buf[3] = (uv>>12)&0x3f;
|
||||
buf[4] = (uv>>6)&0x3f;
|
||||
buf[5] = uv&0x3f;
|
||||
buf[1] = ((uv>>24)&0x3f)|0x80;
|
||||
buf[2] = ((uv>>18)&0x3f)|0x80;
|
||||
buf[3] = ((uv>>12)&0x3f)|0x80;
|
||||
buf[4] = ((uv>>6)&0x3f)|0x80;
|
||||
buf[5] = (uv&0x3f)|0x80;
|
||||
return 6;
|
||||
}
|
||||
buf[0] = uv>>BYTEWIDTH;
|
||||
buf[1] = uv&0xff;
|
||||
return 2;
|
||||
if (uv <= 0xfffffffff) {
|
||||
buf[0] = 0xfe;
|
||||
buf[1] = ((uv>>30)&0x3f)|0x80;
|
||||
buf[2] = ((uv>>24)&0x3f)|0x80;
|
||||
buf[3] = ((uv>>18)&0x3f)|0x80;
|
||||
buf[4] = ((uv>>12)&0x3f)|0x80;
|
||||
buf[5] = ((uv>>6)&0x3f)|0x80;
|
||||
buf[6] = (uv&0x3f)|0x80;
|
||||
return 7;
|
||||
}
|
||||
rb_raise(rb_eArgError, "uv_to_utf8(); too big value");
|
||||
}
|
||||
|
||||
static long
|
||||
static unsigned long
|
||||
utf8_to_uv(p, lenp)
|
||||
char *p;
|
||||
int *lenp;
|
||||
|
@ -1649,12 +1658,15 @@ utf8_to_uv(p, lenp)
|
|||
else if (c < 0xf8) n = 4;
|
||||
else if (c < 0xfc) n = 5;
|
||||
else if (c < 0xfe) n = 6;
|
||||
else if (c == 0xfe) n = 7;
|
||||
*lenp = n--;
|
||||
|
||||
uv = c;
|
||||
uv &= (1<<(BYTEWIDTH-2-n)) - 1;
|
||||
while (n--) {
|
||||
uv = uv << 6 | *p++ & ((1<<6)-1);
|
||||
if (n != 0) {
|
||||
uv &= (1<<(BYTEWIDTH-2-n)) - 1;
|
||||
while (n--) {
|
||||
uv = uv << 6 | *p++ & ((1<<6)-1);
|
||||
}
|
||||
}
|
||||
return uv;
|
||||
}
|
||||
|
|
93
parse.y
93
parse.y
|
@ -55,6 +55,7 @@ static enum lex_state {
|
|||
EXPR_CLASS, /* immediate after `class', no here document. */
|
||||
} lex_state;
|
||||
|
||||
static int cond_nest = 0;
|
||||
static int class_nest = 0;
|
||||
static int in_single = 0;
|
||||
static int compile_for_eval = 0;
|
||||
|
@ -209,6 +210,8 @@ static void top_local_setup();
|
|||
* precedence table
|
||||
*/
|
||||
|
||||
%nonassoc kDO
|
||||
%nonassoc kDO2
|
||||
%left kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
||||
%left kOR kAND
|
||||
%right kNOT
|
||||
|
@ -700,11 +703,24 @@ arg : lhs '=' arg
|
|||
}
|
||||
| tUPLUS arg
|
||||
{
|
||||
$$ = call_op($2, tUPLUS, 0);
|
||||
if (nd_type($2) == NODE_LIT) {
|
||||
$$ = $2;
|
||||
}
|
||||
else {
|
||||
$$ = call_op($2, tUPLUS, 0);
|
||||
}
|
||||
}
|
||||
| tUMINUS arg
|
||||
{
|
||||
$$ = call_op($2, tUMINUS, 0);
|
||||
if (nd_type($2) == NODE_LIT && FIXNUM_P($2->nd_lit)) {
|
||||
long i = FIX2LONG($2->nd_lit);
|
||||
|
||||
$2->nd_lit = INT2FIX(-i);
|
||||
$$ = $2;
|
||||
}
|
||||
else {
|
||||
$$ = call_op($2, tUMINUS, 0);
|
||||
}
|
||||
}
|
||||
| arg '|' arg
|
||||
{
|
||||
|
@ -1046,21 +1062,21 @@ primary : literal
|
|||
$$ = NEW_UNLESS(cond($2), $4, $5);
|
||||
fixpos($$, $2);
|
||||
}
|
||||
| kWHILE expr do
|
||||
| kWHILE {cond_nest++;} expr do {cond_nest--;}
|
||||
compstmt
|
||||
kEND
|
||||
{
|
||||
value_expr($2);
|
||||
$$ = NEW_WHILE(cond($2), $4, 1);
|
||||
fixpos($$, $2);
|
||||
value_expr($3);
|
||||
$$ = NEW_WHILE(cond($3), $6, 1);
|
||||
fixpos($$, $3);
|
||||
}
|
||||
| kUNTIL expr do
|
||||
| kUNTIL {cond_nest++;} expr do {cond_nest--;}
|
||||
compstmt
|
||||
kEND
|
||||
{
|
||||
value_expr($2);
|
||||
$$ = NEW_UNTIL(cond($2), $4, 1);
|
||||
fixpos($$, $2);
|
||||
value_expr($3);
|
||||
$$ = NEW_UNTIL(cond($3), $6, 1);
|
||||
fixpos($$, $3);
|
||||
}
|
||||
| kCASE compstmt
|
||||
case_body
|
||||
|
@ -1070,12 +1086,12 @@ primary : literal
|
|||
$$ = NEW_CASE($2, $3);
|
||||
fixpos($$, $2);
|
||||
}
|
||||
| kFOR block_var kIN expr do
|
||||
| kFOR block_var kIN {cond_nest++;} expr do {cond_nest--;}
|
||||
compstmt
|
||||
kEND
|
||||
{
|
||||
value_expr($2);
|
||||
$$ = NEW_FOR($2, $4, $6);
|
||||
$$ = NEW_FOR($2, $5, $8);
|
||||
fixpos($$, $2);
|
||||
}
|
||||
| kBEGIN
|
||||
|
@ -1350,7 +1366,8 @@ method_call : operation '(' opt_call_args close_paren
|
|||
|
||||
close_paren : ')'
|
||||
{
|
||||
lex_state = EXPR_PAREN;
|
||||
if (cond_nest == 0)
|
||||
lex_state = EXPR_PAREN;
|
||||
}
|
||||
|
||||
stmt_rhs : block_call
|
||||
|
@ -1720,6 +1737,7 @@ yycompile(f)
|
|||
n = yyparse();
|
||||
compile_for_eval = 0;
|
||||
ruby_in_compile = 0;
|
||||
cond_nest = 0;
|
||||
class_nest = 0;
|
||||
in_single = 0;
|
||||
cur_mid = 0;
|
||||
|
@ -1977,7 +1995,7 @@ read_escape()
|
|||
|
||||
static int
|
||||
parse_regx(term, paren)
|
||||
int term;
|
||||
int term, paren;
|
||||
{
|
||||
register int c;
|
||||
char kcode = 0;
|
||||
|
@ -1990,7 +2008,7 @@ parse_regx(term, paren)
|
|||
|
||||
newtok();
|
||||
while ((c = nextc()) != -1) {
|
||||
if ((!in_brack && c == term) || nest > 0) {
|
||||
if (!in_brack && c == term && nest == 0) {
|
||||
goto regx_end;
|
||||
}
|
||||
|
||||
|
@ -2040,29 +2058,12 @@ parse_regx(term, paren)
|
|||
}
|
||||
/* fall through */
|
||||
default:
|
||||
if (paren) {
|
||||
if (c == paren) nest++;
|
||||
if (c == term) nest--;
|
||||
}
|
||||
if (c == term) {
|
||||
tokadd(c);
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
int c1;
|
||||
pushback(c);
|
||||
c1 = read_escape();
|
||||
if (c1 != c) {
|
||||
tokadd(c1);
|
||||
}
|
||||
else {
|
||||
tokadd('\\');
|
||||
tokadd(c);
|
||||
}
|
||||
#else
|
||||
tokadd('\\');
|
||||
tokadd(c);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -2072,6 +2073,10 @@ parse_regx(term, paren)
|
|||
return 0;
|
||||
|
||||
default:
|
||||
if (paren && !in_brack) {
|
||||
if (c == paren) nest++;
|
||||
if (c == term) nest--;
|
||||
}
|
||||
if (ismbchar(c)) {
|
||||
int i, len = mbclen(c)-1;
|
||||
|
||||
|
@ -2198,10 +2203,7 @@ parse_string(func, term, paren)
|
|||
}
|
||||
if (paren) {
|
||||
if (c == paren) nest++;
|
||||
if (c == term) {
|
||||
nest--;
|
||||
if (nest == 0) break;
|
||||
}
|
||||
if (c == term && nest-- == 0) break;
|
||||
}
|
||||
tokadd(c);
|
||||
}
|
||||
|
@ -2276,10 +2278,7 @@ parse_qstring(term, paren)
|
|||
}
|
||||
if (paren) {
|
||||
if (c == paren) nest++;
|
||||
if (c == term) {
|
||||
nest--;
|
||||
if (nest == 0) break;
|
||||
}
|
||||
if (c == term && nest-- == 0) break;
|
||||
}
|
||||
tokadd(c);
|
||||
}
|
||||
|
@ -2388,10 +2387,13 @@ here_document(term, indent)
|
|||
}
|
||||
break;
|
||||
case tDSTRING:
|
||||
if (!list) list = NEW_DSTR(str);
|
||||
/* fall through */
|
||||
case tDXSTRING:
|
||||
if (!list) list = NEW_DXSTR(str);
|
||||
|
||||
list_append(yylval.node, NEW_STR(rb_str_new2("\n")));
|
||||
nd_set_type(yylval.node, NODE_STR);
|
||||
if (!list) list = NEW_DSTR(str);
|
||||
yylval.node = NEW_LIST(yylval.node);
|
||||
yylval.node->nd_next = yylval.node->nd_head->nd_next;
|
||||
list_concat(list, yylval.node);
|
||||
|
@ -2427,6 +2429,7 @@ here_document(term, indent)
|
|||
return tSTRING;
|
||||
case '`':
|
||||
if (list) return tDXSTRING;
|
||||
yylval.val = str;
|
||||
return tXSTRING;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2727,11 +2730,6 @@ yylex()
|
|||
}
|
||||
if (lex_state == EXPR_BEG || lex_state == EXPR_MID ||
|
||||
(lex_state == EXPR_ARG && space_seen && !ISSPACE(c))) {
|
||||
if (ISDIGIT(c)) {
|
||||
pushback(c);
|
||||
c = '-';
|
||||
goto start_num;
|
||||
}
|
||||
lex_state = EXPR_BEG;
|
||||
pushback(c);
|
||||
return tUMINUS;
|
||||
|
@ -3034,11 +3032,12 @@ yylex()
|
|||
rb_compile_error("unterminated quoted string meets end of file");
|
||||
return 0;
|
||||
}
|
||||
paren = 0;
|
||||
paren = term;
|
||||
if (term == '(') term = ')';
|
||||
else if (term == '[') term = ']';
|
||||
else if (term == '{') term = '}';
|
||||
else if (term == '<') term = '>';
|
||||
else paren = 0;
|
||||
|
||||
switch (c) {
|
||||
case 'Q':
|
||||
|
|
|
@ -592,7 +592,7 @@ rb_f_system(argc, argv)
|
|||
int argc;
|
||||
VALUE *argv;
|
||||
{
|
||||
#ifdef NT
|
||||
#if defined(NT) || defined(__EMX__)
|
||||
VALUE cmd;
|
||||
int state;
|
||||
|
||||
|
@ -611,7 +611,7 @@ rb_f_system(argc, argv)
|
|||
if (state == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
#else
|
||||
#if defined(DJGPP) || defined(__EMX__)
|
||||
#ifdef DJGPP
|
||||
VALUE cmd;
|
||||
int state;
|
||||
|
||||
|
|
26
regex.c
26
regex.c
|
@ -193,7 +193,7 @@ init_syntax_once()
|
|||
|
||||
memset(re_syntax_table, 0, sizeof re_syntax_table);
|
||||
|
||||
for (c=0; c<0x7f; c++)
|
||||
for (c=0; c<=0x7f; c++)
|
||||
if (isalnum(c))
|
||||
re_syntax_table[c] = Sword;
|
||||
re_syntax_table['_'] = Sword;
|
||||
|
@ -467,11 +467,12 @@ utf8_firstbyte(c)
|
|||
unsigned int c;
|
||||
{
|
||||
if (c < 0x80) return c;
|
||||
if (c < 0x7ff) return ((c>>6)&0xff)|0xc0;
|
||||
if (c < 0xffff) return ((c>>12)&0xff)|0xe0;
|
||||
if (c < 0x1fffff) return ((c>>18)&0xff)|0xf0;
|
||||
if (c < 0x3ffffff) return ((c>>24)&0xff)|0xf8;
|
||||
if (c < 0x7fffffff) return ((c>>30)&0xff)|0xfc;
|
||||
if (c <= 0x7ff) return ((c>>6)&0xff)|0xc0;
|
||||
if (c <= 0xffff) return ((c>>12)&0xff)|0xe0;
|
||||
if (c <= 0x1fffff) return ((c>>18)&0xff)|0xf0;
|
||||
if (c <= 0x3ffffff) return ((c>>24)&0xff)|0xf8;
|
||||
if (c <= 0x7fffffff) return ((c>>30)&0xff)|0xfc;
|
||||
if (c <= 0xfffffffff) return 0xfe;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -481,15 +482,15 @@ print_mbc(c)
|
|||
if (current_mbctype == MBCTYPE_UTF8) {
|
||||
if (c < 0x80)
|
||||
printf("%c", c);
|
||||
else if (c < 0x7ff)
|
||||
else if (c <= 0x7ff)
|
||||
printf("%c%c", utf8_firstbyte(c), c&0x3f);
|
||||
else if (c < 0xffff)
|
||||
else if (c <= 0xffff)
|
||||
printf("%c%c%c", utf8_firstbyte(c), (c>>6)&0x3f, c&0x3f);
|
||||
else if (c < 0x1fffff)
|
||||
else if (c <= 0x1fffff)
|
||||
printf("%c%c%c%c", utf8_firstbyte(c), (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
|
||||
else if (c < 0x3ffffff)
|
||||
else if (c <= 0x3ffffff)
|
||||
printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
|
||||
else if (c < 0x7fffffff)
|
||||
else if (c <= 0x7fffffff)
|
||||
printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
|
||||
}
|
||||
else {
|
||||
|
@ -2483,8 +2484,7 @@ slow_search(little, llen, big, blen, translate)
|
|||
if (slow_match(little, little+llen, big, bend, translate))
|
||||
return big - bsave;
|
||||
|
||||
if (ismbchar(*big)) big+=mbclen(*big);
|
||||
big++;
|
||||
big+=mbclen(*big);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
1
ruby.h
1
ruby.h
|
@ -276,7 +276,6 @@ struct RData {
|
|||
void *data;
|
||||
};
|
||||
|
||||
extern VALUE rb_cData;
|
||||
#define DATA_PTR(dta) (RDATA(dta)->data)
|
||||
|
||||
VALUE rb_data_object_alloc _((VALUE,void*,void (*)(),void (*)()));
|
||||
|
|
1
rubyio.h
1
rubyio.h
|
@ -36,6 +36,7 @@ typedef struct OpenFile {
|
|||
#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(obj)->fptr)
|
||||
|
||||
#define MakeOpenFile(obj, fp) do {\
|
||||
RFILE(obj)->iv_tbl = 0;\
|
||||
fp = RFILE(obj)->fptr = ALLOC(OpenFile);\
|
||||
fp->f = fp->f2 = NULL;\
|
||||
fp->mode = 0;\
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef SIG_H
|
||||
#define SIG_H
|
||||
|
||||
extern int rb_trap_immediate;
|
||||
EXTERN int rb_trap_immediate;
|
||||
#define TRAP_BEG (rb_trap_immediate=1)
|
||||
#define TRAP_END (rb_trap_immediate=0)
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ class String
|
|||
len += 1
|
||||
me = self[0, len].ljust(len)
|
||||
if me =~ /.$/ and $&.size == 2
|
||||
p me[-2..-1]
|
||||
me[-2..-1] = ' '
|
||||
me[-2, 2] = ' '
|
||||
end
|
||||
|
|
4
st.c
4
st.c
|
@ -10,6 +10,10 @@ static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible";
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef NT
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
typedef struct st_table_entry st_table_entry;
|
||||
|
||||
struct st_table_entry {
|
||||
|
|
1
string.c
1
string.c
|
@ -2180,6 +2180,7 @@ rb_str_each_line(argc, argv, str)
|
|||
}
|
||||
|
||||
if (s != pend) {
|
||||
if (p > pend) p = pend ;
|
||||
line = rb_str_new(s, p - s);
|
||||
rb_yield(line);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.3.4"
|
||||
#define RUBY_RELEASE_DATE "1999-06-11"
|
||||
#define RUBY_RELEASE_DATE "1999-06-24"
|
||||
#define RUBY_VERSION_CODE 134
|
||||
#define RUBY_RELEASE_CODE 19990611
|
||||
#define RUBY_RELEASE_CODE 19990624
|
||||
|
|
|
@ -27,6 +27,8 @@ EXPORTS
|
|||
rb_mErrno;
|
||||
;eval.c:
|
||||
rb_cProc
|
||||
rb_thread_tick
|
||||
rb_thread_critical
|
||||
;file.c:
|
||||
rb_cFile
|
||||
;hash.c:
|
||||
|
@ -35,6 +37,7 @@ EXPORTS
|
|||
ruby_unsetenv
|
||||
;io.c:
|
||||
rb_cIO
|
||||
rb_io_check_closed
|
||||
;numeric.c:
|
||||
rb_cNumeric
|
||||
rb_cFloat
|
||||
|
@ -52,6 +55,10 @@ EXPORTS
|
|||
rb_cFalseClass
|
||||
;re.c:
|
||||
rb_cRegexp
|
||||
;signal.c:
|
||||
rb_trap_immediate
|
||||
rb_trap_pending
|
||||
rb_prohibit_interrupt
|
||||
;string.c:
|
||||
rb_cString
|
||||
rb_cStruct
|
||||
|
@ -60,9 +67,13 @@ EXPORTS
|
|||
;missing/nt.c
|
||||
NtInitialize
|
||||
myfdopen
|
||||
myfdclose
|
||||
myaccept
|
||||
mybind
|
||||
myconnect
|
||||
myfdset
|
||||
myfdisset
|
||||
myselect
|
||||
mygetpeername
|
||||
mygetsockname
|
||||
mygetsockopt
|
||||
|
@ -82,10 +93,11 @@ EXPORTS
|
|||
mygetprotobynumber
|
||||
mygetservbyname
|
||||
mygetservbyport
|
||||
myget_osfhandle
|
||||
;array.c
|
||||
rb_ary_freeze
|
||||
rb_ary_new2
|
||||
rb_ary_new
|
||||
rb_ary_new2
|
||||
rb_ary_new3
|
||||
rb_ary_new4
|
||||
rb_assoc_new
|
||||
|
@ -118,6 +130,7 @@ EXPORTS
|
|||
rb_uint2inum
|
||||
rb_int2inum
|
||||
rb_str2inum
|
||||
rb_str2cstr
|
||||
rb_big2str
|
||||
rb_big2ulong
|
||||
rb_big2long
|
||||
|
@ -236,6 +249,11 @@ EXPORTS
|
|||
rb_thread_scope_shared_p
|
||||
rb_thread_interrupt
|
||||
rb_thread_trap_eval
|
||||
rb_thread_fd_close
|
||||
rb_thread_stop
|
||||
rb_thread_wakeup
|
||||
rb_thread_run
|
||||
rb_thread_create
|
||||
rb_catch
|
||||
rb_throw
|
||||
rb_yield
|
||||
|
@ -293,6 +311,7 @@ EXPORTS
|
|||
rb_obj_is_instance_of
|
||||
rb_obj_is_kind_of
|
||||
rb_obj_alloc
|
||||
rb_obj_taint
|
||||
rb_to_id
|
||||
rb_class_of
|
||||
rb_type
|
||||
|
@ -301,6 +320,7 @@ EXPORTS
|
|||
rb_Float
|
||||
rb_String
|
||||
rb_Array
|
||||
rb_num2dbl
|
||||
; parse.c
|
||||
rb_node_newnode
|
||||
rb_id_attrset
|
||||
|
@ -334,6 +354,9 @@ EXPORTS
|
|||
rb_get_kcode
|
||||
rb_set_kcode
|
||||
; ruby.c
|
||||
rb_argv
|
||||
rb_argv0
|
||||
rb_progname
|
||||
rb_load_file
|
||||
ruby_script
|
||||
ruby_prog_init
|
||||
|
|
|
@ -1780,6 +1780,36 @@ ioctl(int i, unsigned int u, long data)
|
|||
}
|
||||
|
||||
|
||||
#undef FD_SET
|
||||
|
||||
void
|
||||
myfdset(int fd, fd_set *set)
|
||||
{
|
||||
unsigned int i;
|
||||
SOCKET s = TO_SOCKET(fd);
|
||||
|
||||
for (i = 0; i < set->fd_count; i++) {
|
||||
if (set->fd_array[i] == s) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i == set->fd_count) {
|
||||
if (set->fd_count < FD_SETSIZE) {
|
||||
set->fd_array[i] = s;
|
||||
set->fd_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#undef FD_ISSET
|
||||
|
||||
int
|
||||
myfdisset(int fd, fd_set *set)
|
||||
{
|
||||
return __WSAFDIsSet(TO_SOCKET(fd), set);
|
||||
}
|
||||
|
||||
//
|
||||
// Networking trampolines
|
||||
// These are used to avoid socket startup/shutdown overhead in case
|
||||
|
|
|
@ -175,6 +175,9 @@ extern void myfdclose(FILE *);
|
|||
extern SOCKET myaccept(SOCKET, struct sockaddr *, int *);
|
||||
extern int mybind(SOCKET, struct sockaddr *, int);
|
||||
extern int myconnect(SOCKET, struct sockaddr *, int);
|
||||
extern void myfdset(int, fd_set*);
|
||||
extern int myfdisset(int, fd_set*);
|
||||
extern long myselect(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
extern int mygetpeername(SOCKET, struct sockaddr *, int *);
|
||||
extern int mygetsockname(SOCKET, struct sockaddr *, int *);
|
||||
extern int mygetsockopt(SOCKET, int, int, char *, int *);
|
||||
|
@ -274,6 +277,15 @@ extern char *mystrerror(int);
|
|||
#endif
|
||||
#define connect myconnect
|
||||
|
||||
#undef FD_SET
|
||||
#define FD_SET myfdset
|
||||
|
||||
#undef FD_ISSET
|
||||
#define FD_ISSET myfdisset
|
||||
|
||||
#undef select
|
||||
#define select myselect
|
||||
|
||||
#ifdef getpeername
|
||||
#undef getpeername
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue