| 12345678910111213141516171819202122232425262728293031323334 |
- #include "Script.h"
- #include <iostream>
- Script::Script()
- {
- }
- Script::~Script()
- {
- for(int i = 0; i < instructions.getSize(); i++)
- {
- delete instructions.get(i);
- }
- }
- void Script::execute()
- {
- for(int i = 0; i < instructions.getSize(); i++)
- {
- cout << i << endl;
- instructions.get(i)->execute(dataStack);
- }
-
- if(!dataStack.isEmpty())
- {
- cout << "RESULT: " << *dataStack.pop() << endl;
- }
- }
- ArrayList<Instruction*>& Script::getInstructions()
- {
- return instructions;
- }
|