[PD-cvs] externals/miXed/cyclone/shadow Makefile.objects,1.4,1.5 cyclone.c,1.7,1.8 dummies.c,1.8,1.9 maxmode.c,1.1,1.2

Krzysztof Czaja krzyszcz at users.sourceforge.net
Tue Jan 11 11:33:22 CET 2005


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

Modified Files:
	Makefile.objects cyclone.c dummies.c maxmode.c 
Log Message:
svf~: args parsing; prepend/Append: bang handling; seq: pause, continue, goto; many maxmode changes

Index: dummies.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/shadow/dummies.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** dummies.c	10 Dec 2004 20:47:02 -0000	1.8
--- dummies.c	11 Jan 2005 10:33:20 -0000	1.9
***************
*** 1,3 ****
! /* Copyright (c) 2003-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) 2003-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.  */
***************
*** 555,559 ****
      sl = &dummy_slots[fnd];
      if (fnd == dummy_nclasses)
! 	bug("dummy_newobject");  /* create a "_dummy" in this case */
      else if (!sl->s_warned)
      {
--- 555,559 ----
      sl = &dummy_slots[fnd];
      if (fnd == dummy_nclasses)
! 	loudbug_bug("dummy_newobject");  /* create a "_dummy" in this case */
      else if (!sl->s_warned)
      {
***************
*** 568,580 ****
  {
      if (dummy_nreps)
- 	post("send 'reps' message to see the list of %d \
- replacement abstractions", dummy_nreps);
-     else
- 	post("no replacement abstractions");
- }
- 
- static void ccdummies_reps(t_pd *x)
- {
-     if (dummy_nreps)
      {
  	char *msg = "replacement abstractions are: ";
--- 568,571 ----
***************
*** 620,625 ****
  	else if (ndoomed && i < dummy_nclasses - 1)
  	{
! 	    bug("dummies_setup");
! 	    post("(\"%s\": clashing or doomed dummy not registered for import)",
  		 sl->s_name);
  	}
--- 611,617 ----
  	else if (ndoomed && i < dummy_nclasses - 1)
  	{
! 	    loudbug_bug("dummies_setup");
! 	    loudbug_post
! 		("(\"%s\": clashing or doomed dummy not registered for import)",
  		 sl->s_name);
  	}
***************
*** 644,649 ****
  				sizeof(t_pd), CLASS_PD | CLASS_NOINLET, 0);
      class_addbang(ccdummies_class, ccdummies_bang);
-     class_addmethod(ccdummies_class, (t_method)ccdummies_reps,
- 		    gensym("reps"), 0);
      pd_bind(pd_new(ccdummies_class), gensym("_cc.dummies"));  /* never freed */
  }
--- 636,639 ----

Index: cyclone.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/shadow/cyclone.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** cyclone.c	8 Dec 2004 15:40:11 -0000	1.7
--- cyclone.c	11 Jan 2005 10:33:20 -0000	1.8
***************
*** 1,3 ****
! /* Copyright (c) 2003-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) 2003-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.  */
***************
*** 5,13 ****
  /* Never use forked calls in shadow code... */
  
! /* LATER support multi-atom dir (creation args), and fn ('import' message)
!    (same in hammer and sickle) */
  
- #include <stdio.h>
- #include <string.h>
  #include "m_pd.h"
  #include "common/loud.h"
--- 5,11 ----
  /* Never use forked calls in shadow code... */
  
! /* LATER support multi-atom dir ('cd' message), and fn ('import' message)
!    (same in maxmode, hammer and sickle) */
  
  #include "m_pd.h"
  #include "common/loud.h"
***************
*** 23,26 ****
--- 21,25 ----
      t_object       x_ob;
      t_symbol      *x_dir;
+     t_symbol      *x_canvasdir;
      t_hammerfile  *x_filehandle;
  } t_cyclone;
***************
*** 30,38 ****
  static int cyclone_sicklendx;
  static int cyclone_nettlesndx;
- static int cyclone_dummiesndx;
  static int cyclone_lastndx;
  
- static t_pd *cyclone_dproxy = 0;
- 
  static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
  {
--- 29,34 ----
***************
*** 42,46 ****
  static void cyclone_doimport(t_cyclone *x, t_symbol *fn, t_symbol *dir)
  {
!     if (!dir || dir == &s_) dir = x->x_dir;
      if (fn && fn != &s_)
  	import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
--- 38,43 ----
  static void cyclone_doimport(t_cyclone *x, t_symbol *fn, t_symbol *dir)
  {
!     if (!dir || dir == &s_)
! 	dir = x->x_dir;
      if (fn && fn != &s_)
  	import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
***************
*** 60,99 ****
  }
  
! static void cyclone_bang(t_cyclone *x)
  {
!     int i;
!     fragile_class_printnames("hammer classes are: ",
! 			     cyclone_hammerndx, cyclone_sicklendx - 1);
!     fragile_class_printnames("sickle classes are: ",
! 			     cyclone_sicklendx, cyclone_nettlesndx - 1);
!     fragile_class_printnames("nettles are: ",
! 			     cyclone_nettlesndx, cyclone_dummiesndx - 1);
!     if (cyclone_dproxy)
! 	pd_bang(cyclone_dproxy);
!     else
! 	post("no replacement abstractions");
!     if (cyclone_lastndx > cyclone_dummiesndx)
! 	post("send 'dummies' message to see the list of %d dummy classes",
! 	     /* cyclone_lastndx points to the "_dummy" sentinel class */
! 	     cyclone_lastndx - cyclone_dummiesndx);
!     else
! 	post("no dummies");
  }
  
! static void cyclone_reps(t_cyclone *x)
  {
!     if (cyclone_dproxy)
! 	typedmess(cyclone_dproxy, gensym("reps"), 0, 0);
!     else
! 	post("no replacement abstractions");
  }
  
! static void cyclone_dummies(t_cyclone *x)
  {
!     if (cyclone_lastndx > cyclone_dummiesndx)
! 	fragile_class_printnames("dummies are: ",
! 				 cyclone_dummiesndx, cyclone_lastndx);
!     else
! 	post("no dummies");
  }
  
--- 57,82 ----
  }
  
! static void cyclone_cd(t_cyclone *x, t_symbol *dir)
  {
!     /* LATER hammerfile interface for relative jumps, etc. */
!     x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
  }
  
! static void cyclone_pwd(t_cyclone *x)
  {
!     outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
  }
  
! static void cyclone_bang(t_cyclone *x)
  {
!     if (cyclone_hammerndx && cyclone_sicklendx)
!     {
! 	fragile_class_printnames("hammer classes are: ",
! 				 cyclone_hammerndx, cyclone_sicklendx - 1);
! 	fragile_class_printnames("sickle classes are: ",
! 				 cyclone_sicklendx, cyclone_nettlesndx - 1);
!     }
!     fragile_class_printnames("nettles are: ",
! 			     cyclone_nettlesndx, cyclone_lastndx - 1);
  }
  
***************
*** 103,111 ****
  }
  
! static void *cyclone_new(t_symbol *s)
  {
      t_cyclone *x = (t_cyclone *)pd_new(cyclone_class);
      x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_readhook, 0, 0);
!     x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas));
      return (x);
  }
