From patchwork Fri Dec 2 05:38:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 701806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tVNJ86h0Tz9t9b for ; Fri, 2 Dec 2016 16:39:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PZDGI/fd"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tVNJ85W3DzDvTQ for ; Fri, 2 Dec 2016 16:39:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PZDGI/fd"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tVNJ16SbkzDt3R for ; Fri, 2 Dec 2016 16:39:13 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PZDGI/fd"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id y68so12985922pfb.1 for ; Thu, 01 Dec 2016 21:39:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=zvc+EFS4unLVATSlqhena4PFPTuSpwOCp//aFkJc/yA=; b=PZDGI/fdlar+ZmNWYtbPDoKlDetn/bvL6GA2e0Wod0EIKjyIEXwv36pR4KSRyVmryx p0NgHg48GjfyXn3qifkiwN8lqhGoeWcSnqX5GRD0Sw4imk8Z0+8RAoH6xnROi2hmreWE pr4wXB3g57vSyzO9NhRdet0h9xahzA4JOHr88nDqjod5mniff5xfJnt3dQqPBFF09L94 xNe0bQJWZKsUP/qeoQfj/VbnzKDyzyQYySY6VLQBN9ShTFg6j4AfRU9T/bB9RlWLJd1t ln/WFu5nplPy40c3doiq8TeMt/GxRHUKrQN2lnE9nsoW7Q3q6jdrcu8Mz3NUih0rY70l 8CDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zvc+EFS4unLVATSlqhena4PFPTuSpwOCp//aFkJc/yA=; b=ZMfHr27kV3EzAvNR0UcXPGJ4E+5e5UHU/SwuynBe39813jLGzUQ/pCXKsYTFMH4dC1 Id8+on3iD91z1JDU1J3rqlnt+qyBZiA0R0DZoV3F9FhtJjNOt+80Y/lJ6Ak38PmoPu99 Q3pJxSMcq0wJW3vsSe/wt32Eui8sqar78yvA7etDLditBOAwNDMoYNoH5xcbfqnPscei 4I6znw5fbabZ+uuqASxBTkhBBOXqQfYXBKmJh/Ur+7cO6zX1WJGXHjWgwHRK0cNQNcpL VFGuGTzS3732GNlBHZjvBoDfgNcq6wxBWvXRDaVZXBlbzxi0p+x5SHo+F7/G8W6axF3g wpuA== X-Gm-Message-State: AKaTC03dy2lqAUMMgIzANImvyTvstC10WQ3BRZ05ef2so1/gAFqIuYufZv1UuVprf0mOLw== X-Received: by 10.84.143.233 with SMTP id 96mr93716512plz.27.1480657152245; Thu, 01 Dec 2016 21:39:12 -0800 (PST) Received: from canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id r21sm4020332pfd.44.2016.12.01.21.39.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 21:39:11 -0800 (PST) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 2 Dec 2016 16:38:58 +1100 Message-Id: <1480657140-3955-1-git-send-email-oohall@gmail.com> X-Mailer: git-send-email 2.5.5 Subject: [Skiboot] [PATCH 1/3] mambo_utils: make p return a value X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- external/mambo/mambo_utils.tcl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl index a97bdc42af64..e1243432cdaf 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" } #