From 8ea2dcf14ddddc1b698ce2165118d52f86a6bd13 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Fri, 2 Dec 2016 16:38:58 +1100 Subject: mambo_utils: make p return a value Currently the "p" command uses puts to output the result to the user. This works for interactive usage, but it makes it impossible for use inside scripts. This patch changes the function to return the value rather than print it. The mambo interpreter prints the result of an expression so this should not cause any user visible changes. With this change you can use p in expressions: x [p r3] 4 Which will display the word at the address in r3. Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- external/mambo/mambo_utils.tcl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'external') diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl index a97bdc4..e124343 100644 --- a/external/mambo/mambo_utils.tcl +++ b/external/mambo/mambo_utils.tcl @@ -6,28 +6,25 @@ proc p { reg { t 0 } { c 0 } } { switch -regexp $reg { ^r$ { set val [mysim cpu $c thread $t display gprs] - puts "$val" } ^r[0-9]+$ { regexp "r(\[0-9\]*)" $reg dummy num set val [mysim cpu $c thread $t display gpr $num] - puts "$val" } ^f[0-9]+$ { regexp "f(\[0-9\]*)" $reg dummy num set val [mysim cpu $c thread $t display fpr $num] - puts "$val" } ^v[0-9]+$ { regexp "v(\[0-9\]*)" $reg dummy num set val [mysim cpu $c thread $t display vmxr $num] - puts "$val" } default { set val [mysim cpu $c thread $t display spr $reg] - puts "$val" } } + + return "$val" } # -- cgit v1.1