Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Ls97t-0004bt-Dn for mharc-grub-devel@gnu.org; Fri, 10 Apr 2009 01:18:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ls97r-0004bl-1j for grub-devel@gnu.org; Fri, 10 Apr 2009 01:18:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ls97l-0004bZ-8M for grub-devel@gnu.org; Fri, 10 Apr 2009 01:18:01 -0400 Received: from [199.232.76.173] (port=57019 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ls97l-0004bW-3G for grub-devel@gnu.org; Fri, 10 Apr 2009 01:17:57 -0400 Received: from ti-out-0910.google.com ([209.85.142.186]:35568) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ls97k-0003xw-GP for grub-devel@gnu.org; Fri, 10 Apr 2009 01:17:56 -0400 Received: by ti-out-0910.google.com with SMTP id y8so641970tia.10 for ; Thu, 09 Apr 2009 22:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=EMioG1GsYkgXfs7WPZvY83PE7osYjpkUVOJB608YPbU=; b=wFxVDikpR9IzoJJZCEbM9pRUNHHWFbCpBoCBr4YPylcVaxuIxDBnbzKWGp+B7rW50O aSaJP33r8xhrBeGE1yqmhBYT6Na/Vbz3utfLjKFbs0vZ+/KCCl1Wco2jLf0q3gEMHJW8 9BdA8usdO71Fne3g7K01OqROHUv1kMIC9TVYk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=dNWfRnGJ0YjnxpHoVWzcPi4qq/gwZyY9u0TrQBYjPzIBbiXXtOSw19SIT3pyzGJtPK Pp774/vJlcOCkh3DOwC5qgLUvzg2kpbBIBBefjDBVXZW/9Fq+Onflz5QmGcai0X0C5FJ lfEW5w0//eyutTfpMhhMakW/WrbFvwyakoFSA= MIME-Version: 1.0 Received: by 10.110.50.19 with SMTP id x19mr4366036tix.42.1239340674464; Thu, 09 Apr 2009 22:17:54 -0700 (PDT) In-Reply-To: <200904100849.57251.okuji@enbug.org> References: <200904060043.03075.okuji@enbug.org> <200904100849.57251.okuji@enbug.org> Date: Fri, 10 Apr 2009 13:17:54 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Split of normal mode (version 2) 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: Fri, 10 Apr 2009 05:18:03 -0000 On Fri, Apr 10, 2009 at 7:49 AM, Yoshinori K. Okuji wrote: > On Tuesday 07 April 2009 01:39:23 Bean wrote: >> Hi, >> >> This is another update of the patch. >> >> 1, Now completion.c is in menu.mod, and menu_viewer.c is in misc.mod, >> the reason for the switch is to allow configfile to depend on misc.mod >> only. > > I think the name "misc.mod" is ugly. Can you think about a better name? > Hi, Perhaps lib.mod, or helper.mod ? >> 2, Auto generate handler.lst file, which contain module information >> for handlers. normal.mod uses it to register commands to set active >> handler, for example: >> >> parser.sh >> menu_viewer.text >> terminal_output.gfxterm > > Great. > >> 3, configfile now support an optional parameter to specify the script >> engine, for example: >> >> configfile /aa.cfg sh >> >> When configfile returns, the script engine would be restored to the >> previous value. This is useful for switching script engine. For >> example, you can parse a file in another language, then switch back to >> sh for the rest of grub.cfg. > > I object to the syntax, but not to the idea. "configfile" is GRUB-specific, so > it might be acceptable. But IIRC the underlying function is shared > with "source", right? In Bourne Shell, "source FILE ARG" means that the file > FILE is executed with a positional argument ARG. So it is not intuitive to > specify a parser this way. Yeah, I don't like the syntax either, but we need to find a way to distinguish between the "configfile" and "source". "source" operates on the current environment, while "configfile" create a new environment. > > I proposed using a shebang some days ago. Was it so bad? I like that idea too, but it needs to change grub_file_getline a little bit as currently it treats lines starting with '#' as comment, so we don't have a chance to examine the contents behind it. Perhaps we can combine this with configfile/source. For example, when it reads a file starts with #!, it automatically switch parser, and restore back to the original parser on exit. This way, we don't need to hack the configfile/source command at all. -- Bean