Follow Up: Variable and Procedure Lists in Sisc

Eric <[email protected]> Fri, 06 Apr 2007 02:13:29 -0400
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Hello,
For archiving purposes, I'm going to post the solution to the list. 
However, I'm not too sure if its an elegant solution, so if anyone knows 
something better then please advise. Maybe the author :) .

This whole code is on the assumption that the repl.go() has been called 
and is currently started. This code also assumes you are handling 
threading issues, in particular with the environment.env and 
environment.symbol.

ThreadContext context = repl.primordialThread.threadContext;
Interpreter interpreter = threadContext.currentInterpreter();
MemorySymEnv environment = (MemorySymEnv)inter.tpl;

//To get the symbol objects
Hashmap<Symbol, Integer> symbolMap = environment.symbolmaps;

//given a particular symbol (for example a symbol variable sym) , to 
obtain its value
Value value =  environment.env[symbolMap.get(sym)];

Hope this helps,

Eric W

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV