From: Marco Gerards <metgerards@student.han.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Scripting support
Date: Sat, 22 Oct 2005 17:08:26 +0200 [thread overview]
Message-ID: <87hdb9twr9.fsf@student.han.nl> (raw)
In-Reply-To: <435A50BE.5030801@gmail.com> (Vladimir Serbinenko's message of "Sat, 22 Oct 2005 16:46:22 +0200")
Vladimir Serbinenko <phcoder@gmail.com> writes:
Hi Vladimir,
>>Last days I have been thinking about scripting support. With my last
>>patch it should be easy to implement. I hope Vladimir is still
>>interested in this.
>>
>>
> Yes. Exactly now I'm on holiday so I have a lot of time. And also I
> have some ideas for some new GRUB features but theese features aren't
> useful without scripting so I'm interested more than ever.
Nice.
>>The most important is the general design. I think we shouldn't put
>>too much in the core and not even in normal mode. This is the same
>>approach bash has taken. I think the core functionality should be:
>>
>>- variables (we have that)
>>- functions
>> Functions should work *exactly* like normal GRUB commands. In
>> that case we can easily mix GRUB commands and functions.
>>
>>
> In bash when you define a function it appears under environment
> variables. IMHO it's useless to store completely the source code as an
> environment variables. I propose that the functions will be preparsed
> (converted to internal format ready for execution) because it will
> gretelya simplify lexer and parser
Right. We should discuss the internal format on the list, I think.
>>- Return values
>> All commands should be able to return a value. That's also what
>> bash has. This value can be stored in a variable or simply
>> returned, I am not too sure about that. Just check what bash
>> does.
>>
>>
> Could it be merged with error variable. It's what bash does
Ok.
>>- Conditional statements like if and case
>>- loops: until, while and for
>>
>>
>>
> I propose the following argorithm. Bison parser transforms the
> text-form to internal form of a linked list of commands with some
> special commands like jump if last value was true, ... . Think about
> assembler. Then it's executed by simple engine that works like CPU: it
> takes one command from a linked list. Executes it and changes the
> pointer so it points to the next command. A command is a structure
> containing:
> variable showing it's type (normal command, jump, loop, end of
> loop, ...)
> union of data necessary for necessary commands
> pointer to next command.
Right. And this can be kept quite simple. The commands itself are
just a string of text. The loops just check a variable, no? It can
be something like:
for foo in 1 2 3
do
echo $i
done
That can be translated into some kind of pseudo language:
1: list = 1 2 3
2: read i, list
3: echo $i
4: check list
5: je 2
I know it's stupid and kind of silly like this. But we have to define
a language. It's important to discuss this on the list, IMO.
> I made a simple example I posted as preview version of scripting
> engine and I also posted on this list simple design doc.
> Any ideas are welcome.
I think I gave you some ideas. ;)
Which mail are you talking about (subject and date)? I must have
missed a few the last months. :-(
--
Marco
next prev parent reply other threads:[~2005-10-22 15:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-22 13:59 Scripting support Marco Gerards
2005-10-22 14:46 ` Vladimir Serbinenko
2005-10-22 15:08 ` Marco Gerards [this message]
2005-10-22 15:37 ` Vladimir Serbinenko
2005-10-22 15:47 ` Marco Gerards
2005-10-22 16:03 ` Vladimir Serbinenko
2005-10-22 16:42 ` Marco Gerards
2005-10-22 16:33 ` Marco Gerards
2005-10-28 3:04 ` Yoshinori K. Okuji
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hdb9twr9.fsf@student.han.nl \
--to=metgerards@student.han.nl \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.