mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
ifdef around massive debug output
This commit is contained in:
parent
ca432a415f
commit
8757600a5e
1 changed files with 76 additions and 73 deletions
|
@ -41,6 +41,13 @@
|
||||||
|
|
||||||
#include "MIDIEvent.h"
|
#include "MIDIEvent.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WANT_DEBUG_SCRIPT_ENDING
|
||||||
|
#define DEBUG_SCRIPT_ENDING(X) X
|
||||||
|
#else
|
||||||
|
#define DEBUG_SCRIPT_ENDING(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
EntityScriptingInterface ScriptEngine::_entityScriptingInterface;
|
EntityScriptingInterface ScriptEngine::_entityScriptingInterface;
|
||||||
|
|
||||||
static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
|
static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
|
||||||
|
@ -100,7 +107,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEngine::~ScriptEngine() {
|
ScriptEngine::~ScriptEngine() {
|
||||||
qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename();
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename();)
|
||||||
// If we're not already in the middle of stopping all scripts, then we should remove ourselves
|
// If we're not already in the middle of stopping all scripts, then we should remove ourselves
|
||||||
// from the list of running scripts. We don't do this if we're in the process of stopping all scripts
|
// from the list of running scripts. We don't do this if we're in the process of stopping all scripts
|
||||||
// because that method removes scripts from its list as it iterates them
|
// because that method removes scripts from its list as it iterates them
|
||||||
|
@ -109,7 +116,7 @@ ScriptEngine::~ScriptEngine() {
|
||||||
_allKnownScriptEngines.remove(this);
|
_allKnownScriptEngines.remove(this);
|
||||||
_allScriptsMutex.unlock();
|
_allScriptsMutex.unlock();
|
||||||
}
|
}
|
||||||
qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename();
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename();)
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<ScriptEngine*> ScriptEngine::_allKnownScriptEngines;
|
QSet<ScriptEngine*> ScriptEngine::_allKnownScriptEngines;
|
||||||
|
@ -118,7 +125,7 @@ bool ScriptEngine::_stoppingAllScripts = false;
|
||||||
bool ScriptEngine::_doneRunningThisScript = false;
|
bool ScriptEngine::_doneRunningThisScript = false;
|
||||||
|
|
||||||
void ScriptEngine::stopAllScripts(QObject* application) {
|
void ScriptEngine::stopAllScripts(QObject* application) {
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------";)
|
||||||
|
|
||||||
_allScriptsMutex.lock();
|
_allScriptsMutex.lock();
|
||||||
_stoppingAllScripts = true;
|
_stoppingAllScripts = true;
|
||||||
|
@ -129,9 +136,9 @@ void ScriptEngine::stopAllScripts(QObject* application) {
|
||||||
|
|
||||||
QString scriptName = scriptEngine->getFilename();
|
QString scriptName = scriptEngine->getFilename();
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName
|
||||||
<< "isRunning():" << scriptEngine->isRunning()
|
<< "isRunning():" << scriptEngine->isRunning()
|
||||||
<< "evaluatePending():" << scriptEngine->evaluatePending();
|
<< "evaluatePending():" << scriptEngine->evaluatePending();)
|
||||||
|
|
||||||
// NOTE: typically all script engines are running. But there's at least one known exception to this, the
|
// NOTE: typically all script engines are running. But there's at least one known exception to this, the
|
||||||
// "entities sandbox" which is only used to evaluate entities scripts to test their validity before using
|
// "entities sandbox" which is only used to evaluate entities scripts to test their validity before using
|
||||||
|
@ -144,38 +151,34 @@ void ScriptEngine::stopAllScripts(QObject* application) {
|
||||||
while (scriptEngine->evaluatePending()) {
|
while (scriptEngine->evaluatePending()) {
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit);
|
QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit);
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName;)
|
||||||
loop.exec();
|
loop.exec();
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName;)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptEngine->disconnect(application);
|
scriptEngine->disconnect(application);
|
||||||
scriptEngine->stop();
|
scriptEngine->stop();
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName;)
|
||||||
scriptEngine->waitTillDoneRunning();
|
scriptEngine->waitTillDoneRunning();
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName;)
|
||||||
i.remove();
|
i.remove();
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_stoppingAllScripts = false;
|
_stoppingAllScripts = false;
|
||||||
_allScriptsMutex.unlock();
|
_allScriptsMutex.unlock();
|
||||||
qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------";)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScriptEngine::waitTillDoneRunning() {
|
void ScriptEngine::waitTillDoneRunning() {
|
||||||
QString scriptName = getFilename();
|
QString scriptName = getFilename();
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName;)
|
||||||
qDebug() << " _isFinished:" << _isFinished;
|
|
||||||
qDebug() << " _isRunning:" << _isRunning;
|
|
||||||
qDebug() << " _isInitialized:" << _isInitialized;
|
|
||||||
qDebug() << " _evaluatesPending:" << _evaluatesPending;
|
|
||||||
|
|
||||||
if (_isRunning) {
|
if (_isRunning) {
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
_doneRunningThisScript = false;
|
_doneRunningThisScript = false;
|
||||||
_isWaitingForDoneRunning = true;
|
_isWaitingForDoneRunning = true;
|
||||||
|
|
||||||
|
@ -188,23 +191,23 @@ void ScriptEngine::waitTillDoneRunning() {
|
||||||
// and run a QEventLoop???
|
// and run a QEventLoop???
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit);
|
QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit);
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName;)
|
||||||
qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript;)
|
||||||
qDebug() << " _isRunning:" << _isRunning;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _isRunning:" << _isRunning;)
|
||||||
qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning;)
|
||||||
qDebug() << " _isFinished:" << _isFinished;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _isFinished:" << _isFinished;)
|
||||||
qDebug() << " _isInitialized:" << _isInitialized;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _isInitialized:" << _isInitialized;)
|
||||||
qDebug() << " _evaluatesPending:" << _evaluatesPending;
|
DEBUG_SCRIPT_ENDING(qDebug() << " _evaluatesPending:" << _evaluatesPending;)
|
||||||
loop.exec();
|
loop.exec();
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName;)
|
||||||
|
|
||||||
// process events
|
// process events
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName;)
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName;)
|
||||||
|
|
||||||
if (_doneRunningThisScript) {
|
if (_doneRunningThisScript) {
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName;)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +215,7 @@ void ScriptEngine::waitTillDoneRunning() {
|
||||||
_isWaitingForDoneRunning = false;
|
_isWaitingForDoneRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName;)
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ScriptEngine::getFilename() const {
|
QString ScriptEngine::getFilename() const {
|
||||||
|
@ -430,20 +433,20 @@ void ScriptEngine::evaluate() {
|
||||||
return; // bail early
|
return; // bail early
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]";)
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]";)
|
||||||
QScriptValue result = evaluate(_scriptContents);
|
QScriptValue result = evaluate(_scriptContents);
|
||||||
qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
// TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call
|
// TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call
|
||||||
// will cause this code to never actually run...
|
// will cause this code to never actually run...
|
||||||
if (hasUncaughtException()) {
|
if (hasUncaughtException()) {
|
||||||
int line = uncaughtExceptionLineNumber();
|
int line = uncaughtExceptionLineNumber();
|
||||||
qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
|
DEBUG_SCRIPT_ENDING(qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();)
|
||||||
emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
|
emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
|
||||||
clearExceptions();
|
clearExceptions();
|
||||||
}
|
}
|
||||||
|
@ -456,24 +459,24 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN
|
||||||
return QScriptValue(); // bail early
|
return QScriptValue(); // bail early
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
_evaluatesPending++;
|
_evaluatesPending++;
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber);
|
QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber);
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
if (hasUncaughtException()) {
|
if (hasUncaughtException()) {
|
||||||
int line = uncaughtExceptionLineNumber();
|
int line = uncaughtExceptionLineNumber();
|
||||||
qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString();
|
qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString();
|
||||||
}
|
}
|
||||||
_evaluatesPending--;
|
_evaluatesPending--;
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
emit evaluationFinished(result, hasUncaughtException());
|
emit evaluationFinished(result, hasUncaughtException());
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
clearExceptions();
|
clearExceptions();
|
||||||
qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,18 +496,18 @@ void ScriptEngine::run() {
|
||||||
// TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if
|
// TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if
|
||||||
// we're in the process of stopping?
|
// we're in the process of stopping?
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_isFinished = false;
|
_isFinished = false;
|
||||||
emit runningStateChanged();
|
emit runningStateChanged();
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
QScriptValue result = evaluate(_scriptContents);
|
QScriptValue result = evaluate(_scriptContents);
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
QElapsedTimer startTime;
|
QElapsedTimer startTime;
|
||||||
startTime.start();
|
startTime.start();
|
||||||
|
@ -515,11 +518,11 @@ void ScriptEngine::run() {
|
||||||
|
|
||||||
qint64 lastUpdate = usecTimestampNow();
|
qint64 lastUpdate = usecTimestampNow();
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
while (!_isFinished) {
|
while (!_isFinished) {
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec
|
int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec
|
||||||
|
@ -528,22 +531,22 @@ void ScriptEngine::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isFinished) {
|
if (_isFinished) {
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isFinished) {
|
if (_isFinished) {
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,34 +676,34 @@ void ScriptEngine::run() {
|
||||||
lastUpdate = now;
|
lastUpdate = now;
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
stopAllTimers(); // make sure all our timers are stopped if the script is ending
|
stopAllTimers(); // make sure all our timers are stopped if the script is ending
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename();
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename();)
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
emit scriptEnding();
|
emit scriptEnding();
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
// kill the avatar identity timer
|
// kill the avatar identity timer
|
||||||
delete _avatarIdentityTimer;
|
delete _avatarIdentityTimer;
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {
|
if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {
|
||||||
|
@ -713,43 +716,43 @@ void ScriptEngine::run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
// If we were on a thread, then wait till it's done
|
// If we were on a thread, then wait till it's done
|
||||||
if (thread()) {
|
if (thread()) {
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
thread()->quit();
|
thread()->quit();
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
emit finished(_fileNameString);
|
emit finished(_fileNameString);
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
_isRunning = false;
|
_isRunning = false;
|
||||||
emit runningStateChanged();
|
emit runningStateChanged();
|
||||||
|
|
||||||
qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]";)
|
||||||
emit doneRunning();
|
emit doneRunning();
|
||||||
qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]";)
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
_doneRunningThisScript = true;
|
_doneRunningThisScript = true;
|
||||||
|
|
||||||
if (_isWaitingForDoneRunning) {
|
if (_isWaitingForDoneRunning) {
|
||||||
qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,10 +768,10 @@ void ScriptEngine::stopAllTimers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::stop() {
|
void ScriptEngine::stop() {
|
||||||
qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename();
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename();)
|
||||||
_isFinished = true;
|
_isFinished = true;
|
||||||
emit runningStateChanged();
|
emit runningStateChanged();
|
||||||
qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename();
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename();)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::timerFired() {
|
void ScriptEngine::timerFired() {
|
||||||
|
@ -884,9 +887,9 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
||||||
if (contents.isNull()) {
|
if (contents.isNull()) {
|
||||||
qDebug() << "Error loading file: " << url;
|
qDebug() << "Error loading file: " << url;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;)
|
||||||
QScriptValue result = evaluate(contents, url.toString());
|
QScriptValue result = evaluate(contents, url.toString());
|
||||||
qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;
|
DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue