From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EWEN0-0002Ec-Ft for mharc-grub-devel@gnu.org; Sun, 30 Oct 2005 09:41:14 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWEMs-0002C5-Ty for grub-devel@gnu.org; Sun, 30 Oct 2005 09:41:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWEMq-0002AR-SA for grub-devel@gnu.org; Sun, 30 Oct 2005 09:41:06 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWEMp-00029R-8T for grub-devel@gnu.org; Sun, 30 Oct 2005 09:41:03 -0500 Received: from [64.233.182.198] (helo=nproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWEMp-0008KH-Av for grub-devel@gnu.org; Sun, 30 Oct 2005 09:41:03 -0500 Received: by nproxy.gmail.com with SMTP id a25so266904nfc for ; Sun, 30 Oct 2005 06:41:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:disposition-notification-to:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=M4JCoXU4WaL/wu2XY5TXaGzjQ/THDfy7jWvw4oYRfdHyeoIHFS63O0KDAbCy7kuXKr8NiG+YVfnrstapMsjugG7TKxRF8R1q//4UBltdK7GQ0P5kLYQ7dw4xKy49Y/rEOTAHLsEifsKp8aiB0i+Rp7yt9Wf4/WECP9qL1rLPp9U= Received: by 10.48.226.12 with SMTP id y12mr712539nfg; Sun, 30 Oct 2005 06:41:01 -0800 (PST) Received: from ?192.168.1.100? ( [83.76.229.87]) by mx.gmail.com with ESMTP id l38sm820429nfc.2005.10.30.06.41.00; Sun, 30 Oct 2005 06:41:01 -0800 (PST) Message-ID: <4364DB7F.1060309@gmail.com> Date: Sun, 30 Oct 2005 15:41:03 +0100 From: Vladimir Serbinenko User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050804) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <87u0f0t30k.fsf@student.han.nl> In-Reply-To: <87u0f0t30k.fsf@student.han.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Scripting support (PATCH) 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: Sun, 30 Oct 2005 14:41:09 -0000 After discussion with Marco on IRC we decided that his code is better for the core features and other things are fast to implement. But the next questions are menu entries. I propose the following syntax: menu [arguments] name { Commands } arguments can be --default, --fallback perhaps some more in the future. But the main question is about realization. We need to store the source code to be able to edit it. Marco and me propose the following solution: lexer keeps the buffer of current parsed script/block and it stores begin and end of tokens in this buffer in yylloc's new fields: buf_beg and buf_end. Then when parser founds a menu entry it copies a part of buffer using position of command. E.g (schematically): "menu" string '{' commands '}' { char was = buf[@4.buf_end]; buf[@4.buf_end] = 0; create_menu_command ($2, grub_strdup (&buf[@4.buf_beg])); } And menu is always stored unparsed and parsed only just before execution. Than editing is no problem. Other solution proposed by Marco was to rerun the script file or part of it. We would like to know what other people think about it Vladimir 'phcoder' Serbinenko