Update of /cvsroot/pure-data/externals/miXed/cyclone/hammer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15191/cyclone/hammer
Modified Files: Table.c prob.c Log Message:
Index: prob.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/prob.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** prob.c 23 May 2003 12:29:48 -0000 1.1.1.1 --- prob.c 23 Apr 2004 11:25:52 -0000 1.2 *************** *** 1,3 **** ! /* Copyright (c) 2002-2003 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ --- 1,3 ---- ! /* Copyright (c) 2002-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ *************** *** 9,14 **** #include "hammer/file.h"
! /* CHECKED: no preallocation. Apparently, it looks like if the new ! state-entries were added to the list's head, and the new transition-entries were added to the sublist's head. No sorting of any kind. */
--- 9,14 ---- #include "hammer/file.h"
! /* CHECKED: no preallocation. It looks like if new state-entries ! were added to the list's head, and new transition-entries were added to the sublist's head. No sorting of any kind. */
*************** *** 63,89 **** }
! /* ! CHECKED: embedmode off: ! #N prob; ! #P newobj ... prob; ! ! CHECKED: embedmode on, after clear: ! #N prob; ! #T embed 1; ! #P newobj ... prob;
- CHECKED: embedmode on, filled: - #N prob; - #T <preffix> <suffix> <count> - ... - #T embed 1; - #T reset <default>; (if set) - #P newobj ... prob; - */ static void prob_embed(t_prob *x, t_floatarg f) { x->x_embedmode = ((int)f != 0); - if (x->x_embedmode) - loud_incompatible(prob_class, "embedding not supported (yet)..."); }
--- 63,86 ---- }
! static void prob_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym) ! { ! t_prob *x = (t_prob *)z; ! if (x->x_embedmode) ! { ! t_probtrans *pfx, *sfx; ! for (pfx = x->x_translist; pfx; pfx = pfx->tr_nextstate) ! for (sfx = pfx->tr_nexttrans; sfx; sfx = sfx->tr_nexttrans) ! binbuf_addv(bb, "siii;", bindsym, ! pfx->tr_value, sfx->tr_value, sfx->tr_count); ! binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1); ! if (x->x_default) ! binbuf_addv(bb, "ssi;", bindsym, gensym("reset"), ! x->x_default->tr_value); ! } ! }
static void prob_embed(t_prob *x, t_floatarg f) { x->x_embedmode = ((int)f != 0); }
*************** *** 236,244 **** }
! static void prob_silent(t_prob *x) { if (!x->x_silent) { ! loud_incompatible(prob_class, "no 'silent' message in max"); x->x_silent = 1; } --- 233,241 ---- }
! static void prob__silent(t_prob *x) { if (!x->x_silent) { ! loud_incompatible(prob_class, "no '_silent' message in max"); x->x_silent = 1; } *************** *** 280,284 **** outlet_new((t_object *)x, &s_float); x->x_bangout = outlet_new((t_object *)x, &s_bang); ! x->x_filehandle = hammerfile_new((t_pd *)x, 0, 0, 0, 0); return (x); } --- 277,281 ---- outlet_new((t_object *)x, &s_float); x->x_bangout = outlet_new((t_object *)x, &s_bang); ! x->x_filehandle = hammerfile_new((t_pd *)x, prob_embedhook, 0, 0, 0); return (x); } *************** *** 302,312 **** gensym("dump"), 0); /* CHECKED: doesn't understand "seed" */ ! ! /* below are the incompatible extensions... */ ! class_addmethod(prob_class, (t_method)prob_silent, ! gensym("silent"), 0); class_addmethod(prob_class, (t_method)prob_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); ! hammerfile_setup(prob_class, 0); /* LATER embedding (, 1) */ } --- 299,307 ---- gensym("dump"), 0); /* CHECKED: doesn't understand "seed" */ ! class_addmethod(prob_class, (t_method)prob__silent, ! gensym("_silent"), 0); class_addmethod(prob_class, (t_method)prob_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); ! hammerfile_setup(prob_class, 1); }
Index: Table.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/Table.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Table.c 21 Apr 2004 14:47:26 -0000 1.3 --- Table.c 23 Apr 2004 11:25:52 -0000 1.4 *************** *** 68,71 **** --- 68,72 ---- int x_valueset; int x_head; + int x_intraversal; /* ``set-with-next/prev'' flag */ int x_loadflag; int x_loadndx; *************** *** 184,189 **** cc->c_length = length; /* CHECKED values at common indices are preserved */ ! /* CHECKED rewinding neither head, nor loadndx, but a separate ! condition of eot is preserved only for the head. */ tablecommon_modified(cc, relocate); } --- 185,191 ---- cc->c_length = length; /* CHECKED values at common indices are preserved */ ! /* CHECKED rewinding neither head, nor loadndx -- both are preserved, ! although there is a bug in handling of 'prev' after the head ! overflows due to shrinking. */ tablecommon_modified(cc, relocate); } *************** *** 428,433 **** } else table_dooutput(x, ndx); ! /* CHECKME if head is updated */ ! x->x_head = ndx; } } --- 430,434 ---- } else table_dooutput(x, ndx); ! /* CHECKED head is not updated */ } } *************** *** 501,505 **** { tablecommon_setall(x->x_common, 0); ! /* CHECKME head */ }
--- 502,506 ---- { tablecommon_setall(x->x_common, 0); ! /* CHECKED head preserved */ }
*************** *** 507,511 **** { tablecommon_setall(x->x_common, (int)f); ! /* CHECKME head */ }
--- 508,512 ---- { tablecommon_setall(x->x_common, (int)f); ! /* CHECKED head preserved */ }
*************** *** 523,536 **** static void table_next(t_table *x) { ! table_dooutput(x, x->x_head++); ! if (x->x_head >= x->x_common->c_length) x->x_head = 0; }
static void table_prev(t_table *x) { ! table_dooutput(x, x->x_head--); ! if (x->x_head < 0) x->x_head = x->x_common->c_length - 1; }
--- 524,541 ---- static void table_next(t_table *x) { ! if (!x->x_intraversal) ! x->x_intraversal = 1; ! else if (++x->x_head >= x->x_common->c_length) x->x_head = 0; + table_dooutput(x, x->x_head); }
static void table_prev(t_table *x) { ! if (!x->x_intraversal) ! x->x_intraversal = 1; ! else if (--x->x_head < 0) x->x_head = x->x_common->c_length - 1; + table_dooutput(x, x->x_head); }
*************** *** 539,549 **** /* CHECKED floats are truncated */ x->x_head = tablecommon_getindex(x->x_common, (int)f); }
! /* CHECKED 'send <target> length' works, but not max, min, sum... */ ! /* CHECKED 'send <target> <ndx> <value>' writes the value (a bug?) */ ! static void table_send(t_table *x, t_symbol *s, t_floatarg f) { ! /* FIXME */ }
--- 544,580 ---- /* CHECKED floats are truncated */ x->x_head = tablecommon_getindex(x->x_common, (int)f); + /* CHECKED the head should be pre-updated during traversal, in order + to maintain the logical way of direction change. Therefore, we + need the flag below, which locks head in place that has just been + set by goto. The flag is then set by next or prev. */ + x->x_intraversal = 0; }
! static void table_send(t_table *x, t_symbol *s, int ac, t_atom *av) { ! if (ac > 1 && av->a_type == A_SYMBOL) ! { ! t_symbol *target = av->a_w.w_symbol; ! if (!target->s_thing) ! return; /* CHECKED no complaint */ ! ac--; av++; ! if (av->a_type == A_FLOAT) ! { ! if (ac == 1) ! { ! int ndx = (int)av->a_w.w_float; ! pd_float(target->s_thing, ! (t_float)tablecommon_getvalue(x->x_common, ndx)); ! } ! /* CHECKED incompatible: 'send <target> <ndx> <value>' ! stores <value> at <ndx> (a bug?) */ ! } ! else if (av->a_type == A_SYMBOL) ! { ! /* CHECKED 'send <target> length' works, but not max, min, sum... */ ! if (av->a_w.w_symbol == gensym("length")) ! pd_float(target->s_thing, (t_float)x->x_common->c_length); ! } ! } }
*************** *** 613,617 **** /* FIXME arguments (from, to) */ /* CHECKED no remote dumping, symbol args bashed to 0 */ ! static void table_dump(t_table *x) { t_tablecommon *cc = x->x_common; --- 644,648 ---- /* FIXME arguments (from, to) */ /* CHECKED no remote dumping, symbol args bashed to 0 */ ! static void table_dump(t_table *x, t_symbol *s, int ac, t_atom *av) { t_tablecommon *cc = x->x_common; *************** *** 650,654 **** tablecommon_dowrite(cc, s, x->x_canvas); else ! hammerpanel_save(cc->c_filehandle, 0, 0); /* CHECKME default name */ }
--- 681,686 ---- tablecommon_dowrite(cc, s, x->x_canvas); else ! /* CHECKED default name is plain `Untitled' */ ! hammerpanel_save(cc->c_filehandle, 0, 0); }
*************** *** 726,729 **** --- 758,762 ---- x->x_valueset = 0; x->x_head = 0; + x->x_intraversal = 0; /* CHECKED */ x->x_loadflag = 0; rand_seed(&x->x_seed, 0); *************** *** 774,778 **** gensym("goto"), A_FLOAT, 0); class_addmethod(table_class, (t_method)table_send, ! gensym("send"), A_SYMBOL, A_FLOAT, 0); class_addmethod(table_class, (t_method)table_length, gensym("length"), 0); --- 807,811 ---- gensym("goto"), A_FLOAT, 0); class_addmethod(table_class, (t_method)table_send, ! gensym("send"), A_GIMME, 0); class_addmethod(table_class, (t_method)table_length, gensym("length"), 0); *************** *** 794,798 **** gensym("fquantile"), A_FLOAT, 0); class_addmethod(table_class, (t_method)table_dump, ! gensym("dump"), 0); class_addmethod(table_class, (t_method)table_refer, gensym("refer"), A_SYMBOL, 0); --- 827,831 ---- gensym("fquantile"), A_FLOAT, 0); class_addmethod(table_class, (t_method)table_dump, ! gensym("dump"), A_GIMME, 0); class_addmethod(table_class, (t_method)table_refer, gensym("refer"), A_SYMBOL, 0);