[Gridflow-cvs] [svn] commit: r3483 - /trunk/rubyext.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Mon Apr 14 14:00:08 EDT 2008


Author: matju
Date: Mon Apr 14 14:00:08 2008
New Revision: 3483

Log:
convert ruby Array to t_list

Modified:
    trunk/rubyext.c

Modified: trunk/rubyext.c
==============================================================================
--- trunk/rubyext.c (original)
+++ trunk/rubyext.c Mon Apr 14 14:00:08 2008
@@ -139,7 +139,14 @@
 	else if ( SYMBOL_P(arg)) SETSYMBOL(at,gensym((char *)rb_sym_name(arg)));
 	else if (  FLOAT_P(arg)) SETFLOAT(at,RFLOAT(arg)->value);
 	else if (rb_obj_class(arg)==cPointer) SETPOINTER(at,(t_gpointer*)Pointer_get(arg));
-	else RAISE("cannot convert argument of class '%s'",
+	else if (TYPE(arg)==T_ARRAY) {
+		t_binbuf *b = binbuf_new();
+		t_atom a;
+		int n=rb_ary_len(arg);
+		Ruby *p=rb_ary_ptr(arg);
+		for (int i=0; i<n; i++) {Bridge_export_value(p[i],&a); binbuf_add(b,1,&a);}
+		SETLIST(at,b);
+	} else RAISE("cannot convert argument of class '%s'",
 		rb_str_ptr(rb_funcall(rb_funcall(arg,SI(class),0),SI(inspect),0)));
 }
 
@@ -787,7 +794,5 @@
 	signal(SIGSEGV,SIG_DFL);
 	signal(SIGABRT,SIG_DFL);
 	signal(SIGBUS, SIG_DFL);
-    } catch (Barf *oozy) {
-        post("Init_gridflow error: %s",oozy->text);
-    }
-}
+    } catch (Barf *oozy) {post("Init_gridflow error: %s",oozy->text);}
+}



More information about the Gridflow-cvs mailing list