summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Context.h
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/Context.h')
-rw-r--r--Sencha-lang/Context.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Sencha-lang/Context.h b/Sencha-lang/Context.h
new file mode 100644
index 0000000..53e7888
--- /dev/null
+++ b/Sencha-lang/Context.h
@@ -0,0 +1,43 @@
+/*
+ * Context.h
+ *
+ * Created on: Dec 30, 2012
+ * Author: att
+ */
+
+#ifndef CONTEXT_H_
+#define CONTEXT_H_
+#include "Utils/to_string.h"
+
+class Context {
+public:
+ Context(std::string name);
+ unsigned int index;
+
+ std::string name;
+ 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
+
+ typedef std::map<std::string, ObjectIndex> ExecutionContext;
+ ExecutionContext interpreter_context;
+
+ std::string debug() ;
+ void add(std::string name, SenchaObject object);
+ void set(std::string name, SenchaObject object);
+ SenchaObject get(std::string name);
+ virtual ~Context();
+};
+
+#endif /* CONTEXT_H_ */