[Gridflow-cvs] [svn] commit: r3621 - in /trunk: base/flow_objects.c rubyext.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 18 21:47:38 EDT 2008


Author: matju
Date: Fri Apr 18 21:47:38 2008
New Revision: 3621

Log:
"method_missing" renamed to "anything"

Modified:
    trunk/base/flow_objects.c
    trunk/rubyext.c

Modified: trunk/base/flow_objects.c
==============================================================================
--- trunk/base/flow_objects.c (original)
+++ trunk/base/flow_objects.c Fri Apr 18 21:47:38 2008
@@ -2451,7 +2451,7 @@
 		if (clock) clock_free(clock);
 	}
 	\decl void initialize2();
-	\decl void method_missing (...);
+	\decl void anything (...);
 	\decl 0 set_size(int sy, int sx);
 	\decl 0 grid(...);
 	\decl 0 very_long_name_that_nobody_uses(...);
@@ -2517,7 +2517,7 @@
 	clock = clock_new((void *)this,(void(*)())display_update);
 }
 \def 0 set_size(int sy, int sx) {this->sy=sy; this->sx=sx;}
-\def void method_missing (...) {
+\def void anything (...) {
 	string sel = argv[0];
 	text.str("");
 	if (sel != "float") {text << sel; if (argc>1) text << " ";}
@@ -2780,11 +2780,11 @@
 	~Route2() {if (sels) delete[] sels;}
 	\constructor (...) {nsels=0; sels=0; _1_list(argc,argv);}
 	\decl void initialize2();
-	\decl void method_missing(...);
+	\decl void anything(...);
 	\decl 1 list(...);
 };
 \def void initialize2() {bself->noutlets_set(1+nsels);}
-\def void method_missing(...) {
+\def void anything(...) {
 	t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
 	int i=0;
 	for (i=0; i<nsels; i++) if (sel==sels[i]) break;
@@ -2815,11 +2815,11 @@
 		this->index=i;
 	}
 	\decl void initialize2();
-	\decl void method_missing(...);
+	\decl void anything(...);
 	\decl 1 float(int i);
 };
 \def void initialize2() {bself->noutlets_set(n);}
-\def void method_missing(...) {
+\def void anything(...) {
 	t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
 	outlet_anything(bself->out[index],sel,argc-1,argv+1);
 	if (mode) {

Modified: trunk/rubyext.c
==============================================================================
--- trunk/rubyext.c (original)
+++ trunk/rubyext.c Fri Apr 18 21:47:38 2008
@@ -45,9 +45,7 @@
 static RMethod funcall_lookup (BFObject *bself, const char *sel) {
 	FClass *fclass = fclasses_pd[*(t_class **)bself];
 	int n = fclass->methodsn;
-	for (int i=0; i<n; i++) {
-		if (strcmp(fclass->methods[i].selector,sel)==0) return fclass->methods[i].method;
-	}
+	for (int i=0; i<n; i++) if (strcmp(fclass->methods[i].selector,sel)==0) return fclass->methods[i].method;
 	return 0;
 }
 
@@ -74,7 +72,7 @@
 
 static t_class *BFProxy_class;
 
-static void BFObject_method_missing (BFObject *bself, int winlet, t_symbol *selector, int ac, t_atom *at) {
+static void BFObject_anything (BFObject *bself, int winlet, t_symbol *selector, int ac, t_atom *at) {
     try {
 	t_atom argv[ac+1];
 	for (int i=0; i<ac; i++) argv[i+1] = at[i];
@@ -90,16 +88,16 @@
 			funcall_rescue(bself,buf,argc,argv+1);
 		} else {
 			SETSYMBOL(argv+0,gensym(buf));
-			funcall_rescue(bself,"method_missing",argc+1,argv);
+			funcall_rescue(bself,"anything",argc+1,argv);
 		}
 	}
     } catch (Barf *oozy) {pd_error(bself,"%s",oozy->text);}
 }
-static void BFObject_method_missing0 (BFObject *self, t_symbol *s, int argc, t_atom *argv) {
-	BFObject_method_missing(self,0,s,argc,argv);
-}
-static void BFProxy_method_missing   (BFProxy *self,  t_symbol *s, int argc, t_atom *argv) {
-	BFObject_method_missing(self->parent,self->id,s,argc,argv);
+static void BFObject_anything0 (BFObject *self, t_symbol *s, int argc, t_atom *argv) {
+	BFObject_anything(self,0,s,argc,argv);
+}
+static void BFProxy_anything   (BFProxy *self,  t_symbol *s, int argc, t_atom *argv) {
+	BFObject_anything(self->parent,self->id,s,argc,argv);
 }
 
 typedef void *(*t_constructor)(MESSAGE);
@@ -120,7 +118,6 @@
 	CPPExtern::m_holdname = "keep_gem_happy";
 #endif
 #endif
-
 	int j;
 	for (j=0; j<argc; j++) if (argv[j].a_type==A_COMMA) break;
 	t_constructor alloc = fclasses[string(classsym->s_name)]->allocator;
@@ -268,7 +265,7 @@
 		sizeof(BFObject), CLASS_DEFAULT, A_GIMME,0);
 	fclasses[string(name)] = fclass;
 	fclasses_pd[fclass->bfclass] = fclass;
-	class_addanything(fclass->bfclass,(t_method)BFObject_method_missing0);
+	class_addanything(fclass->bfclass,(t_method)BFObject_anything0);
 }
 
 /* This code handles nested lists because PureData (all versions including 0.40) doesn't do it */
@@ -326,10 +323,6 @@
   free(symbols);
 }
 
-#undef SDEF
-#define SDEF(_class_,_name_,_argc_)   rb_define_singleton_method(c##_class_,#_name_,(RMethod)_class_##_s_##_name_,_argc_)
-#define SDEF2(_name1_,_name2_,_argc_) rb_define_singleton_method(mGridFlow,_name1_,(RMethod)GridFlow_s_##_name2_,_argc_)
-
 // note: contrary to what m_pd.h says, pd_getfilename() and pd_getdirname()
 // don't exist; also, canvas_getcurrentdir() isn't available during setup
 // (segfaults), in addition to libraries not being canvases ;-)
@@ -350,7 +343,7 @@
 	/* nameresult is only a pointer in dirresult space so don't delete[] it. */
 	add_to_path(dirresult);
 	BFProxy_class = class_new(gensym("gf.proxy"),0,0,sizeof(BFProxy),CLASS_PD|CLASS_NOINLET, A_NULL);
-	class_addanything(BFProxy_class,BFProxy_method_missing);
+	class_addanything(BFProxy_class,BFProxy_anything);
 	gf_data_path.push_back(string(dirresult)+"/images");
         srandom(rdtsc());
 #define FOO(_sym_,_name_) bsym._sym_ = gensym(_name_);



More information about the Gridflow-cvs mailing list