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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Wed Apr 16 22:01:58 EDT 2008


Author: matju
Date: Wed Apr 16 22:01:58 2008
New Revision: 3579

Log:
end of first draft of introduction of \constructor ... now will fix bugs

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:01:58 2008
@@ -951,7 +951,7 @@
 
 \class Pointer : CObject {
 	void *p;
-	Pointer() { RAISE("trying to construct a (ruby) Pointer without an argument"); }
+	Pointer(MESSAGE) {RAISE("calling Pointer constructor the wrong way"); }
 	Pointer(void *_p) : p(_p) {}
 	\decl Ruby ptr ();
 };

Modified: trunk/rubyext.c
==============================================================================
--- trunk/rubyext.c (original)
+++ trunk/rubyext.c Wed Apr 16 22:01:58 2008
@@ -443,15 +443,10 @@
 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) {
-		// this is a pure-ruby FObject/GridObject
-		// !@#$ GridObject is in FObject constructor (ugly)
-		self = new GridObject;
-	} else {
-		// this is a C++ FObject/GridObject
-		void*(*alloc)() = (void*(*)())FIX2PTR(void,allocator);
-		self = (FObject *)alloc();
-	}
+	if (allocator==Qnil) RAISE("this shouldn't happen anymore");
+	// this is a C++ FObject/GridObject
+	void*(*alloc)() = (void*(*)())FIX2PTR(void,allocator);
+	self = (FObject *)alloc();
 	Ruby keep = rb_ivar_get(mGridFlow, SI(@fobjects));
 	self->bself = 0;
 	Ruby rself = Data_Wrap_Struct(qlass, CObject_mark, CObject_free, self);



More information about the Gridflow-cvs mailing list