[Gridflow-cvs] [svn] commit: r3636 - in /trunk: base/flow_objects.c base/grid.c base/source_filter.rb format/main.c format/quicktimehw.c format/x11.c gridflow.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 18 23:37:53 EDT 2008


Author: matju
Date: Fri Apr 18 23:37:53 2008
New Revision: 3636

Log:
rename in,out to ninlets,noutlets in BFObject

Modified:
    trunk/base/flow_objects.c
    trunk/base/grid.c
    trunk/base/source_filter.rb
    trunk/format/main.c
    trunk/format/quicktimehw.c
    trunk/format/x11.c
    trunk/gridflow.c
    trunk/gridflow.h

Modified: trunk/base/flow_objects.c
==============================================================================
--- trunk/base/flow_objects.c (original)
+++ trunk/base/flow_objects.c Fri Apr 18 23:37:53 2008
@@ -177,7 +177,7 @@
 };
 GRID_INLET(GridToFloat,0) {
 } GRID_FLOW {
-	for (int i=0; i<n; i++) outlet_float(bself->out[0],data[i]);
+	for (int i=0; i<n; i++) outlet_float(bself->outlets[0],data[i]);
 } GRID_END
 \end class {install("#to_float",1,1); add_creator("#export"); add_creator("@export");}
 
@@ -191,7 +191,7 @@
 	char c[n+1];
 	for (int i=0; i<n; i++) c[i]=(char)data[i];
 	c[n]=0;
-	outlet_symbol(bself->out[0],gensym(c));
+	outlet_symbol(bself->outlets[0],gensym(c));
 } GRID_END
 \end class {install("#to_symbol",1,1); add_creator("#export_symbol"); add_creator("@export_symbol");}
 
@@ -990,7 +990,7 @@
 GRID_INLET(GridFinished,0) {
 	in->set_mode(0);
 } GRID_FINISH {
-	outlet_bang(bself->out[0]);
+	outlet_bang(bself->outlets[0]);
 } GRID_END
 \end class {install("#finished",1,1); add_creator("@finished");}
 
@@ -1010,7 +1010,7 @@
 	\grin 0
 };
 GRID_INLET(GridType,0) {
-	outlet_symbol(bself->out[0],gensym((char *)number_type_table[in->nt].name));
+	outlet_symbol(bself->outlets[0],gensym((char *)number_type_table[in->nt].name));
 	in->set_mode(0);
 } GRID_END
 \end class {install("#type",1,1); add_creator("@type");}
@@ -1295,8 +1295,8 @@
 	blah[0] = sum ? sumy/sum : 0;
 	blah[1] = sum ? sumx/sum : 0;
 	out->send(2,blah);
-	outlet_float(bself->out[1],blah[0]);
-	outlet_float(bself->out[2],blah[1]);
+	outlet_float(bself->outlets[1],blah[0]);
+	outlet_float(bself->outlets[2],blah[1]);
 } GRID_END
 
 \end class {install("#centroid",1,3);}
@@ -2232,7 +2232,7 @@
 GRID_INLET(GridUnpack,0) {
 	in->set_chunk(0);
 } GRID_FLOW {
-	for (int i=n-1; i>=0; i--) outlet_float(bself->out[i],(t_float)data[i]);
+	for (int i=n-1; i>=0; i--) outlet_float(bself->outlets[i],(t_float)data[i]);
 } GRID_END
 \def void initialize2 () {bself->noutlets_set(this->n);}
 \end class {install("#unpack",1,0);}
