19991004
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d426749ff0
commit
758cb647c7
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
|||||||
|
Mon Oct 4 12:42:32 1999 Kazuhiko Izawa <izawa@erec.che.tohoku.ac.jp>
|
||||||
|
|
||||||
|
* pack.c (pack_unpack): % in printf format should be %%.
|
||||||
|
|
||||||
|
Mon Oct 4 10:01:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* 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 <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* pack.c (OFF16): need to adjust pointer address to pack/unpack on
|
||||||
|
64bit machines.
|
||||||
|
|
||||||
|
Sun Oct 03 03:05:59 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
|
||||||
|
|
||||||
|
* time.c (time_arg): mktime y2k problem.
|
||||||
|
|
||||||
|
Sun Sep 26 16:54:45 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
|
||||||
|
|
||||||
|
* parse.y (here_document): `\r' handling for here documents.
|
||||||
|
|
||||||
Wed Sep 22 09:20:11 1999 Masahiro Tomita <tommy@tmtm.org>
|
Wed Sep 22 09:20:11 1999 Masahiro Tomita <tommy@tmtm.org>
|
||||||
|
|
||||||
* ext/socket/socket.c: SOCKS5 support.
|
* ext/socket/socket.c: SOCKS5 support.
|
||||||
|
14
Makefile.in
14
Makefile.in
@ -38,7 +38,7 @@ LIBRUBY_ALIASES= @LIBRUBY_ALIASES@
|
|||||||
LIBRUBY = @LIBRUBY@
|
LIBRUBY = @LIBRUBY@
|
||||||
LIBRUBYARG = @LIBRUBYARG@
|
LIBRUBYARG = @LIBRUBYARG@
|
||||||
|
|
||||||
EXTOBJS =
|
EXTOBJS = dmyext.@OBJEXT@
|
||||||
|
|
||||||
MAINOBJ = main.@OBJEXT@
|
MAINOBJ = main.@OBJEXT@
|
||||||
|
|
||||||
@ -83,20 +83,20 @@ OBJS = array.@OBJEXT@ \
|
|||||||
all: miniruby$(EXEEXT) rbconfig.rb
|
all: miniruby$(EXEEXT) rbconfig.rb
|
||||||
@./miniruby$(EXEEXT) -Xext extmk.rb @EXTSTATIC@
|
@./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 $@
|
@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)
|
$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS)
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
|
$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
|
||||||
|
|
||||||
$(LIBRUBY_A): $(OBJS) dmyext.@OBJEXT@
|
$(LIBRUBY_A): $(OBJS)
|
||||||
@AR@ rcu $@ $(OBJS) dmyext.@OBJEXT@
|
@AR@ rcu $@ $(OBJS)
|
||||||
@-@RANLIB@ $@ 2> /dev/null || true
|
@-@RANLIB@ $@ 2> /dev/null || true
|
||||||
|
|
||||||
$(LIBRUBY_SO): $(OBJS) dmyext.@OBJEXT@
|
$(LIBRUBY_SO): $(OBJS)
|
||||||
$(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.@OBJEXT@ -o $@
|
$(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) -o $@
|
||||||
@-./miniruby -e 'ARGV.each{|link| File.delete link if File.exist? link; \
|
@-./miniruby -e 'ARGV.each{|link| File.delete link if File.exist? link; \
|
||||||
File.symlink "$(LIBRUBY_SO)", link}' \
|
File.symlink "$(LIBRUBY_SO)", link}' \
|
||||||
$(LIBRUBY_ALIASES) || true
|
$(LIBRUBY_ALIASES) || true
|
||||||
|
@ -892,7 +892,6 @@ Sets the value of the instance variable.
|
|||||||
Calls the function func1, supplying func2 as the block. func1 will be
|
Calls the function func1, supplying func2 as the block. func1 will be
|
||||||
called with the argument arg1. func2 receives the value from yield as
|
called with the argument arg1. func2 receives the value from yield as
|
||||||
the first argument, arg2 as the second argument.
|
the first argument, arg2 as the second argument.
|
||||||
|
|
||||||
|
|
||||||
VALUE rb_yield(VALUE val)
|
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):
|
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.
|
Initializes the interpreter.
|
||||||
|
|
||||||
|
void ruby_options(int argc, char **argv)
|
||||||
|
|
||||||
|
Process command line arguments for the interpreter.
|
||||||
|
|
||||||
void ruby_run()
|
void ruby_run()
|
||||||
|
|
||||||
Starts execution of the interpreter.
|
Starts execution of the interpreter.
|
||||||
|
@ -245,8 +245,8 @@ Ruby
|
|||||||
クラスやモジュールを他のクラスの内部にネストして定義する時に
|
クラスやモジュールを他のクラスの内部にネストして定義する時に
|
||||||
は以下の関数を使います.
|
は以下の関数を使います.
|
||||||
|
|
||||||
VALUE rb_define_class(VALUE outer, char *name, VALUE super)
|
VALUE rb_define_class_under(VALUE outer, char *name, VALUE super)
|
||||||
VALUE rb_define_module(VALUE outer, char *name)
|
VALUE rb_define_module_under(VALUE outer, char *name)
|
||||||
|
|
||||||
2.1.2 メソッド/特異メソッド定義
|
2.1.2 メソッド/特異メソッド定義
|
||||||
|
|
||||||
@ -1099,10 +1099,14 @@ void rb_bug(char *fmt, ...)
|
|||||||
Rubyをアプリケーションに埋め込む場合には以下のインタフェース
|
Rubyをアプリケーションに埋め込む場合には以下のインタフェース
|
||||||
を使う.通常の拡張ライブラリには必要ない.
|
を使う.通常の拡張ライブラリには必要ない.
|
||||||
|
|
||||||
void ruby_init(int argc, char **argv, char **envp)
|
void ruby_init()
|
||||||
|
|
||||||
Rubyインタプリタの初期化を行なう.
|
Rubyインタプリタの初期化を行なう.
|
||||||
|
|
||||||
|
void ruby_options(int argc, char **argv)
|
||||||
|
|
||||||
|
Rubyインタプリタのコマンドライン引数の処理を行なう.
|
||||||
|
|
||||||
void ruby_run()
|
void ruby_run()
|
||||||
|
|
||||||
Rubyインタプリタを実行する.
|
Rubyインタプリタを実行する.
|
||||||
|
@ -136,7 +136,7 @@ UNIX
|
|||||||
* 配布条件
|
* 配布条件
|
||||||
|
|
||||||
Rubyはフリーソフトウェアです.GPL(the GNU General Public
|
Rubyはフリーソフトウェアです.GPL(the GNU General Public
|
||||||
Licence)または以下に示す条件でRubyを再配布できます.GPLにつ
|
License)または以下に示す条件でRubyを再配布できます.GPLにつ
|
||||||
いてはCOPYINGファイルを参照して下さい.
|
いてはCOPYINGファイルを参照して下さい.
|
||||||
|
|
||||||
1. 複製は制限なく自由です.
|
1. 複製は制限なく自由です.
|
||||||
|
1
ToDo
1
ToDo
@ -15,6 +15,7 @@ Language Spec.
|
|||||||
|
|
||||||
Hacking Interpreter
|
Hacking Interpreter
|
||||||
|
|
||||||
|
* RUBYOPT environment variable
|
||||||
* non-blocking open (e.g. named pipe) for thread
|
* non-blocking open (e.g. named pipe) for thread
|
||||||
* avoid blocking with gethostbyname/gethostbyaddr
|
* avoid blocking with gethostbyname/gethostbyaddr
|
||||||
* objectify interpreters
|
* objectify interpreters
|
||||||
|
7
eval.c
7
eval.c
@ -1185,9 +1185,9 @@ rb_eval_string_wrap(str, state)
|
|||||||
POP_CLASS();
|
POP_CLASS();
|
||||||
if (state) {
|
if (state) {
|
||||||
*state = status;
|
*state = status;
|
||||||
if (status) {
|
}
|
||||||
JUMP_TAG(status);
|
else if (status) {
|
||||||
}
|
JUMP_TAG(status);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -6414,7 +6414,6 @@ rb_thread_schedule()
|
|||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
struct timeval delay_tv, *delay_ptr;
|
struct timeval delay_tv, *delay_ptr;
|
||||||
double delay, now; /* OK */
|
double delay, now; /* OK */
|
||||||
|
|
||||||
int n, max;
|
int n, max;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#undef getc
|
#undef getc
|
||||||
#undef ungetc
|
#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--
|
#define ungetc(c,f) input_ctr--
|
||||||
|
|
||||||
#undef putchar
|
#undef putchar
|
||||||
|
@ -871,7 +871,7 @@ kanji_convert(f)
|
|||||||
} else if(c1 == SO) {
|
} else if(c1 == SO) {
|
||||||
shift_mode = TRUE;
|
shift_mode = TRUE;
|
||||||
NEXT;
|
NEXT;
|
||||||
} else if(c1 == ESC ) {
|
} else if(c1 == ESC) {
|
||||||
if((c1 = GETC(f)) == EOF) {
|
if((c1 = GETC(f)) == EOF) {
|
||||||
(*oconv)(0, ESC);
|
(*oconv)(0, ESC);
|
||||||
LAST;
|
LAST;
|
||||||
@ -1826,6 +1826,7 @@ reinit()
|
|||||||
file_out = FALSE;
|
file_out = FALSE;
|
||||||
add_cr = FALSE;
|
add_cr = FALSE;
|
||||||
del_cr = FALSE;
|
del_cr = FALSE;
|
||||||
|
line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PERL_XS
|
#ifndef PERL_XS
|
||||||
|
@ -67,6 +67,10 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef SOCKS5
|
||||||
|
#include <socks.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "addrinfo.h"
|
#include "addrinfo.h"
|
||||||
#include "sockport.h"
|
#include "sockport.h"
|
||||||
|
@ -56,6 +56,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef SOCKS5
|
||||||
|
#include <socks.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "addrinfo.h"
|
#include "addrinfo.h"
|
||||||
#include "sockport.h"
|
#include "sockport.h"
|
||||||
|
@ -780,6 +780,20 @@ socks_s_open(class, host, serv)
|
|||||||
Check_SafeStr(host);
|
Check_SafeStr(host);
|
||||||
return open_inet(class, host, serv, INET_SOCKS);
|
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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1876,6 +1890,9 @@ Init_socket()
|
|||||||
rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket);
|
rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket);
|
||||||
rb_define_singleton_method(rb_cSOCKSSocket, "open", socks_s_open, 2);
|
rb_define_singleton_method(rb_cSOCKSSocket, "open", socks_s_open, 2);
|
||||||
rb_define_singleton_method(rb_cSOCKSSocket, "new", 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
|
#endif
|
||||||
|
|
||||||
rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
|
rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
|
||||||
|
@ -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 ()
|
(defun ruby-reindent-then-newline-and-indent ()
|
||||||
(interactive "*")
|
(interactive "*")
|
||||||
(save-excursion
|
|
||||||
(delete-region (point) (progn (skip-chars-backward " \t") (point))))
|
|
||||||
(newline)
|
(newline)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(forward-line -1)
|
(end-of-line 0)
|
||||||
(indent-according-to-mode))
|
(indent-according-to-mode)
|
||||||
|
(delete-region (point) (progn (skip-chars-backward " \t") (point))))
|
||||||
(indent-according-to-mode))
|
(indent-according-to-mode))
|
||||||
|
|
||||||
(fset 'ruby-encomment-region (symbol-function 'comment-region))
|
(fset 'ruby-encomment-region (symbol-function 'comment-region))
|
||||||
|
@ -108,6 +108,8 @@ and source-file directory for your debugger."
|
|||||||
(gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.")
|
(gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.")
|
||||||
|
|
||||||
(setq comint-prompt-regexp "^(rdb:-) ")
|
(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)
|
(set (make-local-variable 'paragraph-start) comint-prompt-regexp)
|
||||||
(run-hooks 'rubydb-mode-hook)
|
(run-hooks 'rubydb-mode-hook)
|
||||||
)
|
)
|
||||||
|
@ -425,6 +425,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
|||||||
*/
|
*/
|
||||||
off = -(daylight ? timezone : altzone) / 60;
|
off = -(daylight ? timezone : altzone) / 60;
|
||||||
#else /* !HAVE_TZNAME */
|
#else /* !HAVE_TZNAME */
|
||||||
|
gettimeofday(&tv, &zone);
|
||||||
off = -zone.tz_minuteswest;
|
off = -zone.tz_minuteswest;
|
||||||
#endif /* !HAVE_TZNAME */
|
#endif /* !HAVE_TZNAME */
|
||||||
#endif /* !HAVE_TM_ZONE */
|
#endif /* !HAVE_TM_ZONE */
|
||||||
|
69
pack.c
69
pack.c
@ -23,10 +23,19 @@
|
|||||||
|
|
||||||
#ifdef NATINT_PACK
|
#ifdef NATINT_PACK
|
||||||
# define NATINT_LEN(type,len) (natint?sizeof(type):(len))
|
# 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
|
#else
|
||||||
# define NATINT_LEN(type,len) sizeof(type)
|
# define NATINT_LEN(type,len) sizeof(type)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef OFF16
|
||||||
|
# define OFF16(p) (char*)(p)
|
||||||
|
# define OFF32(p) (char*)(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define define_swapx(x, xtype) \
|
#define define_swapx(x, xtype) \
|
||||||
static xtype \
|
static xtype \
|
||||||
TOKEN_PASTE(swap,x)(z) \
|
TOKEN_PASTE(swap,x)(z) \
|
||||||
@ -546,7 +555,7 @@ pack_pack(ary, fmt)
|
|||||||
else {
|
else {
|
||||||
s = NUM2INT(from);
|
s = NUM2INT(from);
|
||||||
}
|
}
|
||||||
rb_str_cat(res, (char*)&s, NATINT_LEN(short,2));
|
rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -574,7 +583,7 @@ pack_pack(ary, fmt)
|
|||||||
else {
|
else {
|
||||||
l = NUM2ULONG(from);
|
l = NUM2ULONG(from);
|
||||||
}
|
}
|
||||||
rb_str_cat(res, (char*)&l, NATINT_LEN(long,4));
|
rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -588,7 +597,7 @@ pack_pack(ary, fmt)
|
|||||||
s = NUM2INT(from);
|
s = NUM2INT(from);
|
||||||
}
|
}
|
||||||
s = htons(s);
|
s = htons(s);
|
||||||
rb_str_cat(res, (char*)&s, NATINT_LEN(short,2));
|
rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -602,7 +611,7 @@ pack_pack(ary, fmt)
|
|||||||
l = NUM2ULONG(from);
|
l = NUM2ULONG(from);
|
||||||
}
|
}
|
||||||
l = htonl(l);
|
l = htonl(l);
|
||||||
rb_str_cat(res, (char*)&l, NATINT_LEN(long,4));
|
rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -616,7 +625,7 @@ pack_pack(ary, fmt)
|
|||||||
s = NUM2INT(from);
|
s = NUM2INT(from);
|
||||||
}
|
}
|
||||||
s = htovs(s);
|
s = htovs(s);
|
||||||
rb_str_cat(res, (char*)&s, NATINT_LEN(short,2));
|
rb_str_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -630,7 +639,7 @@ pack_pack(ary, fmt)
|
|||||||
l = NUM2ULONG(from);
|
l = NUM2ULONG(from);
|
||||||
}
|
}
|
||||||
l = htovl(l);
|
l = htovl(l);
|
||||||
rb_str_cat(res, (char*)&l, NATINT_LEN(long,4));
|
rb_str_cat(res, OFF32(&l), NATINT_LEN(long,4));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -783,7 +792,7 @@ pack_pack(ary, fmt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
rb_raise(rb_eArgError, "% may only be used in unpack");
|
rb_raise(rb_eArgError, "%% is not supported");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
@ -1062,7 +1071,7 @@ pack_unpack(str, fmt)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case '%':
|
case '%':
|
||||||
rb_raise(rb_eArgError, "% is not supported(yet)");
|
rb_raise(rb_eArgError, "%% is not supported");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -1204,8 +1213,8 @@ pack_unpack(str, fmt)
|
|||||||
case 's':
|
case 's':
|
||||||
PACK_LENGTH_ADJUST(short,2);
|
PACK_LENGTH_ADJUST(short,2);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
short tmp;
|
short tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(short,2));
|
memcpy(OFF16(&tmp), s, NATINT_LEN(short,2));
|
||||||
s += NATINT_LEN(short,2);
|
s += NATINT_LEN(short,2);
|
||||||
rb_ary_push(ary, INT2FIX(tmp));
|
rb_ary_push(ary, INT2FIX(tmp));
|
||||||
}
|
}
|
||||||
@ -1215,8 +1224,8 @@ pack_unpack(str, fmt)
|
|||||||
case 'S':
|
case 'S':
|
||||||
PACK_LENGTH_ADJUST(unsigned short,2);
|
PACK_LENGTH_ADJUST(unsigned short,2);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned short tmp;
|
unsigned short tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(unsigned short,2));
|
memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2));
|
||||||
s += NATINT_LEN(unsigned short,2);
|
s += NATINT_LEN(unsigned short,2);
|
||||||
rb_ary_push(ary, INT2FIX(tmp));
|
rb_ary_push(ary, INT2FIX(tmp));
|
||||||
}
|
}
|
||||||
@ -1248,8 +1257,8 @@ pack_unpack(str, fmt)
|
|||||||
case 'l':
|
case 'l':
|
||||||
PACK_LENGTH_ADJUST(long,4);
|
PACK_LENGTH_ADJUST(long,4);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
long tmp;
|
long tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(long,4));
|
memcpy(OFF32(&tmp), s, NATINT_LEN(long,4));
|
||||||
s += NATINT_LEN(long,4);
|
s += NATINT_LEN(long,4);
|
||||||
rb_ary_push(ary, rb_int2inum(tmp));
|
rb_ary_push(ary, rb_int2inum(tmp));
|
||||||
}
|
}
|
||||||
@ -1259,8 +1268,8 @@ pack_unpack(str, fmt)
|
|||||||
case 'L':
|
case 'L':
|
||||||
PACK_LENGTH_ADJUST(unsigned long,4);
|
PACK_LENGTH_ADJUST(unsigned long,4);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned long tmp;
|
unsigned long tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(unsigned long,4));
|
memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4));
|
||||||
s += NATINT_LEN(unsigned long,4);
|
s += NATINT_LEN(unsigned long,4);
|
||||||
rb_ary_push(ary, rb_uint2inum(tmp));
|
rb_ary_push(ary, rb_uint2inum(tmp));
|
||||||
}
|
}
|
||||||
@ -1270,11 +1279,10 @@ pack_unpack(str, fmt)
|
|||||||
case 'n':
|
case 'n':
|
||||||
PACK_LENGTH_ADJUST(unsigned short,2);
|
PACK_LENGTH_ADJUST(unsigned short,2);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned short tmp;
|
unsigned short tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(unsigned short,2));
|
memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2));
|
||||||
s += NATINT_LEN(unsigned short,2);
|
s += NATINT_LEN(unsigned short,2);
|
||||||
tmp = ntohs(tmp);
|
rb_ary_push(ary, rb_uint2inum(ntohs(tmp)));
|
||||||
rb_ary_push(ary, rb_uint2inum(tmp));
|
|
||||||
}
|
}
|
||||||
PACK_ITEM_ADJUST();
|
PACK_ITEM_ADJUST();
|
||||||
break;
|
break;
|
||||||
@ -1282,11 +1290,10 @@ pack_unpack(str, fmt)
|
|||||||
case 'N':
|
case 'N':
|
||||||
PACK_LENGTH_ADJUST(unsigned long,4);
|
PACK_LENGTH_ADJUST(unsigned long,4);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned long tmp;
|
unsigned long tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(unsigned long,4));
|
memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4));
|
||||||
s += NATINT_LEN(unsigned long,4);
|
s += NATINT_LEN(unsigned long,4);
|
||||||
tmp = ntohl(tmp);
|
rb_ary_push(ary, rb_uint2inum(ntohl(tmp)));
|
||||||
rb_ary_push(ary, rb_uint2inum(tmp));
|
|
||||||
}
|
}
|
||||||
PACK_ITEM_ADJUST();
|
PACK_ITEM_ADJUST();
|
||||||
break;
|
break;
|
||||||
@ -1294,11 +1301,10 @@ pack_unpack(str, fmt)
|
|||||||
case 'v':
|
case 'v':
|
||||||
PACK_LENGTH_ADJUST(unsigned short,2);
|
PACK_LENGTH_ADJUST(unsigned short,2);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned short tmp;
|
unsigned short tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(unsigned short,2));
|
memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2));
|
||||||
s += NATINT_LEN(unsigned short,2);
|
s += NATINT_LEN(unsigned short,2);
|
||||||
tmp = vtohs(tmp);
|
rb_ary_push(ary, rb_uint2inum(vtohs(tmp)));
|
||||||
rb_ary_push(ary, rb_uint2inum(tmp));
|
|
||||||
}
|
}
|
||||||
PACK_ITEM_ADJUST();
|
PACK_ITEM_ADJUST();
|
||||||
break;
|
break;
|
||||||
@ -1306,11 +1312,10 @@ pack_unpack(str, fmt)
|
|||||||
case 'V':
|
case 'V':
|
||||||
PACK_LENGTH_ADJUST(unsigned long,4);
|
PACK_LENGTH_ADJUST(unsigned long,4);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned long tmp;
|
unsigned long tmp = 0;
|
||||||
memcpy(&tmp, s, NATINT_LEN(long,4));
|
memcpy(OFF32(&tmp), s, NATINT_LEN(long,4));
|
||||||
s += NATINT_LEN(long,4);
|
s += NATINT_LEN(long,4);
|
||||||
tmp = vtohl(tmp);
|
rb_ary_push(ary, rb_uint2inum(vtohl(tmp)));
|
||||||
rb_ary_push(ary, rb_uint2inum(tmp));
|
|
||||||
}
|
}
|
||||||
PACK_ITEM_ADJUST();
|
PACK_ITEM_ADJUST();
|
||||||
break;
|
break;
|
||||||
|
2
parse.y
2
parse.y
@ -2387,7 +2387,7 @@ here_document(term, indent)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strncmp(eos, p, len) == 0 && p[len] == '\n') {
|
if (strncmp(eos, p, len) == 0 && (p[len] == '\n' || p[len] == '\r')) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
regex.c
2
regex.c
@ -2877,7 +2877,7 @@ re_compile_fastmap(bufp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (j = 0,c = 0;j < (int)size; j++) {
|
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);
|
beg = WC2MBC1ST(cc);
|
||||||
while (c < beg) {
|
while (c < beg) {
|
||||||
if (ismbchar(c))
|
if (ismbchar(c))
|
||||||
|
2
time.c
2
time.c
@ -208,7 +208,7 @@ time_arg(argc, argv, tm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tm->tm_year = obj2long(v[0]);
|
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 (tm->tm_year >= 1900) tm->tm_year -= 1900;
|
||||||
if (NIL_P(v[1])) {
|
if (NIL_P(v[1])) {
|
||||||
tm->tm_mon = 0;
|
tm->tm_mon = 0;
|
||||||
|
12
variable.c
12
variable.c
@ -916,7 +916,7 @@ VALUE
|
|||||||
rb_obj_instance_variables(obj)
|
rb_obj_instance_variables(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
VALUE ary;
|
VALUE ary = rb_ary_new();
|
||||||
|
|
||||||
if (!FL_TEST(obj, FL_TAINT) && rb_safe_level() >= 4)
|
if (!FL_TEST(obj, FL_TAINT) && rb_safe_level() >= 4)
|
||||||
rb_raise(rb_eSecurityError, "Insecure: can't get metainfo");
|
rb_raise(rb_eSecurityError, "Insecure: can't get metainfo");
|
||||||
@ -924,24 +924,22 @@ rb_obj_instance_variables(obj)
|
|||||||
case T_OBJECT:
|
case T_OBJECT:
|
||||||
case T_CLASS:
|
case T_CLASS:
|
||||||
case T_MODULE:
|
case T_MODULE:
|
||||||
ary = rb_ary_new();
|
|
||||||
if (ROBJECT(obj)->iv_tbl) {
|
if (ROBJECT(obj)->iv_tbl) {
|
||||||
st_foreach(ROBJECT(obj)->iv_tbl, ivar_i, ary);
|
st_foreach(ROBJECT(obj)->iv_tbl, ivar_i, ary);
|
||||||
}
|
}
|
||||||
return ary;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!generic_iv_tbl) return Qnil;
|
if (!generic_iv_tbl) break;
|
||||||
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
|
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
|
||||||
st_table *tbl;
|
st_table *tbl;
|
||||||
|
|
||||||
if (st_lookup(generic_iv_tbl, obj, &tbl)) {
|
if (st_lookup(generic_iv_tbl, obj, &tbl)) {
|
||||||
ary = rb_ary_new();
|
|
||||||
st_foreach(tbl, ivar_i, ary);
|
st_foreach(tbl, ivar_i, ary);
|
||||||
return ary;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Qnil;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user