mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-22 09:49:11 +00:00
WINTERMUTE: Remove the rest of the compiler-references
This commit is contained in:
parent
48118cb940
commit
45e97705ef
@ -73,14 +73,6 @@ CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) {
|
||||
|
||||
_currentScript = NULL;
|
||||
|
||||
_fileToCompile = NULL;
|
||||
|
||||
_compileErrorCallback = NULL;
|
||||
_compileErrorCallbackData = NULL;
|
||||
|
||||
_parseElementCallback = NULL;
|
||||
_parseElementCallbackData = NULL;
|
||||
|
||||
_isProfiling = false;
|
||||
_profilingStartTime = 0;
|
||||
|
||||
@ -123,15 +115,6 @@ HRESULT CScEngine::cleanup() {
|
||||
|
||||
_currentScript = NULL; // ref only
|
||||
|
||||
delete[] _fileToCompile;
|
||||
_fileToCompile = NULL;
|
||||
|
||||
_compileErrorCallback = NULL;
|
||||
_compileErrorCallbackData = NULL;
|
||||
|
||||
_parseElementCallback = NULL;
|
||||
_parseElementCallbackData = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -148,34 +131,9 @@ void CScEngine::closeFile(void *data, byte *buffer) {
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CScEngine::addError(void *data, int line, char *text) {
|
||||
CBGame *Game = (CBGame *)data;
|
||||
|
||||
if (Game) {
|
||||
if (Game->_scEngine && Game->_scEngine->_fileToCompile)
|
||||
Game->LOG(0, "Compiling script '%s'...", Game->_scEngine->_fileToCompile);
|
||||
Game->LOG(0, " Error@line %d: %s", line, text);
|
||||
|
||||
|
||||
// redirect to an engine's own callback
|
||||
if (Game->_scEngine && Game->_scEngine->_compileErrorCallback) {
|
||||
Game->_scEngine->_compileErrorCallback(line, text, Game->_scEngine->_compileErrorCallbackData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CScEngine::parseElement(void *data, int line, int type, void *elementData) {
|
||||
CBGame *Game = (CBGame *)data;
|
||||
|
||||
if (Game) {
|
||||
// redirect to an engine's own callback
|
||||
if (Game->_scEngine && Game->_scEngine->_parseElementCallback) {
|
||||
Game->_scEngine->_parseElementCallback(line, type, elementData, Game->_scEngine->_compileErrorCallbackData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +186,6 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i
|
||||
// nope, load it
|
||||
byte *compBuffer;
|
||||
uint32 compSize;
|
||||
bool compiledNow = false;
|
||||
|
||||
uint32 size;
|
||||
|
||||
@ -280,7 +237,6 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i
|
||||
|
||||
// cleanup
|
||||
delete [] buffer;
|
||||
if (compiledNow) ExtReleaseBuffer(compBuffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -497,7 +453,6 @@ HRESULT CScEngine::persist(CBPersistMgr *persistMgr) {
|
||||
|
||||
persistMgr->transfer(TMEMBER(Game));
|
||||
persistMgr->transfer(TMEMBER(_currentScript));
|
||||
persistMgr->transfer(TMEMBER(_fileToCompile));
|
||||
persistMgr->transfer(TMEMBER(_globals));
|
||||
_scripts.persist(persistMgr);
|
||||
|
||||
@ -536,30 +491,6 @@ HRESULT CScEngine::resumeAll() {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CScEngine::setFileToCompile(const char *filename) {
|
||||
delete[] _fileToCompile;
|
||||
_fileToCompile = new char[strlen(filename) + 1];
|
||||
if (_fileToCompile) {
|
||||
strcpy(_fileToCompile, filename);
|
||||
return S_OK;
|
||||
} else return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CScEngine::setCompileErrorCallback(COMPILE_ERROR_CALLBACK callback, void *data) {
|
||||
_compileErrorCallback = callback;
|
||||
_compileErrorCallbackData = data;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CScEngine::setParseElementCallback(PARSE_ELEMENT_CALLBACK callback, void *data) {
|
||||
_parseElementCallback = callback;
|
||||
_parseElementCallbackData = data;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CScEngine::isValidScript(CScScript *script) {
|
||||
for (int i = 0; i < _scripts.GetSize(); i++) {
|
||||
|
@ -38,16 +38,6 @@
|
||||
|
||||
namespace WinterMute {
|
||||
|
||||
typedef byte *(*DLL_COMPILE_BUFFER)(byte *buffer, char *source, uint32 bufferSize, uint32 *compiledSize);
|
||||
typedef byte *(*DLL_COMPILE_FILE)(char *filename, uint32 *compiledSize);
|
||||
typedef void (*DLL_RELEASE_BUFFER)(unsigned char *buffer);
|
||||
typedef void (*DLL_SET_CALLBACKS)(CALLBACKS *callbacks, void *Data);
|
||||
typedef int (*DLL_DEFINE_FUNCTION)(const char *name); /* Was non-const, changed to silence warnings */
|
||||
typedef int (*DLL_DEFINE_VARIABLE)(const char *name); /* Was non-const, changed to silence warnings */
|
||||
|
||||
typedef void (*COMPILE_ERROR_CALLBACK)(int line, char *text , void *data);
|
||||
typedef void (*PARSE_ELEMENT_CALLBACK)(int line, int type, void *elementData, void *data);
|
||||
|
||||
#define MAX_CACHED_SCRIPTS 20
|
||||
class CScScript;
|
||||
class CScValue;
|
||||
@ -107,17 +97,7 @@ public:
|
||||
HRESULT tickUnbreakable();
|
||||
HRESULT removeFinishedScripts();
|
||||
bool isValidScript(CScScript *script);
|
||||
void setCompileErrorCallback(COMPILE_ERROR_CALLBACK callback, void *data);
|
||||
void setParseElementCallback(PARSE_ELEMENT_CALLBACK callback, void *data);
|
||||
|
||||
COMPILE_ERROR_CALLBACK _compileErrorCallback;
|
||||
void *_compileErrorCallbackData;
|
||||
|
||||
PARSE_ELEMENT_CALLBACK _parseElementCallback;
|
||||
void *_parseElementCallbackData;
|
||||
|
||||
HRESULT setFileToCompile(const char *filename);
|
||||
char *_fileToCompile;
|
||||
CScScript *_currentScript;
|
||||
HRESULT resumeAll();
|
||||
HRESULT pauseAll();
|
||||
@ -136,16 +116,9 @@ public:
|
||||
|
||||
CScEngine(CBGame *inGame);
|
||||
virtual ~CScEngine();
|
||||
static void addError(void *data, int line, char *text);
|
||||
static byte *loadFile(void *data, char *filename, uint32 *size);
|
||||
static void closeFile(void *data, byte *buffer);
|
||||
static void parseElement(void *data, int line, int type, void *elementData);
|
||||
DLL_COMPILE_BUFFER ExtCompileBuffer;
|
||||
DLL_COMPILE_FILE ExtCompileFile;
|
||||
DLL_RELEASE_BUFFER ExtReleaseBuffer;
|
||||
DLL_SET_CALLBACKS ExtSetCallbacks;
|
||||
DLL_DEFINE_FUNCTION ExtDefineFunction;
|
||||
DLL_DEFINE_VARIABLE ExtDefineVariable;
|
||||
|
||||
CBArray<CScScript *, CScScript *> _scripts;
|
||||
|
||||
|
@ -136,21 +136,6 @@ typedef enum {
|
||||
ELEMENT_STRING = 0
|
||||
} TElementType;
|
||||
|
||||
|
||||
|
||||
// compiler interface
|
||||
typedef byte *(DLL_LOAD_FILE)(void *data, char *filename, uint32 *size);
|
||||
typedef void (DLL_CLOSE_FILE)(void *data, byte *buffer);
|
||||
typedef void (DLL_ADD_ERROR)(void *data, int line, char *text);
|
||||
typedef void (DLL_PARSE_ELEMENT)(void *data, int line, int type, void *elementData);
|
||||
|
||||
typedef struct {
|
||||
DLL_LOAD_FILE *Dll_LoadFile;
|
||||
DLL_CLOSE_FILE *Dll_CloseFile;
|
||||
DLL_ADD_ERROR *Dll_AddError;
|
||||
DLL_PARSE_ELEMENT *Dll_ParseElement;
|
||||
} CALLBACKS;
|
||||
|
||||
} // end of namespace WinterMute
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user