Permalink
Browse files

-r debug, -s, etc.

git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 54fe42c commit 3e2b0212adc9bba31ad790000902cdb649a398f0 matz committed Oct 15, 1999
Showing with 252 additions and 159 deletions.
  1. +26 −0 ChangeLog
  2. +3 −2 ToDo
  3. +3 −17 eval.c
  4. +11 −5 ext/Win32API/Win32API.c
  5. +0 −1 intern.h
  6. +10 −20 lib/debug.rb
  7. +5 −4 lib/tracer.rb
  8. +64 −12 parse.y
  9. +5 −3 re.c
  10. +98 −90 ruby.c
  11. +25 −4 sample/test.rb
  12. +2 −1 string.c
View
@@ -1,3 +1,25 @@
+Fri Oct 15 01:32:31 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): need to use NUM2ULONG,
+ not NUM2INT.
+
+Fri Oct 15 00:22:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (Init_Regexp): super class of the MatchingData, which was
+ Data, to be Object.
+
+ * eval.c (ruby_run): evaluate required libraries before load &
+ compiling the script.
+
+ * parse.y (lex_getline): retrieve a line from the stream, saving
+ lines in the table in debug mode.
+
+ * eval.c (call_trace_func): treat the case ruby_sourcefile is null.
+
+Thu Oct 14 02:00:10 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (string): compile time string concatenation.
+
Wed Oct 13 02:17:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (block_pass): should copy block to prevent modifications.
@@ -45,6 +67,10 @@ Mon Oct 11 07:27:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* signal.c (Init_signal): ignore SIGPIPE by default.
+Wed Oct 6 17:13:19 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ruby.c (addpath): rubylib_mangled_path() modified.
+
Mon Oct 4 12:42:32 1999 Kazuhiko Izawa <izawa@erec.che.tohoku.ac.jp>
* pack.c (pack_unpack): % in printf format should be %%.
View
5 ToDo
@@ -1,7 +1,7 @@
Language Spec.
- def foo; .. rescue .. end
-* compile time string concatenation, "hello" "world" => "helloworld"
+- compile time string concatenation, "hello" "world" => "helloworld"
* ../... outside condition invokes operator method too.
* %w(a\ b\ c abc) => ["a b c", "abc"]
* package or access control for global variables
@@ -17,7 +17,7 @@ Language Spec.
Hacking Interpreter
* RUBYOPT environment variable
-* non-blocking open (e.g. named pipe) for thread
+* non-blocking open (e.g. for named pipe) for thread
* avoid blocking with gethostbyname/gethostbyaddr
* objectify interpreters
* remove rb_eval() recursions
@@ -28,6 +28,7 @@ Hacking Interpreter
Standard Libraries
- hash[key] = nil may not remove entry; hashes may have nil as the value.
+- hash.fetch(key) raises exception if key is not found.
- Array#{first,last,at}
- Dir.glob(pat){|f|...}
* Struct::new([name,]member,...) ??
View
20 eval.c
@@ -966,8 +966,6 @@ ruby_init()
ruby_scope = top_scope;
}
-static int ext_init = 0;
-
void
ruby_options(argc, argv)
int argc;
@@ -978,7 +976,6 @@ ruby_options(argc, argv)
PUSH_TAG(PROT_NONE)
if ((state = EXEC_TAG()) == 0) {
ruby_process_options(argc, argv);
- ext_init = 1; /* Init_ext() called in ruby_process_options */
}
POP_TAG();
if (state) {
@@ -1014,18 +1011,6 @@ static void rb_thread_wait_other_threads _((void));
static int exit_status;
-static void
-call_required_libraries()
-{
- NODE *save;
-
- ruby_sourcefile = 0;
- if (!ext_init) Init_ext();
- save = ruby_eval_tree;
- ruby_require_libraries();
- ruby_eval_tree = save;
-}
-
void
ruby_run()
{
@@ -1039,7 +1024,6 @@ ruby_run()
PUSH_TAG(PROT_NONE);
PUSH_ITER(ITER_NOT);
if ((state = EXEC_TAG()) == 0) {
- call_required_libraries();
eval_node(ruby_top_self);
}
POP_ITER();
@@ -1698,6 +1682,7 @@ call_trace_func(event, file, line, self, id, klass)
struct FRAME *prev;
char *file_save = ruby_sourcefile;
int line_save = ruby_sourceline;
+ VALUE srcfile;
if (!trace_func) return;
@@ -1721,8 +1706,9 @@ call_trace_func(event, file, line, self, id, klass)
}
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
+ srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
proc_call(trace, rb_ary_new3(6, rb_str_new2(event),
- rb_str_new2(ruby_sourcefile),
+ srcfile,
INT2FIX(ruby_sourceline),
INT2FIX(id),
self?rb_f_binding(self):Qnil,
View
@@ -140,7 +140,7 @@ Win32API_Call(argc, argv, obj)
obj_proc = rb_iv_get(obj, "__proc__");
- ApiFunction = (FARPROC)NUM2INT(obj_proc);
+ ApiFunction = (FARPROC)NUM2ULONG(obj_proc);
obj_import = rb_iv_get(obj, "__import__");
obj_export = rb_iv_get(obj, "__export__");
@@ -159,7 +159,7 @@ Win32API_Call(argc, argv, obj)
switch (timport) {
case _T_NUMBER:
case _T_INTEGER:
- lParam = NUM2INT(rb_ary_entry(args, i));
+ lParam = NUM2ULONG(rb_ary_entry(args, i));
#if defined(_MSC_VER) || defined(__LCC__)
_asm {
mov eax, lParam
@@ -173,9 +173,15 @@ Win32API_Call(argc, argv, obj)
break;
case _T_POINTER:
str = rb_ary_entry(args, i);
- Check_Type(str, T_STRING);
- rb_str_modify(str);
- pParam = RSTRING(str)->ptr;
+ if (NIL_P(str)) {
+ pParam = 0;
+ } else if (FIXNUM_P(str)){
+ pParam = (char *)NUM2ULONG(str);
+ } else {
+ Check_Type(str, T_STRING);
+ rb_str_modify(str);
+ pParam = RSTRING(str)->ptr;
+ }
#if defined(_MSC_VER) || defined(__LCC__)
_asm {
mov eax, dword ptr pParam
View
@@ -249,7 +249,6 @@ void ruby_script _((char*));
void ruby_prog_init _((void));
void ruby_set_argv _((int, char**));
void ruby_process_options _((int, char**));
-void ruby_require_libraries _((void));
void ruby_load_script _((void));
/* signal.c */
VALUE rb_f_kill _((int, VALUE*));
View
@@ -1,3 +1,5 @@
+LINES__ = {} unless defined? LINES__
+
class DEBUGGER__
begin
require 'readline'
@@ -24,7 +26,6 @@ def initialize
@frames = [nil]
@last_file = nil
@last = [nil, nil]
- @scripts = {}
end
DEBUG_LAST_CMD = []
@@ -206,7 +207,7 @@ def debug_command(file, line, id, binding)
previus_line = b
STDOUT.printf "[%d, %d] in %s\n", b, e, binding_file
line_at(binding_file, binding_line)
- if lines = @scripts[binding_file] and lines != true
+ if lines = LINES__[binding_file] and lines != true
n = 0
b.upto(e) do |n|
if n > 0 && lines[n-1]
@@ -289,26 +290,14 @@ def frame_info(pos = 0)
end
def line_at(file, line)
- lines = @scripts[file]
+ lines = LINES__[file]
if lines
return "\n" if lines == true
line = lines[line-1]
return "\n" unless line
return line
end
- save = $DEBUG
- begin
- $DEBUG = false
- f = open(file)
- lines = @scripts[file] = f.readlines
- rescue
- $DEBUG = save
- @scripts[file] = true
- return "\n"
- end
- line = lines[line-1]
- return "\n" unless line
- return line
+ return "\n"
end
def debug_funcname(id)
@@ -396,8 +385,9 @@ def trace_func(event, file, line, id, binding)
end
CONTEXT = new
-end
-set_trace_func proc{|event, file, line, id, binding,*rest|
- DEBUGGER__::CONTEXT.trace_func event, file, line, id, binding
-}
+
+ set_trace_func proc{|event, file, line, id, binding,*rest|
+ DEBUGGER__::CONTEXT.trace_func event, file, line, id, binding
+ }
+end
View
@@ -40,7 +40,6 @@ def initialize
end
@get_line_procs = {}
- @sources = {}
@filters = []
end
@@ -79,17 +78,17 @@ def get_line(file, line)
return p.call line
end
- unless list = @sources[file]
+ unless list = LINES__[file]
# print file if $DEBUG
begin
f = open(file)
begin
- @sources[file] = list = f.readlines
+ LINES__[file] = list = f.readlines
ensure
f.close
end
rescue
- @sources[file] = list = []
+ LINES__[file] = list = []
end
end
if l = list[line - 1]
@@ -148,6 +147,8 @@ def Tracer.add_filter(p = proc)
end
+LINES__ = {} unless defined? LINES__
+
if caller(0).size == 1
if $0 == Tracer::MY_FILE_NAME
# direct call
Oops, something went wrong.

0 comments on commit 3e2b021

Please sign in to comment.