aboutsummaryrefslogtreecommitdiff
path: root/tclcompat.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-03-03 16:04:06 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:49 +1000
commit6f841c80b5a540c7d3cbf8ea73937019eb88656e (patch)
tree7f6049f2f1cbad8040d0feeb08e5e21ad0ac75da /tclcompat.tcl
parent8a21e1c0ea44a829f84e526a8302e6effbc4a9b1 (diff)
downloadjimtcl-6f841c80b5a540c7d3cbf8ea73937019eb88656e.zip
jimtcl-6f841c80b5a540c7d3cbf8ea73937019eb88656e.tar.gz
jimtcl-6f841c80b5a540c7d3cbf8ea73937019eb88656e.tar.bz2
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 <steveb@workware.net.au>
Diffstat (limited to 'tclcompat.tcl')
-rw-r--r--tclcompat.tcl21
1 files changed, 5 insertions, 16 deletions
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} {} {