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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Thu Apr 17 00:45:37 EDT 2008


Author: matju
Date: Thu Apr 17 00:45:37 2008
New Revision: 3583

Log:
remove method "ptr" in class Pointer

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

Modified: trunk/base/grid.h
==============================================================================
--- trunk/base/grid.h (original)
+++ trunk/base/grid.h Thu Apr 17 00:45:37 2008
@@ -149,6 +149,8 @@
 BUILTIN_SYMBOLS(FOO)
 #undef FOO
 } bsym;
+
+void *Pointer_get (Ruby rself);
 
 struct Numop;
 struct Pointer;
@@ -239,7 +241,7 @@
 	}
 	operator void * () const {
 		if (CLASS_OF(r)!=cPointer) RAISE("not a Pointer");
-		return (void *)NUM2ULONG(rb_funcall(r,SI(ptr),0));
+		return (void *)Pointer_get(r);
 	}
 	static R value(VALUE r) {R x; x.r=r; return x;}
 #define FOO(As,Op) \
@@ -304,7 +306,6 @@
 		return (int32)f;}
 	operator long () const {
 		return sizeof(long)==sizeof(int32) ? (int32)*this : (int64)*this;}
-
 	operator uint64 () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
 		return (uint64)round(a_float);}

Modified: trunk/rubyext.c
==============================================================================
--- trunk/rubyext.c (original)
+++ trunk/rubyext.c Thu Apr 17 00:45:37 2008
@@ -84,6 +84,7 @@
 Ruby cPointer=0;
 Ruby Pointer_s_new (void *ptr) {
 	Pointer *self = new Pointer(ptr);
+	fprintf(stderr,"Pointer_s_new: %p %p\n",ptr,self->p);
 	return Data_Wrap_Struct(cPointer, 0, CObject_free, self);
 }
 void *Pointer_get (Ruby rself) {
@@ -196,6 +197,7 @@
 	DGS(FObject);
 	char buf[256];
 	sprintf(buf,"_n_%s",fm->selector->s_name);
+	rb_funcall(rself,SI(to_s),0); //dummy call as test
 	if (rb_obj_respond_to(rself,rb_intern(buf),0)) {
 		rb_funcall_myrescue2(rself,rb_intern(buf),argc+1,argv);
 	} else {
@@ -295,16 +297,6 @@
 }
 
 //****************************************************************
-
-\class Pointer : CObject
-\def Ruby ptr () { return LONG2NUM(((long)p)); }
-\classinfo {
-	IEVAL(rself,
-"self.module_eval{"
-"def inspect; p=('%08x'%ptr).gsub(/^\\.\\.f/,''); \"#<Pointer:#{p}>\" % ptr; end;"
-"alias to_s inspect }"
-);}
-\end class Pointer
 
 static void BFObject_class_init_1 (t_class *qlass) {class_addanything(qlass,(t_method)BFObject_method_missing0);}
 \class FObject



More information about the Gridflow-cvs mailing list