Permalink
Browse files

matz

git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent e0f3aab commit 770303d5aa3ccc7bdc7b5c3a0552f96238f04dfe @matz matz committed Aug 28, 2000
Showing with 271 additions and 82 deletions.
  1. +17 −0 ChangeLog
  2. +1 −0 ToDo
  3. +3 −0 config.guess
  4. +2 −1 config.sub
  5. +17 −0 configure.in
  6. +47 −17 eval.c
  7. +7 −1 gc.c
  8. +5 −1 intern.h
  9. +26 −9 lib/debug.rb
  10. +1 −1 lib/mkmf.rb
  11. +8 −2 node.h
  12. +18 −18 parse.y
  13. +3 −3 re.c
  14. +59 −21 regex.c
  15. +50 −1 variable.c
  16. +3 −3 version.h
  17. +4 −4 win32/config.h.in
View
@@ -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.
View
1 ToDo
@@ -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
View
@@ -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
View
@@ -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
@@ -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"
;;
View
64 eval.c
@@ -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);
View
8 gc.c
@@ -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
@@ -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
@@ -119,6 +119,15 @@ def debug_eval(str, binding)
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 @@ def debug_command(file, line, id, binding)
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 @@ def display_expressions(binding)
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 @@ def debug_funcname(id)
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
- stdout.printf "watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
- return true
+ 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
@@ -30,7 +30,7 @@
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
Oops, something went wrong.

0 comments on commit 770303d

Please sign in to comment.