summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/ContextManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/ContextManager.h')
-rw-r--r--Sencha-lang/ContextManager.h37
1 files changed, 8 insertions, 29 deletions
diff --git a/Sencha-lang/ContextManager.h b/Sencha-lang/ContextManager.h
index 81bcba2..f376da5 100644
--- a/Sencha-lang/ContextManager.h
+++ b/Sencha-lang/ContextManager.h
@@ -13,7 +13,8 @@
#include <iostream>
#include "Elements/SenchaObject.h"
#include "AST/ASTExpression.h"
-
+#include "Context.h"
+#include "Utils/to_string.h"
typedef unsigned long ObjectIndex;
typedef unsigned long FunctionIndex;
@@ -21,34 +22,12 @@ typedef unsigned long FunctionIndex;
class ContextManager {
public:
ContextManager();
- typedef unsigned long ObjectIndex;
- ObjectIndex index;
-
- std::map<ObjectIndex, SenchaObject> object_store;
- ObjectIndex add_to_store(SenchaObject & object);
- SenchaObject get_from_store(ObjectIndex index);
-
- typedef SenchaObject (*PointerToNativeFunction)(std::vector<ASTExpression *>);
-
- std::map<std::string, PointerToNativeFunction> registered_functions;
-
- void register_function(std::string name, PointerToNativeFunction f);
-
- SenchaObject execute_native_function(std::string name, std::vector<ASTExpression *> arguments);
-
- //Overload it to use contexts
- void add(std::string name, SenchaObject object);
- void set(std::string name, SenchaObject object);
- SenchaObject get(std::string name);
- typedef std::map<std::string, ObjectIndex> ExecutionContext;
- ExecutionContext interpreter_context;
-
- std::string debug() ;
-
-
-
- ExecutionContext global_context;
- std::map<FunctionIndex , ExecutionContext *> function_contexts;
+ std::map<std::string, Context *> contexts;
+ Context * create_new_context();
+ void destroy_context(std::string name);
+ Context * get_context(std::string name);
+ Context * context(std::string name);
+ unsigned int index;
virtual ~ContextManager();
};