]> git.siccegge.de Git - frida/frida.git/blob - src/bindings/Guile.hxx
Add doc repo as submodule
[frida/frida.git] / src / bindings / Guile.hxx
1 #ifndef INCLUDE__Guile_hxx_
2 #define INCLUDE__Guile_hxx_
3
4 #include <libguile.h>
5 #include <log4cxx/logger.h>
6
7 #include "qt.hxx"
8 #include "Interpreter.hxx"
9
10 namespace guile {
11 class Geiser : public QThread {
12 Q_OBJECT
13 public:
14 Geiser(QObject* parent) : QThread(parent) {}
15 Geiser() {}
16 private:
17 void run() Q_DECL_OVERRIDE;
18 };
19 }
20
21 class GuileInterpreter : public QObject, public Interpreter {
22 Q_OBJECT
23 Q_PLUGIN_METADATA(IID "xyz.frida.Interpreter")
24 Q_INTERFACES(Interpreter)
25 public:
26 GuileInterpreter();
27 virtual ~GuileInterpreter();
28
29 int evaluate(const std::string& command,
30 std::ostream& stdout,
31 std::ostream& stderr,
32 std::string& result);
33
34 int loadFile(const std::string& filename,
35 std::ostream& stdout,
36 std::ostream& stderr,
37 std::string& result);
38
39 std::string fileExtension() const {return "scm";}
40 private:
41 int evaluateWithErrorHandling(SCM (*fun)(void *),
42 void* data,
43 std::ostream& stdout,
44 std::ostream& stderr,
45 std::string& result);
46
47 SCM guile_output_port;
48 SCM guile_error_port;
49 log4cxx::LoggerPtr logger;
50 guile::Geiser* geiser;
51 };
52
53 #endif /* INCLUDE__Guile_hxx_ */