On Tuesday 17 March 2009 16:56, Michal Simek wrote:
> Hi All,
>
> I look at shell folder and there is msh patch for function support.
> There is on the top comment that is buggy. What is buggy?
>
> Maybe I will have a time to clean it.
hush code is cleaner (IMO), and it even has tiny rudiment
of function handling (so far commented out).
The easiest way is to remember function body verbatim
as a string, and parse + execute it at the call site.
This is easy because similar code already exists -
the code which handles `cmd param param` thing.
Harder part would be to implement "remember function body
verbatim as a string", you need to parse it
in order to find which one of "}" tokens
is an end of function. This code also exists,
it is needed to handle { cmd; cmd; } thing,
but it does not save the source string, it produces
a parsed tree. You can try remembering that tree instead,
but there was a reason why this may not work
(I forgot what exastly). Also, the tree will
for sure be _bigger_ than source string.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox