aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py/source/main.h')
-rw-r--r--externals/grill/py/source/main.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index b828f47b..23a9ccb0 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -15,17 +15,24 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "pysymbol.h"
#include "pybuffer.h"
#include <flcontainers.h>
+#include <string>
#if FLEXT_OS == FLEXT_LINUX || FLEXT_OS == FLEXT_IRIX
#include <unistd.h>
#endif
+#if FLEXT_SYS == FLEXT_SYS_PD && (!defined (PD_MINOR_VERSION) || PD_MINOR_VERSION < 37)
+#error PD version >= 0.37 required, please upgrade!
+#endif
+
#define PY__VERSION "0.2.0pre"
#define PYEXT_MODULE "pyext" // name for module
#define PYEXT_CLASS "_class" // name for base class
+#define REGNAME "_registry"
+
#define PY_STOP_WAIT 100 // ms
#define PY_STOP_TICK 1 // ms
@@ -67,7 +74,8 @@ protected:
void mg_dir(AtomList &lst) { m__dir(module); }
void m_doc() { m__doc(dict); }
- PyObject *module,*dict; // inherited user class module and associated dictionary
+ std::string modname; // module name
+ PyObject *module,*dict; // object module and associated dictionary
static const char *py_doc;
@@ -78,14 +86,29 @@ protected:
void GetModulePath(const char *mod,char *dir,int len);
void AddToPath(const char *dir);
void SetArgs();
+
+ // reload module and all connected objects
+ void Reload();
+
bool ImportModule(const char *name);
void UnimportModule();
bool ReloadModule();
- void Register(const char *reg);
- void Unregister(const char *reg);
- void Reregister(const char *reg);
- virtual bool Reload() = 0;
+ // Get module registry
+ PyObject *GetRegistry(const char *regname);
+ // Set module registry
+ void SetRegistry(const char *regname,PyObject *reg);
+
+ // Register object
+ void Register(PyObject *reg);
+ // Unregister object
+ void Unregister(PyObject *reg);
+
+ virtual void LoadModule() = 0;
+ virtual void UnloadModule() = 0;
+
+ virtual void Load() = 0;
+ virtual void Unload() = 0;
void OpenEditor();
void Respond(bool b);
@@ -199,7 +222,7 @@ public:
inline void Lock() {}
inline void Unlock() {}
- inline PyThreadState *PyLock(PyThreadState *) { return NULL; }
+ inline PyThreadState *PyLock(PyThreadState * = NULL) { return NULL; }
inline PyThreadState *PyLockSys() { return NULL; }
inline void PyUnlock(PyThreadState *st) {}
#endif