[PD-cvs] externals/miXed/cyclone/hammer Table.c,1.8,1.9 capture.c,1.1.1.1,1.2 coll.c,1.9,1.10 prob.c,1.6,1.7 seq.c,1.9,1.10

Krzysztof Czaja krzyszcz at users.sourceforge.net
Mon Feb 28 14:10:42 CET 2005


Update of /cvsroot/pure-data/externals/miXed/cyclone/hammer
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1442/cyclone/hammer

Modified Files:
	Table.c capture.c coll.c prob.c seq.c 
Log Message:
cyclone alpha53 (see notes.txt for cyclone, bin and shared)

Index: coll.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/coll.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** coll.c	11 Jan 2005 10:33:19 -0000	1.9
--- coll.c	28 Feb 2005 13:10:39 -0000	1.10
***************
*** 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.  */
--- 1,3 ----
! /* Copyright (c) 2002-2005 krzYszcz and others.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
***************
*** 10,17 ****
  #include "hammer/file.h"
  
! /* FIXME sort -1 -1, sort 1 crashes in pd large */
! /* FIXME sort crashes after (corrupt?) transfers from the editor */
  /* LATER make sure that ``reentrancy protection hack'' is really working... */
- /* CHECKME default fname for 'write' -- c_filename, x_name, nothing? */
  
  #ifdef KRZYSZCZ
--- 10,15 ----
  #include "hammer/file.h"
  
! /* LATER profile for the bottlenecks of insertion and sorting */
  /* LATER make sure that ``reentrancy protection hack'' is really working... */
  
  #ifdef KRZYSZCZ
***************
*** 43,47 ****
      int            c_entered;    /* a counter, LATER rethink */
      int            c_embedflag;  /* common field (CHECKED in 'TEXT' files) */
!     t_symbol      *c_filename;
      t_canvas      *c_lastcanvas;
      t_hammerfile  *c_filehandle;
--- 41,45 ----
      int            c_entered;    /* a counter, LATER rethink */
      int            c_embedflag;  /* common field (CHECKED in 'TEXT' files) */
!     t_symbol      *c_filename;   /* CHECKED common for all, read and write */
      t_canvas      *c_lastcanvas;
      t_hammerfile  *c_filehandle;
***************
*** 99,116 ****
  
  /* CHECKME again... apparently c74 is not able to fix this for good */
! /* result: 1 for ep1 < ep2, otherwise 0 (symbols are less then floats) */
! static int collelem_less(t_collelem *ep1, t_collelem *ep2, int ndx)
  {
      if (ndx < 0)
      {
  	if (ep1->e_symkey)
! 	    return (ep2->e_symkey ?
! 		    strcmp(ep1->e_symkey->s_name,
! 			   ep2->e_symkey->s_name) < 0
! 		    : 1);  /* CHECKED incompatible with 4.07, but consistent */
  	else if (ep2->e_symkey)
! 	    return (0);  /* CHECKED incompatible with 4.07, but consistent */
  	else
! 	    return (ep1->e_numkey < ep2->e_numkey);  /* CHECKED in 4.07 */
      }
      else
--- 97,121 ----
  
  /* CHECKME again... apparently c74 is not able to fix this for good */
! /* result: 1 for ep1 < ep2, 0 for ep1 >= ep2, all symbols are < any float */
! static int collelem_less(t_collelem *ep1, t_collelem *ep2, int ndx, int swap)
  {
+     int isless;
+     if (swap)
+     {
+ 	t_collelem *ep = ep1;
+ 	ep1 = ep2;
+ 	ep2 = ep;
+     }
      if (ndx < 0)
      {
  	if (ep1->e_symkey)
! 	    isless =
! 		(ep2->e_symkey ? strcmp(ep1->e_symkey->s_name,
! 					ep2->e_symkey->s_name) < 0
! 		 : 1);  /* CHECKED incompatible with 4.07, but consistent */
  	else if (ep2->e_symkey)
! 	    isless = 0;  /* CHECKED incompatible with 4.07, but consistent */
  	else
! 	    isless = (ep1->e_numkey < ep2->e_numkey);  /* CHECKED in 4.07 */
      }
      else
***************
*** 123,145 ****
  	{
   	    if (ap2->a_type == A_FLOAT)
! 		return (ap1->a_w.w_float < ap2->a_w.w_float);
   	    else if (ap2->a_type == A_SYMBOL)
! 		return (0);
  	    else
! 		return (1);
  	}
  	else if (ap1->a_type == A_SYMBOL)
  	{
  	    if (ap2->a_type == A_FLOAT)
! 		return (1);
  	    else if (ap2->a_type == A_SYMBOL)
! 		return (strcmp(ap1->a_w.w_symbol->s_name,
! 			       ap2->a_w.w_symbol->s_name) < 0);
  	    else
! 		return (1);
  	}
! 	else
! 	    return (0);
      }
  }
  
