summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Context.h
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-30 22:37:10 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-30 22:37:10 +0100
commite01bc95615b24e8e122942f3701b6b4197ec16b7 (patch)
tree9d8246b0d3d76f89bb0af7ffa7c4970bc3e3cb37 /Sencha-lang/Context.h
parentf23c85949f16d4d1e793db5a438adbb900015db1 (diff)
downloadsencha-lang-e01bc95615b24e8e122942f3701b6b4197ec16b7.tar.gz
sencha-lang-e01bc95615b24e8e122942f3701b6b4197ec16b7.tar.bz2
sencha-lang-e01bc95615b24e8e122942f3701b6b4197ec16b7.zip
More on context manager.
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_ */