-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8970296
commit c419cb9
Showing
3 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* xoreos - A reimplementation of BioWare's Aurora engine | ||
* | ||
* xoreos is the legal property of its developers, whose names | ||
* can be found in the AUTHORS file distributed with this source | ||
* distribution. | ||
* | ||
* xoreos is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* xoreos is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with xoreos. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** @file | ||
* Function objects for ActionScript. | ||
*/ | ||
|
||
#include "function.h" | ||
|
||
namespace Aurora { | ||
|
||
namespace ActionScript { | ||
|
||
Function::Function(bool preloadThisFlag, bool preloadSuperFlag) : _preloadThisFlag(preloadThisFlag), _preloadSuperFlag(preloadSuperFlag) { | ||
} | ||
|
||
bool Function::preloadThisFlag() { | ||
return _preloadThisFlag; | ||
} | ||
|
||
bool Function::preloadSuperFlag() { | ||
return _preloadSuperFlag; | ||
} | ||
|
||
ScriptedFunction::ScriptedFunction(Common::SeekableReadStream *as, std::vector<Common::UString> constants, | ||
bool preloadThisFlag, bool preloadSuperFlag) : | ||
Function(preloadThisFlag, preloadSuperFlag), _stream(as), _buffer(as) { | ||
_buffer.setConstantPool(constants); | ||
} | ||
|
||
ScriptedFunction::~ScriptedFunction() { | ||
delete _stream; | ||
} | ||
|
||
Variable ScriptedFunction::operator()(AVM &avm) { | ||
_buffer.run(avm); | ||
return Variable(); | ||
} | ||
|
||
} // End of namespace ActionScript | ||
|
||
} // End of namespace Aurora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* xoreos - A reimplementation of BioWare's Aurora engine | ||
* | ||
* xoreos is the legal property of its developers, whose names | ||
* can be found in the AUTHORS file distributed with this source | ||
* distribution. | ||
* | ||
* xoreos is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* xoreos is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with xoreos. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** @file | ||
* Function objects for ActionScript. | ||
*/ | ||
|
||
#ifndef AURORA_ACTIONSCRIPT_FUNCTION_H | ||
#define AURORA_ACTIONSCRIPT_FUNCTION_H | ||
|
||
#include <vector> | ||
|
||
#include "src/aurora/actionscript/variable.h" | ||
#include "src/aurora/actionscript/asbuffer.h" | ||
|
||
namespace Aurora { | ||
|
||
namespace ActionScript { | ||
|
||
class Function; | ||
|
||
typedef boost::shared_ptr<Function> FunctionPtr; | ||
|
||
class Function : public Object { | ||
public: | ||
Function(bool preloadThisFlag, bool preloadSuperFlag); | ||
|
||
bool preloadThisFlag(); | ||
bool preloadSuperFlag(); | ||
|
||
virtual Variable operator()(AVM &avm) = 0; | ||
|
||
private: | ||
bool _preloadThisFlag; | ||
bool _preloadSuperFlag; | ||
}; | ||
|
||
class ScriptedFunction : public Function { | ||
public: | ||
ScriptedFunction( | ||
Common::SeekableReadStream *as, | ||
std::vector<Common::UString> constantPool, | ||
bool preloadThisFlag, | ||
bool preloadSuperFlag | ||
); | ||
~ScriptedFunction(); | ||
|
||
Variable operator()(AVM &avm); | ||
|
||
private: | ||
Common::SeekableReadStream *_stream; | ||
ASBuffer _buffer; | ||
}; | ||
|
||
} // End of namespace ActionScript | ||
|
||
} // End of namespace Aurora | ||
|
||
#endif // AURORA_ACTIONSCRIPT_FUNCTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters