From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49384C07E99 for ; Mon, 5 Jul 2021 19:47:57 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5756B61426 for ; Mon, 5 Jul 2021 19:47:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5756B61426 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7DA9182BE3; Mon, 5 Jul 2021 21:47:54 +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="Lt9UnDhp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3CB9D82BED; Mon, 5 Jul 2021 21:47:53 +0200 (CEST) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (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 1D04D82991 for ; Mon, 5 Jul 2021 21:47:50 +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-xf36.google.com with SMTP id j14so8719603qvu.6 for ; Mon, 05 Jul 2021 12:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jrYGLcYv83OYiuSM2h/n5om++5TQIcC7BV3INkhJ5Lk=; b=Lt9UnDhpDcIfpi9AjYlo+dnB8/LEN2czWuZMmeE1ftKy+XTp4db2dGXIgeABW7J2o2 +NbHvG4iNkbRTgKH8H9puvv+RbLoLYK1EvbGTnX6Nh9aN3+u2YCmLRXos6BWrEgBAkte QNDioHKX++84Z93f47sSrdjyxS30+LBglv9us6lHjE415oOnm6gZaT4PTVOfFUqRaXZ+ gpZd8iTShhRCV0y1uopYp3Had/QaUa6AHz4fBpLS5L8p9/L47GwQ6Qg1yPhQB8baQwZv aiKB3C7Kkax3flOINtpFVLSyaH912RRvBHnj8ke4yBJB8kHcdZ94UiP+5XRSEsm3HDkN SNyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jrYGLcYv83OYiuSM2h/n5om++5TQIcC7BV3INkhJ5Lk=; b=ueUkOgn0YzwEvaVhMUmrsk97M2SXOLVoZrulLuTdPdt/DIEMg0NR/S0uFkhUDJB8xM zTT4xqwB3e5tBPVy7G4i6Yo7Xlferry5NYGhyuECKQ0CqFsn8LEdVS6thzjrh0qAoeZP e40JmLVAZiWyga0amzr7Ex9VSJZQUX3NH/df4qgANaklSuYrIblvPBOsrLMFF/utY4KM +z6kBfDSHjJiSyyLnsbpTwyEmqnFZeqMUIo3ROaDBOAwZbXYsiplSrNdyoxRVJUVmyXC DNOCH2BOJ2/cumNCBybJxsOL6dAPQTMCe6CpoRnMrh8j7v7jIHXlW74jah2oURyekd5X VTXg== X-Gm-Message-State: AOAM530XVws81JyiooXktsYOVDMyhfkkfggqsUZkZ6RDH7j+gKrk1itZ SZUhnxFWFLTzzHEujU2e7Mc= X-Google-Smtp-Source: ABdhPJwxYom2APGBbbpfRFkjHt/5BRE2m5/i0GYtzq2WpGdRFLkiWZrrfByb3L6IQCCUcf69drPtNw== X-Received: by 2002:a0c:ef48:: with SMTP id t8mr14250824qvs.6.1625514468985; Mon, 05 Jul 2021 12:47:48 -0700 (PDT) Received: from [192.168.1.201] (pool-74-96-87-9.washdc.fios.verizon.net. [74.96.87.9]) by smtp.googlemail.com with ESMTPSA id a19sm4768394qtb.54.2021.07.05.12.47.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jul 2021 12:47:48 -0700 (PDT) From: Sean Anderson Subject: Re: [RFC PATCH 02/28] cli: Add LIL shell To: Tom Rini , Wolfgang Denk Cc: u-boot@lists.denx.de, =?UTF-8?Q?Marek_Beh=c3=ban?= , Simon Glass , Roland Gaudig , Heinrich Schuchardt , Kostas Michalopoulos References: <20210701061611.957918-1-seanga2@gmail.com> <20210701061611.957918-3-seanga2@gmail.com> <126700.1625223815@gemini.denx.de> <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b@gmail.com> <18831.1625340810@gemini.denx.de> <20210705191058.GB9516@bill-the-cat> Message-ID: Date: Mon, 5 Jul 2021 15:47:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20210705191058.GB9516@bill-the-cat> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 7/5/21 3:10 PM, Tom Rini wrote: > On Sat, Jul 03, 2021 at 09:33:30PM +0200, Wolfgang Denk wrote: >> Dear Sean, >> >> In message <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b@gmail.com> you wrote: >>> >>>> For a partial list, see >>>> >>>> [1] https://github.com/Forty-Bot/lil/commits/master >>> >>> Whoops, looks like I completely misread what you were asking here. I >>> don't have an exhaustive list of differences, but here are some similar >>> things expressed in both languages: >>> >>> sh tcl >>> >>> foo=bar set foo bar >>> echo $foo echo $foo >>> >>> if [ 1 -gt 2 ]; then if {1 > 2} { >>> echo a echo a >>> else } { >>> echo b echo b >>> fi } The left side is possible with something like if itest 1 -gt 2; then # etc. >>> >>> foo() { proc foo {first second} { >>> echo $1 $2 echo $first $second >>> } } This is not possible. We only have eval (run) as of today. I view adding functions as one of the most important usability improvements we can make. >>> >>> for file in $(ls *.c); do foreach file [glob *.c] { >>> echo $file echo $file >>> done } This is possible only if you already have a list of files. For example, one could do part list mmc 0 -bootable parts for p in $parts; do #etc but the part command is one of the only ones which produces output in the correct format. If you want to (e.g.) dynamically construct a list you will have a much harder time. >>> fact() { >>> if [ $1 -eq 0 ]; then >>> echo 1 >>> else >>> echo $(($1 * $(fact $(($1 - 1))))) >>> fi >>> } This is technically possible with run and setexpr, but fairly cumbersome to do. >>> >>> proc fact {n} { >>> if {$n} { >>> expr {$n * [fact [expr {$n - 1}]]} >>> } { >>> return 1 >>> } >>> } >>> >>> Hopefully this gives you a bit of a feel for the basic differences. > > Which of these things, from each column, can you do in the context of > U-Boot? That's important too. See above. --Sean