From 562dcc336797951b2a8707413aa44177484c9f2a Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 28 Dec 2002 04:37:42 +0000 Subject: "" svn path=/trunk/; revision=309 --- externals/grill/py/pd/thread-1.pd | 94 ++++++++++++++++++------------------- externals/grill/py/readme.txt | 3 ++ externals/grill/py/source/main.h | 2 +- externals/grill/py/source/py.cpp | 38 ++++++++------- externals/grill/py/source/pyext.cpp | 22 ++++----- externals/grill/py/source/pyext.h | 4 +- 6 files changed, 85 insertions(+), 78 deletions(-) (limited to 'externals/grill/py') diff --git a/externals/grill/py/pd/thread-1.pd b/externals/grill/py/pd/thread-1.pd index 9a873781..5a9545e2 100644 --- a/externals/grill/py/pd/thread-1.pd +++ b/externals/grill/py/pd/thread-1.pd @@ -1,47 +1,47 @@ -#N canvas 440 61 586 398 12; -#X msg 38 265 help; -#X msg 37 290 doc; -#X msg 73 291 doc+; -#X floatatom 145 323 5 0 0; -#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill -; -#X text 14 44 This demonstrates threading. See the threads.py file. -; -#X obj 140 216 tgl 15 0 empty empty empty 0 -6 32 8 -262144 -1 -1 0 -1; -#X msg 140 236 detach \$1; -#X floatatom 253 324 5 0 0; -#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699 --1 -1; -#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699 --1 -1; -#X obj 146 154 t b b b; -#X obj 275 150 t b b b; -#X obj 289 179 1; -#X obj 160 181 0; -#X text 87 87 without threads; -#X text 251 85 with threads; -#X text 252 102 non-blocking; -#X text 178 345 watch that!; -#X msg 414 127 stop; -#X text 384 106 you can even stop it; -#X text 115 102 blocking; -#X obj 145 279 pyext threads ex1; -#X connect 0 0 22 0; -#X connect 1 0 22 0; -#X connect 2 0 22 0; -#X connect 6 0 7 0; -#X connect 7 0 22 0; -#X connect 9 0 12 0; -#X connect 10 0 11 0; -#X connect 11 0 22 1; -#X connect 11 1 22 2; -#X connect 11 2 14 0; -#X connect 12 0 22 1; -#X connect 12 1 22 2; -#X connect 12 2 13 0; -#X connect 13 0 6 0; -#X connect 14 0 6 0; -#X connect 19 0 22 0; -#X connect 22 0 3 0; -#X connect 22 1 8 0; +#N canvas 440 61 588 400 12; +#X msg 38 265 help; +#X msg 37 290 doc; +#X msg 73 291 doc+; +#X floatatom 145 323 5 0 0 0 - - -; +#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill +; +#X text 14 44 This demonstrates threading. See the threads.py file. +; +#X obj 140 216 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X msg 140 236 detach \$1; +#X floatatom 253 324 5 0 0 0 - - -; +#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 +-1; +#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 +-1; +#X obj 146 154 t b b b; +#X obj 275 150 t b b b; +#X obj 289 179 1; +#X obj 160 181 0; +#X text 87 87 without threads; +#X text 251 85 with threads; +#X text 252 102 non-blocking; +#X text 178 345 watch that!; +#X msg 414 127 stop; +#X text 384 106 you can even stop it; +#X obj 145 279 pyext threads ex1; +#X text 93 101 - blocking!! -; +#X connect 0 0 21 0; +#X connect 1 0 21 0; +#X connect 2 0 21 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 21 1; +#X connect 11 1 21 2; +#X connect 11 2 14 0; +#X connect 12 0 21 1; +#X connect 12 1 21 2; +#X connect 12 2 13 0; +#X connect 13 0 6 0; +#X connect 14 0 6 0; +#X connect 19 0 21 0; +#X connect 21 0 3 0; +#X connect 21 1 8 0; diff --git a/externals/grill/py/readme.txt b/externals/grill/py/readme.txt index 3173ce04..82d88985 100644 --- a/externals/grill/py/readme.txt +++ b/externals/grill/py/readme.txt @@ -73,6 +73,9 @@ o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh" Version history: +0.1.2: +- CHANGE: updates for flext 0.4.1 - method registering within class scope + 0.1.1: - CHANGE: updates for flext 0.4.0 - FIX: crash when module couldn't be loaded diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h index eaa9f7b6..721a1d43 100644 --- a/externals/grill/py/source/main.h +++ b/externals/grill/py/source/main.h @@ -22,7 +22,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #error You need at least flext version 0.4.1 #endif -#define PY__VERSION "0.1.1" +#define PY__VERSION "0.1.2pre" #define PYEXT_MODULE "pyext" // name for module diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp index f6127716..00f1f992 100644 --- a/externals/grill/py/source/py.cpp +++ b/externals/grill/py/source/py.cpp @@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. class pyobj: public py { - FLEXT_HEADER(pyobj,py) + FLEXT_HEADER_S(pyobj,py,Setup) public: pyobj(I argc,const t_atom *argv); @@ -50,6 +50,7 @@ protected: V ResetFunction(); private: + static void Setup(t_class *c); FLEXT_CALLBACK(m_bang) FLEXT_CALLBACK(m_reload) @@ -72,6 +73,25 @@ private: FLEXT_LIB_V("py",pyobj) +void pyobj::Setup(t_class *c) +{ + FLEXT_CADDBANG(c,0,m_bang); + FLEXT_CADDMETHOD_(c,0,"reload",m_reload_); + FLEXT_CADDMETHOD_(c,0,"reload.",m_reload); + FLEXT_CADDMETHOD_(c,0,"set",m_set); + FLEXT_CADDMETHOD_(c,0,"doc",m_doc); + FLEXT_CADDMETHOD_(c,0,"doc+",m_doc_); +#ifdef FLEXT_THREADS + FLEXT_CADDMETHOD_(c,0,"detach",m_detach); + FLEXT_CADDMETHOD_(c,0,"stop",m_stop); +#endif + + FLEXT_CADDMETHOD_(c,1,"float",m_py_float); + FLEXT_CADDMETHOD_(c,1,"int",m_py_int); + FLEXT_CADDMETHOD(c,1,m_py_list); + FLEXT_CADDMETHOD(c,1,m_py_any); +} + pyobj::pyobj(I argc,const t_atom *argv): function(NULL),funname(NULL) { @@ -80,22 +100,6 @@ pyobj::pyobj(I argc,const t_atom *argv): AddInAnything(2); AddOutAnything(); - FLEXT_ADDBANG(0,m_bang); - FLEXT_ADDMETHOD_(0,"reload",m_reload_); - FLEXT_ADDMETHOD_(0,"reload.",m_reload); - FLEXT_ADDMETHOD_(0,"set",m_set); - FLEXT_ADDMETHOD_(0,"doc",m_doc); - FLEXT_ADDMETHOD_(0,"doc+",m_doc_); -#ifdef FLEXT_THREADS - FLEXT_ADDMETHOD_(0,"detach",m_detach); - FLEXT_ADDMETHOD_(0,"stop",m_stop); -#endif - - FLEXT_ADDMETHOD_(1,"float",m_py_float); - FLEXT_ADDMETHOD_(1,"int",m_py_int); - FLEXT_ADDMETHOD(1,m_py_list); - FLEXT_ADDMETHOD(1,m_py_any); - if(argc > 2) SetArgs(argc-2,argv+2); else diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp index 8bff5913..958f1882 100644 --- a/externals/grill/py/source/pyext.cpp +++ b/externals/grill/py/source/pyext.cpp @@ -14,12 +14,22 @@ WARRANTIES, see the file, "license.txt," in this distribution. FLEXT_LIB_V("pyext",pyext) -V pyext::setup(t_class *) +V pyext::Setup(t_class *c) { px_head = px_tail = NULL; px_class = class_new(gensym("pyext proxy"),NULL,NULL,sizeof(py_proxy),CLASS_PD|CLASS_NOINLET, A_NULL); ::add_anything(px_class,py_proxy::px_method); // for other inlets + + FLEXT_CADDMETHOD_(c,0,"reload.",m_reload); + FLEXT_CADDMETHOD_(c,0,"reload",m_reload_); + FLEXT_CADDMETHOD_(c,0,"doc",m_doc); + FLEXT_CADDMETHOD_(c,0,"doc+",m_doc_); + +#ifdef FLEXT_THREADS + FLEXT_CADDMETHOD_(c,0,"detach",m_detach); + FLEXT_CADDMETHOD_(c,0,"stop",m_stop); +#endif } pyext *pyext::GetThis(PyObject *self) @@ -165,16 +175,6 @@ pyext::pyext(I argc,const t_atom *argv): AddInAnything(1+inlets); AddOutAnything(outlets); - FLEXT_ADDMETHOD_(0,"reload.",m_reload); - FLEXT_ADDMETHOD_(0,"reload",m_reload_); - FLEXT_ADDMETHOD_(0,"doc",m_doc); - FLEXT_ADDMETHOD_(0,"doc+",m_doc_); - -#ifdef FLEXT_THREADS - FLEXT_ADDMETHOD_(0,"detach",m_detach); - FLEXT_ADDMETHOD_(0,"stop",m_stop); -#endif - if(!pyobj) InitProblem(); } diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h index d804d825..4d35e0a4 100644 --- a/externals/grill/py/source/pyext.h +++ b/externals/grill/py/source/pyext.h @@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. class pyext: public py { - FLEXT_HEADER_S(pyext,py,setup) + FLEXT_HEADER_S(pyext,py,Setup) public: pyext(I argc,const t_atom *argv); @@ -53,7 +53,7 @@ protected: I inlets,outlets; private: - static V setup(t_class *); + static V Setup(t_class *); static pyext *GetThis(PyObject *self); V ClearBinding(); -- cgit v1.2.1