On 23/08/12 13:18, Mark Cave-Ayland wrote:
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.
Actually after I little research, this isn't the right approach after all - apparently the variables are stored on the return stack: http://www.softsynth.com/pforth/pf_ref.php#Local%20Variables%20%7B%20foo%20-....
ATB,
Mark.