[OpenBIOS] Local variable support

Programmingkid programmingkidx at gmail.com
Mon Aug 27 13:33:28 CEST 2012


On Aug 25, 2012, at 8:19 AM, openbios-request at openbios.org wrote:

> On 22/08/12 02:44, Programmingkid wrote:
> 
>> The following code is for the use of local variables in OpenBIOS. I was
>> able to successfully make a word that used local variables. The work
>> isn't complete. There is still work to be done with the INTERPRET word.
>> The LFIND word has be implemented in the INTERPRET word for local
>> variables to be recognized during the compile state. I just need a
>> C-like CONTINUE word to go back to the start of a loop to fix all my
>> problems with INTERPRET. Maybe someone knows a better way of adding
>> LFIND to INTERPRET.
>> 
>> I would appreciate any comments, suggestions, or advice for the
>> following code.
> 
> Interesting work! I think that you may have made this a harder problem 
> that it should be though.
> 
> When I had a quick look at doing something earlier a while back, I 
> noticed that OpenBIOS already has a concept of multiple dictionaries 
> with a search order (see dict-list?). My idea for an implementation was 
> to intercept docol to create a new dictionary at the top of the 
> function, add it to the head of the search list and then add the values 
> from the local variable declaration. This is pretty much what happens 
> when you "cd" to a particular path in the device tree.
> 
> Similarly you can then intercept dosemi from the search list to remove 
> the dictionary and clear up. The advantage of this approach is that you 
> can use all the in-built dictionary functions to manage your local 
> variable words, rather than your current approach which is to 
> re-implement this functionality yourself.
> 
> 
> HTH,
> 
> Mark.


I did try at one time to do this, but decided to go the route of imitating how x86 assembly uses local variables. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20120827/c461989d/attachment.html>


More information about the OpenBIOS mailing list