return 0;
}
+
+int GuileInterpreter::loadFile(const std::string& filename,
+ std::ostream& stdout,
+ std::ostream& stderr,
+ std::string& result) {
+ return evaluate("(load \"" + filename + "\")",
+ stdout, stderr, result);
+}
std::ostream& stdout,
std::ostream& stderr,
std::string& result) = 0;
+
+ virtual int loadFile(const std::string& filename,
+ std::ostream& stdout,
+ std::ostream& stderr,
+ std::string& result) = 0;
+
+ virtual std::string fileExtension() const = 0;
private:
};
fileMenu->addSeparator();
fileMenu->addAction(exitAction);
- scripting = new ScriptingDock(new GuileInterpreter, tr("Scripting"), this);
+ QMenu* interpretermenu = menuBar()->addMenu(tr("&Interpreter"));
+
+ interpreter["GUILE"] = new GuileInterpreter;
+ scripting = new ScriptingDock(interpreter["GUILE"], tr("Scripting"), this);
scripting->setAllowedAreas(Qt::BottomDockWidgetArea);
addDockWidget(Qt::BottomDockWidgetArea, scripting);
+ QAction* guileLoad = new QAction(tr("&GUILE"), this);
+ interpretermenu->addAction(guileLoad);
+ connect(guileLoad, &QAction::triggered,
+ [&]() {
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open Script"), "",
+ tr("Binaries") + " (*." +
+ interpreter["GUILE"]->fileExtension().c_str() + ")");
+ std::stringstream a, b;
+ std::string c;
+ interpreter["GUILE"]->loadFile(fileName.toStdString(), a, b, c);
+ });
listWidget = new QTreeWidget();
listWidget->setColumnCount(1);
#include <memory>
#include <map>
#include <vector>
+#include <string>
#include <QTextEdit>
#include <QPushButton>
class FunctionWidget;
class BasicBlockWidget;
class ScriptingDock;
+class Interpreter;
class Mainwindow : public QMainWindow {
Q_OBJECT
std::map<QTreeWidgetItem*, FunctionWidget*> objects_list;
std::map<uint64_t, QTreeWidgetItem*> objects_list_by_address;
std::vector<QTreeWidgetItem*> group_list;
+ std::map<std::string, Interpreter*> interpreter;
InformationManager* manager;
log4cxx::LoggerPtr logger;