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 CABFCC07E99 for ; Mon, 5 Jul 2021 19:55:47 +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 1FAA561483 for ; Mon, 5 Jul 2021 19:55:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FAA561483 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 6E80782BF4; Mon, 5 Jul 2021 21:55:45 +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="EMxax+Yg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4675A82BFD; Mon, 5 Jul 2021 21:55:44 +0200 (CEST) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (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 235A482BE4 for ; Mon, 5 Jul 2021 21:55:40 +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-qt1-x834.google.com with SMTP id x24so3113268qts.11 for ; Mon, 05 Jul 2021 12:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dhoejot1Ru+E2EzFO9hLtU3Uv3AeGAiKEG00AGXyg+0=; b=EMxax+YgDWT8CbHTs+Hsf/RoSBXGl7dfs3GGkglxu+CME5o0CctQCiaCXTOYtXo64C /TsbJ25F6Dx8M7kiWrwUMbaPWkvGINch70+/uWkhfX+QD1YeCeT9f+hte89ebbLz4NMI hP8BX+8PhGXnFFrfiwzO1J/2+UaVZ3XlxqWtIFxYg01eW0bGvf5Qe8/cGrOMCbqzIlgP 9afq0sHGSIm2GFtgiE62pxWcXI/XCBr6dbYIYlS8sXNbbYonkj/EXKapAAUxoN6hL6jI hMuOOwETjaO4KA79k/9H59fWO//5gxzwkPKmXmrveiGFgI7+f7FJ+wOexG4UAHVrDjTo i/mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dhoejot1Ru+E2EzFO9hLtU3Uv3AeGAiKEG00AGXyg+0=; b=ZAajEjvDFgNNUX2Amrr+EpxTnYaimtdMT3w6d5Nwl9+zkqRtf8snmIbWe2IkV5z9In mg8eMwW/t7xdioRwILmX843pamP8QwhlU02K/z6Na8xI+clVUJx5+6TaPFlbzvtw+dJt AG/fKxDyZ8GHfQYLvYphKAjDQY4dmYpqF2VcKKhxB3FUFgu2JsbwSCd7YsnVwzx7yGDp NouRGWvIbgHlqR2FC1Q26uTvO0rVbjsefucGaZ8l+U0HiqBu0Z0axQ81rNLhB/B4OW63 YN+Ise3Q/06wSuSA/HcQ8QvABNWl4x5fHIgUXJPrrDm7V56PcDKbd3Xxdb7zwNoLflsm TrHw== X-Gm-Message-State: AOAM531vPVsh442NBE2vHU0QYCT33iGpnl5GZ/1CnK9rCBaez9vbU4n7 HRPd+B9Nb3ueq8nuNmeiu7Y= X-Google-Smtp-Source: ABdhPJy1ANaD4v82246li3r19Gi3iGA98kq2s5A07ub0FiKq3PjV1HeS0U7QCmzsRk7yZRM8d5woUA== X-Received: by 2002:ac8:60d9:: with SMTP id i25mr12419857qtm.227.1625514939063; Mon, 05 Jul 2021 12:55:39 -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 h5sm4742289qtm.22.2021.07.05.12.55.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jul 2021 12:55:38 -0700 (PDT) Subject: Re: [RFC PATCH 02/28] cli: Add LIL shell To: Tom Rini Cc: Wolfgang Denk , 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> <20210705195345.GC9516@bill-the-cat> From: Sean Anderson Message-ID: Date: Mon, 5 Jul 2021 15:55:38 -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: <20210705195345.GC9516@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:53 PM, Tom Rini wrote: > On Mon, Jul 05, 2021 at 03:47:47PM -0400, Sean Anderson wrote: >> 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. > > And for clarity, on the LIL side, with a few things like needing to > bring in the list of files somehow, all of those would work in U-Boot? > Correct. The only unimplemented function is "glob". --Sean