From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1CzjBG-0003wD-62 for mharc-grub-devel@gnu.org; Fri, 11 Feb 2005 17:22:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CzjAz-0003sZ-6Y for grub-devel@gnu.org; Fri, 11 Feb 2005 17:22:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CzjAo-0003mB-IO for grub-devel@gnu.org; Fri, 11 Feb 2005 17:22:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzjAm-0003jE-Ty for grub-devel@gnu.org; Fri, 11 Feb 2005 17:22:00 -0500 Received: from [194.67.23.122] (helo=mx2.mail.ru) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CziqG-0003LC-Tw for grub-devel@gnu.org; Fri, 11 Feb 2005 17:00:49 -0500 Received: from [83.77.8.238] (port=1480 helo=[192.168.1.100]) by mx2.mail.ru with esmtp id 1CziqF-000Hxz-00 for grub-devel@gnu.org; Sat, 12 Feb 2005 01:00:47 +0300 Message-ID: <420D2B3B.9040702@list.ru> Date: Fri, 11 Feb 2005 23:01:31 +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: <20050207121011.GC1380@mjk.myfqdn.de> <42077EA1.5090403@list.ru> <200502081420.43561.okuji@enbug.org> <4208E717.9040205@list.ru> <87650yonaj.fsf@marco.marco-g.com> In-Reply-To: <87650yonaj.fsf@marco.marco-g.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: Not detected Subject: Scripting 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, 11 Feb 2005 22:22:21 -0000 Marco Gerards wrote: >I had a quick look at the patch for now. Can you please explain in a >new thread how the patch globally works? I will reply about the other >issues there as well. > >There are still some things I would like to know: > >- Why does everything happen with strings? > > > Because environment variables are the strings and it's not really needed to convert them (excluding the calculating) >- Why are that many functions duplicated? (for example > grub_bash_dupstr). > > > In this case I just forgot about grub_strdup. But some other functions have (nerly) the same names that string function but are adapted for scripting (ex: grub_bash_strchr) >- What is that huge table with operators? > It's used to determinate which operator to execute (see grub_bash_find_oper and grub_bash_eval_arith) >What kind of parser is it? > > It's a direct parser with aritmetic subparser. Main parser is grub_bash_execute, arithmetic subparser is grub_bash_eval_arith. grub_bash_execute determinates the special cases (loops,conditions, functions,...) for other cases (commands,assignments, function calling) it calls grub_bash_split_tokens, grub_bash_expand_braces and grub_bash_expand_dollar > I have never seen this in a top-down or bottom-up parser I have > studied. > > > I don't like to write the things reffering every time to algorithm. Genereally I take some ideas and I write myself, at my own. >- How does the parser in general work? > grub_bash_execute parses a line. If it detectes that end of the line is not the end of command it calls getline function >So can you explain what > happens when executing a script? First you load the file. Do you > parse it, make pcode of it, run it directly? > For the files I use grub_bash_exec_file. Only thing it does is reading a file line by line and calling grub_bash_execute > How about error > handling? > > > For now the problem is that not all posiible syntax errors are handled correctly and more return checks have to be written. But first I'll write line counting (only grub_bash_execute, grub_bash_list_execute and grub_command_execute are affected) >Thanks, >Marco > > > >_______________________________________________ >Grub-devel mailing list >Grub-devel@gnu.org >http://lists.gnu.org/mailman/listinfo/grub-devel > > > >