From 4f73fae2c849e74272aff4cd4250196b12947f2b Mon Sep 17 00:00:00 2001 From: koennecke Date: Fri, 3 Mar 2006 15:33:40 +0000 Subject: [PATCH] - New script which allows to devug SICS scripts from a plain SICS interpreter --- tcl/sicstcldebug.tcl | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tcl/sicstcldebug.tcl diff --git a/tcl/sicstcldebug.tcl b/tcl/sicstcldebug.tcl new file mode 100644 index 00000000..0815f409 --- /dev/null +++ b/tcl/sicstcldebug.tcl @@ -0,0 +1,38 @@ +#------------------------------------------------------------------ +# This is a helper file in order to debug SICS Tcl scripts. The idea +# is that a connection to a SICS interpreter at localhost:2911 is opened. +# Then unknown is reimplemented to send unknown commands (which must be +# SICS commands) to the SICS interpreter for evaluation. This is done +# with transact in order to figure out when SICS finished processing. +# Thus is should be possible to debug SICS Tcl scripts in a normal +# standalone interpreter without the overhead of restarting SICS +# all the time. It may even be possible to use one of the normal +# Tcl debugfgers then.... +# +# Mark Koennecke, February 2006 +#------------------------------------------------------------------ + +set socke [socket localhost 2911] +gets $socke +puts $socke "Spy 007" +flush $socke +gets $socke +#------------------------------------------------------------------ +proc unknown args { + global socke + append com "transact " [join $args] + puts $socke $com + flush $socke + while {1} { + set line [gets $socke] + if {[string first TRANSACTIONFINISHED $line] >= 0} { + return $reply + } else { + append reply $line + } + } +} +#------------------------------------------------------------------ +proc clientput args { + puts stdout [join $args] +}