--- 86,96 ----
  }
  
! static void *cyclone_new(void)
  {
      t_cyclone *x = (t_cyclone *)pd_new(cyclone_class);
      x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_readhook, 0, 0);
!     x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
!     x->x_dir = x->x_canvasdir;
!     outlet_new((t_object *)x, &s_symbol);
      return (x);
  }
***************
*** 113,126 ****
  void cyclone_setup(void)
  {
!     int hresult, sresult, dresult;
!     hresult = sresult = dresult = LOADER_OK;
!     if (canvas_getcurrent())
!     {
! 	/* Loading the library by object creation is banned, because of a danger
! 	   of having some of the classes already loaded. LATER rethink. */
! 	loud_error(0, "apparently an attempt to create a 'cyclone' object");
! 	loud_errand(0, "without having cyclone library preloaded");
! 	return;
!     }
      if (zgetfn(&pd_objectmaker, gensym("cyclone")))
      {
--- 98,103 ----
  void cyclone_setup(void)
  {
!     int hresult, sresult;
!     hresult = sresult = LOADER_OK;
      if (zgetfn(&pd_objectmaker, gensym("cyclone")))
      {
***************
*** 133,142 ****
  			      (t_newmethod)cyclone_new,
  			      (t_method)cyclone_free,
! 			      sizeof(t_cyclone), 0, A_DEFSYM, 0);
      class_addbang(cyclone_class, cyclone_bang);
!     class_addmethod(cyclone_class, (t_method)cyclone_reps,
! 		    gensym("reps"), 0);
!     class_addmethod(cyclone_class, (t_method)cyclone_dummies,
! 		    gensym("dummies"), 0);
      class_addmethod(cyclone_class, (t_method)cyclone_import,
  		    gensym("import"), A_DEFSYM, 0);
--- 110,119 ----
  			      (t_newmethod)cyclone_new,
  			      (t_method)cyclone_free,
! 			      sizeof(t_cyclone), 0, 0);
      class_addbang(cyclone_class, cyclone_bang);
!     class_addmethod(cyclone_class, (t_method)cyclone_cd,
! 		    gensym("cd"), A_DEFSYM, 0);
!     class_addmethod(cyclone_class, (t_method)cyclone_pwd,
! 		    gensym("pwd"), 0);
      class_addmethod(cyclone_class, (t_method)cyclone_import,
  		    gensym("import"), A_DEFSYM, 0);
***************
*** 146,170 ****
      hammerfile_setup(cyclone_class, 0);
  
!     cyclone_hammerndx = fragile_class_count();
!     if (zgetfn(&pd_objectmaker, gensym("hammer")))
! 	loud_warning(0, "cyclone", "hammer is already loaded");
!     else
! 	hresult = unstable_load_lib("", "hammer");
! 
!     cyclone_sicklendx = fragile_class_count();
!     if (zgetfn(&pd_objectmaker, gensym("sickle")))
! 	loud_warning(0, "cyclone", "sickle is already loaded");
      else
! 	sresult = unstable_load_lib("", "sickle");
  
      cyclone_nettlesndx = fragile_class_count();
      allnettles_setup();
- 
-     cyclone_dummiesndx = fragile_class_count();
-     if (zgetfn(&pd_objectmaker, gensym("dummies")))
- 	loud_warning(0, "cyclone", "dummies are already loaded");
-     else
- 	dresult = unstable_load_lib("", "dummies");
- 
      cyclone_lastndx = fragile_class_count() - 1;
  
--- 123,150 ----
      hammerfile_setup(cyclone_class, 0);
  
!     if (canvas_getcurrent())
!     {
! 	/* Loading hammer and sickle by cyclone object creation is banned,
! 	   because of a danger of having some of the classes already loaded. */
! 	loud_warning(0, "cyclone",
!  "creating cyclone object without loading cyclone components");
! 	cyclone_hammerndx = cyclone_sicklendx = 0;
!     }
      else
!     {
! 	cyclone_hammerndx = fragile_class_count();
! 	if (zgetfn(&pd_objectmaker, gensym("hammer")))
! 	    loud_warning(0, "cyclone", "hammer is already loaded");
! 	else
! 	    hresult = unstable_load_lib("", "hammer");
  
+ 	cyclone_sicklendx = fragile_class_count();
+ 	if (zgetfn(&pd_objectmaker, gensym("sickle")))
+ 	    loud_warning(0, "cyclone", "sickle is already loaded");
+ 	else
+ 	    sresult = unstable_load_lib("", "sickle");
+     }
      cyclone_nettlesndx = fragile_class_count();
      allnettles_setup();
      cyclone_lastndx = fragile_class_count() - 1;
  
***************
*** 173,178 ****
      else if (sresult == LOADER_NOFILE)
  	loud_error(0, "sickle library is missing");
!     else if (!zgetfn(&pd_objectmaker, gensym("hammer")) ||
! 	     !zgetfn(&pd_objectmaker, gensym("sickle")))
      {
  	loud_error(0, "version mismatch");
--- 153,159 ----
      else if (sresult == LOADER_NOFILE)
  	loud_error(0, "sickle library is missing");
!     else if (cyclone_hammerndx &&
! 	     (!zgetfn(&pd_objectmaker, gensym("hammer")) ||
! 	      !zgetfn(&pd_objectmaker, gensym("sickle"))))
      {
  	loud_error(0, "version mismatch");
***************
*** 180,193 ****
  		    "use a more recent Pd release (or recompile the cyclone).");
      }
-     else if (dresult == LOADER_NOFILE)
- 	loud_warning(0, "cyclone", "dummies not found");
-     else
-     {
- 	t_symbol *s = gensym("_cc.dummies");
- 	if (s->s_thing && !s->s_next
- 	    && !strcmp(class_getname(*s->s_thing), "_cc.dummies"))
- 	    cyclone_dproxy = s->s_thing;
- 	else
- 	    bug("cyclone_setup");  /* FIXME */
-     }
  }
--- 161,163 ----

Index: maxmode.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/shadow/maxmode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** maxmode.c	8 Dec 2004 15:45:24 -0000	1.1
--- maxmode.c	11 Jan 2005 10:33:20 -0000	1.2
***************
*** 1,21 ****
! /* 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.  */
  
  #include "m_pd.h"
  #include "common/loud.h"
  #include "unstable/loader.h"
  
  void maxmode_setup(void)
  {
!     shared_setmaxcompatibility();
!     if (zgetfn(&pd_objectmaker, gensym("cyclone")))
! 	loud_warning(0, "maxmode", "cyclone is already loaded");
      else
      {
! 	if (unstable_load_lib("", "cyclone") == LOADER_NOFILE)
! 	    loud_error(0, "cyclone library is missing");
! 	else if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
! 	    loud_error(0, "miXed/Pd version mismatch");
      }
  }
--- 1,180 ----
! /* 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.  */
  
+ #include <stdio.h>
+ #include <string.h>
  #include "m_pd.h"
  #include "common/loud.h"
+ #include "common/fitter.h"
+ #include "common/port.h"
+ #include "hammer/file.h"
+ #include "unstable/fragile.h"
  #include "unstable/loader.h"
+ #include "../build_counter"
+ 
+ typedef struct _maxmode
+ {
+     t_object       x_ob;
+     t_symbol      *x_dir;
+     t_symbol      *x_canvasdir;
+     t_hammerfile  *x_filehandle;
+ } t_maxmode;
+ 
+ static t_class *maxmode_class;
+ static int maxmode_dummiesndx;
+ static int maxmode_lastndx;
+ static t_pd *maxmode_dproxy = 0;
+ static int maxmode_withbanner = 0;
+ 
+ static void maxmode_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
+ {
+     import_max(fn->s_name, "");
+ }
+ 
+ static void maxmode_doimport(t_maxmode *x, t_symbol *fn, t_symbol *dir)
+ {
+     if (!dir || dir == &s_)
+ 	dir = x->x_dir;
+     if (fn && fn != &s_)
+ 	import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
+     else
+ 	hammerpanel_open(x->x_filehandle, dir);
+ }
+ 
+ static void maxmode_click(t_maxmode *x, t_floatarg xpos, t_floatarg ypos,
+ 			  t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+ {
+     maxmode_doimport(x, 0, 0);
+ }
+ 
+ static void maxmode_import(t_maxmode *x, t_symbol *fn)
+ {
+     maxmode_doimport(x, fn, 0);
+ }
+ 
+ static void maxmode_cd(t_maxmode *x, t_symbol *dir)
+ {
+     /* LATER hammerfile interface for relative jumps, etc. */
+     x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
+ }
+ 
+ static void maxmode_pwd(t_maxmode *x)
+ {
+     outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
+ }
+ 
+ static void maxmode_bang(t_maxmode *x)
+ {
+     if (maxmode_dproxy)
+ 	pd_bang(maxmode_dproxy);
+     else
+ 	post("no replacement abstractions");
+     if (maxmode_lastndx > maxmode_dummiesndx)
+ 	fragile_class_printnames("dummies are: ",
+ 				 maxmode_dummiesndx, maxmode_lastndx);
+     else
+ 	post("no dummies");
+ }
+ 
+ static void maxmode_free(t_maxmode *x)
+ {
+     hammerfile_free(x->x_filehandle);
+ }
+ 
+ static void *maxmode_new(t_symbol *s, int ac, t_atom *av)
+ {
+     t_maxmode *x = (t_maxmode *)pd_new(maxmode_class);
+     if (maxmode_withbanner && !ac)
+     {
+ 	post("this is maxmode %s, %s %s build",
+ 	     CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE);
+ 	loud_warning(0, "maxmode",
+  "creating maxmode object without loading cyclone components");
+ 	maxmode_withbanner = 0;
+     }
+     if (!fittermax_get())
+     {
+ 	int selective = 0;
+ 	if (ac)
+ 	{
+ 	    while (ac--) if (av->a_type == A_SYMBOL)
+ 	    {
+ 		/* FIXME register into fitter for per-patch, selective
+ 		   compatibility control */
+ 		av++;
+ 	    }
+ 	}
+ 	if (!selective)
+ 	    fittermax_set();
+     }
+     x->x_filehandle = hammerfile_new((t_pd *)x, 0, maxmode_readhook, 0, 0);
+     x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
+     x->x_dir = x->x_canvasdir;
+     outlet_new((t_object *)x, &s_symbol);
+     return (x);
+ }
  
  void maxmode_setup(void)
  {
!     int dresult = LOADER_OK;
!     if (zgetfn(&pd_objectmaker, gensym("maxmode")))
!     {
! 	loud_error(0, "maxmode is already loaded");
! 	return;
!     }
!     maxmode_class = class_new(gensym("maxmode"),
! 			      (t_newmethod)maxmode_new,
! 			      (t_method)maxmode_free,
! 			      sizeof(t_maxmode), 0, A_GIMME, 0);
!     class_addbang(maxmode_class, maxmode_bang);
!     class_addmethod(maxmode_class, (t_method)maxmode_cd,
! 		    gensym("cd"), A_DEFSYM, 0);
!     class_addmethod(maxmode_class, (t_method)maxmode_pwd,
! 		    gensym("pwd"), 0);
!     class_addmethod(maxmode_class, (t_method)maxmode_import,
! 		    gensym("import"), A_DEFSYM, 0);
!     class_addmethod(maxmode_class, (t_method)maxmode_click,
! 		    gensym("click"),
! 		    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
!     hammerfile_setup(maxmode_class, 0);
! 
!     if (canvas_getcurrent())
!     {
! 	fitter_setup(0, 0, 0);
! 	if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
! 	    /* cycloneless maxmode -- banner is posted by the oldest
! 	       maxmode object with no creation arguments */
! 	    maxmode_withbanner = 1;
!     }
      else
      {
! 	fittermax_set();
! 	if (zgetfn(&pd_objectmaker, gensym("cyclone")))
! 	    loud_warning(0, "maxmode", "cyclone is already loaded");
! 	else
! 	{
! 	    if (unstable_load_lib("", "cyclone") == LOADER_NOFILE)
! 		loud_error(0, "cyclone library is missing");
! 	    else if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
! 		loud_error(0, "miXed/Pd version mismatch");
! 	}
!     }
!     maxmode_dummiesndx = fragile_class_count();
!     if (zgetfn(&pd_objectmaker, gensym("dummies")))
! 	loud_warning(0, "maxmode", "dummies are already loaded");
!     else
! 	dresult = unstable_load_lib("", "dummies");
!     maxmode_lastndx = fragile_class_count() - 1;
!     if (dresult == LOADER_NOFILE)
! 	loud_warning(0, "maxmode", "dummies not found");
!     else
!     {
! 	t_symbol *s = gensym("_cc.dummies");
! 	if (s->s_thing && !s->s_next
! 	    && !strcmp(class_getname(*s->s_thing), "_cc.dummies"))
! 	    maxmode_dproxy = s->s_thing;
! 	else
! 	    loudbug_bug("maxmode_setup");  /* FIXME */
      }
  }

Index: Makefile.objects
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/cyclone/shadow/Makefile.objects,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile.objects	8 Dec 2004 15:40:11 -0000	1.4
--- Makefile.objects	11 Jan 2005 10:33:20 -0000	1.5
***************
*** 2,5 ****
--- 2,6 ----
  common/loud.o \
  common/grow.o \
+ common/fitter.o \
  common/lex.o \
  common/binport.o \





More information about the Pd-cvs mailing list