[Gridflow-cvs] [svn] commit: r3363 - /trunk/base/grid.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Sun Mar 30 18:16:52 EDT 2008


Author: matju
Date: Sun Mar 30 18:16:52 2008
New Revision: 3363

Log:
upgrade op table lookup

Modified:
    trunk/base/grid.h

Modified: trunk/base/grid.h
==============================================================================
--- trunk/base/grid.h (original)
+++ trunk/base/grid.h Sun Mar 30 18:16:52 2008
@@ -581,14 +581,11 @@
 #ifdef USE_RUBY
 #ifndef IS_BRIDGE
 static Numop *convert(Ruby x, Numop **bogus) {
-	Ruby s = rb_hash_aref(rb_ivar_get(mGridFlow,SI(@op_dict)),x);
-	if (s==Qnil) {
-		s = rb_hash_aref(rb_ivar_get(mGridFlow,SI(@vop_dict)),x);
-		if (s==Qnil) RAISE("expected two-input-operator, not %s",
-			rb_str_ptr(rb_funcall(x,SI(inspect),0)));
-//		post("warning: using vecop !!!");
-	}
-	return FIX2PTR(Numop,s);
+	string k = string(rb_str_ptr(x));
+	if (op_dict.find(k)==op_dict.end()) {
+		if (vop_dict.find(k)==vop_dict.end()) RAISE("expected two-input-operator, not %s", rb_str_ptr(rb_funcall(x,SI(inspect),0)));
+		return vop_dict[k];
+	} else return op_dict[k];
 }
 #endif
 #endif



More information about the Gridflow-cvs mailing list