@@ -2243,7 +2243,7 @@
 	\decl 0 list (...);
 };
 \def 0 list (...) {
-	t_outlet *o = bself->out[0];
+	t_outlet *o = bself->outlets[0];
 	for (int i=0; i<argc; i++) {
 		if      (argv[i].a_type==A_FLOAT)  outlet_float( o,argv[i]);
 		else if (argv[i].a_type==A_SYMBOL) outlet_symbol(o,argv[i]);
@@ -2367,15 +2367,15 @@
 \def 0 list (...) {
 	if (argc<1) RAISE("empty input");
 	int i=0; for (; i<ac; i++) if (atom_eq(at[i],argv[0])) break;
-	outlet_float(bself->out[0],i==ac?-1:i);
+	outlet_float(bself->outlets[0],i==ac?-1:i);
 }
 \def 0 float (float f) {
 	int i=0; for (; i<ac; i++) if (atom_eq(at[i],argv[0])) break;
-	outlet_float(bself->out[0],i==ac?-1:i);
+	outlet_float(bself->outlets[0],i==ac?-1:i);
 }
 \def 0 symbol (t_symbol *s) {
 	int i=0; for (; i<ac; i++) if (atom_eq(at[i],argv[0])) break;
-	outlet_float(bself->out[0],i==ac?-1:i);
+	outlet_float(bself->outlets[0],i==ac?-1:i);
 }
 //doc:_1_list,"list to search into"
 //doc:_0_float,"float to find in that list"
@@ -2404,7 +2404,7 @@
 \def 0 float(float f) {
 	int i;
 	for (i=0; i<nmosusses; i++) if (f<mosusses[i]) break;
-	outlet_float(bself->out[i],f);
+	outlet_float(bself->outlets[i],f);
 }
 \def void _n_float(int i, float f) {
 	if (!i) _0_float(argc,argv,f); // precedence problem in rubyext...
@@ -2637,7 +2637,7 @@
 		j++;
 		int k=j;
 		for (; j<ac; j++) if (av[j].a_type==A_SYMBOL && av[j].a_symbol==comma) break;
-		outlet_anything2(bself->out[sargc],j-k,av+k);
+		outlet_anything2(bself->outlets[sargc],j-k,av+k);
 	}
 }
 void Args::process_args (int argc, t_atom *argv) {
@@ -2653,14 +2653,14 @@
 			}
 		} else v = &argv[i];
 		if (sargv[i].name==wildcard) {
-			if (argc-i>0) outlet_list(bself->out[i],&s_list,argc-i,argv+i);
-			else outlet_bang(bself->out[i]);
+			if (argc-i>0) outlet_list(bself->outlets[i],&s_list,argc-i,argv+i);
+			else outlet_bang(bself->outlets[i]);
 		} else {
 			if (v->a_type==A_LIST) {
 				t_binbuf *b = (t_binbuf *)v->a_gpointer;
-				outlet_list(bself->out[i],&s_list,binbuf_getnatom(b),binbuf_getvec(b));
-			} else if (v->a_type==A_SYMBOL) outlet_symbol(bself->out[i],v->a_symbol);
-			else outlet_anything2(bself->out[i],1,v);
+				outlet_list(bself->outlets[i],&s_list,binbuf_getnatom(b),binbuf_getvec(b));
+			} else if (v->a_type==A_SYMBOL) outlet_symbol(bself->outlets[i],v->a_symbol);
+			else outlet_anything2(bself->outlets[i],1,v);
 		}
 	}
 	if (argc>sargc && sargv[sargc-1].name!=wildcard) post("warning: too many args (got %d, want %d)", argc, sargc);
@@ -2692,8 +2692,8 @@
 	SETFLOAT(b+0,tv.tv_sec/86400);
 	SETFLOAT(b+1,mod(tv.tv_sec,86400));
 	SETFLOAT(b+2,tv.tv_usec);
-	outlet_anything(bself->out[2],&s_list,6,a);
-	outlet_anything(bself->out[1],&s_list,3,b);
+	outlet_anything(bself->outlets[2],&s_list,6,a);
+	outlet_anything(bself->outlets[1],&s_list,3,b);
 	send_out(0,strlen(tt),tt);
 }
 