--- 128,150 ----
  	{
   	    if (ap2->a_type == A_FLOAT)
! 		isless = (ap1->a_w.w_float < ap2->a_w.w_float);
   	    else if (ap2->a_type == A_SYMBOL)
! 		isless = 0;
  	    else
! 		isless = 1;
  	}
  	else if (ap1->a_type == A_SYMBOL)
  	{
  	    if (ap2->a_type == A_FLOAT)
! 		isless = 1;
  	    else if (ap2->a_type == A_SYMBOL)
! 		isless = (strcmp(ap1->a_w.w_symbol->s_name,
! 				 ap2->a_w.w_symbol->s_name) < 0);
  	    else
! 		isless = 1;
  	}
! 	else isless = 0;
      }
+     return (isless);
  }
  
***************
*** 380,387 ****
  
  /* LATER choose a better algo, after coll's storage structures stabilize.
!    Note, that even the simple insertion sort below (n-square) might prove
!    better for dlls, than theoretically efficient algo (nlogn) which requires
     random access emulation.  Avoiding recursion is not a bad idea, too. */
! static void collcommon_sort(t_collcommon *cc, int asc, int ndx)
  {
      t_collelem *min = cc->c_first;
--- 385,392 ----
  
  /* LATER choose a better algo, after coll's storage structures stabilize.
!    Note, that even the simple insertion sort below (n-square) might prove better
!    for bi-directional lists, than theoretically efficient algo (nlogn) requiring
     random access emulation.  Avoiding recursion is not a bad idea, too. */
! static void collcommon_sort(t_collcommon *cc, int descending, int ndx)
  {
      t_collelem *min = cc->c_first;
***************
*** 392,396 ****
  	/* search for a sentinel element */
   	do
! 	    if (collelem_less(ep, min, ndx) == asc) min = ep;
  	while (ep = ep->e_next);
  	/* prepend it */
--- 397,402 ----
  	/* search for a sentinel element */
   	do
! 	    if (collelem_less(ep, min, ndx, descending))
! 		min = ep;
  	while (ep = ep->e_next);
  	/* prepend it */
***************
*** 402,408 ****
  	    t_collelem *next = ep->e_next;
  	    for (min = ep->e_prev;
! 		 collelem_less(ep, min, ndx) == asc;
  		 min = min->e_prev);
! 	    if (ep != min->e_next)
  	    {
  		collcommon_takeout(cc, ep);
--- 408,417 ----
  	    t_collelem *next = ep->e_next;
  	    for (min = ep->e_prev;
! 		 min &&  /* LATER remove */
! 		     collelem_less(ep, min, ndx, descending);
  		 min = min->e_prev);
! 	    if (!min)  /* LATER remove */
! 		loudbug_bug("collcommon_sort");
! 	    else if (ep != min->e_next)
  	    {
  		collcommon_takeout(cc, ep);
***************
*** 458,467 ****
  	    collcommon_putbefore(cc, new, old);
  	    do
! 		if (old->e_hasnumkey) old->e_numkey++;  /* LATER rethink */
  	    while (old = old->e_next);
  	}
  	else
  	{
! 	    int closestkey = 0;  /* LATER rethink */
  	    t_collelem *closest = 0, *ep;
  	    for (ep = cc->c_first; ep; ep = ep->e_next)
--- 467,481 ----
  	    collcommon_putbefore(cc, new, old);
  	    do
! 		if (old->e_hasnumkey)
! 		    /* CHECKED incremented up to the last one; incompatible:
! 		       elements with numkey == 0 not incremented (a bug?) */
! 		    old->e_numkey++;
  	    while (old = old->e_next);
  	}
  	else
  	{
! 	    /* CHECKED negative numkey always put before the last element,
! 	       zero numkey always becomes the new head */
! 	    int closestkey = 0;
  	    t_collelem *closest = 0, *ep;
  	    for (ep = cc->c_first; ep; ep = ep->e_next)
***************
*** 502,506 ****
  }
  
! static int collcommon_fromlist(t_collcommon *cc, int ac, t_atom *av)
  {
      int hasnumkey = 0, numkey;
--- 516,520 ----
  }
  
! static int collcommon_fromatoms(t_collcommon *cc, int ac, t_atom *av)
  {
      int hasnumkey = 0, numkey;
***************
*** 566,570 ****
  static int collcommon_frombinbuf(t_collcommon *cc, t_binbuf *bb)
  {
!     return (collcommon_fromlist(cc, binbuf_getnatom(bb), binbuf_getvec(bb)));
  }
  
--- 580,584 ----
  static int collcommon_frombinbuf(t_collcommon *cc, t_binbuf *bb)
  {
!     return (collcommon_fromatoms(cc, binbuf_getnatom(bb), binbuf_getvec(bb)));
  }
  
***************
*** 731,735 ****
  static void collcommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av)
  {
!     int nlines = collcommon_fromlist((t_collcommon *)z, ac, av);
      if (nlines < 0)
  	loud_error(0, "coll: editing error in line %d", 1 - nlines);
--- 745,749 ----
  static void collcommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av)
  {
!     int nlines = collcommon_fromatoms((t_collcommon *)z, ac, av);
      if (nlines < 0)
  	loud_error(0, "coll: editing error in line %d", 1 - nlines);
***************
*** 1170,1174 ****
      if (loud_checkint((t_pd *)x, f1, &dir, gensym("sort")) &&
  	loud_checkint((t_pd *)x, f2, &ndx, gensym("sort")))
! 	collcommon_sort(x->x_common, (dir < 0 ? 1 : 0),
  			(ndx < 0 ? -1 : (ndx ? ndx - 1 : 0)));
  }
--- 1184,1188 ----
      if (loud_checkint((t_pd *)x, f1, &dir, gensym("sort")) &&
  	loud_checkint((t_pd *)x, f2, &ndx, gensym("sort")))
! 	collcommon_sort(x->x_common, (dir < 0 ? 0 : 1),
  			(ndx < 0 ? -1 : (ndx ? ndx - 1 : 0)));
  }
***************
*** 1299,1305 ****
      {
  	t_collelem *found;
! 	if (ndx <= 0)
! 	    ndx = 0;  /* LATER consider complaining, CHECKME */
! 	else ndx--;
  	if (found = coll_firsttyped(x, ndx, A_FLOAT))
  	{
--- 1313,1322 ----
      {
  	t_collelem *found;
! 	if (ndx > 0)
! 	    ndx--;
! 	/* LATER consider complaining: */
! 	else if (ndx < 0)
! 	    return;  /* CHECKED silently rejected */
! 	/* else CHECKED silently defaults to 1 */
  	if (found = coll_firsttyped(x, ndx, A_FLOAT))
  	{
***************
*** 1328,1334 ****
      {
  	t_collelem *found;
! 	if (ndx <= 0)
! 	    ndx = 0;  /* LATER consider complaining, CHECKME */
! 	else ndx--;
  	if (found = coll_firsttyped(x, ndx, A_FLOAT))
  	{
--- 1345,1354 ----
      {
  	t_collelem *found;
! 	if (ndx > 0)
! 	    ndx--;
! 	/* LATER consider complaining: */
! 	else if (ndx < 0)
! 	    return;  /* CHECKED silently rejected */
! 	/* else CHECKED silently defaults to 1 */
  	if (found = coll_firsttyped(x, ndx, A_FLOAT))
  	{
***************
*** 1384,1388 ****
  	collcommon_dowrite(cc, s, x->x_canvas);
      else
! 	hammerpanel_save(cc->c_filehandle, 0, 0);  /* CHECKME default name */
  }
  
--- 1404,1408 ----
  	collcommon_dowrite(cc, s, x->x_canvas);
      else
! 	hammerpanel_save(cc->c_filehandle, 0, 0);  /* CHECKED no default name */
  }
  
***************
*** 1402,1406 ****
  	collcommon_dowrite(cc, 0, 0);
      else
! 	hammerpanel_save(cc->c_filehandle, 0, 0);  /* CHECKME default name */
  }
  
--- 1422,1426 ----
  	collcommon_dowrite(cc, 0, 0);
      else
! 	hammerpanel_save(cc->c_filehandle, 0, 0);  /* CHECKED no default name */
  }
  
***************
*** 1432,1438 ****
      t_atom *ap;
      char buf[MAXPDSTRING];
-     /* LATER prepend "coll: " */
      hammereditor_open(cc->c_filehandle,
! 		      x->x_name ? x->x_name->s_name : "Untitled");
      collcommon_tobinbuf(cc, bb);
      natoms = binbuf_getnatom(bb);
--- 1452,1457 ----
      t_atom *ap;
      char buf[MAXPDSTRING];
      hammereditor_open(cc->c_filehandle,
! 		      (x->x_name ? x->x_name->s_name : "Untitled"), "coll");
      collcommon_tobinbuf(cc, bb);
      natoms = binbuf_getnatom(bb);
***************
*** 1454,1461 ****
  	ap++;
      }
      binbuf_free(bb);
  }
  
! /* asking and storing the changes -- CHECKME close window, and 'wclose' */
  static void coll_wclose(t_coll *x)
  {
--- 1473,1482 ----
  	ap++;
      }
+     hammereditor_setdirty(cc->c_filehandle, 0);
      binbuf_free(bb);
  }
  
! /* CHECKED if there was any editing, both close window and 'wclose'
!    ask and replace the contents.  LATER debug. */
  static void coll_wclose(t_coll *x)
  {

Index: prob.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/prob.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** prob.c	27 Jan 2005 14:42:47 -0000	1.6
--- prob.c	28 Feb 2005 13:10:39 -0000	1.7
***************
*** 245,248 ****
--- 245,249 ----
  }
  
+ /* CHECKED not available, LATER full editing */
  static void prob_click(t_prob *x, t_floatarg xpos, t_floatarg ypos,
  		       t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
***************
*** 250,254 ****
      t_probtrans *state;
      char buf[64];
!     hammereditor_open(x->x_filehandle, "prob");
      for (state = x->x_translist; state; state = state->tr_nextstate)
      {
--- 251,255 ----
      t_probtrans *state;
      char buf[64];
!     hammereditor_open(x->x_filehandle, 0, 0);
      for (state = x->x_translist; state; state = state->tr_nextstate)
      {

Index: Table.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/Table.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Table.c	11 Jan 2005 10:33:19 -0000	1.8
--- Table.c	28 Feb 2005 13:10:39 -0000	1.9
***************
*** 1,3 ****
! /* Copyright (c) 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.  */
--- 1,3 ----
! /* Copyright (c) 2004-2005 krzYszcz and others.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
***************
*** 226,233 ****
  }
  
  /* LATER binary files */
  static void tablecommon_doread(t_tablecommon *cc, t_symbol *fn, t_canvas *cv)
  {
-     /* FIXME */
      t_binbuf *bb = binbuf_new();
      int ac;
--- 226,271 ----
  }
  
+ static void tablecommon_fromatoms(t_tablecommon *cc, int ac, t_atom *av)
+ {
+     int i, size = 0, nsyms = 0;
+     t_atom *ap;
+     int *ptr;
+     cc->c_increation = 1;
+     for (i = 0, ap = av; i < ac; i++, ap++)
+     {
+ 	if (ap->a_type == A_FLOAT)
+ 	    size++;
+ 	else if (ap->a_type == A_SYMBOL)
+ 	    nsyms++, size++;
+     }
+     if (size < ac)
+ 	loud_warning(0, "Table", "%d invalid atom%s ignored",
+ 		     ac - size, (ac - size > 1 ? "s" : ""));
+     if (nsyms)
+ 	loud_warning(0, "Table", "%d symbol%s bashed to zero",
+ 		     nsyms, (nsyms > 1 ? "s" : ""));
+     tablecommon_setlength(cc, size);
+     size = cc->c_length;
+     ptr = cc->c_table;
+     for (i = 0; i < ac; i++, av++)
+     {
+ 	if (av->a_type == A_FLOAT)
+ 	    *ptr++ = (int)av->a_w.w_float;
+ 	else if (av->a_type == A_SYMBOL)
+ 	    *ptr++ = 0;
+ 	else
+ 	    continue;
+ 	if (size-- == 1)
+ 	    break;
+     }
+     while (size--)
+ 	*ptr++ = 0;
+     cc->c_increation = 0;
+ }
+ 
+ /* FIXME keep int precision: save/load directly, not through a bb */
  /* LATER binary files */
  static void tablecommon_doread(t_tablecommon *cc, t_symbol *fn, t_canvas *cv)
  {
      t_binbuf *bb = binbuf_new();
      int ac;
***************
*** 250,255 ****
  	av->a_w.w_symbol == gensym("table"))
      {
  	post("Table: %s read successful", fn->s_name);  /* CHECKME */
- 	/* FIXME */
      }
  #if 0  /* FIXME */
--- 288,293 ----
  	av->a_w.w_symbol == gensym("table"))
      {
+ 	tablecommon_fromatoms(cc, ac - 1, av + 1);
  	post("Table: %s read successful", fn->s_name);  /* CHECKME */
      }
  #if 0  /* FIXME */
***************
*** 326,330 ****
  static void tablecommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av)
  {
!     /* FIXME */
  }
  
--- 364,368 ----
  static void tablecommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av)
  {
!     tablecommon_fromatoms((t_tablecommon *)z, ac, av);
  }
  
***************
*** 755,759 ****
      cnt += sprintf(bp, "%d", v);
      if (col + cnt > 80)
! 	buf[0] = '\n', col = cnt;
      else
  	col += cnt;
--- 793,797 ----
      cnt += sprintf(bp, "%d", v);
      if (col + cnt > 80)
! 	buf[0] = '\n', col = cnt - 1;  /* assuming col > 0 */
      else
  	col += cnt;
***************
*** 764,783 ****
  static void table_open(t_table *x)
  {
-     /* FIXME */
      t_tablecommon *cc = x->x_common;
      char buf[MAXPDSTRING];
      int *bp = cc->c_table;
      int count = cc->c_length, col = 0;
!     /* LATER prepend "table: " */
!     hammereditor_open(cc->c_filehandle,
! 		      /* CHECKED default name is plain `Untitled' */
! 		      x->x_name ? x->x_name->s_name : "Untitled");
      while (count--)
  	col = tablecommon_editorappend(cc, *bp++, buf, col);
  }
  
  static void table_wclose(t_table *x)
  {
!     /* FIXME */
  }
  
--- 802,818 ----
  static void table_open(t_table *x)
  {
      t_tablecommon *cc = x->x_common;
      char buf[MAXPDSTRING];
      int *bp = cc->c_table;
      int count = cc->c_length, col = 0;
!     hammereditor_open(cc->c_filehandle, (x->x_name ? x->x_name->s_name : 0), 0);
      while (count--)
  	col = tablecommon_editorappend(cc, *bp++, buf, col);
+     hammereditor_setdirty(cc->c_filehandle, 0);
  }
  
  static void table_wclose(t_table *x)
  {
!     hammereditor_close(x->x_common->c_filehandle, 1);
  }
  

Index: seq.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/seq.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** seq.c	27 Jan 2005 14:42:47 -0000	1.9
--- seq.c	28 Feb 2005 13:10:39 -0000	1.10
***************
*** 861,873 ****
  }
  
! /* FIXME */
! /* CHECKED absolute timestamps, semi-terminated, verified */
! static int seq_frombinbuf(t_seq *x, t_binbuf *bb)
  {
!     int nevents = 0;
!     int ac = binbuf_getnatom(bb);
!     t_atom *av = binbuf_getvec(bb);
!     while (ac--)
! 	if (av++->a_type == A_SEMI)  /* FIXME parsing */
  	    nevents++;
      if (nevents)
--- 861,871 ----
  }
  
! /* CHECKED text file input: absolute timestamps, semi-terminated, verified */
! static int seq_fromatoms(t_seq *x, int ac, t_atom *av, int abstime)
  {
!     int i, nevents = 0;
!     t_atom *ap;
!     for (i = 0, ap = av; i < ac; i++, ap++)
! 	if (ap->a_type == A_SEMI)  /* FIXME parsing */
  	    nevents++;
      if (nevents)
***************
*** 875,884 ****
  	t_seqevent *ep;
  	float prevtime = 0;
- 	int i = -1;
  	if (!seq_dogrowing(x, nevents, 0))
  	    return (0);
  	nevents = 0;
- 	ac = binbuf_getnatom(bb);
- 	av = binbuf_getvec(bb);
  	ep = x->x_sequence;
  	while (ac--)
--- 873,880 ----
  	t_seqevent *ep;
  	float prevtime = 0;
  	if (!seq_dogrowing(x, nevents, 0))
  	    return (0);
+ 	i = -1;
  	nevents = 0;
  	ep = x->x_sequence;
  	while (ac--)
***************
*** 888,893 ****
  		if (i < 0)
  		{
! 		    ep->e_delta = av->a_w.w_float - prevtime;
! 		    prevtime = av->a_w.w_float;
  		    i = 0;
  		}
--- 884,893 ----
  		if (i < 0)
  		{
! 		    if (abstime)
! 		    {
! 			ep->e_delta = av->a_w.w_float - prevtime;
! 			prevtime = av->a_w.w_float;
! 		    }
! 		    else ep->e_delta = av->a_w.w_float;
  		    i = 0;
  		}
***************
*** 946,950 ****
      else
      {
! 	int nlines = seq_frombinbuf(x, bb);
  	if (nlines < 0)
  	    /* CHECKED "bad MIDI file (truncated)" alert, even if a text file */
--- 946,951 ----
      else
      {
! 	int nlines = /* CHECKED absolute timestamps */
! 	    seq_fromatoms(x, binbuf_getnatom(bb), binbuf_getvec(bb), 1);
  	if (nlines < 0)
  	    /* CHECKED "bad MIDI file (truncated)" alert, even if a text file */
***************
*** 1048,1056 ****
  }
  
! static void seq_eventstring(t_seq *x, char *buf, t_seqevent *ep)
  {
      unsigned char *bp = ep->e_bytes;
      int i;
!     if (*bp < 128 || *bp == 247)
  	sprintf(buf, "(%g)->", ep->e_delta);
      else
--- 1049,1059 ----
  }
  
! static void seq_eventstring(t_seq *x, char *buf, t_seqevent *ep, int editable)
  {
      unsigned char *bp = ep->e_bytes;
      int i;
!     if (editable)
! 	sprintf(buf, "%g", ep->e_delta);
!     else if (*bp < 128 || *bp == 247)
  	sprintf(buf, "(%g)->", ep->e_delta);
      else
***************
*** 1080,1086 ****
  	endpost();
  	while (nevents--)
! 	{
! 	    /* CHECKED bytes are space-separated, no semi */
! 	    seq_eventstring(x, buf, ep);
  	    post(buf);
  	    ep++;
--- 1083,1088 ----
  	endpost();
  	while (nevents--)
! 	{  /* CHECKED bytes are space-separated, no semi */
! 	    seq_eventstring(x, buf, ep, 0);
  	    post(buf);
  	    ep++;
***************
*** 1091,1110 ****
  }
  
! static void seq_properties(t_gobj *z, t_glist *glist)
  {
-     t_seq *x = (t_seq *)z;
      t_seqevent *ep = x->x_sequence;
      int nevents = x->x_nevents;
      char buf[MAXPDSTRING+2];
!     sprintf(buf, "seq: %s", (x->x_defname && x->x_defname != &s_ ?
! 			     x->x_defname->s_name : "<anonymous>"));
!     hammereditor_open(x->x_filehandle, buf);
      while (nevents--)
!     {
! 	seq_eventstring(x, buf, ep);
! 	strcat(buf, "\n");
  	hammereditor_append(x->x_filehandle, buf);
  	ep++;
      }
  }
  
--- 1093,1118 ----
  }
  
! static void seq_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av)
! {
!     seq_fromatoms((t_seq *)z, ac, av, 0);
! }
! 
! static void seq_click(t_seq *x, t_floatarg xpos, t_floatarg ypos,
! 		      t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
  {
      t_seqevent *ep = x->x_sequence;
      int nevents = x->x_nevents;
      char buf[MAXPDSTRING+2];
!     hammereditor_open(x->x_filehandle,
! 		      (x->x_defname && x->x_defname != &s_ ?
! 		       x->x_defname->s_name : "<anonymous>"), 0);
      while (nevents--)
!     {  /* LATER rethink sysex continuation */
! 	seq_eventstring(x, buf, ep, 1);
! 	strcat(buf, ";\n");
  	hammereditor_append(x->x_filehandle, buf);
  	ep++;
      }
+     hammereditor_setdirty(x->x_filehandle, 0);
  }
  
***************
*** 1130,1135 ****
      }
      x->x_canvas = canvas_getcurrent();
!     x->x_filehandle = hammerfile_new((t_pd *)x, 0,
! 				     seq_readhook, seq_writehook, 0);
      x->x_timescale = 1.;
      x->x_newtimescale = 1.;
--- 1138,1143 ----
      }
      x->x_canvas = canvas_getcurrent();
!     x->x_filehandle = hammerfile_new((t_pd *)x, 0, seq_readhook, seq_writehook,
! 				     seq_editorhook);
      x->x_timescale = 1.;
      x->x_newtimescale = 1.;
***************
*** 1189,1192 ****
--- 1197,1201 ----
  		    gensym("print"), 0);
  
+     /* incompatible extensions */
      class_addmethod(seq_class, (t_method)seq_pause,
  		    gensym("pause"), 0);
***************
*** 1201,1206 ****
      class_addmethod(seq_class, (t_method)seq_pwd,
  		    gensym("pwd"), A_SYMBOL, 0);
! 
!     forky_setpropertiesfn(seq_class, seq_properties);
      hammerfile_setup(seq_class, 0);
      fitter_setup(seq_class, 0);
--- 1210,1216 ----
      class_addmethod(seq_class, (t_method)seq_pwd,
  		    gensym("pwd"), A_SYMBOL, 0);
!     class_addmethod(seq_class, (t_method)seq_click,
! 		    gensym("click"),
! 		    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
      hammerfile_setup(seq_class, 0);
      fitter_setup(seq_class, 0);

Index: capture.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/hammer/capture.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** capture.c	23 May 2003 12:29:46 -0000	1.1.1.1
--- capture.c	28 Feb 2005 13:10:39 -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-2005 krzYszcz and others.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
***************
*** 88,92 ****
      cnt += sprintf(bp, fmt, i);
      if (col + cnt > maxcol)
! 	buf[0] = '\n', col = cnt;
      else
  	col += cnt;
--- 88,92 ----
      cnt += sprintf(bp, fmt, i);
      if (col + cnt > maxcol)
! 	buf[0] = '\n', col = cnt - 1;  /* assuming col > 0 */
      else
  	col += cnt;
***************
*** 103,107 ****
      cnt += sprintf(bp, fmt, f);
      if (col + cnt > maxcol)
! 	buf[0] = '\n', col = cnt;
      else
  	col += cnt;
--- 103,107 ----
      cnt += sprintf(bp, fmt, f);
      if (col + cnt > maxcol)
! 	buf[0] = '\n', col = cnt - 1;  /* assuming col > 0 */
      else
  	col += cnt;
***************
*** 195,199 ****
      int count = x->x_count;
      char buf[MAXPDSTRING];
!     hammereditor_open(x->x_filehandle, "t_capture");  /* CHECKED */
      if (count < x->x_bufsize)
      {
--- 195,199 ----
      int count = x->x_count;
      char buf[MAXPDSTRING];
!     hammereditor_open(x->x_filehandle, "Capture", "");  /* CHECKED */
      if (count < x->x_bufsize)
      {





More information about the Pd-cvs mailing list