1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-08-28 09:53:42 +00:00
parent df9d49d088
commit 0a2f8b61d4
17 changed files with 271 additions and 82 deletions

View file

@ -1,7 +1,24 @@
Mon Aug 28 18:43:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (is_defined): now handles class variables.
* eval.c (rb_eval): class variable behavior revisited.
* parse.y (assignable): ditto.
* parse.y (gettable): ditto.
* regex.c (PUSH_FAILURE_COUNT): push/pop interval count on failure
stack.
Fri Aug 25 15:24:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_cvar_get): should not follow __attached__.
* variable.c (rb_cvar_set): ditto.
* variable.c (rb_cvar_declare): ditto.
* variable.c (mod_av_set): second class variable assignment at the
toplevel shoule not give warning.

1
ToDo
View file

@ -47,6 +47,7 @@ Hacking Interpreter
* generational GC ?
* give warnings to assign magic variables.
* export rb_io_{addstr,printf,puts,print}
* autoload should work with threads [ruby-talk:4589]
Standard Libraries

3
config.guess vendored
View file

@ -969,6 +969,9 @@ EOF
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
echo ${UNAME_MACHINE}-apple-darwin${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

3
config.sub vendored
View file

@ -914,7 +914,8 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit* \
| -darwin*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \

View file

@ -57,6 +57,10 @@ AC_ARG_ENABLE(fat-binary,
# to ensure AC_HEADER_SYS_WAIT works
AC_DEFINE(_POSIX_SOURCE)
;;
darwin*)
echo -n "MacOS X (Darwin): "
TARGET_ARCHS="ppc"
;;
esac
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
for archs in $TARGET_ARCHS
@ -160,6 +164,7 @@ case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
darwin*) ;;
human*) ac_cv_func_getpgrp_void=yes;;
beos*) ;;
cygwin*) rb_cv_have_daylight=no;;
@ -443,6 +448,7 @@ if test "$with_dln_a_out" != yes; then
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
darwin*) ;;
human*) ;;
bsdi*) ;;
beos*) ;;
@ -524,6 +530,10 @@ if test "$with_dln_a_out" != yes; then
LDFLAGS=""
DLDFLAGS="$ARCH_FLAG"
rb_cv_dlopen=yes ;;
darwin*) LDSHARED='cc -dynamic -bundle -undefined suppress'
LDFLAGS=""
DLDFLAGS="$ARCH_FLAG"
rb_cv_dlopen=yes ;;
aix*) LDSHARED='/usr/ccs/bin/ld'
XLDFLAGS='-Wl,-bE:ruby.imp'
DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
@ -590,6 +600,8 @@ else
AC_DEFINE(DLEXT, ".bundle");;
rhapsody*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");;
darwin*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");;
os2_emx*) DLEXT=dll
AC_DEFINE(DLEXT, ".dll");;
cygwin*|mingw*) DLEXT=so
@ -617,6 +629,8 @@ case "$target_os" in
STRIP='strip -A -n';;
rhapsody*)
STRIP='strip -A -n';;
darwin*)
STRIP='strip -A -n';;
esac
EXTSTATIC=
@ -803,6 +817,9 @@ case "$target_os" in
rhapsody*)
CFLAGS="$CFLAGS -pipe -no-precomp"
;;
darwin*)
CFLAGS="$CFLAGS -pipe -no-precomp"
;;
os2_emx)
CFLAGS="$CFLAGS -DOS2"
;;

64
eval.c
View file

