/* * Context.h * * Created on: Dec 7, 2012 * Author: attero */ #ifndef CONTEXT_H_ #define CONTEXT_H_ #include #include #include #include #include "AST/SenchaObject.h" #include "AST/ASTExpression.h" typedef unsigned long ObjectIndex; typedef unsigned long FunctionIndex; class Context { public: Context(); typedef unsigned long ObjectIndex; ObjectIndex index; std::map object_store; ObjectIndex add_to_store(SenchaObject & object); SenchaObject get_from_store(ObjectIndex index); typedef SenchaObject (*PointerToNativeFunction)(std::vector); std::map registered_functions; void register_function(std::string name, PointerToNativeFunction f); SenchaObject execute_native_function(std::string name, std::vector 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 ExecutionContext; ExecutionContext interpreter_context; std::string debug() ; ExecutionContext global_context; std::map function_contexts; virtual ~Context(); }; #endif /* CONTEXT_H_ */