From 31f625c4e5eaf443872eece61b9a7156121669d9 Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Mon, 10 Sep 2007 22:25:41 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r8719, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/tof/; revision=8720 --- destroysend/destroysend-help.pd | 13 ++++++ destroysend/destroysend.c | 50 +++++++++++++++++++++ destroysend/makefile | 66 +++++++++++++++++++++++++++ folderpanel/folderpanel-help.pd | 13 ++++++ folderpanel/folderpanel.c | 89 +++++++++++++++++++++++++++++++++++++ folderpanel/makefile | 60 +++++++++++++++++++++++++ getdollarzero/getdollarzero-abs0.pd | 16 +++++++ getdollarzero/getdollarzero-abs1.pd | 15 +++++++ getdollarzero/getdollarzero-help.pd | 13 ++++++ getdollarzero/getdollarzero.c | 64 ++++++++++++++++++++++++++ getdollarzero/makefile | 60 +++++++++++++++++++++++++ 11 files changed, 459 insertions(+) create mode 100644 destroysend/destroysend-help.pd create mode 100644 destroysend/destroysend.c create mode 100755 destroysend/makefile create mode 100644 folderpanel/folderpanel-help.pd create mode 100644 folderpanel/folderpanel.c create mode 100755 folderpanel/makefile create mode 100755 getdollarzero/getdollarzero-abs0.pd create mode 100755 getdollarzero/getdollarzero-abs1.pd create mode 100755 getdollarzero/getdollarzero-help.pd create mode 100755 getdollarzero/getdollarzero.c create mode 100755 getdollarzero/makefile diff --git a/destroysend/destroysend-help.pd b/destroysend/destroysend-help.pd new file mode 100644 index 0000000..8b8f45b --- /dev/null +++ b/destroysend/destroysend-help.pd @@ -0,0 +1,13 @@ +#N canvas 455 76 573 366 10; +#X obj 241 236 print DESTROYED; +#X text 225 139 <- Create and destroy this external. It will send a +bang to [receive test] everythime it is destroyed.; +#X obj 241 203 receive test; +#X obj 84 82 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 84 142 destroysend test; +#X obj 84 303 destroysend; +#X text 170 300 <- If it is created without an argument \, you can +set the target through the right inlet.; +#X connect 2 0 0 0; +#X connect 3 0 4 0; diff --git a/destroysend/destroysend.c b/destroysend/destroysend.c new file mode 100644 index 0000000..fbf3466 --- /dev/null +++ b/destroysend/destroysend.c @@ -0,0 +1,50 @@ +// Made by tof@danslchamp.prg + +#include "m_pd.h" +#include +#include + +static t_class *destroysend_class; + +typedef struct _destroysend { + t_object x_obj; + t_symbol *x_sym; //from pd_send +} t_destroysend; + +void destroysend_bang(t_destroysend *x) +{ + //post("Hello world !!"); +//From pd_send + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); +//END +} + + +void *destroysend_new(t_symbol *s) //Added args from pd send +{ + t_destroysend *x = (t_destroysend *)pd_new(destroysend_class); + +//From pd_send + + if (!*s->s_name) symbolinlet_new(&x->x_obj, &x->x_sym); + x->x_sym = s; + +//END + + return (void *)x; //return (x); +} + + +void *destroysend_free(t_destroysend *x) +{ + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); + //post("Killing !!"); + return 0; +} + +void destroysend_setup(void) { + + destroysend_class = class_new(gensym("destroysend"),(t_newmethod)destroysend_new,(t_method)destroysend_free, +sizeof(t_destroysend),0, A_DEFSYM, 0); + class_addbang(destroysend_class, destroysend_bang); +} diff --git a/destroysend/makefile b/destroysend/makefile new file mode 100755 index 0000000..124f762 --- /dev/null +++ b/destroysend/makefile @@ -0,0 +1,66 @@ +current: + echo make pd_linux, pd_win, or pd_darwin + +clean: ; rm -f *.pd_linux *.o + + + + + +# ----------------------- WINDOWS ----------------------- + +pd_win: destroysend.dll + +WINPDPATH = /home/tom/pd0.4 + +.SUFFIXES: .dll + +WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Werror -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer + +WININCLUDE = -I.. -I../include -I$(WINPDPATH)/src + +LDFLAGS = -shared + +.c.dll: + gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c + gcc $(LDFLAGS) -o $*.dll $*.o $(WINPDPATH)/bin/pd.dll + strip --strip-unneeded $*.dll + rm -f $*.o + + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: destroysend.pd_linux + + + +.SUFFIXES: .pd_linux + +PDPATH = /home/tom/pd/cvs/pd + +LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +LINUXINCLUDE = -I$(PDPATH)/src + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm $*.o + +# ----------------------- Mac OSX ----------------------- + +pd_darwin: destroysend.pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +.c.pd_darwin: + cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o + rm -f $*.o + diff --git a/folderpanel/folderpanel-help.pd b/folderpanel/folderpanel-help.pd new file mode 100644 index 0000000..04e1427 --- /dev/null +++ b/folderpanel/folderpanel-help.pd @@ -0,0 +1,13 @@ +#N canvas 0 0 450 300 10; +#X obj 146 135 folderpanel; +#X obj 157 95 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 228 202 folderpanel; +#X obj 142 170 print A; +#X obj 227 241 print B; +#X obj 244 162 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X connect 0 0 3 0; +#X connect 1 0 0 0; +#X connect 2 0 4 0; +#X connect 5 0 2 0; diff --git a/folderpanel/folderpanel.c b/folderpanel/folderpanel.c new file mode 100644 index 0000000..51d735b --- /dev/null +++ b/folderpanel/folderpanel.c @@ -0,0 +1,89 @@ +#include +#include +#include "m_pd.h" +#include "g_canvas.h" + +// tk_chooseDirectory +/* + +proc pdtk_folderpanel {target localdir} { + if {$localdir == ""} { + set filename [tk_getSaveFile] + } else { + set filename [tk_getSaveFile -initialdir $localdir] + } + if {$filename != ""} { + pd [concat $target callback [pdtk_enquote $filename] \;] + } +} + + +*/ + + + + +t_class *folderpanel_class; + +typedef struct _folderpanel +{ + t_object x_obj; + t_symbol *x_s; +} t_folderpanel; + + +static void folderpanel_symbol(t_folderpanel *x, t_symbol *s) +{ + char *path = (s && s->s_name) ? s->s_name : "\"\""; + sys_vgui("tof_folderpanel %s \n", x->x_s->s_name); +} + +static void folderpanel_bang(t_folderpanel *x) +{ + folderpanel_symbol(x, &s_); +} + +static void folderpanel_callback(t_folderpanel *x, t_symbol *s) +{ + outlet_symbol(x->x_obj.ob_outlet, s); +} + +static void folderpanel_free(t_folderpanel *x) +{ + pd_unbind(&x->x_obj.ob_pd, x->x_s); +} + +static void *folderpanel_new( void) +{ + char buf[50]; + t_folderpanel *x = (t_folderpanel *)pd_new(folderpanel_class); + sprintf(buf, "d%lx", (t_int)x); + x->x_s = gensym(buf); + pd_bind(&x->x_obj.ob_pd, x->x_s); + outlet_new(&x->x_obj, &s_symbol); + return (x); +} + +void folderpanel_setup(void) +{ + folderpanel_class = class_new(gensym("folderpanel"), + (t_newmethod)folderpanel_new, (t_method)folderpanel_free, + sizeof(t_folderpanel), 0, 0); + class_addbang(folderpanel_class, folderpanel_bang); + class_addsymbol(folderpanel_class, folderpanel_symbol); + class_addmethod(folderpanel_class, (t_method)folderpanel_callback, + gensym("callback"), A_SYMBOL, 0); + + + sys_gui("proc tof_folderpanel {target} {\n"); + sys_gui(" set path [tk_chooseDirectory] \n"); + sys_gui(" if {$path != \"\"} {\n"); + sys_gui(" pd [concat $target callback [pdtk_enquote $path]] \\;\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + + +} + + diff --git a/folderpanel/makefile b/folderpanel/makefile new file mode 100755 index 0000000..bab0766 --- /dev/null +++ b/folderpanel/makefile @@ -0,0 +1,60 @@ +current: + echo make pd_linux, pd_win, or pd_darwin + +clean: ; rm -f *.pd_linux *.o + +# ----------------------- WINDOWS ----------------------- + +pd_win: folderpanel.dll + +.SUFFIXES: .dll + +WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Werror -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer + +WINPDPATH = /home/tom/pd0.4 + +WININCLUDE = -I.. -I../include -I$(WINPDPATH)/src + +LDFLAGS = -shared + +.c.dll: + gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c + gcc $(LDFLAGS) -o $*.dll $*.o $(WINPDPATH)/bin/pd.dll + strip --strip-unneeded $*.dll + rm -f $*.o + + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: folderpanel.pd_linux + +.SUFFIXES: .pd_linux + +PDPATH = /home/tom/pd/cvs/pd + +LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +LINUXINCLUDE = -I$(PDPATH)/src + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm $*.o + +# ----------------------- Mac OSX ----------------------- + +pd_darwin: folderpanel.pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +.c.pd_darwin: + cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o + rm -f $*.o + diff --git a/getdollarzero/getdollarzero-abs0.pd b/getdollarzero/getdollarzero-abs0.pd new file mode 100755 index 0000000..73b842e --- /dev/null +++ b/getdollarzero/getdollarzero-abs0.pd @@ -0,0 +1,16 @@ +#N canvas 186 97 466 316 10; +#X obj 103 52 loadbang; +#X obj 116 139 f \$0; +#X obj 174 253 print; +#X msg 122 178 abs0 dollarzero= \$1; +#X obj 279 174 getdollarzero 1; +#X obj 180 98 t b b; +#X msg 275 204 parent dollarzero= \$1; +#X obj 303 100 getdollarzero-abs1; +#X connect 0 0 5 0; +#X connect 1 0 3 0; +#X connect 3 0 2 0; +#X connect 4 0 6 0; +#X connect 5 0 1 0; +#X connect 5 1 4 0; +#X connect 6 0 2 0; diff --git a/getdollarzero/getdollarzero-abs1.pd b/getdollarzero/getdollarzero-abs1.pd new file mode 100755 index 0000000..ef5f5bd --- /dev/null +++ b/getdollarzero/getdollarzero-abs1.pd @@ -0,0 +1,15 @@ +#N canvas 0 0 470 320 10; +#X obj 103 52 loadbang; +#X obj 116 139 f \$0; +#X obj 174 253 print; +#X obj 180 98 t b b; +#X msg 122 178 abs1 dollarzero= \$1; +#X obj 280 174 getdollarzero 5; +#X msg 275 204 abs1's parent's parent dollarzero= \$1; +#X connect 0 0 3 0; +#X connect 1 0 4 0; +#X connect 3 0 1 0; +#X connect 3 1 5 0; +#X connect 4 0 2 0; +#X connect 5 0 6 0; +#X connect 6 0 2 0; diff --git a/getdollarzero/getdollarzero-help.pd b/getdollarzero/getdollarzero-help.pd new file mode 100755 index 0000000..1f9f127 --- /dev/null +++ b/getdollarzero/getdollarzero-help.pd @@ -0,0 +1,13 @@ +#N canvas 372 409 472 395 10; +#X msg 42 73 bang; +#X obj 41 149 print; +#X obj 42 111 getdollarzero; +#X symbolatom 87 148 10 0 0 0 - - -; +#X obj 209 112 getdollarzero-abs0; +#X text 17 22 Get the dollar zero of a patch.; +#X text 28 199 Argument: How much recursion you want (If set to 1 \, +it will get the parent's dollar zero \, if set to 2 \, it will get +the parent's parent's dollar zero \, etc); +#X connect 0 0 2 0; +#X connect 2 0 1 0; +#X connect 2 0 3 0; diff --git a/getdollarzero/getdollarzero.c b/getdollarzero/getdollarzero.c new file mode 100755 index 0000000..8a19486 --- /dev/null +++ b/getdollarzero/getdollarzero.c @@ -0,0 +1,64 @@ +/* (C) 2005 Guenter Geiger */ + +#include "m_pd.h" +#include "g_canvas.h" + + +/* HACK + +struct _glist +{ + t_object gl_obj; // header in case we're a glist + t_gobj *gl_list; // the actual data + struct _gstub *gl_stub; // safe pointer handler + int gl_valid; // incremented when pointers might be stale + struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none +}; + +END HACK + +*/ + +typedef struct getdollarzero +{ + t_object x_ob; + t_canvas * x_canvas; + t_outlet* x_outlet; + int x_level; +} t_getdollarzero; + + + + +static void getdollarzero_bang(t_getdollarzero *x) +{ + int i = x->x_level; + t_canvas* last = x->x_canvas; + + while (i>0) { + i--; + if (last->gl_owner) last = last->gl_owner; + } +// x->s_parent_unique = canvas_realizedollar((t_canvas *)this_canvas->gl_owner, gensym("$0")); + //outlet_symbol(x->x_outlet,canvas_getdir(last)); + outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0"))); +} + +t_class *getdollarzero_class; + +static void *getdollarzero_new(t_floatarg level) +{ + t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class); + x->x_canvas = canvas_getcurrent(); + x->x_outlet = outlet_new(&x->x_ob, &s_); + x->x_level = level; + return (void *)x; +} + +void getdollarzero_setup(void) +{ + getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, + sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); + class_addbang(getdollarzero_class, getdollarzero_bang); +} + diff --git a/getdollarzero/makefile b/getdollarzero/makefile new file mode 100755 index 0000000..14a52b3 --- /dev/null +++ b/getdollarzero/makefile @@ -0,0 +1,60 @@ +current: + echo make pd_linux, pd_win, or pd_darwin + +clean: ; rm -f *.pd_linux *.o + +# ----------------------- WINDOWS ----------------------- + +pd_win: getdollarzero.dll + +.SUFFIXES: .dll + +WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Werror -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer + +PDPATH = /home/tom/pd0.4 + +WININCLUDE = -I.. -I../include -I$(PDPATH)/src + +LDFLAGS = -shared + +.c.dll: + gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c + gcc $(LDFLAGS) -o $*.dll $*.o $(PDPATH)/bin/pd.dll + strip --strip-unneeded $*.dll + rm -f $*.o + + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: getdollarzero.pd_linux + +.SUFFIXES: .pd_linux + +PDPATH = /home/tom/pd/cvs/pd + +LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +LINUXINCLUDE = -I$(PDPATH)/src + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm $*.o + +# ----------------------- Mac OSX ----------------------- + +pd_darwin: getdollarzero.pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +.c.pd_darwin: + cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o + rm -f $*.o + -- cgit v1.2.1