mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (yylex): ternary ? can be followed by newline.
* eval.c (rb_f_require): should check static linked libraries before raising exception. * array.c (rb_ary_equal): check identiry equality first. * string.c (rb_str_equal): ditto. * struct.c (rb_struct_equal): ditto. * numeric.c (Init_Numeric): undef Integer::new. * eval.c (rb_eval): NODE_WHILE should update result for each conditional evaluation. * eval.c (rb_eval): NODE_UNTIL should return last evaluated value (or value given to break). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5f224f6869
commit
b47a99485b
15 changed files with 100 additions and 60 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
Wed Aug 29 02:18:53 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (yylex): ternary ? can be followed by newline.
|
||||||
|
|
||||||
|
Tue Aug 28 00:40:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_f_require): should check static linked libraries
|
||||||
|
before raising exception.
|
||||||
|
|
||||||
|
Fri Aug 24 15:17:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_equal): check identiry equality first.
|
||||||
|
|
||||||
|
* string.c (rb_str_equal): ditto.
|
||||||
|
|
||||||
|
* struct.c (rb_struct_equal): ditto.
|
||||||
|
|
||||||
Fri Aug 24 14:38:17 2001 Usaku Nakamura <usa@ruby-lang.org>
|
Fri Aug 24 14:38:17 2001 Usaku Nakamura <usa@ruby-lang.org>
|
||||||
|
|
||||||
* dln.c (dln_strerror): fix a bug that sometimes made null message on
|
* dln.c (dln_strerror): fix a bug that sometimes made null message on
|
||||||
|
@ -5,6 +22,18 @@ Fri Aug 24 14:38:17 2001 Usaku Nakamura <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (mystrerror): ditto.
|
* win32/win32.c (mystrerror): ditto.
|
||||||
|
|
||||||
|
Fri Aug 24 03:15:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* numeric.c (Init_Numeric): undef Integer::new.
|
||||||
|
|
||||||
|
Fri Aug 24 00:46:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_eval): NODE_WHILE should update result for each
|
||||||
|
conditional evaluation.
|
||||||
|
|
||||||
|
* eval.c (rb_eval): NODE_UNTIL should return last evaluated value
|
||||||
|
(or value given to break).
|
||||||
|
|
||||||
Thu Aug 23 21:59:38 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
Thu Aug 23 21:59:38 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||||
|
|
||||||
* enum.c (sort_by_i): fix typo.
|
* enum.c (sort_by_i): fix typo.
|
||||||
|
|
1
array.c
1
array.c
|
@ -1388,6 +1388,7 @@ rb_ary_equal(ary1, ary2)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
|
if (ary1 == ary2) return Qtrue;
|
||||||
if (TYPE(ary2) != T_ARRAY) return Qfalse;
|
if (TYPE(ary2) != T_ARRAY) return Qfalse;
|
||||||
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
|
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
|
||||||
for (i=0; i<RARRAY(ary1)->len; i++) {
|
for (i=0; i<RARRAY(ary1)->len; i++) {
|
||||||
|
|
2
bignum.c
2
bignum.c
|
@ -1420,8 +1420,6 @@ Init_Bignum()
|
||||||
{
|
{
|
||||||
rb_cBignum = rb_define_class("Bignum", rb_cInteger);
|
rb_cBignum = rb_define_class("Bignum", rb_cInteger);
|
||||||
|
|
||||||
rb_undef_method(CLASS_OF(rb_cBignum), "new");
|
|
||||||
|
|
||||||
rb_define_method(rb_cBignum, "to_s", rb_big_to_s, 0);
|
rb_define_method(rb_cBignum, "to_s", rb_big_to_s, 0);
|
||||||
rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1);
|
rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1);
|
||||||
rb_define_method(rb_cBignum, "-@", rb_big_uminus, 0);
|
rb_define_method(rb_cBignum, "-@", rb_big_uminus, 0);
|
||||||
|
|
8
doc/NEWS
8
doc/NEWS
|
@ -1,3 +1,11 @@
|
||||||
|
: Enum#sort_by
|
||||||
|
|
||||||
|
Added.
|
||||||
|
|
||||||
|
: Signal
|
||||||
|
|
||||||
|
new module, has module functions Signal::trap and Signal::list.
|
||||||
|
|
||||||
: Curses
|
: Curses
|
||||||
|
|
||||||
Updated. New methods and constants for using the mouse, character
|
Updated. New methods and constants for using the mouse, character
|
||||||
|
|
13
eval.c
13
eval.c
|
@ -2280,7 +2280,7 @@ rb_eval(self, n)
|
||||||
rb_eval(self, node->nd_body);
|
rb_eval(self, node->nd_body);
|
||||||
while_next:
|
while_next:
|
||||||
;
|
;
|
||||||
} while (RTEST(rb_eval(self, node->nd_cond)));
|
} while (RTEST(result = rb_eval(self, node->nd_cond)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TAG_REDO:
|
case TAG_REDO:
|
||||||
|
@ -2311,7 +2311,7 @@ rb_eval(self, n)
|
||||||
rb_eval(self, node->nd_body);
|
rb_eval(self, node->nd_body);
|
||||||
until_next:
|
until_next:
|
||||||
;
|
;
|
||||||
} while (!RTEST(rb_eval(self, node->nd_cond)));
|
} while (!RTEST(result = rb_eval(self, node->nd_cond)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TAG_REDO:
|
case TAG_REDO:
|
||||||
|
@ -2329,7 +2329,7 @@ rb_eval(self, n)
|
||||||
until_out:
|
until_out:
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (state) JUMP_TAG(state);
|
if (state) JUMP_TAG(state);
|
||||||
RETURN(Qnil);
|
RETURN(result);
|
||||||
|
|
||||||
case NODE_BLOCK_PASS:
|
case NODE_BLOCK_PASS:
|
||||||
result = block_pass(self, node);
|
result = block_pass(self, node);
|
||||||
|
@ -3976,7 +3976,7 @@ handle_rescue(self, node)
|
||||||
if (!rb_obj_is_kind_of(argv[0], rb_cModule)) {
|
if (!rb_obj_is_kind_of(argv[0], rb_cModule)) {
|
||||||
rb_raise(rb_eTypeError, "class or module required for rescue clause");
|
rb_raise(rb_eTypeError, "class or module required for rescue clause");
|
||||||
}
|
}
|
||||||
if (rb_funcall(*argv, eqq, 1, ruby_errinfo)) return 1;
|
if (RTEST(rb_funcall(*argv, eqq, 1, ruby_errinfo))) return 1;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5494,6 +5494,8 @@ rb_f_require(obj, fname)
|
||||||
fname = rb_find_file(tmp);
|
fname = rb_find_file(tmp);
|
||||||
goto load_dyna;
|
goto load_dyna;
|
||||||
}
|
}
|
||||||
|
if (rb_feature_p(RSTRING(fname)->ptr, Qfalse))
|
||||||
|
return Qfalse;
|
||||||
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
||||||
|
|
||||||
load_dyna:
|
load_dyna:
|
||||||
|
@ -8329,9 +8331,6 @@ rb_thread_start_0(fn, arg, th_arg)
|
||||||
while (saved_block) {
|
while (saved_block) {
|
||||||
struct BLOCK *tmp = saved_block;
|
struct BLOCK *tmp = saved_block;
|
||||||
|
|
||||||
if (curr_thread == main_thread) {
|
|
||||||
printf("free(%p)\n", saved_block);
|
|
||||||
}
|
|
||||||
if (tmp->frame.argc > 0)
|
if (tmp->frame.argc > 0)
|
||||||
free(tmp->frame.argv);
|
free(tmp->frame.argv);
|
||||||
saved_block = tmp->prev;
|
saved_block = tmp->prev;
|
||||||
|
|
|
@ -740,7 +740,7 @@ if $extlist.size > 0
|
||||||
if File.exist?(f)
|
if File.exist?(f)
|
||||||
$extinit += format("\
|
$extinit += format("\
|
||||||
\tInit_%s();\n\
|
\tInit_%s();\n\
|
||||||
\trb_provide(\"%s.so\");\n\
|
\trb_provide(\"%s\");\n\
|
||||||
", t, s)
|
", t, s)
|
||||||
$extobjs += "ext/"
|
$extobjs += "ext/"
|
||||||
$extobjs += f
|
$extobjs += f
|
||||||
|
|
1
intern.h
1
intern.h
|
@ -357,6 +357,7 @@ VALUE rb_struct_alloc _((VALUE, VALUE));
|
||||||
VALUE rb_struct_aref _((VALUE, VALUE));
|
VALUE rb_struct_aref _((VALUE, VALUE));
|
||||||
VALUE rb_struct_aset _((VALUE, VALUE, VALUE));
|
VALUE rb_struct_aset _((VALUE, VALUE, VALUE));
|
||||||
VALUE rb_struct_getmember _((VALUE, ID));
|
VALUE rb_struct_getmember _((VALUE, ID));
|
||||||
|
VALUE rb_struct_iv_get _((VALUE, char*));
|
||||||
/* time.c */
|
/* time.c */
|
||||||
VALUE rb_time_new(ANYARGS);
|
VALUE rb_time_new(ANYARGS);
|
||||||
/* variable.c */
|
/* variable.c */
|
||||||
|
|
43
marshal.c
43
marshal.c
|
@ -26,7 +26,7 @@ typedef unsigned short BDIGIT;
|
||||||
#define SIZEOF_BDIGITS SIZEOF_SHORT
|
#define SIZEOF_BDIGITS SIZEOF_SHORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BITSPERSHORT (sizeof(short)*CHAR_BIT)
|
#define BITSPERSHORT (2*CHAR_BIT)
|
||||||
#define SHORTMASK ((1<<BITSPERSHORT)-1)
|
#define SHORTMASK ((1<<BITSPERSHORT)-1)
|
||||||
#define SHORTDN(x) RSHIFT(x,BITSPERSHORT)
|
#define SHORTDN(x) RSHIFT(x,BITSPERSHORT)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ shortlen(len, ds)
|
||||||
num = SHORTDN(num);
|
num = SHORTDN(num);
|
||||||
offset++;
|
offset++;
|
||||||
}
|
}
|
||||||
return (len - 1)*sizeof(BDIGIT)/sizeof(short) + offset;
|
return (len - 1)*sizeof(BDIGIT)/2 + offset;
|
||||||
}
|
}
|
||||||
#define SHORTLEN(x) shortlen((x),d)
|
#define SHORTLEN(x) shortlen((x),d)
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,11 +129,8 @@ w_short(x, arg)
|
||||||
int x;
|
int x;
|
||||||
struct dump_arg *arg;
|
struct dump_arg *arg;
|
||||||
{
|
{
|
||||||
int i;
|
w_byte((x >> 0) & 0xff, arg);
|
||||||
|
w_byte((x >> 8) & 0xff, arg);
|
||||||
for (i=0; i<sizeof(short); i++) {
|
|
||||||
w_byte((x >> (i*8)) & 0xff, arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,7 +142,7 @@ w_long(x, arg)
|
||||||
int i, len = 0;
|
int i, len = 0;
|
||||||
|
|
||||||
#if SIZEOF_LONG > 4
|
#if SIZEOF_LONG > 4
|
||||||
if (!(RSHIFT(x, 32) == 0 || RSHIFT(x, 32) == -1)) {
|
if (!(RSHIFT(x, 31) == 0 || RSHIFT(x, 31) == -1)) {
|
||||||
/* big long does not fit in 4 bytes */
|
/* big long does not fit in 4 bytes */
|
||||||
rb_raise(rb_eTypeError, "long too big to dump");
|
rb_raise(rb_eTypeError, "long too big to dump");
|
||||||
}
|
}
|
||||||
|
@ -452,7 +449,7 @@ w_object(obj, arg, limit)
|
||||||
|
|
||||||
w_unique(rb_class2name(CLASS_OF(obj)), arg);
|
w_unique(rb_class2name(CLASS_OF(obj)), arg);
|
||||||
w_long(len, arg);
|
w_long(len, arg);
|
||||||
mem = rb_ivar_get(rb_obj_class(obj), rb_intern("__member__"));
|
mem = rb_struct_iv_get(rb_obj_class(obj), "__member__");
|
||||||
if (mem == Qnil) {
|
if (mem == Qnil) {
|
||||||
rb_raise(rb_eTypeError, "uninitialized struct");
|
rb_raise(rb_eTypeError, "uninitialized struct");
|
||||||
}
|
}
|
||||||
|
@ -601,12 +598,9 @@ r_short(arg)
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
unsigned short x;
|
unsigned short x;
|
||||||
int i;
|
|
||||||
|
|
||||||
x = 0;
|
x = r_byte(arg);
|
||||||
for (i=0; i<sizeof(short); i++) {
|
x |= r_byte(arg)<<8;
|
||||||
x |= r_byte(arg)<<(i*8);
|
|
||||||
}
|
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -619,13 +613,21 @@ long_toobig(size)
|
||||||
sizeof(long), size);
|
sizeof(long), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef SIGN_EXTEND_CHAR
|
||||||
|
#if __STDC__
|
||||||
|
# define SIGN_EXTEND_CHAR(c) ((signed char)(c))
|
||||||
|
#else /* not __STDC__ */
|
||||||
|
/* As in Harbison and Steele. */
|
||||||
|
# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128)
|
||||||
|
#endif
|
||||||
|
|
||||||
static long
|
static long
|
||||||
r_long(arg)
|
r_long(arg)
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
{
|
{
|
||||||
register long x;
|
register long x;
|
||||||
int c = (char)r_byte(arg);
|
int c = SIGN_EXTEND_CHAR(r_byte(arg));
|
||||||
int i;
|
long i;
|
||||||
|
|
||||||
if (c == 0) return 0;
|
if (c == 0) return 0;
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
|
@ -646,7 +648,7 @@ r_long(arg)
|
||||||
if (c > sizeof(long)) long_toobig(c);
|
if (c > sizeof(long)) long_toobig(c);
|
||||||
x = -1;
|
x = -1;
|
||||||
for (i=0;i<c;i++) {
|
for (i=0;i<c;i++) {
|
||||||
x &= ~(0xff << (8*i));
|
x &= ~((long)0xff << (8*i));
|
||||||
x |= (long)r_byte(arg) << (8*i);
|
x |= (long)r_byte(arg) << (8*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,7 +797,8 @@ r_object(arg)
|
||||||
{
|
{
|
||||||
VALUE c = rb_path2class(r_unique(arg));
|
VALUE c = rb_path2class(r_unique(arg));
|
||||||
v = r_object(arg);
|
v = r_object(arg);
|
||||||
if (rb_special_const_p(v)) {
|
if (rb_special_const_p(v) ||
|
||||||
|
!RTEST(rb_funcall(c, rb_intern("==="), 1, v))) {
|
||||||
rb_raise(rb_eArgError, "dump format error (user class)");
|
rb_raise(rb_eArgError, "dump format error (user class)");
|
||||||
}
|
}
|
||||||
RBASIC(v)->klass = c;
|
RBASIC(v)->klass = c;
|
||||||
|
@ -838,7 +841,7 @@ r_object(arg)
|
||||||
#if SIZEOF_BDIGITS == SIZEOF_SHORT
|
#if SIZEOF_BDIGITS == SIZEOF_SHORT
|
||||||
big->len = len;
|
big->len = len;
|
||||||
#else
|
#else
|
||||||
big->len = (len + 1) * sizeof(short) / sizeof(BDIGIT);
|
big->len = (len + 1) * 2 / sizeof(BDIGIT);
|
||||||
#endif
|
#endif
|
||||||
big->digits = digits = ALLOC_N(BDIGIT, big->len);
|
big->digits = digits = ALLOC_N(BDIGIT, big->len);
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
|
@ -847,7 +850,7 @@ r_object(arg)
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<SIZEOF_BDIGITS; i+=sizeof(short)) {
|
for (i=0; i<SIZEOF_BDIGITS; i+=2) {
|
||||||
int j = r_short(arg);
|
int j = r_short(arg);
|
||||||
num |= j << shift;
|
num |= j << shift;
|
||||||
shift += BITSPERSHORT;
|
shift += BITSPERSHORT;
|
||||||
|
|
|
@ -672,19 +672,19 @@ An end of a defun is found by moving forward from the beginning of one."
|
||||||
;; #{ }, #$hoge, #@foo are not comments
|
;; #{ }, #$hoge, #@foo are not comments
|
||||||
("\\(#\\)[{$@]" 1 (1 . nil))
|
("\\(#\\)[{$@]" 1 (1 . nil))
|
||||||
;; the last $' in the string ,'...$' is not variable
|
;; the last $' in the string ,'...$' is not variable
|
||||||
("\\(^\\|[[\\s <+(,]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*\\$\\('\\)"
|
("\\(^\\|[[\\s <+(,]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*[\\?\\$]\\('\\)"
|
||||||
(2 (7 . nil))
|
(2 (7 . nil))
|
||||||
(4 (7 . nil)))
|
(4 (7 . nil)))
|
||||||
;; the last $` in the string ,`...$` is not variable
|
;; the last $` in the string ,`...$` is not variable
|
||||||
("\\(^\\|[[\\s <+(,]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*\\$\\(`\\)"
|
("\\(^\\|[[\\s <+(,]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*[\\?\\$]\\(`\\)"
|
||||||
(2 (7 . nil))
|
(2 (7 . nil))
|
||||||
(4 (7 . nil)))
|
(4 (7 . nil)))
|
||||||
;; the last $" in the string ,"...$" is not variable
|
;; the last $" in the string ,"...$" is not variable
|
||||||
("\\(^\\|[[\\s <+(,]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*\\$\\(\"\\)"
|
("\\(^\\|[[\\s <+(,]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*[\\?\\$]\\(\"\\)"
|
||||||
(2 (7 . nil))
|
(2 (7 . nil))
|
||||||
(4 (7 . nil)))
|
(4 (7 . nil)))
|
||||||
;; $' $" $` .... are variables
|
;; $' $" $` .... are variables
|
||||||
("\\$[#\"'`$\\]" 0 (1 . nil))
|
("[\\?\\$][#\"'`]" 0 (1 . nil))
|
||||||
;; regexps
|
;; regexps
|
||||||
("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
|
("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
|
||||||
(4 (7 . ?/))
|
(4 (7 . ?/))
|
||||||
|
@ -714,12 +714,12 @@ An end of a defun is found by moving forward from the beginning of one."
|
||||||
(let (beg)
|
(let (beg)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(if (and (re-search-backward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
|
(if (and (re-search-backward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
|
||||||
(string= (match-string-no-properties 1) "begin"))
|
(string= (match-string 1) "begin"))
|
||||||
(progn
|
(progn
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(setq beg (point)))))
|
(setq beg (point)))))
|
||||||
(if (and beg (and (re-search-forward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
|
(if (and beg (and (re-search-forward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
|
||||||
(string= (match-string-no-properties 1) "end")))
|
(string= (match-string 1) "end")))
|
||||||
(progn
|
(progn
|
||||||
(set-match-data (list beg (point)))
|
(set-match-data (list beg (point)))
|
||||||
t)
|
t)
|
||||||
|
|
|
@ -1566,6 +1566,8 @@ Init_Numeric()
|
||||||
rb_define_method(rb_cNumeric, "truncate", num_truncate, 0);
|
rb_define_method(rb_cNumeric, "truncate", num_truncate, 0);
|
||||||
|
|
||||||
rb_cInteger = rb_define_class("Integer", rb_cNumeric);
|
rb_cInteger = rb_define_class("Integer", rb_cNumeric);
|
||||||
|
rb_undef_method(CLASS_OF(rb_cInteger), "new");
|
||||||
|
|
||||||
rb_define_method(rb_cInteger, "integer?", int_int_p, 0);
|
rb_define_method(rb_cInteger, "integer?", int_int_p, 0);
|
||||||
rb_define_method(rb_cInteger, "upto", int_upto, 1);
|
rb_define_method(rb_cInteger, "upto", int_upto, 1);
|
||||||
rb_define_method(rb_cInteger, "downto", int_downto, 1);
|
rb_define_method(rb_cInteger, "downto", int_downto, 1);
|
||||||
|
@ -1587,8 +1589,6 @@ Init_Numeric()
|
||||||
rb_define_singleton_method(rb_cFixnum, "induced_from", rb_fix_induced_from, 1);
|
rb_define_singleton_method(rb_cFixnum, "induced_from", rb_fix_induced_from, 1);
|
||||||
rb_define_singleton_method(rb_cInteger, "induced_from", rb_int_induced_from, 1);
|
rb_define_singleton_method(rb_cInteger, "induced_from", rb_int_induced_from, 1);
|
||||||
|
|
||||||
rb_undef_method(CLASS_OF(rb_cFixnum), "new");
|
|
||||||
|
|
||||||
rb_define_method(rb_cFixnum, "to_s", fix_to_s, 0);
|
rb_define_method(rb_cFixnum, "to_s", fix_to_s, 0);
|
||||||
rb_define_method(rb_cFixnum, "type", fix_type, 0);
|
rb_define_method(rb_cFixnum, "type", fix_type, 0);
|
||||||
|
|
||||||
|
|
2
parse.y
2
parse.y
|
@ -3082,7 +3082,7 @@ yylex()
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
c = nextc();
|
c = nextc();
|
||||||
if (c == -1 || c == 10) {
|
if (c == -1) {
|
||||||
rb_compile_error("incomplete character syntax");
|
rb_compile_error("incomplete character syntax");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
5
prec.c
5
prec.c
|
@ -51,7 +51,7 @@ prec_induced_from(module, x)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
prec_append_features(module, include)
|
prec_included(module, include)
|
||||||
VALUE module, include;
|
VALUE module, include;
|
||||||
{
|
{
|
||||||
switch (TYPE(include)) {
|
switch (TYPE(include)) {
|
||||||
|
@ -62,7 +62,6 @@ prec_append_features(module, include)
|
||||||
Check_Type(include, T_CLASS);
|
Check_Type(include, T_CLASS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb_include_module(include, module);
|
|
||||||
rb_define_singleton_method(include, "induced_from", prec_induced_from, 1);
|
rb_define_singleton_method(include, "induced_from", prec_induced_from, 1);
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +71,7 @@ void
|
||||||
Init_Precision()
|
Init_Precision()
|
||||||
{
|
{
|
||||||
rb_mPrecision = rb_define_module("Precision");
|
rb_mPrecision = rb_define_module("Precision");
|
||||||
rb_define_singleton_method(rb_mPrecision, "append_features", prec_append_features, 1);
|
rb_define_singleton_method(rb_mPrecision, "included", prec_included, 1);
|
||||||
rb_define_method(rb_mPrecision, "prec", prec_prec, 1);
|
rb_define_method(rb_mPrecision, "prec", prec_prec, 1);
|
||||||
rb_define_method(rb_mPrecision, "prec_i", prec_prec_i, 0);
|
rb_define_method(rb_mPrecision, "prec_i", prec_prec_i, 0);
|
||||||
rb_define_method(rb_mPrecision, "prec_f", prec_prec_f, 0);
|
rb_define_method(rb_mPrecision, "prec_f", prec_prec_f, 0);
|
||||||
|
|
1
string.c
1
string.c
|
@ -694,6 +694,7 @@ static VALUE
|
||||||
rb_str_equal(str1, str2)
|
rb_str_equal(str1, str2)
|
||||||
VALUE str1, str2;
|
VALUE str1, str2;
|
||||||
{
|
{
|
||||||
|
if (str1 == str2) return Qtrue;
|
||||||
if (TYPE(str2) != T_STRING)
|
if (TYPE(str2) != T_STRING)
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
|
|
||||||
|
|
33
struct.c
33
struct.c
|
@ -16,19 +16,19 @@ VALUE rb_cStruct;
|
||||||
|
|
||||||
static VALUE struct_alloc _((int, VALUE*, VALUE));
|
static VALUE struct_alloc _((int, VALUE*, VALUE));
|
||||||
|
|
||||||
static VALUE
|
VALUE
|
||||||
iv_get(obj, name)
|
rb_struct_iv_get(c, name)
|
||||||
VALUE obj;
|
VALUE c;
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
ID id;
|
ID id;
|
||||||
|
|
||||||
id = rb_intern(name);
|
id = rb_intern(name);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (rb_ivar_defined(obj, id))
|
if (rb_ivar_defined(c, id))
|
||||||
return rb_ivar_get(obj, id);
|
return rb_ivar_get(c, id);
|
||||||
obj = RCLASS(obj)->super;
|
c = RCLASS(c)->super;
|
||||||
if (obj == 0 || obj == rb_cStruct)
|
if (c == 0 || c == rb_cStruct)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ rb_struct_s_members(obj)
|
||||||
VALUE member, ary;
|
VALUE member, ary;
|
||||||
VALUE *p, *pend;
|
VALUE *p, *pend;
|
||||||
|
|
||||||
member = iv_get(obj, "__member__");
|
member = rb_struct_iv_get(obj, "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("uninitialized struct");
|
rb_bug("uninitialized struct");
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ rb_struct_getmember(obj, id)
|
||||||
VALUE member, slot;
|
VALUE member, slot;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
member = iv_get(rb_obj_class(obj), "__member__");
|
member = rb_struct_iv_get(rb_obj_class(obj), "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("uninitialized struct");
|
rb_bug("uninitialized struct");
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ rb_struct_set(obj, val)
|
||||||
VALUE member, slot;
|
VALUE member, slot;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
member = iv_get(rb_obj_class(obj), "__member__");
|
member = rb_struct_iv_get(rb_obj_class(obj), "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("non-initialized struct");
|
rb_bug("non-initialized struct");
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ rb_struct_initialize(self, values)
|
||||||
long n;
|
long n;
|
||||||
|
|
||||||
rb_struct_modify(self);
|
rb_struct_modify(self);
|
||||||
size = iv_get(klass, "__size__");
|
size = rb_struct_iv_get(klass, "__size__");
|
||||||
n = FIX2LONG(size);
|
n = FIX2LONG(size);
|
||||||
if (n < RARRAY(values)->len) {
|
if (n < RARRAY(values)->len) {
|
||||||
rb_raise(rb_eArgError, "struct size differs");
|
rb_raise(rb_eArgError, "struct size differs");
|
||||||
|
@ -280,7 +280,7 @@ struct_alloc(argc, argv, klass)
|
||||||
NEWOBJ(st, struct RStruct);
|
NEWOBJ(st, struct RStruct);
|
||||||
OBJSETUP(st, klass, T_STRUCT);
|
OBJSETUP(st, klass, T_STRUCT);
|
||||||
|
|
||||||
size = iv_get(klass, "__size__");
|
size = rb_struct_iv_get(klass, "__size__");
|
||||||
n = FIX2LONG(size);
|
n = FIX2LONG(size);
|
||||||
|
|
||||||
st->ptr = ALLOC_N(VALUE, n);
|
st->ptr = ALLOC_N(VALUE, n);
|
||||||
|
@ -311,7 +311,7 @@ rb_struct_new(klass, va_alist)
|
||||||
long size, i;
|
long size, i;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
sz = iv_get(klass, "__size__");
|
sz = rb_struct_iv_get(klass, "__size__");
|
||||||
size = FIX2LONG(sz);
|
size = FIX2LONG(sz);
|
||||||
mem = ALLOCA_N(VALUE, size);
|
mem = ALLOCA_N(VALUE, size);
|
||||||
va_init_list(args, klass);
|
va_init_list(args, klass);
|
||||||
|
@ -355,7 +355,7 @@ inspect_struct(s)
|
||||||
VALUE str, member;
|
VALUE str, member;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
member = iv_get(rb_obj_class(s), "__member__");
|
member = rb_struct_iv_get(rb_obj_class(s), "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("non-initialized struct");
|
rb_bug("non-initialized struct");
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ rb_struct_aref_id(s, id)
|
||||||
VALUE member;
|
VALUE member;
|
||||||
long i, len;
|
long i, len;
|
||||||
|
|
||||||
member = iv_get(rb_obj_class(s), "__member__");
|
member = rb_struct_iv_get(rb_obj_class(s), "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("non-initialized struct");
|
rb_bug("non-initialized struct");
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ rb_struct_aset_id(s, id, val)
|
||||||
VALUE member;
|
VALUE member;
|
||||||
long i, len;
|
long i, len;
|
||||||
|
|
||||||
member = iv_get(rb_obj_class(s), "__member__");
|
member = rb_struct_iv_get(rb_obj_class(s), "__member__");
|
||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("non-initialized struct");
|
rb_bug("non-initialized struct");
|
||||||
}
|
}
|
||||||
|
@ -516,6 +516,7 @@ rb_struct_equal(s, s2)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
|
if (s == s2) return Qtrue;
|
||||||
if (TYPE(s2) != T_STRUCT) return Qfalse;
|
if (TYPE(s2) != T_STRUCT) return Qfalse;
|
||||||
if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse;
|
if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse;
|
||||||
if (RSTRUCT(s)->len != RSTRUCT(s2)->len) {
|
if (RSTRUCT(s)->len != RSTRUCT(s2)->len) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.7.1"
|
#define RUBY_VERSION "1.7.1"
|
||||||
#define RUBY_RELEASE_DATE "2001-08-24"
|
#define RUBY_RELEASE_DATE "2001-08-29"
|
||||||
#define RUBY_VERSION_CODE 171
|
#define RUBY_VERSION_CODE 171
|
||||||
#define RUBY_RELEASE_CODE 20010824
|
#define RUBY_RELEASE_CODE 20010829
|
||||||
|
|
Loading…
Reference in a new issue