@ -1717,8 +1717,11 @@ is_defined(self, node, buf)
case NODE_DASGN:
case NODE_DASGN_CURR:
case NODE_GASGN:
case NODE_IASGN:
case NODE_CASGN:
case NODE_CDECL:
case NODE_CVDECL:
case NODE_CVASGN:
case NODE_CVASGN2:
case NODE_CVASGN3:
return "assignment";
case NODE_LVAR:
@ -1744,6 +1747,24 @@ is_defined(self, node, buf)
}
break;
case NODE_CVAR:
if (rb_cvar_defined(ruby_cbase, node->nd_vid)) {
return "class variable";
}
break;
case NODE_CVAR2:
if (rb_cvar_defined(CLASS_OF(self), node->nd_vid)) {
return "class variable";
}
break;
case NODE_CVAR3:
if (rb_cvar_defined_singleton(self, node->nd_vid)) {
return "class variable";
}
break;
case NODE_COLON2:
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
@ -2554,14 +2575,6 @@ rb_eval(self, n)
rb_ivar_set(self, node->nd_vid, result);
break;
case NODE_CASGN:
if (NIL_P(ruby_cbase)) {
rb_raise(rb_eTypeError, "no class/module to define constant");
}
result = rb_eval(self, node->nd_value);
ev_const_set(RNODE(ruby_frame->cbase), node->nd_vid, result);
break;
case NODE_CDECL:
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class/module to define constant");
@ -2578,6 +2591,16 @@ rb_eval(self, n)
rb_cvar_set(ruby_cbase, node->nd_vid, result);
break;
case NODE_CVASGN2:
result = rb_eval(self, node->nd_value);
rb_cvar_set(CLASS_OF(self), node->nd_vid, result);
break;
case NODE_CVASGN3:
result = rb_eval(self, node->nd_value);
rb_cvar_set_singleton(self, node->nd_vid, result);
break;
case NODE_CVDECL:
if (NIL_P(ruby_cbase)) {
rb_raise(rb_eTypeError, "no class/module to define class variable");
@ -2613,6 +2636,14 @@ rb_eval(self, n)
result = rb_cvar_get(ruby_cbase, node->nd_vid);
break;
case NODE_CVAR2:
result = rb_cvar_get(CLASS_OF(self), node->nd_vid);
break;
case NODE_CVAR3:
result = rb_cvar_get_singleton(self, node->nd_vid);
break;
case NODE_BLOCK_ARG:
if (ruby_scope->local_vars == 0)
rb_bug("unexpected block argument");
@ -3581,10 +3612,6 @@ assign(self, lhs, val, check)
dvar_asgn_curr(lhs->nd_vid, val);
break;
case NODE_CASGN:
ev_const_set(RNODE(ruby_frame->cbase), lhs->nd_vid, val);
break;
case NODE_CDECL:
rb_const_set(ruby_class, lhs->nd_vid, val);
break;
@ -3597,6 +3624,10 @@ assign(self, lhs, val, check)
rb_cvar_set(ruby_cbase, lhs->nd_vid, val);
break;
case NODE_CVASGN2:
rb_cvar_set(CLASS_OF(self), lhs->nd_vid, val);
break;
case NODE_MASGN:
massign(self, lhs, val, check);
break;
@ -5027,8 +5058,7 @@ rb_f_require(obj, fname)
volatile int safe = ruby_safe_level;
Check_SafeStr(fname);
if (rb_provided(RSTRING(fname)->ptr))
return Qfalse;
if (rb_thread_loading(RSTRING(fname)->ptr)) return Qfalse;
ext = strrchr(RSTRING(fname)->ptr, '.');
if (ext) {
@ -5107,8 +5137,8 @@ rb_f_require(obj, fname)
load_dyna:
if (rb_thread_loading(feature)) return Qfalse;
rb_provide(feature);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
load = rb_str_new2(file);

8
gc.c
View file

@ -481,7 +481,11 @@ rb_gc_mark(ptr)
case NODE_DASGN:
case NODE_DASGN_CURR:
case NODE_IASGN:
case NODE_CASGN:
case NODE_CDECL:
case NODE_CVDECL:
case NODE_CVASGN:
case NODE_CVASGN2:
case NODE_CVASGN3:
case NODE_MODULE:
case NODE_COLON3:
case NODE_OPT_N:
@ -517,6 +521,8 @@ rb_gc_mark(ptr)
case NODE_DVAR:
case NODE_IVAR:
case NODE_CVAR:
case NODE_CVAR2:
case NODE_CVAR3:
case NODE_NTH_REF:
case NODE_BACK_REF:
case NODE_ALIAS:

View file

@ -366,8 +366,12 @@ void rb_const_assign _((VALUE, ID, VALUE));
VALUE rb_mod_constants _((VALUE));
void rb_autoload_load _((ID));
void rb_cvar_declare _((VALUE, ID, VALUE));
VALUE rb_cvar_get _((VALUE, ID));
int rb_cvar_defined _((VALUE, ID));
void rb_cvar_set _((VALUE, ID, VALUE));
VALUE rb_cvar_get _((VALUE, ID));
int rb_cvar_defined_singleton _((VALUE, ID));
void rb_cvar_set_singleton _((VALUE, ID, VALUE));
VALUE rb_cvar_get_singleton _((VALUE, ID));
/* version.c */
void ruby_show_version _((void));
void ruby_show_copyright _((void));

View file

@ -119,6 +119,15 @@ class DEBUGGER__
end
end
def debug_silent_eval(str, binding)
begin
val = eval(str, binding)
val
rescue StandardError, ScriptError
nil
end
end
def var_list(ary, binding)
ary.sort!
if false # ary.size < 0
@ -307,9 +316,9 @@ class DEBUGGER__
when /^\s*disp(?:lay)?\s+(.+)$/
exp = $1
display.push.push [true, exp]
stdout.printf " %d: %s = %s\n", display.size, exp,
eval(exp, binding) rescue "--"
display.push [true, exp]
stdout.printf "%d: ", display.size
display_expression(exp, binding)
when /^\s*disp(?:lay)?$/
display_expressions(binding)
@ -493,12 +502,17 @@ EOHELP
n = 1
for d in display
if d[0]
stdout.printf "%d: %s = %s\n", n, d[1], debug_eval(d[1], binding).to_s
stdout.printf "%d: ", n
display_expression(d[1], binding)
end
n += 1
end
end
def display_expression(exp, binding)
stdout.printf "%s = %s\n", exp, debug_silent_eval(exp, binding).to_s
end
def frame_set_pos(file, line)
if @frames[0]
@frames[0][1] = file
@ -559,22 +573,25 @@ EOHELP
end
def check_break_points(file, pos, binding, id)
return false if break_points.empty?
MUTEX.lock
file = File.basename(file)
n = 1
for b in break_points
if b[0]
if b[1] == 0 and b[2] == file and b[3] == pos
MUTEX.lock
stdout.printf "breakpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
return true
elsif b[1] == 1 and debug_eval(b[2], binding)
MUTEX.lock
elsif b[1] == 1
if debug_silent_eval(b[2], binding)
stdout.printf "watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
return true
end
end
end
n += 1
end
MUTEX.unlock
return false
end

View file

@ -30,7 +30,7 @@ $hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/
CFLAGS = CONFIG["CFLAGS"]
if RUBY_PLATFORM == "m68k-human"
CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
elsif RUBY_PLATFORM =~ /-nextstep|-rhapsody/
elsif RUBY_PLATFORM =~ /-nextstep|-rhapsody|-darwin/
CFLAGS.gsub!( /-arch\s\w*/, '' )
end

10
node.h
View file

@ -48,9 +48,10 @@ enum node_type {
NODE_DASGN_CURR,
NODE_GASGN,
NODE_IASGN,
NODE_CASGN,
NODE_CDECL,
NODE_CVASGN,
NODE_CVASGN2,
NODE_CVASGN3,
NODE_CVDECL,
NODE_OP_ASGN1,
NODE_OP_ASGN2,
@ -72,6 +73,8 @@ enum node_type {
NODE_IVAR,
NODE_CONST,
NODE_CVAR,
NODE_CVAR2,
NODE_CVAR3,
NODE_NTH_REF,
NODE_BACK_REF,
NODE_MATCH,
@ -266,9 +269,10 @@ typedef struct RNode {
#define NEW_DASGN(v,val) rb_node_newnode(NODE_DASGN,v,val,0);
#define NEW_DASGN_CURR(v,val) rb_node_newnode(NODE_DASGN_CURR,v,val,0);
#define NEW_IASGN(v,val) rb_node_newnode(NODE_IASGN,v,val,0)
#define NEW_CASGN(v,val) rb_node_newnode(NODE_CASGN,v,val,0)
#define NEW_CDECL(v,val) rb_node_newnode(NODE_CDECL,v,val,0)
#define NEW_CVASGN(v,val) rb_node_newnode(NODE_CVASGN,v,val,0)
#define NEW_CVASGN2(v,val) rb_node_newnode(NODE_CVASGN2,v,val,0)
#define NEW_CVASGN3(v,val) rb_node_newnode(NODE_CVASGN3,v,val,0)
#define NEW_CVDECL(v,val) rb_node_newnode(NODE_CVDECL,v,val,0)
#define NEW_OP_ASGN1(p,id,a) rb_node_newnode(NODE_OP_ASGN1,p,id,a)
#define NEW_OP_ASGN2(r,i,o,val) rb_node_newnode(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
@ -281,6 +285,8 @@ typedef struct RNode {
#define NEW_IVAR(v) rb_node_newnode(NODE_IVAR,v,0,0)
#define NEW_CONST(v) rb_node_newnode(NODE_CONST,v,0,0)
#define NEW_CVAR(v) rb_node_newnode(NODE_CVAR,v,0,0)
#define NEW_CVAR2(v) rb_node_newnode(NODE_CVAR2,v,0,0)
#define NEW_CVAR3(v) rb_node_newnode(NODE_CVAR3,v,0,0)
#define NEW_NTH_REF(n) rb_node_newnode(NODE_NTH_REF,0,n,local_cnt('~'))
#define NEW_BACK_REF(n) rb_node_newnode(NODE_BACK_REF,0,n,local_cnt('~'))
#define NEW_MATCH(c) rb_node_newnode(NODE_MATCH,c,0,0)

36
parse.y
View file

@ -3944,7 +3944,10 @@ gettable(id)
return NEW_CONST(id);
}
else if (is_class_id(id)) {
return NEW_CVAR(id);
if (in_single) return NEW_CVAR3(id);
if (class_nest ==0 && cur_mid)
return NEW_CVAR2(id);
else return NEW_CVAR(id);
}
rb_bug("invalid id for gettable");
return 0;
@ -3955,8 +3958,6 @@ assignable(id, val)
ID id;
NODE *val;
{
NODE *lhs = 0;
value_expr(val);
if (id == kSELF) {
yyerror("Can't change the value of self");
@ -3978,42 +3979,43 @@ assignable(id, val)
}
else if (is_local_id(id)) {
if (rb_dvar_curr(id)) {
lhs = NEW_DASGN_CURR(id, val);
return NEW_DASGN_CURR(id, val);
}
else if (rb_dvar_defined(id)) {
lhs = NEW_DASGN(id, val);
return NEW_DASGN(id, val);
}
else if (local_id(id) || !dyna_in_block()) {
lhs = NEW_LASGN(id, val);
return NEW_LASGN(id, val);
}
else{
rb_dvar_push(id, Qnil);
lhs = NEW_DASGN_CURR(id, val);
return NEW_DASGN_CURR(id, val);
}
}
else if (is_global_id(id)) {
lhs = NEW_GASGN(id, val);
return NEW_GASGN(id, val);
}
else if (is_instance_id(id)) {
lhs = NEW_IASGN(id, val);
return NEW_IASGN(id, val);
}
else if (is_const_id(id)) {
if (cur_mid || in_single)
yyerror("dynamic constant assignment");
lhs = NEW_CDECL(id, val);
return NEW_CDECL(id, val);
}
else if (is_class_id(id)) {
if (cur_mid || in_single) {
lhs = NEW_CVASGN(id, val);
}
else {
lhs = NEW_CVDECL(id, val);
if (in_single) return NEW_CVASGN3(id, val);
if (cur_mid) {
if (class_nest == 0)
return NEW_CVASGN2(id, val);
return NEW_CVASGN(id, val);
}
return NEW_CVDECL(id, val);
}
else {
rb_bug("bad id for variable");
}
return lhs;
return 0;
}
static NODE *
@ -4095,7 +4097,6 @@ node_assign(lhs, rhs)
case NODE_DASGN:
case NODE_DASGN_CURR:
case NODE_MASGN:
case NODE_CASGN:
case NODE_CDECL:
case NODE_CVASGN:
case NODE_CVDECL:
@ -4287,7 +4288,6 @@ assign_in_cond(node)
case NODE_DASGN:
case NODE_GASGN:
case NODE_IASGN:
case NODE_CASGN:
break;
case NODE_NEWLINE:

6
re.c
View file

@ -12,7 +12,7 @@
#include "ruby.h"
#include "re.h"
static VALUE rb_eRegxpError;
static VALUE rb_eRegexpError;
#define BEG(no) regs->beg[no]
#define END(no) regs->end[no]
@ -351,7 +351,7 @@ rb_reg_raise(s, len, err, re)
if (ruby_in_compile)
rb_compile_error("%s: %s", err, RSTRING(desc)->ptr);
else
rb_raise(rb_eRegxpError, "%s: %s", err, RSTRING(desc)->ptr);
rb_raise(rb_eRegexpError, "%s: %s", err, RSTRING(desc)->ptr);
}
static VALUE
@ -1321,7 +1321,7 @@ match_setter(val)
void
Init_Regexp()
{
rb_eRegxpError = rb_define_class("RegxpError", rb_eStandardError);
rb_eRegexpError = rb_define_class("RegexpError", rb_eStandardError);
re_set_casetable(casetable);
#if DEFAULT_KCODE == KCODE_EUC

80
regex.c
View file

@ -149,6 +149,22 @@ char *alloca();
stacke = stackb + 2 * len; \
} while (0)
#define ENSURE_FAIL_STACK(n) \
do { \
if (stacke - stackp <= (n)) { \
unsigned char **stackx; \
unsigned int len = stacke - stackb; \
/* if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \
{ \
FREE_VARIABLES(); \
FREE_AND_RETURN(stackb,(-2)); \
}*/ \
\
/* Roughly double the size of the stack. */ \
EXPAND_FAIL_STACK(stackx, stackb, len); \
} \
} while (0)
/* Get the interface, including the syntax bits. */
#include "regex.h"
@ -2069,7 +2085,7 @@ re_compile_pattern(pattern, size, bufp)
jump back only `upper_bound - 1' times. */
GET_BUFFER_SPACE(5);
store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5,
upper_bound/* - 1*/);
upper_bound - 1);
b += 5;
/* The location we want to set is the second
@ -2087,7 +2103,7 @@ re_compile_pattern(pattern, size, bufp)
so that if we fail during matching, we'll
reinitialize the bounds. */
insert_op_2(set_number_at, laststart, b, b - laststart,
upper_bound/* - 1*/);
upper_bound - 1);
b += 5;
}
}
@ -3329,6 +3345,9 @@ re_search(bufp, string, size, startpos, range, regs)
/* I.e., regstart, regend, and reg_info. */
#define NUM_REG_ITEMS 3
/* I.e., ptr and count. */
#define NUM_COUNT_ITEMS 2
/* Individual items aside from the registers. */
#define NUM_NONREG_ITEMS 3
@ -3338,8 +3357,18 @@ re_search(bufp, string, size, startpos, range, regs)
#define MAX_NUM_FAILURE_ITEMS (num_regs * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
/* We push this many things on the stack whenever we fail. */
#define NUM_FAILURE_ITEMS (last_used_reg * NUM_REG_ITEMS + NUM_REG_ITEMS)
#define NUM_FAILURE_ITEMS (last_used_reg * NUM_REG_ITEMS + NUM_REG_ITEMS + 1)
/* This pushes counter information for succeed_n and jump_n */
#define PUSH_FAILURE_COUNT(ptr) \
do { \
int c; \
EXTRACT_NUMBER(c, ptr); \
ENSURE_FAIL_STACK(NUM_COUNT_ITEMS); \
*stackp++ = (unsigned char*)c; \
*stackp++ = (ptr); \
num_failure_counts++; \
} while (0)
/* This pushes most of the information about the current state we will want
if we ever fail back to it. */
@ -3354,18 +3383,9 @@ re_search(bufp, string, size, startpos, range, regs)
if (!REG_UNSET(regstart[last_used_reg])) \
break; \
\
if (stacke - stackp <= NUM_FAILURE_ITEMS) { \
unsigned char **stackx; \
unsigned int len = stacke - stackb; \
/* if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \
{ \
FREE_VARIABLES(); \
FREE_AND_RETURN(stackb,(-2)); \
}*/ \
\
/* Roughly double the size of the stack. */ \
EXPAND_FAIL_STACK(stackx, stackb, len); \
} \
ENSURE_FAIL_STACK(NUM_FAILURE_ITEMS); \
*stackp++ = (unsigned char*)num_failure_counts; \
num_failure_counts = 0; \
\
/* Now push the info for each of those registers. */ \
for (this_reg = 1; this_reg <= last_used_reg; this_reg++) { \
@ -3384,7 +3404,14 @@ re_search(bufp, string, size, startpos, range, regs)
#define NON_GREEDY ((unsigned char*)1)
/* This pops what PUSH_FAILURE_POINT pushes. */
#define POP_FAILURE_COUNT() \
do { \
unsigned char *ptr = *--stackp; \
int count = (long)*--stackp; \
STORE_NUMBER(ptr, count); \
} while (0)
/* This pops what PUSH_FAILURE_POINT pushes. */
#define POP_FAILURE_POINT() \
do { \
@ -3393,6 +3420,11 @@ re_search(bufp, string, size, startpos, range, regs)
temp = (long)*--stackp; /* How many regs pushed. */ \
temp *= NUM_REG_ITEMS; /* How much to take off the stack. */ \
stackp -= temp; /* Remove the register info. */ \
temp = (long)*--stackp; /* How many counters pushed. */ \
while (temp--) { \
POP_FAILURE_COUNT(); /* Remove the counter info. */ \
} \
num_failure_counts = 0; /* Reset num_failure_counts. */ \
} while(0)
/* Registers are set to a sentinel when they haven't yet matched. */
@ -3540,6 +3572,8 @@ re_match(bufp, string_arg, size, pos, regs)
unsigned char **best_regstart = bufp->best_regstart;
unsigned char **best_regend = bufp->best_regend;
int num_failure_counts = 0;
if (regs) {
init_regs(regs, num_regs);
}
@ -3901,7 +3935,7 @@ re_match(bufp, string_arg, size, pos, regs)
pattern follows its end. If we can establish that there
is nothing that they would both match, i.e., that we
would have to backtrack because of (as in, e.g., `a*a')
then we can change to pop_failure_jump, because we'll
then we can change to finalize_jump, because we'll
never have to backtrack.
This is not true in the case of alternatives: in
@ -4025,15 +4059,14 @@ re_match(bufp, string_arg, size, pos, regs)
case succeed_n:
EXTRACT_NUMBER(mcnt, p + 2);
/* Originally, this is how many times we HAVE to succeed. */
if (mcnt > 0) {
if (mcnt != 0) {
mcnt--;
p += 2;
PUSH_FAILURE_COUNT(p);
STORE_NUMBER_AND_INCR(p, mcnt);
PUSH_FAILURE_POINT(0, 0);
}
else if (mcnt == 0) {
p[2] = unused;
p[3] = unused;
else {
goto on_failure;
}
continue;
@ -4043,6 +4076,7 @@ re_match(bufp, string_arg, size, pos, regs)
/* Originally, this is how many times we CAN jump. */
if (mcnt) {
mcnt--;
PUSH_FAILURE_COUNT(p + 2);
STORE_NUMBER(p + 2, mcnt);
goto nofinalize; /* Do the jump without taking off
any failure points. */
@ -4260,6 +4294,10 @@ re_match(bufp, string_arg, size, pos, regs)
regend[this_reg] = *--stackp;
regstart[this_reg] = *--stackp;
}
mcnt = (long)*--stackp;
while (mcnt--) {
POP_FAILURE_COUNT();
}
if (p < pend) {
int is_a_jump_n = 0;
int failed_paren = 0;

View file

@ -1054,8 +1054,8 @@ rb_autoload_load(id)
st_delete(autoload_tbl, &id, &modname);
module = rb_str_new2(modname);
FL_UNSET(module, FL_TAINT);
free(modname);
FL_UNSET(module, FL_TAINT);
rb_f_require(Qnil, module);
}
@ -1395,6 +1395,55 @@ rb_cvar_defined(klass, id)
return Qfalse;
}
int
rb_cvar_defined_singleton(obj, id)
VALUE obj;
ID id;
{
switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
break;
default:
obj = CLASS_OF(obj);
break;
}
return rb_cvar_defined(obj, id);
}
void
rb_cvar_set_singleton(obj, id, value)
VALUE obj;
ID id;
VALUE value;
{
switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
break;
default:
obj = CLASS_OF(obj);
break;
}
rb_cvar_set(obj, id, value);
}
VALUE
rb_cvar_get_singleton(obj, id)
VALUE obj;
ID id;
{
switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
break;
default:
obj = CLASS_OF(obj);
break;
}
return rb_cvar_get(obj, id);
}
void
rb_cv_set(klass, name, val)
VALUE klass;

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.0"
#define RUBY_RELEASE_DATE "2000-08-24"
#define RUBY_VERSION_CODE 155
#define RUBY_RELEASE_CODE 20000824
#define RUBY_RELEASE_DATE "2000-08-25"
#define RUBY_VERSION_CODE 160
#define RUBY_RELEASE_CODE 20000825

View file

@ -40,12 +40,12 @@
#define FILE_COUNT _cnt
#define DLEXT ".so"
#define DLEXT2 ".dll"
#define RUBY_LIB "/lib/ruby/1.5"
#define RUBY_LIB "/lib/ruby/1.6"
#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.5"
#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.6"
#define RUBY_PLATFORM "i586-mswin32"
#define RUBY_ARCHLIB "/lib/ruby/1.5/i586-mswin32"
#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.5/i586-mswin32"
#define RUBY_ARCHLIB "/lib/ruby/1.6/i586-mswin32"
#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.6/i586-mswin32"
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2