From patchwork Thu Jul 1 06:15:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1499279 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lnNUNmOI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GFp0N74nVz9sWX for ; Thu, 1 Jul 2021 16:17:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E3378321B; Thu, 1 Jul 2021 08:16:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lnNUNmOI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 448868327E; Thu, 1 Jul 2021 08:16:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE2BD83219 for ; Thu, 1 Jul 2021 08:16:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qv1-xf32.google.com with SMTP id d2so2430074qvh.2 for ; Wed, 30 Jun 2021 23:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7SNLHIKfEYOaaD41OLk3wJrt7d9q4lXdU/HLuTIEbFU=; b=lnNUNmOIhM7xkeKYhpgLHm8Qo6xgrhL5Klcv3toFFYRQgiZFa5f+v9jLdVkU1fxn3g E7KcasIhZI+BfIiI4EAGL8rKkWoaqW5iLIWwOyyUjT2z8KPqsK9ezjI1wMtop+7HSor2 yv254wChE5fn5UQlcdbDBhtxwXQcW8fSfyohIPgX9WSzT6SWttUynqI5PSCDz7LRETJp YkNo3hVx3pAc8uMBtQOQrO4nxm3rvFfseq/n+ZtQvo0TNXvfD4F82LrHLoPyghCwjuiI rT5GcwQEiYsA6/vhwi8mJLuWCdoxiBjqesh7SAtfXAxx9ekwpVHAFGF0iNsFzEAm3UO1 vhUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7SNLHIKfEYOaaD41OLk3wJrt7d9q4lXdU/HLuTIEbFU=; b=AQ1DgSuLRgOnk90Z2PLWRRji/RZk+zm6OIqszDAtlXHaUgSPA4/f9GowB1Fi+/fe8G 7b94VUO39ERqaNiCQlDnTF0f63jEyWncMfnmtXBAVmQd/KLA4j/zIMyVlEhKuAfmsV8q 9vq98jP+IqePhMaRd3aWibFzxS8tjSlH3z3n1gvQQn+clDS3Kzaqap4qJWnoWJUBo0kh /YVgSJYN3AAk1Qqvtmdr9+P0FwiIAS6rKlRDSxamjonCdAiXHQL5KmzoiX5M2wo/U/IU zGySCznaTEYpUEDYvFrPute6kLYGe6Qli7GO2xyFVIor4YOKr1Mn8U6Uxltibnj4Go1g ifdg== X-Gm-Message-State: AOAM530qdN7n6yQSKTaHESQQVeLRWFtegavV+y8NqgnfGvCeuO7YOEFC OqpOg590AKwwQFDoSYg6CXOJFBQNLEo= X-Google-Smtp-Source: ABdhPJwFChiy8UqkTOxEujY0UfKCOO0lKJQwe8QeAgHD56uct30LJTSr2wV06dmVcWuE6/Zucl91zg== X-Received: by 2002:a05:6214:5088:: with SMTP id kk8mr41163083qvb.44.1625120178434; Wed, 30 Jun 2021 23:16:18 -0700 (PDT) Received: from godwin.fios-router.home (pool-74-96-87-9.washdc.fios.verizon.net. [74.96.87.9]) by smtp.gmail.com with ESMTPSA id g21sm1684673qts.90.2021.06.30.23.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 23:16:18 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de, Tom Rini Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , Wolfgang Denk , Simon Glass , Roland Gaudig , Heinrich Schuchardt , Kostas Michalopoulos , Sean Anderson Subject: [RFC PATCH 05/28] cli: lil: Rename some functions to be more like TCL Date: Thu, 1 Jul 2021 02:15:48 -0400 Message-Id: <20210701061611.957918-6-seanga2@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210701061611.957918-1-seanga2@gmail.com> References: <20210701061611.957918-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Several functions have different names than they do in TCL. To make things easier for those familiar with TCL, rename them to their TCL equivalents. At the moment, this is only done for functions not used by LIL_FULL. Some functions need more substantive work to conform them to TCL. For example, in TCL, there is a `string` function with a subcommand of `compare`, which is the same as the top-level function `compare`. Several functions also have no TCL equivalent. Do we need these? TODO: do this for all functions Signed-off-by: Sean Anderson --- common/cli_lil.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/common/cli_lil.c b/common/cli_lil.c index a2e5cdf35a..a6c77ee19c 100644 --- a/common/cli_lil.c +++ b/common/cli_lil.c @@ -1829,10 +1829,10 @@ static struct lil_value *fnc_reflect(struct lil *lil, size_t argc, return lil_clone_value(func->code); } - if (!strcmp(type, "func-count")) + if (!strcmp(type, "proc-count")) return lil_alloc_integer(lil->cmds); - if (!strcmp(type, "funcs")) { + if (!strcmp(type, "procs")) { struct lil_list *funcs = lil_alloc_list(); for (i = 0; i < lil->cmds; i++) @@ -1878,7 +1878,7 @@ static struct lil_value *fnc_reflect(struct lil *lil, size_t argc, return r; } - if (!strcmp(type, "has-func")) { + if (!strcmp(type, "has-proc")) { const char *target; if (argc == 1) @@ -1948,7 +1948,7 @@ static struct lil_value *fnc_reflect(struct lil *lil, size_t argc, return NULL; } -static struct lil_value *fnc_func(struct lil *lil, size_t argc, +static struct lil_value *fnc_proc(struct lil *lil, size_t argc, struct lil_value **argv) { struct lil_value *name; @@ -2472,8 +2472,8 @@ static struct lil_value *real_inc(struct lil *lil, const char *varname, return pv; } -static struct lil_value *fnc_inc(struct lil *lil, size_t argc, - struct lil_value **argv) +static struct lil_value *fnc_incr(struct lil *lil, size_t argc, + struct lil_value **argv) { if (argc < 1) return NULL; @@ -2482,8 +2482,8 @@ static struct lil_value *fnc_inc(struct lil *lil, size_t argc, argc > 1 ? lil_to_integer(argv[1]) : 1); } -static struct lil_value *fnc_dec(struct lil *lil, size_t argc, - struct lil_value **argv) +static struct lil_value *fnc_decr(struct lil *lil, size_t argc, + struct lil_value **argv) { if (argc < 1) return NULL; @@ -2786,8 +2786,8 @@ static struct lil_value *fnc_rtrim(struct lil *lil, size_t argc, return real_trim(lil_to_string(argv[0]), chars, 0, 1); } -static struct lil_value *fnc_strcmp(struct lil *lil, size_t argc, - struct lil_value **argv) +static struct lil_value *fnc_compare(struct lil *lil, size_t argc, + struct lil_value **argv) { if (argc < 2) return NULL; @@ -2940,18 +2940,18 @@ static struct lil_value *fnc_lmap(struct lil *lil, size_t argc, static void register_stdcmds(struct lil *lil) { - lil_register(lil, "dec", fnc_dec); + lil_register(lil, "decr", fnc_decr); lil_register(lil, "eval", fnc_eval); lil_register(lil, "expr", fnc_expr); lil_register(lil, "for", fnc_for); lil_register(lil, "foreach", fnc_foreach); - lil_register(lil, "func", fnc_func); + lil_register(lil, "proc", fnc_proc); lil_register(lil, "if", fnc_if); - lil_register(lil, "inc", fnc_inc); + lil_register(lil, "incr", fnc_incr); lil_register(lil, "local", fnc_local); lil_register(lil, "return", fnc_return); lil_register(lil, "set", fnc_set); - lil_register(lil, "strcmp", fnc_strcmp); + lil_register(lil, "compare", fnc_compare); lil_register(lil, "try", fnc_try); lil_register(lil, "while", fnc_while);