Revision: 10397 http://pure-data.svn.sourceforge.net/pure-data/?rev=10397&view=rev Author: zmoelnig Date: 2008-11-27 15:57:15 +0000 (Thu, 27 Nov 2008)
Log Message: ----------- renamed [saveargs] to [canvasargs]
Added Paths: ----------- trunk/externals/iem/iemguts/src/canvasargs.c
Removed Paths: ------------- trunk/externals/iem/iemguts/src/saveargs.c
Copied: trunk/externals/iem/iemguts/src/canvasargs.c (from rev 10396, trunk/externals/iem/iemguts/src/saveargs.c) =================================================================== --- trunk/externals/iem/iemguts/src/canvasargs.c (rev 0) +++ trunk/externals/iem/iemguts/src/canvasargs.c 2008-11-27 15:57:15 UTC (rev 10397) @@ -0,0 +1,112 @@ +/****************************************************** + * + * canvasargs - implementation file + * + * copyleft (c) IOhannes m zm-b\xF6lnig-A + * + * 2007:forum::f-b\xFCr::uml\xE4ute:2007-A + * + * institute of electronic music and acoustics (iem) + * + ****************************************************** + * + * license: GNU General Public License v.2 + * + ******************************************************/ + + +/* + * this object provides a way to manipulate the parent-patches arguments (and name!) + * usage: + * + put this object into an abstraction + * + put the abstraction in a patch + * + send the object a _list_ of arguments + * + the next time the patch (wherein the abstraction that holds this object lives) + * is saved, it will be saved with the new arguments instead of the old ones! + * - example: "list 2 3 4" will save the object as [<absname> 2 3 4] + * + you can also change the abstraction name itself by using a selector other than "list" + * - example: "bonkers 8 9" will save the object as [bonkers 8 9] regardless of it's original name + * - use with care! + * + * nice, eh? + */ + +#include "m_pd.h" +#include "g_canvas.h" + + +/* ------------------------- canvasargs ---------------------------- */ + +static t_class *canvasargs_class; + +typedef struct _canvasargs +{ + t_object x_obj; + + t_canvas *x_canvas; +} t_canvasargs; + + +static void canvasargs_list(t_canvasargs *x, t_symbol*s, int argc, t_atom*argv) +{ + t_canvas*c=x->x_canvas; + t_binbuf*b=0; + t_atom name[1]; + + if(!x->x_canvas) return; + b=x->x_canvas->gl_obj.te_binbuf; + + if(!b)return; + + if(s==0 || s==gensym("") || s==&s_list || s==&s_bang || s==&s_float || s==&s_symbol || s==&s_) { + t_atom*ap=binbuf_getvec(b); + s=atom_getsymbol(ap); + } + SETSYMBOL(name, s); + + binbuf_clear(b); + binbuf_add(b, 1, name); + binbuf_add(b, argc, argv); +} + +static void canvasargs_bang(t_canvasargs *x) +{ + int argc=0; + t_atom*argv=0; + t_binbuf*b; + + if(!x->x_canvas) return; + b=x->x_canvas->gl_obj.te_binbuf; + + if(!b)return; + + argc=binbuf_getnatom(b); + argv=binbuf_getvec(b); + post("..."); + outlet_list(x->x_obj.ob_outlet, &s_list, argc-1, argv+1); +} + + +static void canvasargs_free(t_canvasargs *x) +{ +} + +static void *canvasargs_new(void) +{ + t_canvasargs *x = (t_canvasargs *)pd_new(canvasargs_class); + t_glist *glist=(t_glist *)canvas_getcurrent(); + t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); + + x->x_canvas = canvas; + + outlet_new(&x->x_obj, 0); + return (x); +} + +void canvasargs_setup(void) +{ + canvasargs_class = class_new(gensym("canvasargs"), (t_newmethod)canvasargs_new, + (t_method)canvasargs_free, sizeof(t_canvasargs), 0, 0); + class_addlist(canvasargs_class, (t_method)canvasargs_list); + class_addbang(canvasargs_class, (t_method)canvasargs_bang); +}
Property changes on: trunk/externals/iem/iemguts/src/canvasargs.c ___________________________________________________________________ Added: svn:mergeinfo +
Deleted: trunk/externals/iem/iemguts/src/saveargs.c =================================================================== --- trunk/externals/iem/iemguts/src/saveargs.c 2008-11-27 09:44:12 UTC (rev 10396) +++ trunk/externals/iem/iemguts/src/saveargs.c 2008-11-27 15:57:15 UTC (rev 10397) @@ -1,92 +0,0 @@ - -/****************************************************** - * - * saveargs - implementation file - * - * copyleft (c) IOhannes m zm-b\xF6lnig-A - * - * 2007:forum::f-b\xFCr::uml\xE4ute:2007-A - * - * institute of electronic music and acoustics (iem) - * - ****************************************************** - * - * license: GNU General Public License v.2 - * - ******************************************************/ - - -/* - * this object provides a way to manipulate the parent-patches arguments (and name!) - * usage: - * + put this object into an abstraction - * + put the abstraction in a patch - * + send the object a _list_ of arguments - * + the next time the patch (wherein the abstraction that holds this object lives) - * is saved, it will be saved with the new arguments instead of the old ones! - * - example: "list 2 3 4" will save the object as [<absname> 2 3 4] - * + you can also change the abstraction name itself by using a selector other than "list" - * - example: "bonkers 8 9" will save the object as [bonkers 8 9] regardless of it's original name - * - use with care! - * - * nice, eh? - */ - -#include "m_pd.h" -#include "g_canvas.h" - - -/* ------------------------- saveargs ---------------------------- */ - -static t_class *saveargs_class; - -typedef struct _saveargs -{ - t_object x_obj; - - t_canvas *x_canvas; -} t_saveargs; - - -static void saveargs_list(t_saveargs *x, t_symbol*s, int argc, t_atom*argv) -{ - t_canvas*c=x->x_canvas; - t_binbuf*b=0; - t_atom name[1]; - - if(!x->x_canvas) return; - b=x->x_canvas->gl_obj.te_binbuf; - - if(!b)return; - - if(s==0 || s==gensym("") || s==&s_list || s==&s_bang || s==&s_float || s==&s_symbol || s==&s_) { - t_atom*ap=binbuf_getvec(b); - s=atom_getsymbol(ap); - } - SETSYMBOL(name, s); - - binbuf_clear(b); - binbuf_add(b, 1, name); - binbuf_add(b, argc, argv); -} - -static void saveargs_free(t_saveargs *x) -{ -} - -static void *saveargs_new(void) -{ - t_saveargs *x = (t_saveargs *)pd_new(saveargs_class); - t_glist *glist=(t_glist *)canvas_getcurrent(); - t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); - - x->x_canvas = canvas; - return (x); -} - -void saveargs_setup(void) -{ - saveargs_class = class_new(gensym("saveargs"), (t_newmethod)saveargs_new, - (t_method)saveargs_free, sizeof(t_saveargs), 0, 0); - class_addanything(saveargs_class, (t_method)saveargs_list); -}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.