diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2016-12-02 16:38:58 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-12-23 16:16:13 +1100 |
commit | 8ea2dcf14ddddc1b698ce2165118d52f86a6bd13 (patch) | |
tree | 1d947745a55e9c2462d8c6069f67e27f4d1f4081 /external/mambo/mambo_utils.tcl | |
parent | 85e67a66daaa7adff336b4501c1b1f45d5f03bb5 (diff) | |
download | talos-skiboot-8ea2dcf14ddddc1b698ce2165118d52f86a6bd13.tar.gz talos-skiboot-8ea2dcf14ddddc1b698ce2165118d52f86a6bd13.zip |
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 <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/mambo/mambo_utils.tcl')
-rw-r--r-- | external/mambo/mambo_utils.tcl | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl index a97bdc42..e1243432 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" } # |