|
PH Logo
Logo intepreter modeled after UCB Logo.
|
00001 /* 00002 * World.cpp 00003 * 00004 * Author: Paul Hamilton 00005 * Date: 6 Jun 2011 00006 * 00007 */ 00008 00009 #include "World.h" 00010 00011 #include "Console.h" 00012 #include "Func.h" 00013 #include "Scope.h" 00014 #include "Exceptions.h" 00015 #include "Thing.h" 00016 00017 using namespace std; 00018 00019 namespace phlogo { 00020 00021 World::World(Console *console) { 00022 _console = console; 00023 _global.reset(new Scope()); 00024 _result.reset(new Thing()); 00025 _curscope = _global.get(); 00026 _turtle = 0; 00027 } 00028 00029 void World::setThing(const string &name, const string &value, bool local) 00030 { 00031 _curscope->setThing(name, value, local); 00032 } 00033 00034 void World::setThing(const string &name, pThing value, bool local) 00035 { 00036 _curscope->setThing(name, value, local); 00037 } 00038 00039 pThing World::getThing(const string &name) 00040 { 00041 return _curscope->getThing(name); 00042 } 00043 00044 pThing World::allocResult() 00045 { 00046 pThing t(new Thing()); 00047 _result = t; 00048 return _result; 00049 } 00050 00051 }
1.7.4