Øyvind Harboe wrote:
>> for {set i 0} {$i < 10} {incr i} {openocd "mww [expr $i*4] 0"}

Hooking the command interpreter on a per-line basis isn't a good approach IMHO.

I think something more along the lines of embedded script usage in web pages 
would make more sense:

e.g.

<?lua
... lua code here
?>

or with tcl:

<?tcl
... tcl code here
?>

Scripts really should be allowed to be multi-line and include whatever syntax 
the scripting language wants to use - be it lua, tcl, php, perl, whatever is 
embedded.

Single line stuff is and can be embedded cleanly:

<?tcl whatever ?>

There is also the concept of a simple result return via a <%= syntax %> which 
basically means an expression where the result is 'output' to be merged in the 
page.

And typically the embedding stuff basically uses the programming language to 
pick up and rewrite the code to be print statements which are then executed.

e.g.

<?lua for i=0,9 do openocd("mwm "..i*4.." 0"); end ?>

or

<?lua for i=0,9 do ?>
mwm <%= i*4 %> 0
<?lua end ?>

The simple examples don't really highlight the difference.

In some of the lua based stuff the interpreter of the pages like that is done 
in 
lua itself as a set of regular expression rewrites to make a full lua program 
like the following:

for i=0,9 do
   print("mwm "..i*4.." 0")
end

Of course if you have only one scripting language you leave it out and have
<? code ?>

It would also be good to see the whole file as something which gets parsed and 
rewritten - then I'd get my conditionals etc handled and be able to respond to 
error conditions and take different logic paths more easily.

Tim.

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to