summaryrefslogtreecommitdiff
path: root/include/script.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-11 00:08:41 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-11 00:08:41 +0100
commit1efade1a7667e4e1a34265fb3cf310faf8c80bb6 (patch)
treebd311ac3de5500daae633fbfdb585faf737607ba /include/script.h
parent825049026dd2b2e906cdb46279faa39580d931d1 (diff)
refactored script class to have a seperate opcodes class, added file class that uses this same opcodes class
Diffstat (limited to 'include/script.h')
-rw-r--r--include/script.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/script.h b/include/script.h
index d2eb575..a9c2921 100644
--- a/include/script.h
+++ b/include/script.h
@@ -62,7 +62,7 @@ public:
/**
* Destructor
*/
- virtual ~Script();
+ virtual ~Script() {}
/**
* Is the script a valid PHP script without syntax errors?
@@ -70,7 +70,7 @@ public:
*/
bool valid() const
{
- return _opcodes != nullptr;
+ return _opcodes.valid();
}
/**
@@ -78,14 +78,26 @@ public:
* The return value of the script is returned
* @return Value
*/
- Value execute() const;
+ Value execute() const
+ {
+ return _opcodes.execute();
+ }
private:
/**
* The opcodes
- * @var zend_op_array
+ * @var Opcodes
+ */
+ Opcodes _opcodes;
+
+ /**
+ * Helper function to compile the source code
+ * @param name name of the script
+ * @param script actual PHP code
+ * @param size length of the string
+ * @return opcodes
*/
- struct _zend_op_array *_opcodes;
+ static struct _zend_op_array *compile(const char *name, const char *phpcode, size_t size);
};