aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/dyn/pd/help-dyn~.pd (renamed from externals/grill/dyn/pd/dyn~.pd)275
-rw-r--r--externals/grill/dyn/readme.txt1
-rw-r--r--externals/grill/dyn/src/main.cpp87
-rw-r--r--externals/grill/pool/source/pool.cpp6
-rw-r--r--externals/grill/py/pd/pak.pd28
-rw-r--r--externals/grill/py/scripts/pak.py14
-rw-r--r--externals/grill/py/source/main.h2
-rw-r--r--externals/grill/py/source/py.cpp3
-rw-r--r--externals/grill/py/source/pyext.cpp96
-rw-r--r--externals/grill/py/source/pyext.h1
10 files changed, 307 insertions, 206 deletions
diff --git a/externals/grill/dyn/pd/dyn~.pd b/externals/grill/dyn/pd/help-dyn~.pd
index 8ec75d9c..61d9e572 100644
--- a/externals/grill/dyn/pd/dyn~.pd
+++ b/externals/grill/dyn/pd/help-dyn~.pd
@@ -1,137 +1,138 @@
-#N canvas 351 22 757 583 12;
-#N canvas 41 57 576 675 examples 0;
-#X floatatom 153 276 5 0 0 0 - - -;
-#X floatatom 110 353 5 0 0 0 - - -;
-#X floatatom 111 576 5 0 0 0 - - -;
-#X obj 256 315 +;
-#X floatatom 257 350 5 0 0 0 - - -;
-#X floatatom 153 498 5 0 0 0 - - -;
-#X floatatom 242 499 5 0 0 0 - - -;
-#X floatatom 304 497 5 0 0 0 - - -;
-#X obj 259 543 * 2;
-#X obj 301 544 + 1;
-#X floatatom 268 574 5 0 0 0 - - -;
-#X floatatom 261 275 5 0 0 0 - - -;
-#X floatatom 224 72 5 0 0 0 - - -;
-#X floatatom 100 155 5 0 0 0 - - -;
-#X floatatom 239 152 5 0 0 0 - - -;
-#X obj 238 117 f;
-#X obj 101 117 dyn~ 0 1 0 1;
-#X obj 111 315 dyn~ 0 2 0 1;
-#X obj 111 543 dyn~ 0 3 0 1;
-#X msg 36 34 reset \, newobj . a f \, conn 0 a 0 \, conn a 0 0;
-#X msg 42 234 reset \, newobj . a + \, conn 0 a 0 \, conn 1 a 1 \,
-conn a 0 0;
-#X msg 35 443 reset \, newobj . a * 2 \, newobj . b + 1 \, conn 0 a
-0 \, conn 1 a 1 \, conn a 0 b 0 \, conn 2 b 1 \, conn b 0 0;
-#X connect 0 0 3 0;
-#X connect 0 0 17 1;
-#X connect 3 0 4 0;
-#X connect 5 0 8 0;
-#X connect 5 0 18 1;
-#X connect 6 0 8 1;
-#X connect 6 0 18 2;
-#X connect 7 0 9 1;
-#X connect 7 0 18 3;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 11 0 3 1;
-#X connect 11 0 17 2;
-#X connect 12 0 15 0;
-#X connect 12 0 16 1;
-#X connect 15 0 14 0;
-#X connect 16 0 13 0;
-#X connect 17 0 1 0;
-#X connect 18 0 2 0;
-#X connect 19 0 16 0;
-#X connect 20 0 17 0;
-#X connect 21 0 18 0;
-#X restore 514 459 pd examples;
-#X msg 127 70 reset;
-#X text 184 70 clear all objects and connections;
-#X msg 129 231 conn 0 a 0;
-#X text 224 230 connect dyn-inlet 0 to a-inlet 0;
-#X msg 129 260 conn a 0 0;
-#X text 224 259 connect a-outlet 0 to dyn-outlet 0;
-#X msg 129 293 conn x 2 y 3;
-#X text 234 292 connect x-outlet 2 to y-inlet 3;
-#X msg 129 356 del a;
-#X text 181 358 delete object "a";
-#X obj 11 10 cnv 15 600 40 empty empty dyn~ 10 22 0 24 -260818 -1 0
-;
-#X text 133 32 http://www.parasitaere-kapazitaeten.net;
-#X text 133 12 dynamic object management \, (C)2003 Thomas Grill;
-#X msg 128 387 send a message 1;
-#X text 270 387 send "message 1" to a-inlet 0;
-#X obj 54 468 dyn~ 0 1 0 2;
-#X text 156 467 dyn sig/msg inlets sig/msg outlets;
-#X msg 165 421 vis \$1;
-#X obj 129 421 tgl 20 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X text 222 417 make patch visible/invisible;
-#X msg 129 323 dis x 2 y 3;
-#X text 234 324 disconnect x-outlet 2 to y-inlet 3;
-#X text 187 98 reload all objects (keep connections);
-#X msg 127 98 reload;
-#X text 218 432 (connections are not drawn at the moment!);
-#N canvas 178 192 574 430 dsp-ex 0;
-#X obj 73 380 dac~;
-#X obj 183 257 hsl 128 15 0 1000 0 0 empty empty empty -2 -6 0 8 -261681
--1 -1 5200 1;
-#X obj 194 282 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
--262144 -1 -1 409.449 256;
-#X msg 66 78 reset;
-#X obj 467 323 loadbang;
-#X msg 466 347 \; pd dsp 1;
-#X text 65 56 clear all;
-#X obj 47 278 dyn~ 0 1 2 0;
-#X text 70 107 make an oscillator (left);
-#X text 66 167 add an oscillator (double frq \, right);
-#X text 24 17 signals passing through dyn~ are delayed by one block
-;
-#X text 74 239 select frequency;
-#X obj 57 341 *~ 0.2;
-#X obj 141 340 *~ 0.2;
-#X obj 179 313 hsl 128 15 0.001 1 1 0 empty empty empty -2 -6 0 8 -262131
--1 -1 8800 1;
-#X text 316 309 gain;
-#X msg 64 129 newobj . o1 osc~ 220 \, conn 0 o1 0 \, conn o1 0 0;
-#X msg 67 187 newobj . m * 1.5 \, newobj . o2 osc~ 330 \, conn 0 m
-0 \, conn m 0 o2 0 \, conn o2 0 1;
-#X connect 1 0 2 0;
-#X connect 1 0 7 1;
-#X connect 3 0 7 0;
-#X connect 4 0 5 0;
-#X connect 7 0 12 0;
-#X connect 7 1 13 0;
-#X connect 12 0 0 0;
-#X connect 13 0 0 1;
-#X connect 14 0 12 1;
-#X connect 14 0 13 1;
-#X connect 16 0 7 0;
-#X connect 17 0 7 0;
-#X restore 514 487 pd dsp-ex;
-#X msg 129 156 newmsg . b Hello;
-#X msg 128 124 newobj . a + 1;
-#X text 247 124 make new object [+ 1] with name "a" in root patcher
-(".");
-#X text 269 156 make new message object [Hello( with name "b" in root
-patcher;
-#X msg 128 200 newobj . c pd sub;
-#X text 273 200 make sub patcher;
-#X msg 425 198 newobj c d bang;
-#X text 561 198 make object in sub patcher;
-#X connect 1 0 16 0;
-#X connect 3 0 16 0;
-#X connect 5 0 16 0;
-#X connect 7 0 16 0;
-#X connect 9 0 16 0;
-#X connect 14 0 16 0;
-#X connect 18 0 16 0;
-#X connect 19 0 18 0;
-#X connect 21 0 16 0;
-#X connect 24 0 16 0;
-#X connect 27 0 16 0;
-#X connect 28 0 16 0;
-#X connect 31 0 16 0;
-#X connect 33 0 16 0;
+#N canvas 81 25 813 532 12;
+#N canvas 71 10 550 557 examples 0;
+#X floatatom 148 239 5 0 0 0 - - -;
+#X floatatom 105 304 5 0 0 0 - - -;
+#X floatatom 113 501 5 0 0 0 - - -;
+#X obj 251 273 +;
+#X floatatom 252 301 5 0 0 0 - - -;
+#X floatatom 155 423 5 0 0 0 - - -;
+#X floatatom 244 424 5 0 0 0 - - -;
+#X floatatom 306 422 5 0 0 0 - - -;
+#X obj 261 468 * 2;
+#X obj 303 469 + 1;
+#X floatatom 270 499 5 0 0 0 - - -;
+#X floatatom 256 238 5 0 0 0 - - -;
+#X floatatom 224 72 5 0 0 0 - - -;
+#X floatatom 98 136 5 0 0 0 - - -;
+#X floatatom 237 133 5 0 0 0 - - -;
+#X obj 236 107 f;
+#X obj 99 107 dyn~ 0 1 0 1;
+#X obj 106 273 dyn~ 0 2 0 1;
+#X obj 113 468 dyn~ 0 3 0 1;
+#X msg 37 36 reset \, newobj . a f \, conn 0 a 0 \, conn a 0 0;
+#X msg 37 197 reset \, newobj . a + \, conn 0 a 0 \, conn 1 a 1 \,
+conn a 0 0;
+#X msg 37 368 reset \, newobj . a * 2 \, newobj . b + 1 \, conn 0 a
+0 \, conn 1 a 1 \, conn a 0 b 0 \, conn 2 b 1 \, conn b 0 0;
+#X connect 0 0 3 0;
+#X connect 0 0 17 1;
+#X connect 3 0 4 0;
+#X connect 5 0 8 0;
+#X connect 5 0 18 1;
+#X connect 6 0 8 1;
+#X connect 6 0 18 2;
+#X connect 7 0 9 1;
+#X connect 7 0 18 3;
+#X connect 8 0 9 0;
+#X connect 9 0 10 0;
+#X connect 11 0 3 1;
+#X connect 11 0 17 2;
+#X connect 12 0 15 0;
+#X connect 12 0 16 1;
+#X connect 15 0 14 0;
+#X connect 16 0 13 0;
+#X connect 17 0 1 0;
+#X connect 18 0 2 0;
+#X connect 19 0 16 0;
+#X connect 20 0 17 0;
+#X connect 21 0 18 0;
+#X restore 514 459 pd examples;
+#X msg 127 70 reset;
+#X text 184 70 clear all objects and connections;
+#X msg 129 231 conn 0 a 0;
+#X text 224 230 connect dyn-inlet 0 to a-inlet 0;
+#X msg 129 260 conn a 0 0;
+#X text 224 259 connect a-outlet 0 to dyn-outlet 0;
+#X msg 129 293 conn x 2 y 3;
+#X text 234 292 connect x-outlet 2 to y-inlet 3;
+#X msg 129 356 del a;
+#X text 181 358 delete object "a";
+#X obj 11 10 cnv 15 700 40 empty empty dyn~ 10 22 0 24 -260818 -1 0
+;
+#X text 133 32 http://www.parasitaere-kapazitaeten.net;
+#X msg 128 387 send a message 1;
+#X text 270 387 send "message 1" to a-inlet 0;
+#X obj 54 468 dyn~ 0 1 0 2;
+#X text 156 467 dyn sig/msg inlets sig/msg outlets;
+#X msg 165 421 vis \$1;
+#X obj 129 421 tgl 20 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 222 417 make patch visible/invisible;
+#X msg 129 323 dis x 2 y 3;
+#X text 234 324 disconnect x-outlet 2 to y-inlet 3;
+#X text 187 98 reload all objects (keep connections);
+#X msg 127 98 reload;
+#X text 218 432 (connections are not drawn at the moment!);
+#N canvas 178 192 578 434 dsp-ex 0;
+#X obj 73 380 dac~;
+#X obj 183 257 hsl 128 15 0 1000 0 0 empty empty empty -2 -6 0 8 -261681
+-1 -1 0 1;
+#X obj 194 282 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 0 256;
+#X msg 66 78 reset;
+#X obj 467 323 loadbang;
+#X msg 466 347 \; pd dsp 1;
+#X text 65 56 clear all;
+#X obj 47 278 dyn~ 0 1 2 0;
+#X text 70 107 make an oscillator (left);
+#X text 66 167 add an oscillator (double frq \, right);
+#X text 24 17 signals passing through dyn~ are delayed by one block
+;
+#X text 74 239 select frequency;
+#X obj 57 341 *~ 0.2;
+#X obj 141 340 *~ 0.2;
+#X obj 179 313 hsl 128 15 0.001 1 1 0 empty empty empty -2 -6 0 8 -262131
+-1 -1 0 1;
+#X text 316 309 gain;
+#X msg 64 129 newobj . o1 osc~ 220 \, conn 0 o1 0 \, conn o1 0 0;
+#X msg 67 187 newobj . m * 1.5 \, newobj . o2 osc~ 330 \, conn 0 m
+0 \, conn m 0 o2 0 \, conn o2 0 1;
+#X connect 1 0 2 0;
+#X connect 1 0 7 1;
+#X connect 3 0 7 0;
+#X connect 4 0 5 0;
+#X connect 7 0 12 0;
+#X connect 7 1 13 0;
+#X connect 12 0 0 0;
+#X connect 13 0 0 1;
+#X connect 14 0 12 1;
+#X connect 14 0 13 1;
+#X connect 16 0 7 0;
+#X connect 17 0 7 0;
+#X restore 514 487 pd dsp-ex;
+#X msg 129 156 newmsg . b Hello;
+#X msg 128 124 newobj . a + 1;
+#X text 247 124 make new object [+ 1] with name "a" in root patcher
+(".");
+#X text 269 156 make new message object [Hello( with name "b" in root
+patcher;
+#X msg 128 200 newobj . c pd sub;
+#X text 273 200 make sub patcher;
+#X msg 432 198 newobj c d bang;
+#X text 561 198 make object in sub patcher;
+#X text 133 12 dynamic object management \, (C)2003-2004 Thomas Grill
+;
+#X connect 1 0 15 0;
+#X connect 3 0 15 0;
+#X connect 5 0 15 0;
+#X connect 7 0 15 0;
+#X connect 9 0 15 0;
+#X connect 13 0 15 0;
+#X connect 17 0 15 0;
+#X connect 18 0 17 0;
+#X connect 20 0 15 0;
+#X connect 23 0 15 0;
+#X connect 26 0 15 0;
+#X connect 27 0 15 0;
+#X connect 30 0 15 0;
+#X connect 32 0 15 0;
diff --git a/externals/grill/dyn/readme.txt b/externals/grill/dyn/readme.txt
index 116e27d3..2942d4e6 100644
--- a/externals/grill/dyn/readme.txt
+++ b/externals/grill/dyn/readme.txt
@@ -41,6 +41,7 @@ CHANGES:
0.1.1:
- using aligned memory
+- cached several symbols
0.1.0:
- first release: PD 0.37 supports all necessary functionality
diff --git a/externals/grill/dyn/src/main.cpp b/externals/grill/dyn/src/main.cpp
index 4447d7a4..34b2f7bf 100644
--- a/externals/grill/dyn/src/main.cpp
+++ b/externals/grill/dyn/src/main.cpp
@@ -166,6 +166,9 @@ private:
FLEXT_CALLBACK_V(m_disconnect)
FLEXT_CALLBACK_V(m_send)
FLEXT_CALLBACK_B(m_vis)
+
+ static const t_symbol *sym_dot,*sym_dynsin,*sym_dynsout,*sym_dynin,*sym_dynout,*sym_dyncanvas;
+ static const t_symbol *sym_vis,*sym_loadbang,*sym_dsp;
};
FLEXT_NEW_DSP_V("dyn~",dyn)
@@ -178,28 +181,47 @@ const t_symbol *dyn::k_obj = NULL;
const t_symbol *dyn::k_msg = NULL;
const t_symbol *dyn::k_text = NULL;
+const t_symbol *dyn::sym_dot = NULL;
+const t_symbol *dyn::sym_dynsin = NULL;
+const t_symbol *dyn::sym_dynsout = NULL;
+const t_symbol *dyn::sym_dynin = NULL;
+const t_symbol *dyn::sym_dynout = NULL;
+const t_symbol *dyn::sym_dyncanvas = NULL;
+
+const t_symbol *dyn::sym_vis = NULL;
+const t_symbol *dyn::sym_loadbang = NULL;
+const t_symbol *dyn::sym_dsp = NULL;
+
void dyn::setup(t_classid c)
{
post("");
- post("dyn~ %s - dynamic object management, (C)2003 Thomas Grill",DYN_VERSION);
+ post("dyn~ %s - dynamic object management, (C)2003-2004 Thomas Grill",DYN_VERSION);
post("");
+ sym_dynsin = MakeSymbol("dyn_in~");
+ sym_dynsout = MakeSymbol("dyn_out~");
+ sym_dynin = MakeSymbol("dyn_in");
+ sym_dynout = MakeSymbol("dyn_out");
+
+ sym_dot = MakeSymbol(".");
+ sym_dyncanvas = MakeSymbol(" dyn~-canvas ");
+
// set up proxy class for inbound messages
- pxin_class = class_new(gensym("dyn_in"),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
+ pxin_class = class_new(const_cast<t_symbol *>(sym_dynin),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_anything(pxin_class,proxyin::px_method);
// set up proxy class for inbound signals
- pxins_class = class_new(gensym("dyn_in~"),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
+ pxins_class = class_new(const_cast<t_symbol *>(sym_dynsin),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
add_dsp(pxins_class,proxyin::dsp);
CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
// set up proxy class for outbound messages
- pxout_class = class_new(gensym("dyn_out"),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
+ pxout_class = class_new(const_cast<t_symbol *>(sym_dynout),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_anything(pxout_class,proxyout::px_method);
// set up proxy class for outbound signals
- pxouts_class = class_new(gensym("dyn_out~"),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
+ pxouts_class = class_new(const_cast<t_symbol *>(sym_dynsout),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
add_dsp(pxouts_class,proxyout::dsp);
CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
@@ -219,6 +241,10 @@ void dyn::setup(t_classid c)
k_obj = MakeSymbol("obj");
k_msg = MakeSymbol("msg");
k_text = MakeSymbol("text");
+
+ sym_vis = MakeSymbol("vis");
+ sym_loadbang = MakeSymbol("loadbang");
+ sym_dsp = MakeSymbol("dsp");
}
@@ -279,7 +305,7 @@ dyn::dyn(int argc,const t_atom *argv):
SetInt(arg[1],0); // ypos
SetInt(arg[2],700); // xwidth
SetInt(arg[3],520); // xwidth
- SetString(arg[4]," dyn~-canvas "); // canvas name
+ SetSymbol(arg[4],sym_dyncanvas); // canvas name
SetInt(arg[5],0); // visible
canvas = canvas_new(NULL, NULL, 6, arg);
@@ -295,9 +321,9 @@ dyn::dyn(int argc,const t_atom *argv):
t_atom lst[5];
SetInt(lst[0],i*100);
SetInt(lst[1],10);
- SetString(lst[2],".");
- SetString(lst[3],"");
- SetString(lst[4],sig?"dyn_in~":"dyn_in");
+ SetSymbol(lst[2],sym_dot);
+ SetSymbol(lst[3],sym__);
+ SetSymbol(lst[4],sig?sym_dynsin:sym_dynin);
try {
pxin[i] = (proxyin *)New(k_obj,5,lst,false);
@@ -317,9 +343,9 @@ dyn::dyn(int argc,const t_atom *argv):
t_atom lst[5];
SetInt(lst[0],i*100);
SetInt(lst[1],500);
- SetString(lst[2],".");
- SetString(lst[3],"");
- SetString(lst[4],sig?"dyn_out~":"dyn_out");
+ SetSymbol(lst[2],sym_dot);
+ SetSymbol(lst[3],sym__);
+ SetSymbol(lst[4],sig?sym_dynsout:sym_dynout);
try {
pxout[i] = (proxyout *)New(k_obj,5,lst,false);
@@ -360,7 +386,7 @@ dyn::obj *dyn::Find(const t_symbol *n)
t_glist *dyn::FindCanvas(const t_symbol *n)
{
- if(n == MakeSymbol("."))
+ if(n == sym_dot)
return canvas;
else {
obj *o = Find(n);
@@ -385,8 +411,10 @@ void dyn::Delete(t_gobj *o)
static t_gobj *GetLast(t_glist *gl)
{
- t_gobj *go;
- for (go = gl->gl_list; go->g_next; go = go->g_next);
+ t_gobj *go = gl->gl_list;
+ if(go)
+ while(go->g_next)
+ go = go->g_next;
return go;
}
@@ -422,7 +450,7 @@ t_gobj *dyn::New(const t_symbol *kind,int _argc_,const t_atom *_argv_,bool add)
}
if(argv) {
- if(add && (!name || name == MakeSymbol(".") || Find(name)))
+ if(add && (!name || name == sym_dot || Find(name)))
err = "Object name is already present";
else if(!canv || !(glist = FindCanvas(canv)))
err = "Canvas could not be found";
@@ -430,24 +458,27 @@ t_gobj *dyn::New(const t_symbol *kind,int _argc_,const t_atom *_argv_,bool add)
// set selected canvas as current
canvas_setcurrent(glist);
- pd_typedmess((t_pd *)glist,(t_symbol *)kind,argc,(t_atom *)argv);
+ t_gobj *last = GetLast(glist);
+ pd_typedmess((t_pd *)glist,(t_symbol *)kind,argc,argv);
+ newest = GetLast(glist);
if(kind == k_obj) {
t_object *o = (t_object *)pd_newest();
- newest = o?&o->te_g:NULL;
- if(!newest) {
+ if(!o) {
// PD creates a text object when the intended object could not be created
t_gobj *trash = GetLast(glist);
- // TODO: Test for it....
-
- // Delete it!
- Delete(trash);
+ // Test for newly created object....
+ if(trash && last != trash) {
+ // Delete it!
+ glist_delete(glist,trash);
+ }
+ newest = NULL;
}
+ else
+ newest = &o->te_g;
}
- else
- newest = GetLast(glist);
// look for latest created object
if(newest) {
@@ -457,10 +488,10 @@ t_gobj *dyn::New(const t_symbol *kind,int _argc_,const t_atom *_argv_,bool add)
// send loadbang (if it is an abstraction)
if(pd_class(&newest->g_pd) == canvas_class) {
// hide the sub-canvas
- pd_vmess((t_pd *)newest,gensym("vis"),"i",0);
+ pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_vis),"i",0);
// loadbang the abstraction
- pd_vmess((t_pd *)newest,gensym("loadbang"),"");
+ pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_loadbang),"");
}
// restart dsp - that's necessary because ToCanvas is called manually
@@ -727,7 +758,7 @@ void dyn::proxyout::init(dyn *t,int o,bool s)
void dyn::m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs)
{
// add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL)
- mess1((t_pd *)canvas, gensym("dsp"),NULL);
+ mess1((t_pd *)canvas,const_cast<t_symbol *>(sym_dsp),NULL);
flext_dsp::m_dsp(n,insigs,outsigs);
}
diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp
index 8773d72c..a4f0805e 100644
--- a/externals/grill/pool/source/pool.cpp
+++ b/externals/grill/pool/source/pool.cpp
@@ -862,8 +862,10 @@ BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
if(!gettag(is,tag)) break;
if(tag == "pool") {
- if(tag.type == xmltag::t_start)
- LdDirXMLRec(is,depth,mkdir,AtomList());
+ if(tag.type == xmltag::t_start) {
+ AtomList empty; // must be a separate definition for gcc
+ LdDirXMLRec(is,depth,mkdir,empty);
+ }
else
post("pool - pool not initialized yet");
}
diff --git a/externals/grill/py/pd/pak.pd b/externals/grill/py/pd/pak.pd
new file mode 100644
index 00000000..99d0ac5b
--- /dev/null
+++ b/externals/grill/py/pd/pak.pd
@@ -0,0 +1,28 @@
+#N canvas 463 293 278 228 12;
+#X obj 17 32 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 18 256;
+#X obj 34 52 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 11 256;
+#X obj 56 68 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 13 256;
+#X obj 68 88 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 21 256;
+#X obj 118 29 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 13 256;
+#X obj 135 49 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 13 256;
+#X obj 157 65 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 10 256;
+#X obj 169 85 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 11 256;
+#X obj 36 168 print;
+#X obj 37 129 pyx pak pak 8;
+#X connect 0 0 9 1;
+#X connect 1 0 9 2;
+#X connect 2 0 9 3;
+#X connect 3 0 9 4;
+#X connect 4 0 9 5;
+#X connect 5 0 9 6;
+#X connect 6 0 9 7;
+#X connect 7 0 9 8;
+#X connect 9 0 8 0;
diff --git a/externals/grill/py/scripts/pak.py b/externals/grill/py/scripts/pak.py
new file mode 100644
index 00000000..17841630
--- /dev/null
+++ b/externals/grill/py/scripts/pak.py
@@ -0,0 +1,14 @@
+import pyext
+
+class pak(pyext._class):
+ def __init__(self,n):
+ # n should be type-checked
+ self._inlets = n
+ self._outlets = 1
+ # initialize list
+ self.lst = [0 for x in range(n)]
+
+ def _anything_(self,n,args):
+ # args should be type-checked!
+ self.lst[n-1] = args
+ self._outlet(1,self.lst)
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index 0bbb92d3..bf0ca6cc 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -29,7 +29,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.4.6
#endif
-#define PY__VERSION "0.1.3"
+#define PY__VERSION "0.1.4pre"
#define PYEXT_MODULE "pyext" // name for module
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index 8b14a485..4690fb50 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -127,9 +127,12 @@ pyobj::pyobj(I argc,const t_atom *argv):
// add current dir to path
AddToPath(GetString(canvas_getcurrentdir()));
#elif FLEXT_SYS == FLEXT_SYS_MAX
+#if FLEXT_OS == FLEXT_OS_WIN
+#else
short path = patcher_myvol(thisCanvas());
path_topathname(path,NULL,dir);
AddToPath(dir);
+#endif
#else
#pragma message("Adding current dir to path is not implemented")
#endif
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index df47beff..7ce0995c 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -167,13 +167,27 @@ pyext::pyext(I argc,const t_atom *argv):
if(methname) {
MakeInstance();
- if(inlets < 0 && outlets < 0) {
- // now get number of inlets and outlets
- inlets = 1,outlets = 1;
+ if(pyobj) {
+ if(inlets >= 0) {
+ // set number of inlets
+ PyObject *res = PyInt_FromLong(inlets);
+ int ret = PyObject_SetAttrString(pyobj,"_inlets",res);
+ FLEXT_ASSERT(!ret);
+ }
+ if(outlets >= 0) {
+ // set number of outlets
+ PyObject *res = PyInt_FromLong(outlets);
+ int ret = PyObject_SetAttrString(pyobj,"_outlets",res);
+ FLEXT_ASSERT(!ret);
+ }
- if(pyobj) {
- PyObject *res;
- res = PyObject_GetAttrString(pyobj,"_inlets"); // get ref
+ DoInit(); // call __init__ constructor
+ // __init__ can override the number of inlets and outlets
+
+ if(inlets < 0) {
+ // get number of inlets
+ inlets = 1;
+ PyObject *res = PyObject_GetAttrString(pyobj,"_inlets"); // get ref
if(res) {
if(PyCallable_Check(res)) {
PyObject *fres = PyEval_CallObject(res,NULL);
@@ -186,8 +200,11 @@ pyext::pyext(I argc,const t_atom *argv):
}
else
PyErr_Clear();
-
- res = PyObject_GetAttrString(pyobj,"_outlets"); // get ref
+ }
+ if(outlets < 0) {
+ // get number of outlets
+ outlets = 1;
+ PyObject *res = PyObject_GetAttrString(pyobj,"_outlets"); // get ref
if(res) {
if(PyCallable_Check(res)) {
PyObject *fres = PyEval_CallObject(res,NULL);
@@ -200,13 +217,16 @@ pyext::pyext(I argc,const t_atom *argv):
}
else
PyErr_Clear();
- }
+ }
}
}
- else inlets = outlets = 0;
+ else
+ inlets = outlets = 0;
PY_UNLOCK
+ FLEXT_ASSERT(inlets >= 0 && outlets >= 0);
+
AddInAnything(1+inlets);
AddOutAnything(outlets);
@@ -227,6 +247,33 @@ pyext::~pyext()
PY_UNLOCK
}
+BL pyext::DoInit()
+{
+ // remember the this pointer
+ PyObject *th = PyLong_FromVoidPtr(this);
+ int ret = PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
+
+ // call init now, after _this has been set, which is
+ // important for eventual callbacks from __init__ to c
+ PyObject *pargs = MakePyArgs(NULL,args.Count(),args.Atoms(),-1,true);
+ if(!pargs) PyErr_Print();
+
+ PyObject *init = PyObject_GetAttrString(pyobj,"__init__"); // get ref
+ if(init) {
+ if(PyCallable_Check(init)) {
+ PyObject *res = PyEval_CallObject(init,pargs);
+ if(!res)
+ PyErr_Print();
+ else
+ Py_DECREF(res);
+ }
+ Py_DECREF(init);
+ }
+
+ Py_XDECREF(pargs);
+ return true;
+}
+
BL pyext::MakeInstance()
{
// pyobj should already have been decref'd / cleared before getting here!!
@@ -240,34 +287,7 @@ BL pyext::MakeInstance()
// make instance, but don't call __init__
pyobj = PyInstance_NewRaw(pref,NULL);
- if(pyobj == NULL)
- PyErr_Print();
- else {
- // remember the this pointer
- PyObject *th = PyLong_FromVoidPtr(this);
- int ret = PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
-
- // call init now, after _this has been set, which is
- // important for eventual callbacks from __init__ to c
- PyObject *pargs = MakePyArgs(NULL,args.Count(),args.Atoms(),-1,true);
- if (pargs == NULL)
- PyErr_Print();
-
- PyObject *init;
- init = PyObject_GetAttrString(pyobj,"__init__"); // get ref
- if(init) {
- if(PyCallable_Check(init)) {
- PyObject *res = PyEval_CallObject(init,pargs);
- if(!res)
- PyErr_Print();
- else
- Py_DECREF(res);
- }
- Py_DECREF(init);
- }
-
- Py_XDECREF(pargs);
- }
+ if(!pyobj) PyErr_Print();
}
else
post("%s - Type of \"%s\" is unhandled!",thisName(),GetString(methname));
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index d05ea7e5..c073fa74 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -67,6 +67,7 @@ private:
static pyext *GetThis(PyObject *self);
V ClearBinding();
BL MakeInstance();
+ BL DoInit();
AtomList args;