#include <ScriptingEnv.h>
ScriptingEnv objects represent a running interpreter, possibly with global variables, and are responsible for generating Script objects (which do the actual evaluation of code).
Public Slots | |
virtual void | clear () |
Clear the global environment. What exactly happens depends on the implementation. | |
void | decref () |
Decrease the reference count. This should only be called by scripted and Script to avoid segfaults. | |
void | incref () |
Increase the reference count. This should only be called by scripted and Script to avoid memory leaks. | |
virtual bool | setDouble (double, const char *) |
virtual bool | setInt (int, const char *) |
virtual bool | setQObject (QObject *, const char *) |
virtual void | startExecution () |
If the implementation supports asynchronuos execution, activate it. | |
virtual void | stopExecution () |
If the implementation supports asynchronuos execution, deactivate it. | |
Signals | |
void | error (const QString &message, const QString &scriptName, int lineNumber) |
signal an error condition / exception | |
void | print (const QString &output) |
output that is not handled by a Script | |
Public Member Functions | |
virtual const QStringList | fileExtensions () const |
Return a list of file extensions commonly used for this language. | |
const QString | fileFilter () const |
Construct a filter expression from fileExtension(), suitable for QFileDialog. | |
virtual bool | initialize () |
Part of the initialization is deferred from the constructor until after the signals have been connected. | |
bool | initialized () const |
initialization of the interpreter may fail; or there could be other errors setting up the environment | |
virtual bool | isRunning () const |
whether asynchronuous execution is enabled (if supported by the implementation) | |
virtual const QString | mathFunctionDoc (const QString &) const |
Return a documentation string for the given mathematical function. | |
virtual const QStringList | mathFunctions () const |
Return a list of supported mathematical functions. These should be imported into the global namespace. | |
virtual Script * | newScript (const QString &, QObject *, const QString &) |
Instantiate the Script subclass matching the ScriptEnv subclass. | |
ScriptingEnv (ApplicationWindow *parent, const char *langName) | |
virtual QString | stackTraceString () |
If an exception / error occured, return a nicely formated stack backtrace. | |
Protected Attributes | |
bool | d_initialized |
whether the interpreter has been successfully initialized | |
ApplicationWindow * | d_parent |
the context in which we are running | |
Private Attributes | |
int | d_refcount |
the reference counter |
ScriptingEnv::ScriptingEnv | ( | ApplicationWindow * | parent, | |
const char * | langName | |||
) |
References d_initialized, and d_refcount.
virtual void ScriptingEnv::clear | ( | ) | [inline, virtual, slot] |
Clear the global environment. What exactly happens depends on the implementation.
void ScriptingEnv::decref | ( | ) | [slot] |
Decrease the reference count. This should only be called by scripted and Script to avoid segfaults.
References d_refcount.
Referenced by scripted::scriptingChangeEvent(), Script::~Script(), and scripted::~scripted().
void ScriptingEnv::error | ( | const QString & | message, | |
const QString & | scriptName, | |||
int | lineNumber | |||
) | [signal] |
signal an error condition / exception
virtual const QStringList ScriptingEnv::fileExtensions | ( | ) | const [inline, virtual] |
Return a list of file extensions commonly used for this language.
Reimplemented in PythonScripting.
Referenced by fileFilter().
const QString ScriptingEnv::fileFilter | ( | ) | const |
Construct a filter expression from fileExtension(), suitable for QFileDialog.
References fileExtensions().
Referenced by ScriptEdit::exportASCII(), and ScriptEdit::importASCII().
void ScriptingEnv::incref | ( | ) | [slot] |
Increase the reference count. This should only be called by scripted and Script to avoid memory leaks.
References d_refcount.
Referenced by Script::Script(), scripted::scripted(), and scripted::scriptingChangeEvent().
virtual bool ScriptingEnv::initialize | ( | ) | [inline, virtual] |
Part of the initialization is deferred from the constructor until after the signals have been connected.
Reimplemented in PythonScripting.
Referenced by ApplicationWindow::init(), and ApplicationWindow::setScriptingLanguage().
bool ScriptingEnv::initialized | ( | ) | const [inline] |
initialization of the interpreter may fail; or there could be other errors setting up the environment
References d_initialized.
Referenced by PythonScripting::initialize().
virtual bool ScriptingEnv::isRunning | ( | ) | const [inline, virtual] |
whether asynchronuous execution is enabled (if supported by the implementation)
Reimplemented in muParserScripting, and PythonScripting.
virtual const QString ScriptingEnv::mathFunctionDoc | ( | const QString & | ) | const [inline, virtual] |
Return a documentation string for the given mathematical function.
Reimplemented in muParserScripting, and PythonScripting.
Referenced by ScriptEdit::contextMenuEvent(), SetColValuesDialog::insertExplain(), and MatrixValuesDialog::insertExplain().
virtual const QStringList ScriptingEnv::mathFunctions | ( | ) | const [inline, virtual] |
Return a list of supported mathematical functions. These should be imported into the global namespace.
Reimplemented in muParserScripting, and PythonScripting.
Referenced by ScriptEdit::contextMenuEvent(), ScriptEdit::insertFunction(), MatrixValuesDialog::MatrixValuesDialog(), and SetColValuesDialog::SetColValuesDialog().
virtual Script* ScriptingEnv::newScript | ( | const QString & | , | |
QObject * | , | |||
const QString & | ||||
) | [inline, virtual] |
Instantiate the Script subclass matching the ScriptEnv subclass.
Reimplemented in muParserScripting, and PythonScripting.
Referenced by Table::calculate(), MatrixModel::calculate(), Matrix::canCalculate(), Table::cellEdited(), ScriptEdit::customEvent(), and ScriptEdit::ScriptEdit().
void ScriptingEnv::print | ( | const QString & | output | ) | [signal] |
virtual bool ScriptingEnv::setDouble | ( | double | , | |
const char * | ||||
) | [inline, virtual, slot] |
Reimplemented in muParserScripting.
virtual bool ScriptingEnv::setInt | ( | int | , | |
const char * | ||||
) | [inline, virtual, slot] |
Reimplemented in muParserScripting.
virtual bool ScriptingEnv::setQObject | ( | QObject * | , | |
const char * | ||||
) | [inline, virtual, slot] |
Reimplemented in muParserScripting, and PythonScripting.
virtual QString ScriptingEnv::stackTraceString | ( | ) | [inline, virtual] |
If an exception / error occured, return a nicely formated stack backtrace.
virtual void ScriptingEnv::startExecution | ( | ) | [inline, virtual, slot] |
If the implementation supports asynchronuos execution, activate it.
virtual void ScriptingEnv::stopExecution | ( | ) | [inline, virtual, slot] |
If the implementation supports asynchronuos execution, deactivate it.
bool ScriptingEnv::d_initialized [protected] |
whether the interpreter has been successfully initialized
Referenced by PythonScripting::initialize(), initialized(), muParserScripting::muParserScripting(), PythonScripting::PythonScripting(), and ScriptingEnv().
ApplicationWindow* ScriptingEnv::d_parent [protected] |
the context in which we are running
Referenced by PythonScripting::initialize(), and PythonScripting::PythonScripting().
int ScriptingEnv::d_refcount [private] |