grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting support (PATCH)


From: Vladimir Serbinenko
Subject: Re: Scripting support (PATCH)
Date: Sun, 30 Oct 2005 15:41:03 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050804)

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 = address@hidden;
   address@hidden = 0;
   create_menu_command ($2, grub_strdup (&address@hidden));
}

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]