From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1D1oUq-0002C9-0K for mharc-grub-devel@gnu.org; Thu, 17 Feb 2005 11:27:20 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D1oUj-00028P-I5 for grub-devel@gnu.org; Thu, 17 Feb 2005 11:27:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D1oUc-000241-TX for grub-devel@gnu.org; Thu, 17 Feb 2005 11:27:08 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D1oUa-0001zl-4h for grub-devel@gnu.org; Thu, 17 Feb 2005 11:27:04 -0500 Received: from [194.67.23.122] (helo=mx2.mail.ru) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D1o73-0007LR-Aw for grub-devel@gnu.org; Thu, 17 Feb 2005 11:02:45 -0500 Received: from [83.76.231.209] (port=1232 helo=[192.168.1.100]) by mx2.mail.ru with esmtp id 1D1o70-000Cxn-00 for grub-devel@gnu.org; Thu, 17 Feb 2005 19:02:43 +0300 Message-ID: <4214C054.50106@list.ru> Date: Thu, 17 Feb 2005 17:03:32 +0100 From: Serbinenko Vladimir User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <200502142225.36773.okuji@enbug.org> <200502152323.09524.okuji@enbug.org> <42136E4D.9090709@list.ru> <200502162207.47056.okuji@enbug.org> In-Reply-To: <200502162207.47056.okuji@enbug.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: Not detected Subject: Re: some design issues X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2005 16:27:18 -0000 Yes this is exactly what I wrote what I spoke about is that when parser recognizes a function header it creates a list instead of executing. Entry command can not be a normal function because if you write entry "foo" { for ((i = 0; i < 9; i++)); do echo $i; done } Normal executing would expand $i before running command that will break the function That's why I parse function by the same engine that loops and conditions. entry and function are parsed the *same* way only difference is which variable engine uses to store it (menu or function list) Yoshinori K. Okuji wrote: >On Wednesday 16 February 2005 17:01, Serbinenko Vladimir wrote: > > >>In my scripting engine entry is parsed the same way that function. >>Only difference is where contents stored but it's not written as a >>normal function because it changes a bit the way the input parsed (no >>expanding, ...) What do you think about it? >> >> > >You can treat commands between braces as a group. In bash, a function is >defined in the following way: > >foo() { > ... >} > >Or: > >function foo { > ... >} > >In both cases, the contents enclosed with braces are not evaluated but >defined as the body of the function `foo'. > >For me, the command `entry' is a kind of shell function. The difference >between an entry and a function is that an entry is a part of a menu, >while a function is a command. In other words, an entry is an anonymous >function which is assigned to a slot in a menu. > >So I think a clean way is to pass such a group as a single argument. For >example, if the user specifies this: > >entry "foo" { kernel /boot/vmlinuz; initrd /boot/initrd } > >your parser would invoke grub_cmd_entry with the arguments "foo" and >"kernel /boot/vmlinuz; initrd /boot/initd". > >If the user specifies this: > >function foo { kernel /boot/vmlinuz; initrd /boot/initrd } > >it would invoke grub_cmd_function with the argument "foo" and >"kernel /boot/vmlinuz; initrd /boot/initd". > >This looks consistent to me. > >Okuji > > > >_______________________________________________ >Grub-devel mailing list >Grub-devel@gnu.org >http://lists.gnu.org/mailman/listinfo/grub-devel > > > >