From 6f841c80b5a540c7d3cbf8ea73937019eb88656e Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 3 Mar 2010 16:04:06 +1000 Subject: Implement 'info frame' and some related procs info frame allows access to source file/line for earler call frames Implement 'stacktrace' to give a live stacktrace And 'stackdump' to convert a stack trace to readable form Update 'errorInfo' to use 'stackdump' Also fix tailcall to retain source info And implement alias, lambda and curry with tailcall Signed-off-by: Steve Bennett --- tclcompat.tcl | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'tclcompat.tcl') diff --git a/tclcompat.tcl b/tclcompat.tcl index 0c6c550..4a0929b 100644 --- a/tclcompat.tcl +++ b/tclcompat.tcl @@ -80,23 +80,12 @@ proc errorInfo {error {stacktrace ""}} { if {$stacktrace eq ""} { set stacktrace [info stacktrace] } - set result "Runtime Error: $error" - foreach {l f p} [lreverse $stacktrace] { - append result \n - if {$p ne ""} { - append result "in procedure '$p' " - if {$f ne ""} { - append result "called " - } - } - if {$f ne ""} { - append result "at file \"$f\", line $l" - } - } - if {[info exists f] && $f ne ""} { - return "$f:$l: $result" + lassign $stacktrace p f l + if {$f ne ""} { + set result "$f:$l " } - return $result + append result "Runtime Error: $error\n" + append result [stackdump $stacktrace] } proc {info nameofexecutable} {} { -- cgit v1.1