[Gridflow-cvs] [svn] commit: r3580 - in /trunk: base/grid.h rubyext.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Wed Apr 16 22:25:18 EDT 2008


Author: matju
Date: Wed Apr 16 22:25:18 2008
New Revision: 3580

Log:
fix some typos

Modified:
    trunk/base/grid.h
    trunk/rubyext.c

Modified: trunk/base/grid.h
==============================================================================
--- trunk/base/grid.h (original)
+++ trunk/base/grid.h Wed Apr 16 22:25:18 2008
@@ -280,28 +280,28 @@
 	operator bool () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		float f = round(a_float);
-		if (f<0 || f>=2) RAISE("value %d is out of range",f);
+		if (f<0 || f>=2) RAISE("value %f is out of range",f);
 		return (bool)f;}
 	operator uint8 () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		float f = round(a_float);
-		if (f<0 || f>=0x100) RAISE("value %d is out of range",f);
+		if (f<0 || f>=0x100) RAISE("value %f is out of range",f);
 		return (uint8)f;}
 	operator int16 () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		float f = round(a_float);
-		if (f<-0x8000 || f>=0x8000) RAISE("value %d is out of range",f);
+		if (f<-0x8000 || f>=0x8000) RAISE("value %f is out of range",f);
 		return (int16)f;}
 	operator uint16 () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		float f = round(a_float);
-		if (f<0 || f>=0x10000) RAISE("value %d is out of range",f);
-		return (uint16)round(f);}
+		if (f<0 || f>=0x10000) RAISE("value %f is out of range",f);
+		return (uint16)f;}
 	operator int32 () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		float f = round(a_float);
-		if (f<-0x80000000 || f>=0x80000000) RAISE("value %d is out of range",f);
-		return (int32)round(f);}
+		if (f<-0x80000000LL || f>=0x80000000LL) RAISE("value %f is out of range",f);
+		return (int32)f;}
 	operator long () const {
 		return sizeof(long)==sizeof(int32) ? (int32)*this : (int64)*this;}
 

Modified: trunk/rubyext.c
==============================================================================
--- trunk/rubyext.c (original)
+++ trunk/rubyext.c Wed Apr 16 22:25:18 2008
@@ -189,7 +189,6 @@
 	t_atom at[fm->ac];
 	for (int i=0; i<fm->ac; i++) at[i] = fm->at[i];
 	int argc = handle_braces(fm->ac,at);
-
 	Ruby argv[argc+1];
 	argv[0] = fm->winlet*2+1; // convert to Ruby Integer
 	for (int i=0; i<argc; i++) argv[1+i] = Bridge_import_value(at+i);
@@ -217,7 +216,9 @@
 static void BFObject_method_missing (BFObject *bself, int winlet, t_symbol *selector, int ac, t_atom *at) {
 	FMessage fm = { bself, winlet, selector, ac, at, false };
 	if (!bself->rself) {pd_error(bself,"message to a dead object. (supposed to be impossible)"); return;}
-	RESCUE(BFObject_method_missing_1,&fm,BFObject_rescue,(Ruby)&fm);
+	try {
+		RESCUE(BFObject_method_missing_1,&fm,BFObject_rescue,(Ruby)&fm);
+	} catch (Barf *oozy) {post("error: %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);
@@ -440,13 +441,17 @@
 	if (fc->startup) fc->startup(rself);
 }
 
+typedef void *(*t_constructor)(MESSAGE);
+
 Ruby FObject_s_new(Ruby argc, Ruby *argv, Ruby qlass) {
 	Ruby allocator = rb_ivar_defined(qlass,SI(@allocator)) ? rb_ivar_get(qlass,SI(@allocator)) : Qnil;
 	FObject *self;
 	if (allocator==Qnil) RAISE("this shouldn't happen anymore");
 	// this is a C++ FObject/GridObject
-	void*(*alloc)() = (void*(*)())FIX2PTR(void,allocator);
-	self = (FObject *)alloc();
+	t_constructor alloc = (t_constructor)FIX2PTR(void,allocator);
+	t_atom2 argv2[argc];
+	ruby2pd(argc,argv,argv2);
+	self = (FObject *)alloc(0,argc,argv2);
 	Ruby keep = rb_ivar_get(mGridFlow, SI(@fobjects));
 	self->bself = 0;
 	Ruby rself = Data_Wrap_Struct(qlass, CObject_mark, CObject_free, self);
@@ -509,7 +514,8 @@
 			j++;
 		}
 	}
-	if (stackn) RAISE("too many open-paren (%d)",stackn);
+	//if (stackn) RAISE("too many open-paren (%d)",stackn);
+	if (stackn) post("too many open-paren (%d)",stackn);
 	return j;
 }
 



More information about the Gridflow-cvs mailing list