diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
commit | 758cb647c7ac9e02a9ee0d7cb0934a5c963481e0 (patch) | |
tree | a6ad21b14e176e9c3a39a775781b978950315543 | |
parent | d426749ff0ec0348e8b2f9e32724ac715aad500b (diff) |
19991004
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | Makefile.in | 14 | ||||
-rw-r--r-- | README.EXT | 7 | ||||
-rw-r--r-- | README.EXT.jp | 10 | ||||
-rw-r--r-- | README.jp | 2 | ||||
-rw-r--r-- | ToDo | 1 | ||||
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | ext/nkf/nkf.c | 2 | ||||
-rw-r--r-- | ext/nkf/nkf1.7/nkf.c | 3 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 4 | ||||
-rw-r--r-- | ext/socket/getnameinfo.c | 4 | ||||
-rw-r--r-- | ext/socket/socket.c | 17 | ||||
-rw-r--r-- | misc/ruby-mode.el | 7 | ||||
-rw-r--r-- | misc/rubydb3x.el | 2 | ||||
-rw-r--r-- | missing/strftime.c | 1 | ||||
-rw-r--r-- | pack.c | 69 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | regex.c | 2 | ||||
-rw-r--r-- | time.c | 2 | ||||
-rw-r--r-- | variable.c | 12 |
20 files changed, 125 insertions, 65 deletions
@@ -1,3 +1,25 @@ +Mon Oct 4 12:42:32 1999 Kazuhiko Izawa <[email protected]> + + * pack.c (pack_unpack): % in printf format should be %%. + +Mon Oct 4 10:01:40 1999 Yukihiro Matsumoto <[email protected]> + + * variable.c (rb_obj_instance_variables): should always return + array for all object can have instance variables now. + +Mon Oct 4 00:08:34 1999 Yukihiro Matsumoto <[email protected]> + + * pack.c (OFF16): need to adjust pointer address to pack/unpack on + 64bit machines. + +Sun Oct 03 03:05:59 1999 WATANABE Hirofumi <[email protected]> + + * time.c (time_arg): mktime y2k problem. + +Sun Sep 26 16:54:45 1999 WATANABE Hirofumi <[email protected]> + + * parse.y (here_document): `\r' handling for here documents. + Wed Sep 22 09:20:11 1999 Masahiro Tomita <[email protected]> * ext/socket/socket.c: SOCKS5 support. diff --git a/Makefile.in b/Makefile.in index 865318ba70..4b1f2696aa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -38,7 +38,7 @@ LIBRUBY_ALIASES= @LIBRUBY_ALIASES@ LIBRUBY = @LIBRUBY@ LIBRUBYARG = @LIBRUBYARG@ -EXTOBJS = +EXTOBJS = dmyext.@OBJEXT@ MAINOBJ = main.@OBJEXT@ @@ -83,20 +83,20 @@ OBJS = array.@OBJEXT@ \ all: miniruby$(EXEEXT) rbconfig.rb @./miniruby$(EXEEXT) -Xext extmk.rb @EXTSTATIC@ -miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@ +miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(EXTOBJS) @rm -f $@ - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) dmyext.@OBJEXT@ $(LIBRUBY_A) $(LIBS) -o $@ + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) -o $@ $(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) @rm -f $@ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ -$(LIBRUBY_A): $(OBJS) dmyext.@OBJEXT@ - @AR@ rcu $@ $(OBJS) dmyext.@OBJEXT@ +$(LIBRUBY_A): $(OBJS) + @AR@ rcu $@ $(OBJS) @-@RANLIB@ $@ 2> /dev/null || true -$(LIBRUBY_SO): $(OBJS) dmyext.@OBJEXT@ - $(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.@OBJEXT@ -o $@ +$(LIBRUBY_SO): $(OBJS) + $(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) -o $@ @-./miniruby -e 'ARGV.each{|link| File.delete link if File.exist? link; \ File.symlink "$(LIBRUBY_SO)", link}' \ $(LIBRUBY_ALIASES) || true diff --git a/README.EXT b/README.EXT index c0f7048bdf..f850f01097 100644 --- a/README.EXT +++ b/README.EXT @@ -892,7 +892,6 @@ Sets the value of the instance variable. Calls the function func1, supplying func2 as the block. func1 will be called with the argument arg1. func2 receives the value from yield as the first argument, arg2 as the second argument. - VALUE rb_yield(VALUE val) @@ -942,10 +941,14 @@ exception handling nor ensure execution will be done. The embedding API are below (not needed for extension libraries): - void ruby_init(int argc, char **argv, char **envp) + void ruby_init() Initializes the interpreter. + void ruby_options(int argc, char **argv) + +Process command line arguments for the interpreter. + void ruby_run() Starts execution of the interpreter. diff --git a/README.EXT.jp b/README.EXT.jp index da3902b8cc..5305f92df4 100644 --- a/README.EXT.jp +++ b/README.EXT.jp @@ -245,8 +245,8 @@ Ruby������Ƥ���ؿ���Ȥ���Ruby���ץ�˿�������ǽ ���饹��⥸�塼���¾�Υ��饹�������˥ͥ��Ȥ������������� �ϰʲ��δؿ���Ȥ��ޤ��� - VALUE rb_define_class(VALUE outer, char *name, VALUE super) - VALUE rb_define_module(VALUE outer, char *name) + VALUE rb_define_class_under(VALUE outer, char *name, VALUE super) + VALUE rb_define_module_under(VALUE outer, char *name) 2.1.2 ��å�/�ðۥ�å���� @@ -1099,10 +1099,14 @@ void rb_bug(char *fmt, ...) Ruby�ץꥱ����������������ˤϰʲ��Υ��ե����� ��Ȥ����̾�γ�ĥ�饤�֥��ˤ�ɬ�פʤ��� -void ruby_init(int argc, char **argv, char **envp) +void ruby_init() Ruby���ץ�ν������Ԥʤ��� +void ruby_options(int argc, char **argv) + + Ruby���ץ�Υ��ޥ�ɥ饤������ν�����Ԥʤ��� + void ruby_run() Ruby���ץ��¹Ԥ��롥 @@ -136,7 +136,7 @@ UNIX�Ǥ����configure���ۤȤ�ɤκ��ۤ�ۼ����Ƥ����Ϥ��� * ���۾�� Ruby�ϥե���եȥ������Ǥ���GPL(the GNU General Public -Licence)�ޤ��ϰʲ��˼�������Ruby������ۤǤ��ޤ���GPL�ˤ� +License)�ޤ��ϰʲ��˼�������Ruby������ۤǤ��ޤ���GPL�ˤ� ���Ƥ�COPYING�ե�����Ȥ��Ʋ������� 1. ʣ�������¤ʤ���ͳ�Ǥ��� @@ -15,6 +15,7 @@ Language Spec. Hacking Interpreter +* RUBYOPT environment variable * non-blocking open (e.g. named pipe) for thread * avoid blocking with gethostbyname/gethostbyaddr * objectify interpreters @@ -1185,9 +1185,9 @@ rb_eval_string_wrap(str, state) POP_CLASS(); if (state) { *state = status; - if (status) { - JUMP_TAG(status); - } + } + else if (status) { + JUMP_TAG(status); } return val; } @@ -6414,7 +6414,6 @@ rb_thread_schedule() fd_set readfds; struct timeval delay_tv, *delay_ptr; double delay, now; /* OK */ - int n, max; do { diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c index 35d9295a74..80d0d2e4be 100644 --- a/ext/nkf/nkf.c +++ b/ext/nkf/nkf.c @@ -10,7 +10,7 @@ #undef getc #undef ungetc -#define getc(f) (input_ctr>i_len?-1:input[input_ctr++]) +#define getc(f) (input_ctr<i_len?input[input_ctr++]:-1) #define ungetc(c,f) input_ctr-- #undef putchar diff --git a/ext/nkf/nkf1.7/nkf.c b/ext/nkf/nkf1.7/nkf.c index 26ef657021..09419f40a7 100644 --- a/ext/nkf/nkf1.7/nkf.c +++ b/ext/nkf/nkf1.7/nkf.c @@ -871,7 +871,7 @@ kanji_convert(f) } else if(c1 == SO) { shift_mode = TRUE; NEXT; - } else if(c1 == ESC ) { + } else if(c1 == ESC) { if((c1 = GETC(f)) == EOF) { (*oconv)(0, ESC); LAST; @@ -1826,6 +1826,7 @@ reinit() file_out = FALSE; add_cr = FALSE; del_cr = FALSE; + line = 0; } #ifndef PERL_XS diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index c71a56ca80..501ebd5006 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -67,6 +67,10 @@ #include <stddef.h> #include <ctype.h> +#ifdef SOCKS5 +#include <socks.h> +#endif + #include "config.h" #include "addrinfo.h" #include "sockport.h" diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index abadd8f442..cb65e4c070 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -56,6 +56,10 @@ #include <string.h> #include <stddef.h> +#ifdef SOCKS5 +#include <socks.h> +#endif + #include "config.h" #include "addrinfo.h" #include "sockport.h" diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 3ff6af441e..f7840948f8 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -780,6 +780,20 @@ socks_s_open(class, host, serv) Check_SafeStr(host); return open_inet(class, host, serv, INET_SOCKS); } + +#ifdef SOCKS5 +static VALUE +socks_s_close(sock) + VALUE sock; +{ + OpenFile *fptr; + + GetOpenFile(sock, fptr); + shutdown(fileno(fptr->f), 2); + shutdown(fileno(fptr->f2), 2); + return rb_io_close(sock); +} +#endif #endif /* @@ -1876,6 +1890,9 @@ Init_socket() rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket); rb_define_singleton_method(rb_cSOCKSSocket, "open", socks_s_open, 2); rb_define_singleton_method(rb_cSOCKSSocket, "new", socks_s_open, 2); +#ifdef SOCKS5 + rb_define_method(rb_cSOCKSSocket, "close", socks_s_close, 0); +#endif #endif rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket); diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 2875608f07..50e4f50e87 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -576,12 +576,11 @@ An end of a defun is found by moving forward from the beginning of one." (defun ruby-reindent-then-newline-and-indent () (interactive "*") - (save-excursion - (delete-region (point) (progn (skip-chars-backward " \t") (point)))) (newline) (save-excursion - (forward-line -1) - (indent-according-to-mode)) + (end-of-line 0) + (indent-according-to-mode) + (delete-region (point) (progn (skip-chars-backward " \t") (point)))) (indent-according-to-mode)) (fset 'ruby-encomment-region (symbol-function 'comment-region)) diff --git a/misc/rubydb3x.el b/misc/rubydb3x.el index 14e3dac83b..98ce1a1978 100644 --- a/misc/rubydb3x.el +++ b/misc/rubydb3x.el @@ -108,6 +108,8 @@ and source-file directory for your debugger." (gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.") (setq comint-prompt-regexp "^(rdb:-) ") + (if (boundp 'comint-last-output-start) + (set-marker comint-last-output-start (point))) (set (make-local-variable 'paragraph-start) comint-prompt-regexp) (run-hooks 'rubydb-mode-hook) ) diff --git a/missing/strftime.c b/missing/strftime.c index cc3f1a8070..6bce490249 100644 --- a/missing/strftime.c +++ b/missing/strftime.c @@ -425,6 +425,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) */ off = -(daylight ? timezone : altzone) / 60; #else /* !HAVE_TZNAME */ + gettimeofday(&tv, &zone); off = -zone.tz_minuteswest; #endif /* !HAVE_TZNAME */ #endif /* !HAVE_TM_ZONE */ @@ -23,10 +23,19 @@ #ifdef NATINT_PACK # define NATINT_LEN(type,len) (natint?sizeof(type):(len)) +# ifndef WORDS_BIGENDIAN +# define OFF16(p) ((char*)(p) + (natint?(sizeof(short) - 2):0)) +# define OFF32(p) ((char*)(p) + (natint?(sizeof(long) - 4):0)) +# endif #else # define NATINT_LEN(type,len) sizeof(type) #endif +#ifndef OFF16 +# define OFF16(p) (char*)(p) +# define OFF32(p) (char*)(p) +#endif + #define define_swapx(x, xtype) \ static xtype \ TOKEN_PASTE(swap,x)(z) \ @@ -546,7 +555,7 @@ pack_pack(ary, fmt) else { s = NUM2INT(from); } - rb_str_cat(res, (char*)&s, NATINT_LEN(short,2)); + rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2)); } break; @@ -574,7 +583,7 @@ pack_pack(ary, fmt) else { l = NUM2ULONG(from); } - rb_str_cat(res, (char*)&l, NATINT_LEN(long,4)); + rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4)); } break; @@ -588,7 +597,7 @@ pack_pack(ary, fmt) s = NUM2INT(from); } s = htons(s); - rb_str_cat(res, (char*)&s, NATINT_LEN(short,2)); + rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2)); } break; @@ -602,7 +611,7 @@ pack_pack(ary, fmt) l = NUM2ULONG(from); } l = htonl(l); - rb_str_cat(res, (char*)&l, NATINT_LEN(long,4)); + rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4)); } break; @@ -616,7 +625,7 @@ pack_pack(ary, fmt) s = NUM2INT(from); } s = htovs(s); - rb_str_cat(res, (char*)&s, NATINT_LEN(short,2)); + rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2)); } break; @@ -630,7 +639,7 @@ pack_pack(ary, fmt) l = NUM2ULONG(from); } l = htovl(l); - rb_str_cat(res, (char*)&l, NATINT_LEN(long,4)); + rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4)); } break; @@ -783,7 +792,7 @@ pack_pack(ary, fmt) break; case '%': - rb_raise(rb_eArgError, "% may only be used in unpack"); + rb_raise(rb_eArgError, "%% is not supported"); break; case 'U': @@ -1062,7 +1071,7 @@ pack_unpack(str, fmt) switch (type) { case '%': - rb_raise(rb_eArgError, "% is not supported(yet)"); + rb_raise(rb_eArgError, "%% is not supported"); break; case 'A': @@ -1204,8 +1213,8 @@ pack_unpack(str, fmt) case 's': PACK_LENGTH_ADJUST(short,2); while (len-- > 0) { - short tmp; - memcpy(&tmp, s, NATINT_LEN(short,2)); + short tmp = 0; + memcpy(OFF16(&tmp), s, NATINT_LEN(short,2)); s += NATINT_LEN(short,2); rb_ary_push(ary, INT2FIX(tmp)); } @@ -1215,8 +1224,8 @@ pack_unpack(str, fmt) case 'S': PACK_LENGTH_ADJUST(unsigned short,2); while (len-- > 0) { - unsigned short tmp; - memcpy(&tmp, s, NATINT_LEN(unsigned short,2)); + unsigned short tmp = 0; + memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); s += NATINT_LEN(unsigned short,2); rb_ary_push(ary, INT2FIX(tmp)); } @@ -1248,8 +1257,8 @@ pack_unpack(str, fmt) case 'l': PACK_LENGTH_ADJUST(long,4); while (len-- > 0) { - long tmp; - memcpy(&tmp, s, NATINT_LEN(long,4)); + long tmp = 0; + memcpy(OFF32(&tmp), s, NATINT_LEN(long,4)); s += NATINT_LEN(long,4); rb_ary_push(ary, rb_int2inum(tmp)); } @@ -1259,8 +1268,8 @@ pack_unpack(str, fmt) case 'L': PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { - unsigned long tmp; - memcpy(&tmp, s, NATINT_LEN(unsigned long,4)); + unsigned long tmp = 0; + memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4)); s += NATINT_LEN(unsigned long,4); rb_ary_push(ary, rb_uint2inum(tmp)); } @@ -1270,11 +1279,10 @@ pack_unpack(str, fmt) case 'n': PACK_LENGTH_ADJUST(unsigned short,2); while (len-- > 0) { - unsigned short tmp; - memcpy(&tmp, s, NATINT_LEN(unsigned short,2)); + unsigned short tmp = 0; + memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); s += NATINT_LEN(unsigned short,2); - tmp = ntohs(tmp); - rb_ary_push(ary, rb_uint2inum(tmp)); + rb_ary_push(ary, rb_uint2inum(ntohs(tmp))); } PACK_ITEM_ADJUST(); break; @@ -1282,11 +1290,10 @@ pack_unpack(str, fmt) case 'N': PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { - unsigned long tmp; - memcpy(&tmp, s, NATINT_LEN(unsigned long,4)); + unsigned long tmp = 0; + memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4)); s += NATINT_LEN(unsigned long,4); - tmp = ntohl(tmp); - rb_ary_push(ary, rb_uint2inum(tmp)); + rb_ary_push(ary, rb_uint2inum(ntohl(tmp))); } PACK_ITEM_ADJUST(); break; @@ -1294,11 +1301,10 @@ pack_unpack(str, fmt) case 'v': PACK_LENGTH_ADJUST(unsigned short,2); while (len-- > 0) { - unsigned short tmp; - memcpy(&tmp, s, NATINT_LEN(unsigned short,2)); + unsigned short tmp = 0; + memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); s += NATINT_LEN(unsigned short,2); - tmp = vtohs(tmp); - rb_ary_push(ary, rb_uint2inum(tmp)); + rb_ary_push(ary, rb_uint2inum(vtohs(tmp))); } PACK_ITEM_ADJUST(); break; @@ -1306,11 +1312,10 @@ pack_unpack(str, fmt) case 'V': PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { - unsigned long tmp; - memcpy(&tmp, s, NATINT_LEN(long,4)); + unsigned long tmp = 0; + memcpy(OFF32(&tmp), s, NATINT_LEN(long,4)); s += NATINT_LEN(long,4); - tmp = vtohl(tmp); - rb_ary_push(ary, rb_uint2inum(tmp)); + rb_ary_push(ary, rb_uint2inum(vtohl(tmp))); } PACK_ITEM_ADJUST(); break; @@ -2387,7 +2387,7 @@ here_document(term, indent) p++; } } - if (strncmp(eos, p, len) == 0 && p[len] == '\n') { + if (strncmp(eos, p, len) == 0 && (p[len] == '\n' || p[len] == '\r')) { break; } @@ -2877,7 +2877,7 @@ re_compile_fastmap(bufp) break; } for (j = 0,c = 0;j < (int)size; j++) { - int cc = EXTRACT_MBC(&p[j*8]); + unsigned int cc = EXTRACT_MBC(&p[j*8]); beg = WC2MBC1ST(cc); while (c < beg) { if (ismbchar(c)) @@ -208,7 +208,7 @@ time_arg(argc, argv, tm) } tm->tm_year = obj2long(v[0]); - if (0 < tm->tm_year && tm->tm_year < 69) tm->tm_year += 100; + if (0 <= tm->tm_year && tm->tm_year < 69) tm->tm_year += 100; if (tm->tm_year >= 1900) tm->tm_year -= 1900; if (NIL_P(v[1])) { tm->tm_mon = 0; diff --git a/variable.c b/variable.c index 23ae945870..7b273933ac 100644 --- a/variable.c +++ b/variable.c @@ -916,7 +916,7 @@ VALUE rb_obj_instance_variables(obj) VALUE obj; { - VALUE ary; + VALUE ary = rb_ary_new(); if (!FL_TEST(obj, FL_TAINT) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't get metainfo"); @@ -924,24 +924,22 @@ rb_obj_instance_variables(obj) case T_OBJECT: case T_CLASS: case T_MODULE: - ary = rb_ary_new(); if (ROBJECT(obj)->iv_tbl) { st_foreach(ROBJECT(obj)->iv_tbl, ivar_i, ary); } - return ary; + break; default: - if (!generic_iv_tbl) return Qnil; + if (!generic_iv_tbl) break; if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) { st_table *tbl; if (st_lookup(generic_iv_tbl, obj, &tbl)) { - ary = rb_ary_new(); st_foreach(tbl, ivar_i, ary); - return ary; } } + break; } - return Qnil; + return ary; } VALUE |