summaryrefslogtreecommitdiffstats
path: root/src/bindings
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-08-01 19:09:43 +0000
committerDavid Robillard <d@drobilla.net>2007-08-01 19:09:43 +0000
commit84b9118ee4dcc180b8fbae85910bec0590858680 (patch)
tree864567eb98e7a0078fd54cf474abf6eebeabf1fc /src/bindings
parentef623f2f3c934d0f3d17d9d8850d59e220fefc52 (diff)
downloadingen-84b9118ee4dcc180b8fbae85910bec0590858680.tar.gz
ingen-84b9118ee4dcc180b8fbae85910bec0590858680.tar.bz2
ingen-84b9118ee4dcc180b8fbae85910bec0590858680.zip
Added missing bindings files.
git-svn-id: http://svn.drobilla.net/lad/ingen@668 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/ingen_bindings.cpp44
-rw-r--r--src/bindings/ingen_bindings.hpp19
2 files changed, 63 insertions, 0 deletions
diff --git a/src/bindings/ingen_bindings.cpp b/src/bindings/ingen_bindings.cpp
new file mode 100644
index 00000000..0f96feda
--- /dev/null
+++ b/src/bindings/ingen_bindings.cpp
@@ -0,0 +1,44 @@
+#include <iostream>
+#include "python2.4/Python.h"
+#include "ingen_bindings.hpp"
+#include "../libs/engine/Engine.hpp"
+
+using namespace std;
+
+namespace Ingen {
+namespace Shared {
+
+Ingen::Shared::World* ingen_world = NULL;
+
+extern "C" {
+
+bool
+run(Ingen::Shared::World* world, const char* filename)
+{
+ ingen_world = world;
+
+ FILE* fd = fopen(filename, "r");
+ if (fd) {
+ cerr << "EXECUTING " << filename << endl;
+ Py_Initialize();
+ PyRun_SimpleFile(fd, filename);
+ Py_Finalize();
+ return true;
+ } else {
+ cerr << "UNABLE TO OPEN FILE " << filename << endl;
+ return false;
+ }
+}
+
+
+void
+script_iteration(Ingen::Shared::World* world) {
+ if (world->local_engine)
+ world->local_engine->main_iteration();
+}
+
+
+}
+
+} // namespace Shared
+} // namespace Ingen
diff --git a/src/bindings/ingen_bindings.hpp b/src/bindings/ingen_bindings.hpp
new file mode 100644
index 00000000..0d501de9
--- /dev/null
+++ b/src/bindings/ingen_bindings.hpp
@@ -0,0 +1,19 @@
+#ifndef INGEN_BINDINGS_HPP
+#define INGEN_BINDINGS_HPP
+
+namespace Ingen {
+namespace Shared {
+
+
+class World;
+extern World* ingen_world;
+
+extern "C" {
+ bool run(World* world, const char* filename);
+ void script_iteration(World* world);
+}
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_BINDINGS_HPP