grub-devel
[Top][All Lists]
Advanced

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

Re: some design issues


From: Yoshinori K. Okuji
Subject: Re: some design issues
Date: Wed, 16 Feb 2005 22:07:46 +0100
User-agent: KMail/1.7.1

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




reply via email to

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