Revision: 10449 http://pure-data.svn.sourceforge.net/pure-data/?rev=10449&view=rev Author: tmusil Date: 2008-12-11 19:56:33 +0000 (Thu, 11 Dec 2008)
Log Message: ----------- some OSC converting stuff: symbol to list of ASCII and list of ASCII to symbol
Modified Paths: -------------- trunk/externals/iemlib/iemlib2/src/makefile_d_fat trunk/externals/iemlib/iemlib2/src/makefile_d_ppc trunk/externals/iemlib/iemlib2/src/makefile_darwin trunk/externals/iemlib/iemlib2/src/makefile_linux trunk/externals/iemlib/iemlib2/src/makefile_win
Added Paths: ----------- trunk/externals/iemlib/iemlib2/iem_alisttosym-help.pd trunk/externals/iemlib/iemlib2/iem_symtoalist-help.pd trunk/externals/iemlib/iemlib2/src/iem_alisttosym.c trunk/externals/iemlib/iemlib2/src/iem_symtoalist.c
Added: trunk/externals/iemlib/iemlib2/iem_alisttosym-help.pd =================================================================== --- trunk/externals/iemlib/iemlib2/iem_alisttosym-help.pd (rev 0) +++ trunk/externals/iemlib/iemlib2/iem_alisttosym-help.pd 2008-12-11 19:56:33 UTC (rev 10449) @@ -0,0 +1,18 @@ +#N canvas 50 29 529 402 10; +#X obj 46 128 iem_alisttosym; +#X symbolatom 46 151 0 0 0 0 - - -; +#X msg 47 86 97 98 99 100; +#X text 27 16 iem_alisttosym; +#X text 152 15 covert a list of ASCII floats to a symbol; +#X text 93 233 IEM KUG; +#X text 72 221 musil; +#X text 107 221 @; +#X text 115 221 iem.at; +#X text 76 243 Graz , Austria; +#X text 28 210 (c) Thomas Musil 2000 - 2008; +#X msg 164 88 65 66 67 68; +#X msg 271 88 49 50 51 52; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0;
Added: trunk/externals/iemlib/iemlib2/iem_symtoalist-help.pd =================================================================== --- trunk/externals/iemlib/iemlib2/iem_symtoalist-help.pd (rev 0) +++ trunk/externals/iemlib/iemlib2/iem_symtoalist-help.pd 2008-12-11 19:56:33 UTC (rev 10449) @@ -0,0 +1,20 @@ +#N canvas 396 66 533 406 10; +#X text 93 233 IEM KUG; +#X text 72 221 musil; +#X text 107 221 @; +#X text 115 221 iem.at; +#X text 76 243 Graz , Austria; +#X text 28 210 (c) Thomas Musil 2000 - 2008; +#X text 27 16 iem_symtoalist; +#X obj 46 128 iem_symtoalist; +#X msg 47 86 symbol abcd; +#X msg 164 88 symbol ABCD; +#X text 152 15 covert a symbol to a list of ASCII floats; +#X obj 47 152 print; +#X msg 271 88 1234; +#X msg 324 87 9.876e-08; +#X connect 7 0 11 0; +#X connect 8 0 7 0; +#X connect 9 0 7 0; +#X connect 12 0 7 0; +#X connect 13 0 7 0;
Added: trunk/externals/iemlib/iemlib2/src/iem_alisttosym.c =================================================================== --- trunk/externals/iemlib/iemlib2/src/iem_alisttosym.c (rev 0) +++ trunk/externals/iemlib/iemlib2/src/iem_alisttosym.c 2008-12-11 19:56:33 UTC (rev 10449) @@ -0,0 +1,66 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */ + + +#include "m_pd.h" +#include "iemlib.h" + + +/* ------------------------ iem_alisttosym ---------------------------- */ +/* ---------- converts a ASCII list of floats to a symbol ------------- */ + +static t_class *iem_alisttosym_class; + +typedef struct _iem_alisttosym +{ + t_object x_obj; + char x_string[MAXPDSTRING]; +} t_iem_alisttosym; + +static void iem_alisttosym_list(t_iem_alisttosym *x, t_symbol *s, int ac, t_atom *av) +{ + t_int i=0, j=0, k=0; + unsigned char uc=0; + + if(ac > 0) + { + for(i=0, j=0; i<ac; i++) + { + if(IS_A_FLOAT(av, i)) + { + k = atom_getintarg(i, ac, av); + if((k >= 0) && (k <= 255)) + { + uc = (unsigned char)k; + x->x_string[j++] = (char)uc; + } + } + if(j >= (MAXPDSTRING - 2)) + break; + } + } + x->x_string[j] = 0; + outlet_symbol(x->x_obj.ob_outlet, gensym(x->x_string)); +} + +static void iem_alisttosym_free(t_iem_alisttosym *x) +{ +} + +static void *iem_alisttosym_new(void) +{ + t_iem_alisttosym *x = (t_iem_alisttosym *)pd_new(iem_alisttosym_class); + + x->x_string[0] = 0; + outlet_new(&x->x_obj, &s_symbol); + return (x); +} + +void iem_alisttosym_setup(void) +{ + iem_alisttosym_class = class_new(gensym("iem_alisttosym"), (t_newmethod)iem_alisttosym_new, + 0, sizeof(t_iem_alisttosym), 0, 0); + class_addlist(iem_alisttosym_class, iem_alisttosym_list); +}
Added: trunk/externals/iemlib/iemlib2/src/iem_symtoalist.c =================================================================== --- trunk/externals/iemlib/iemlib2/src/iem_symtoalist.c (rev 0) +++ trunk/externals/iemlib/iemlib2/src/iem_symtoalist.c 2008-12-11 19:56:33 UTC (rev 10449) @@ -0,0 +1,75 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */ + + +#include "m_pd.h" +#include "iemlib.h" +#include <string.h> +#include <stdlib.h> + + +/* ------------------------ iem_symtoalist --------------------- */ +/* --------- converts a symbol to a ASCII list of floats ------- */ + +static t_class *iem_symtoalist_class; + +typedef struct _iem_symtoalist +{ + t_object x_obj; + char x_string[MAXPDSTRING]; + t_atom x_av[MAXPDSTRING]; +} t_iem_symtoalist; + +static void iem_symtoalist_symbol(t_iem_symtoalist *x, t_symbol *s) +{ + char *string=s->s_name; + unsigned char uc; + t_int i, n=strlen(string); + + for(i=0; i<n; i++) + { + uc = (unsigned char)string[i]; + SETFLOAT(x->x_av+i, (t_float)uc); + } + outlet_list(x->x_obj.ob_outlet, &s_list, n, x->x_av); +} + +static void iem_symtoalist_float(t_iem_symtoalist *x, t_floatarg f) +{ + char string[40]; + unsigned char uc; + t_int i, n; + + sprintf(string, "%g", f); + n=strlen(string); + for(i=0; i<n; i++) + { + uc = (unsigned char)string[i]; + SETFLOAT(x->x_av+i, (t_float)uc); + } + outlet_list(x->x_obj.ob_outlet, &s_list, n, x->x_av); +} + +static void iem_symtoalist_free(t_iem_symtoalist *x) +{ +} + +static void *iem_symtoalist_new(void) +{ + t_iem_symtoalist *x = (t_iem_symtoalist *)pd_new(iem_symtoalist_class); + + x->x_string[0] = 0; + SETFLOAT(x->x_av, 0.0); + outlet_new(&x->x_obj, &s_list); + return (x); +} + +void iem_symtoalist_setup(void) +{ + iem_symtoalist_class = class_new(gensym("iem_symtoalist"), (t_newmethod)iem_symtoalist_new, + 0, sizeof(t_iem_symtoalist), 0, 0); + class_addsymbol(iem_symtoalist_class, iem_symtoalist_symbol); + class_addfloat(iem_symtoalist_class, iem_symtoalist_float); +}
Modified: trunk/externals/iemlib/iemlib2/src/makefile_d_fat =================================================================== --- trunk/externals/iemlib/iemlib2/src/makefile_d_fat 2008-12-11 19:52:38 UTC (rev 10448) +++ trunk/externals/iemlib/iemlib2/src/makefile_d_fat 2008-12-11 19:56:33 UTC (rev 10449) @@ -14,11 +14,13 @@ # the sources
SRC = add2_comma.c \ + aspeedlim.c \ bpe.c \ dollarg.c \ exp_inc.c \ fade~.c \ float24.c \ + iem_alisttosym.c \ iem_anything.c \ iem_append.c \ iem_blocksize~.c \ @@ -30,6 +32,7 @@ iem_samplerate~.c \ iem_sel_any.c \ iem_send.c \ + iem_symtoalist.c \ init.c \ LFO_noise~.c \ list2send.c \
Modified: trunk/externals/iemlib/iemlib2/src/makefile_d_ppc =================================================================== --- trunk/externals/iemlib/iemlib2/src/makefile_d_ppc 2008-12-11 19:52:38 UTC (rev 10448) +++ trunk/externals/iemlib/iemlib2/src/makefile_d_ppc 2008-12-11 19:56:33 UTC (rev 10449) @@ -14,6 +14,7 @@ # the sources
SRC = add2_comma.c \ + aspeedlim.c \ bpe.c \ dollarg.c \ exp_inc.c \
Modified: trunk/externals/iemlib/iemlib2/src/makefile_darwin =================================================================== --- trunk/externals/iemlib/iemlib2/src/makefile_darwin 2008-12-11 19:52:38 UTC (rev 10448) +++ trunk/externals/iemlib/iemlib2/src/makefile_darwin 2008-12-11 19:56:33 UTC (rev 10449) @@ -19,6 +19,7 @@ # the sources
SRC = add2_comma.c \ + aspeedlim.c \ bpe.c \ dollarg.c \ exp_inc.c \
Modified: trunk/externals/iemlib/iemlib2/src/makefile_linux =================================================================== --- trunk/externals/iemlib/iemlib2/src/makefile_linux 2008-12-11 19:52:38 UTC (rev 10448) +++ trunk/externals/iemlib/iemlib2/src/makefile_linux 2008-12-11 19:56:33 UTC (rev 10449) @@ -18,6 +18,7 @@ # the sources
SRC = add2_comma.c \ + aspeedlim.c \ bpe.c \ dollarg.c \ exp_inc.c \
Modified: trunk/externals/iemlib/iemlib2/src/makefile_win =================================================================== --- trunk/externals/iemlib/iemlib2/src/makefile_win 2008-12-11 19:52:38 UTC (rev 10448) +++ trunk/externals/iemlib/iemlib2/src/makefile_win 2008-12-11 19:56:33 UTC (rev 10449) @@ -17,6 +17,7 @@ $(PD_INST_PATH)\bin\pd.lib
SRC = add2_comma.c \ + aspeedlim.c \ bpe.c \ dollarg.c \ exp_inc.c \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.