[Gridflow-cvs] [svn] commit: r6125 - in /trunk/src: gridflow.cxx gridflow.hxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Sun Aug 15 16:13:47 EDT 2010


Author: matju
Date: Sun Aug 15 16:13:47 2010
New Revision: 6125

Log:
added fclass flags; don't use string in fclass; renamed handle_braces to handle_parens

Modified:
    trunk/src/gridflow.cxx
    trunk/src/gridflow.hxx

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Sun Aug 15 16:13:47 2010
@@ -182,6 +182,7 @@
     if      (a.a_type==A_FLOAT  ) (*this)(a.a_float);
     else if (a.a_type==A_SYMBOL ) (*this)(a.a_symbol);
     else if (a.a_type==A_POINTER) (*this)(a.a_gpointer);
+    //else if (a.a_type==A_BLOB   ) (*this)(a.a_blob);
     else error("can't send atom whose type is %d",a.a_type);
 }
 void outlet_atom2 (PtrOutlet self, t_atom *av) {
@@ -517,7 +518,7 @@
 
 #undef pd_class
 #define pd_class(x) (*(t_pd *)x)
-#define pd_classname(x) (fclasses_pd[pd_class(x)]->name.data())
+#define pd_classname(x) (fclasses_pd[pd_class(x)]->name->s_name)
 
 // when winlet==0  : the message came to the receiver of the object (by left inlet or by receive-symbol)
 // when winlet>0   : the message came through a proxy (non-left inlet)
@@ -561,7 +562,7 @@
     #endif
     try {
 	t_atom2 argv[ac+2]; for (int i=0; i<ac; i++) argv[i+2] = at[i];
-	int argc = handle_braces(ac,argv+2);
+	int argc = handle_parens(ac,argv+2);
 	FMethod m;
 	m=method_lookup(bself,winlet,s);                                    if (m) {m(bself->self,argc+0,argv+2); return;}
 	m=method_lookup(bself,-1,s); argv[1]=winlet;                        if (m) {m(bself->self,argc+1,argv+1); return;}
@@ -604,7 +605,7 @@
 	int argc = ac;
 	t_atom2 argv[argc];
 	for (int i=0; i<argc; i++) argv[i] = at[i];
-	argc = handle_braces(argc,argv);
+	argc = handle_parens(argc,argv);
 	int j;
 	for (j=0; j<argc; j++) if (argv[j].a_type==A_COMMA) break;
 	bself->self = 0;
@@ -767,25 +768,25 @@
 	if (fclass->startup) fclass->startup(fclass);
 }
 
-void install2(FClass *fclass, const char *name, int ninlets, int noutlets, int flags) {
-	fclass->ninlets = ninlets;
-	fclass->noutlets = noutlets;
-	fclass->name = string(name);
-	fclass->bfclass = class_new(gensym((char *)name), (t_newmethod)BFObject_new, (t_method)BFObject_delete,
+void install2(FClass *fc, const char *name, int ninlets, int noutlets, int flags) {
+	fc->ninlets = ninlets;
+	fc->noutlets = noutlets;
+	fc->name = gensym(name);
+	fc->flags = flags;
+	// we _have_ to use A_GIMME if we want to check for too many args.
+	t_class *bc = fc->bfclass = class_new(gensym((char *)name), (t_newmethod)BFObject_new, (t_method)BFObject_delete,
 		sizeof(BFObject), flags, A_GIMME,0);
-	fclasses[gensym(name)] = fclass;
-	fclasses_pd[fclass->bfclass] = fclass;
-	t_class *b = fclass->bfclass;
-	class_addanything(b,t_method(BFObject_anything0));
-	FMethod m = method_lookup(fclass,0,s_loadbang);
-	//post("class %s loadbang %08x",name,long(m));
-	if (m) class_addmethod(fclass->bfclass,t_method(BFObject_loadbang),s_loadbang,A_NULL);
+	fclasses[gensym(name)] = fclasses_pd[bc] = fc;
+	class_addanything(bc,t_method(BFObject_anything0));
+// loadbang has to be explicitly registered, because it is called by zgetfn.
+	FMethod m = method_lookup(fc,0,s_loadbang);
+	if (m) class_addmethod(bc,t_method(BFObject_loadbang),s_loadbang,A_NULL);
 }
 
 //static inline const t_atom &convert(const t_atom &x, const t_atom *foo) {return x;}
 
 /* This code handles nested lists because PureData doesn't do it */
-int handle_braces(int ac, t_atom *av_) {
+int handle_parens(int ac, t_atom *av_) {
 	t_atom2 *av = (t_atom2 *)av_;
 	int stack[16];
 	int stackn=0;

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Sun Aug 15 16:13:47 2010
@@ -743,9 +743,10 @@
 	int ninlets;
 	int noutlets;
 	t_class *bfclass;
-	string name;
+	t_symbol *name;
 	map<pair<int,t_symbol *>,FMethod> methods; // (inlet,selector) -> method
 	map<t_symbol *,AttrDecl *> attrs;
+	int flags; // flags: any of: CLASS_NOINLET; (yes, there's only one possibility)
 };
 
 void fclass_install(FClass *fc, FClass *super);
@@ -919,7 +920,7 @@
 inline void set_atom (t_atom *a, const t_atom &v) {*a=v;}
 
 extern map<t_symbol *,FClass *> fclasses;
-int handle_braces(int ac, t_atom *av);
+int handle_parens(int ac, t_atom *av);
 
 extern FClass ciFObject, ciFormat;
 



More information about the Gridflow-cvs mailing list