@@ -2760,11 +2760,11 @@
 void ParallelPort::call() {
 	int flags;
 	if (ioctl(fd,LPGETFLAGS,&flags)<0) post("ioctl: %s",strerror(errno));
-	if (this->flags!=flags) outlet_float(bself->out[2],flags);
+	if (this->flags!=flags) outlet_float(bself->outlets[2],flags);
 	this->flags = flags;
 	int status;
 	if (ioctl(fd,LPGETSTATUS,&status)<0) post("ioctl: %s",strerror(errno));
-	if (this->status!=status) outlet_float(bself->out[1],status);
+	if (this->status!=status) outlet_float(bself->outlets[1],status);
 	this->status = status;
 	if (clock) clock_delay(clock,2000);
 }
@@ -2788,7 +2788,7 @@
 	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;
-	outlet_anything(bself->out[i],sel,argc-1,argv+1);
+	outlet_anything(bself->outlets[i],sel,argc-1,argv+1);
 }
 \def 1 list(...) {
 	for (int i=0; i<argc; i++) if (argv[i].a_type!=A_SYMBOL) {delete[] sels; RAISE("$%d: expected symbol",i+1);}
@@ -2821,7 +2821,7 @@
 \def void initialize2() {bself->noutlets_set(n);}
 \def void anything(...) {
 	t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
-	outlet_anything(bself->out[index],sel,argc-1,argv+1);
+	outlet_anything(bself->outlets[index],sel,argc-1,argv+1);
 	if (mode) {
 		index += sgn(mode);
 		if (index<lo || index>hi) {
@@ -2856,7 +2856,7 @@
 	\decl 1 bang ();
 };
 \def 0 bang () {struct tms t; times(&t); time = t.tms_utime;}
-\def 1 bang () {struct tms t; times(&t); outlet_float(bself->out[0],(t.tms_utime-time)*1000/HZ);}
+\def 1 bang () {struct tms t; times(&t); outlet_float(bself->outlets[0],(t.tms_utime-time)*1000/HZ);}
 \end class {install("usertime",2,1);}
 \class SystemTime : FObject {
 	clock_t time;
@@ -2865,7 +2865,7 @@
 	\decl 1 bang ();
 };
 \def 0 bang () {struct tms t; times(&t); time = t.tms_stime;}
-\def 1 bang () {struct tms t; times(&t); outlet_float(bself->out[0],(t.tms_stime-time)*1000/HZ);}
+\def 1 bang () {struct tms t; times(&t); outlet_float(bself->outlets[0],(t.tms_stime-time)*1000/HZ);}
 \end class {install("systemtime",2,1);}
 \class TSCTime : FObject {
 	uint64 time;
@@ -2874,7 +2874,7 @@
 	\decl 1 bang ();
 };
 \def 0 bang () {time=rdtsc();}
-\def 1 bang () {outlet_float(bself->out[0],(rdtsc()-time)*1000.0/cpu_hertz);}
+\def 1 bang () {outlet_float(bself->outlets[0],(rdtsc()-time)*1000.0/cpu_hertz);}
 \end class {install("tsctime",2,1);
 	struct timeval t0,t1;
 	uint64 u0,u1;

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Fri Apr 18 23:37:53 2008
@@ -291,7 +291,7 @@
 	this->dim = dim;
 	t_atom a[3];
 	SETPOINTER(a,(t_gpointer *)this); // hack
-	outlet_anything(parent->bself->out[woutlet],bsym._grid,1,a);
+	outlet_anything(parent->bself->outlets[woutlet],bsym._grid,1,a);
 	frozen=true;
 	if (!dim->prod()) {finish(); return;}
 	int32 lcm_factor = 1;

Modified: trunk/base/source_filter.rb
==============================================================================
--- trunk/base/source_filter.rb (original)
+++ trunk/base/source_filter.rb Fri Apr 18 23:37:53 2008
@@ -227,7 +227,7 @@
 	frame.attrs.each {|name,attr| startup2 += ":#{name} => []," }
 	startup2 += "}"
 	line.gsub!(/^\s*(\w+\s*)?\{/,"")
-	get << "RAISE(\"unknown attr %s\",s->s_name); outlet_anything(bself->out[bself->nout-1],s,1,a);}"
+	get << "RAISE(\"unknown attr %s\",s->s_name); outlet_anything(bself->outlets[bself->noutlets-1],s,1,a);}"
 	handle_def get if frame.attrs.size>0
 	# "IEVAL(rself,\"#{startup2}\");" # this means no support for attributes for a while.
 	Out.print "void #{frame.name}_startup (FClass *fclass) {"+line.chomp
@@ -252,7 +252,6 @@
 	fields = line.split(/\s+/)
 	n = fields.length
 	if not ClassDecl===frame then raise "\\end: frame is not a \\class" end
-	#handle_classinfo if not frame.info
 	cl = frame.name
 	if fields[0]!="class" or (n>1 and not /^\{/ =~ fields[1] and fields[1]!=cl) then raise "end not matching #{where}" end
 	$stack.push frame

Modified: trunk/format/main.c
==============================================================================
--- trunk/format/main.c (original)
+++ trunk/format/main.c Fri Apr 18 23:37:53 2008
@@ -76,12 +76,12 @@
 \def 0 symbol (t_symbol *str) {
 	char *s = strdup(str->s_name);
 	char *t = strrchr(s,'.');
-	if (!t) outlet_symbol(bself->out[2],gensym(s));
+	if (!t) outlet_symbol(bself->outlets[2],gensym(s));
 	else {
 		*t = 0;
-		outlet_symbol(bself->out[1],gensym(t+1));
+		outlet_symbol(bself->outlets[1],gensym(t+1));
 		std::map<std::string,std::string>::iterator u = suffix_table.find(std::string(t+1));
-		if (u!=suffix_table.end()) outlet_symbol(bself->out[0],gensym((char *)u->second.data()));
+		if (u!=suffix_table.end()) outlet_symbol(bself->outlets[0],gensym((char *)u->second.data()));
 	}
 	free(s);
 }
@@ -94,8 +94,8 @@
 };
 \def 0 symbol (string str) {
 	std::map<std::string,std::string>::iterator u = format_table.find(str);
-	if (u!=format_table.end()) outlet_symbol(bself->out[0],gensym((char *)u->second.data()));
-	else outlet_bang(bself->out[0]);
+	if (u!=format_table.end()) outlet_symbol(bself->outlets[0],gensym((char *)u->second.data()));
+	else outlet_bang(bself->outlets[0]);
 }
 \end class FormatLookup {install("gf.format_lookup",1,1);}
 

Modified: trunk/format/quicktimehw.c
==============================================================================
--- trunk/format/quicktimehw.c (original)
+++ trunk/format/quicktimehw.c Fri Apr 18 23:37:53 2008
@@ -199,7 +199,7 @@
 */
 	t_atom a[1];
 	SETFLOAT(a,length);
-	outlet_anything(bself->out[0],gensym("frames"),1,a);
+	outlet_anything(bself->outlets[0],gensym("frames"),1,a);
 	//SUPER;
 }
 

Modified: trunk/format/x11.c
==============================================================================
--- trunk/format/x11.c (original)
+++ trunk/format/x11.c Fri Apr 18 23:37:53 2008
@@ -265,7 +265,7 @@
 	SETFLOAT(a+0,y);
 	SETFLOAT(a+1,x);
 	SETFLOAT(a+2,state);
-	outlet_anything(bself->out[0],gensym("position"),COUNT(a),a);
+	outlet_anything(bself->outlets[0],gensym("position"),COUNT(a),a);
 }
 
 void FormatX11::call() {
@@ -303,7 +303,7 @@
 			SETFLOAT(at+1,ek->x);
 			SETFLOAT(at+2,ek->state);
 			SETSYMBOL(at+3,gensym(buf));
-			outlet_anything(bself->out[0],sel,4,at);
+			outlet_anything(bself->outlets[0],sel,4,at);
 			//XFree(kss);
 		}break;
 		case MotionNotify:{

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Fri Apr 18 23:37:53 2008
@@ -134,10 +134,10 @@
 	CPPExtern::m_holdname=0;
 #endif
 #endif
-	bself->nin  = 1;
-	bself->nout = 0;
-	bself->in  = new  BFProxy*[1];
-	bself->out = new t_outlet*[1];
+	bself->ninlets  = 1;
+	bself->noutlets = 0;
+	bself->inlets  = new  BFProxy*[1];
+	bself->outlets = new t_outlet*[1];
 	bself->ninlets_set( fclasses[classsym->s_name]->ninlets);
 	bself->noutlets_set(fclasses[classsym->s_name]->noutlets);
 	funcall(bself,"initialize2",0,0,true);
@@ -195,23 +195,23 @@
 	if (!this) RAISE("there is no bself");
 	if (n<1) RAISE("ninlets_set: n=%d must be at least 1",n);
 	BFObject_undrawio(this);
-	if (nin<n) {
+	if (ninlets<n) {
 		BFProxy **noo = new BFProxy*[n];
-		memcpy(noo,in,nin*sizeof(BFProxy*));
-		delete[] in;
-		in = noo;
-		while (nin<n) {
-			BFProxy *p = in[nin] = (BFProxy *)pd_new(BFProxy_class);
+		memcpy(noo,inlets,ninlets*sizeof(BFProxy*));
+		delete[] inlets;
+		inlets = noo;
+		while (ninlets<n) {
+			BFProxy *p = inlets[ninlets] = (BFProxy *)pd_new(BFProxy_class);
 			p->parent = this;
-			p->id = nin;
+			p->id = ninlets;
 			p->inlet = inlet_new(this, &p->ob_pd, 0,0);
-			nin++;
+			ninlets++;
 		}
 	} else {
-		while (nin>n) {
-			nin--;
-			inlet_free(in[nin]->inlet);
-			delete in[nin];
+		while (ninlets>n) {
+			ninlets--;
+			inlet_free(inlets[ninlets]->inlet);
+			delete inlets[ninlets];
 		}
 	}
 	BFObject_redraw(this);
@@ -221,14 +221,14 @@
 	if (!this) RAISE("there is no bself");
 	if (n<0) RAISE("noutlets_set: n=%d must be at least 0",n);
 	BFObject_undrawio(this);
-	if (nout<n) {
+	if (noutlets<n) {
 		t_outlet **noo = new t_outlet*[n>0?n:1];
-		memcpy(noo,out,nout*sizeof(t_outlet*));
-		delete[] out;
-		out = noo;
-		while (nout<n) out[nout++] = outlet_new(this,&s_anything);
+		memcpy(noo,outlets,noutlets*sizeof(t_outlet*));
+		delete[] outlets;
+		outlets = noo;
+		while (noutlets<n) outlets[noutlets++] = outlet_new(this,&s_anything);
 	} else {
-		while (nout>n) outlet_free(out[--nout]);
+		while (noutlets>n) outlet_free(outlets[--noutlets]);
 	}
 	BFObject_redraw(this);
 }

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 18 23:37:53 2008
@@ -818,9 +818,9 @@
 	void *gemself; // a CPPExtern * for binary-compat with GEM's Obj_header class
 #endif
 	FObject *self;
-	int nin,nout;   // per object settings (not class)
-	BFProxy  **in;  // direct access to  inlets (not linked lists)
-	t_outlet **out; // direct access to outlets (not linked lists)
+	int ninlets,noutlets; // per object settings (not class)
+	BFProxy  **inlets;    // direct access to  inlets (not linked lists)
+	t_outlet **outlets;   // direct access to outlets (not linked lists)
 	t_canvas *mom;
 	void  ninlets_set(int n);
 	void noutlets_set(int n);
@@ -833,7 +833,7 @@
 	template <class T> void send_out(int outlet, int argc, T *argv) {
 		t_atom foo[argc];
 		for (int i=0; i<argc; i++) SETFLOAT(&foo[i],argv[i]);
-		outlet_list(bself->out[outlet],&s_list,argc,foo);
+		outlet_list(bself->outlets[outlet],&s_list,argc,foo);
 	}
 };
 \end class FObject



More information about the Gridflow-cvs mailing list