/usr/include/tulip/PythonInterpreter.h is in libtulip-dev 4.4.0dfsg2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /*
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip 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.
*
*/
/**
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip 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.
*
*/
#ifndef PYTHONINTERPRETER_H_
#define PYTHONINTERPRETER_H_
#ifndef PyObject_HEAD
struct _object;
typedef _object PyObject;
#endif
#include <tulip/PythonCppTypesConverter.h>
#include <tulip/Graph.h>
#include <QVector>
#include <QSet>
#include <QString>
class QAbstractScrollArea;
class QPlainTextEdit;
class QTextBrowser;
namespace tlp {
class TLP_PYTHON_SCOPE PythonInterpreter {
PythonInterpreter();
~PythonInterpreter();
void holdGIL();
void releaseGIL();
void setDefaultConsoleWidget(QAbstractScrollArea *consoleWidget);
void setConsoleWidget(QAbstractScrollArea *consoleWidget);
static PythonInterpreter _instance;
bool _wasInit;
bool _runningScript;
QSet<QString> _currentImportPaths;
QAbstractScrollArea *_defaultConsoleWidget;
QString _pythonVersion;
public :
static const QString pythonPluginsPath;
static const QString pythonPluginsPathHome;
static const char pythonReservedCharacters[];
static const char *pythonKeywords[];
static PythonInterpreter *getInstance();
bool interpreterInit() ;
bool loadTulipPythonPlugin(const QString &pluginPath);
void loadTulipPythonPluginsFromDir(const QString &pluginsPath);
void loadTulipPythonPluginsFromDefaultDirs();
bool importModule(const QString &moduleName);
bool registerNewModuleFromString(const QString &moduleName, const QString &moduleSrcCode);
bool runString(const QString &pyhtonCode, const QString &scriptFilePath="");
bool runGraphScript(const QString &module, const QString &function, tlp::Graph *graph, const QString &scriptFilePath="");
template<typename T>
bool evalSingleStatementAndGetValue(const QString &pythonStatement, T &value);
template<typename PARAM_TYPE>
bool callFunctionOneParam(const QString &module, const QString &function, const PARAM_TYPE ¶meter);
template<typename PARAM1_TYPE, typename PARAM2_TYPE>
bool callFunctionTwoParams(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2);
template<typename PARAM1_TYPE, typename PARAM2_TYPE, typename PARAM3_TYPE>
bool callFunctionThreeParams(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2,
const PARAM3_TYPE ¶meter3);
template<typename PARAM1_TYPE, typename PARAM2_TYPE, typename PARAM3_TYPE, typename PARAM4_TYPE>
bool callFunctionFourParams(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2,
const PARAM3_TYPE ¶meter3, const PARAM4_TYPE ¶meter4);
bool callFunction(const QString &module, const QString &function, const tlp::DataSet ¶meters);
template<typename PARAM_TYPE, typename RETURN_TYPE>
bool callFunctionOneParamAndGetReturnValue(const QString &module, const QString &function, const PARAM_TYPE ¶meter, RETURN_TYPE &returnValue);
template<typename PARAM1_TYPE, typename PARAM2_TYPE, typename RETURN_TYPE>
bool callFunctionTwoParamsAndGetReturnValue(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2,
RETURN_TYPE &returnValue);
template<typename PARAM1_TYPE, typename PARAM2_TYPE, typename PARAM3_TYPE, typename RETURN_TYPE>
bool callFunctionThreeParamsAndGetReturnValue(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2,
const PARAM3_TYPE ¶meter3, RETURN_TYPE &returnValue);
template<typename PARAM1_TYPE, typename PARAM2_TYPE, typename PARAM3_TYPE, typename PARAM4_TYPE, typename RETURN_TYPE>
bool callFunctionFourParamsAndGetReturnValue(const QString &module, const QString &function, const PARAM1_TYPE ¶meter1, const PARAM2_TYPE ¶meter2,
const PARAM3_TYPE ¶meter3, const PARAM4_TYPE ¶meter4, RETURN_TYPE &returnValue);
template<typename RETURN_TYPE>
bool callFunctionAndGetReturnValue(const QString &module, const QString &function, const tlp::DataSet ¶meters, RETURN_TYPE &returnValue);
bool functionExists(const QString &moduleName, const QString &functionName);
void addModuleSearchPath(const QString &path, const bool beforeOtherPaths = false);
void deleteModule(const QString &moduleName);
bool reloadModule(const QString &moduleName);
void stopCurrentScript();
void pauseCurrentScript(const bool pause=true);
bool isScriptPaused() const;
void setProcessQtEventsDuringScriptExecution(bool processQtEvents);
bool isRunningScript() const {
return _runningScript;
}
QString getPythonVersionStr() const {
return _pythonVersion;
}
double getPythonVersion() const;
QString getPythonShellBanner();
void setDefaultSIGINTHandler();
QVector<QString> getImportedModulesList();
QVector<QString> getBaseTypesForType(const QString &type);
QVector<QString> getGlobalDictEntries(const QString &prefixFilter = "");
QVector<QString> getObjectDictEntries(const QString &objectName, const QString &prefixFilter = "");
QString getVariableType(const QString &varName);
void setDefaultConsoleWidget(QPlainTextEdit *consoleWidget);
void setDefaultConsoleWidget(QTextBrowser *consoleWidget);
void setConsoleWidget(QPlainTextEdit *consoleWidget);
void setConsoleWidget(QTextBrowser *consoleWidget);
void resetConsoleWidget();
void initConsoleOutput();
void loadTulipPythonPluginsFromDir();
QString getStandardOutput() const;
QString getStandardErrorOutput() const;
void clearOutputBuffers();
void setOutputEnabled(const bool enableOutput);
bool outputEnabled() const;
void sendOutputToConsole(const QString &output, bool stdErr);
QString readLineFromConsole();
PyObject* callPythonFunction(const QString &module, const QString &function, const tlp::DataSet ¶meters);
PyObject* evalPythonStatement(const QString &pythonStatement);
};
#include "PythonInterpreter.cxx"
}
#endif /* PYTHONINTERPRETER_H_ */
|