rev 512 - in trunk: pr/test src

SVN User <[email protected]> Thu, 20 May 2004 03:54:52 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-05-20 03:54:49 -0400 (Thu, 20 May 2004)
New Revision: 512

Modified:
   trunk/pr/test/test.pr
   trunk/src/builtins-core.c
   trunk/src/object.c
Log:
added Object.objId_()

Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr	2004-05-19 23:26:17 UTC (rev 511)
+++ trunk/pr/test/test.pr	2004-05-20 07:54:49 UTC (rev 512)
@@ -17,7 +17,7 @@
         if attrname in attrs:
             a = attrs[attrname]
             if a.hasProto?(Func):
-                return a
+                return a 
             return a
     raise AttributeError
 
@@ -25,21 +25,70 @@
 object ModInt(Int):
     modulo = 10
     def call_(i=0):
+
+        if nextProto is not None:
+            proto2 = self.protoList()[1]
+            if proto2 is not nextProto:
+                print "err before"
+                raise xxx
+
         call = refer(ModInt, 'call_')
+        
+        if nextProto is not None:
+            proto2 = self.protoList()[1]
+            if proto2 is not nextProto:
+                print "err after"
+                raise xxx
+
         return call{self}(i % self.modulo)
+
     def add_(other):
         if self.modulo != other.modulo:
             raise TypeError
         proto = self.protoList()[1]
+        
+        if proto is not lastProto:
+                print "err 1"
+                raise xxx
+        proto2 = proto.protoList()[1]
+        if proto2 is not nextProto:
+                print "err 2"
+                raise xxx
+        
         add = refer(ModInt, 'add_')
+        
+        if proto is not lastProto:
+                print "err 3"
+                raise xxx
+        proto2 = proto.protoList()[1]
+        if proto2 is not nextProto:
+                print "err 4"
+                raise xxx
+        
         x =  proto(add{self}(other))
+        
+        proto = x.protoList()[1]
+        if proto is not lastProto:
+                print "err 5"
+                raise xxx
+        proto2 = proto.protoList()[1]
+        if proto2 is not nextProto:
+                print "err 6"
+                raise xxx
+        
         print "new", x
         return x
 
 object Mod8Int(ModInt):
     modulo = 8
 
+nextProto = None
 m = Mod8Int(1)
+lastProto = m.protoList()[1]
+nextProto = lastProto.protoList()[1]
+print "lastProto: %i" % lastProto.objId_()
+print "nextProto: %i" % nextProto.objId_()
+
 n = Mod8Int(1)
 print "%i, %s" % (m, m.protoList().str_())
 for i in 100:

Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c	2004-05-19 23:26:17 UTC (rev 511)
+++ trunk/src/builtins-core.c	2004-05-20 07:54:49 UTC (rev 512)
@@ -110,6 +110,10 @@
 	return OBJ(NONE);
 }
 
+DEF(Object, objId_, NULL) {
+	return NEW_INT((intptr_t) self);
+}
+
 DEF(Object, Proto, FORM_STAR_PARAM) {
 	int i, llen = (int) list_len(ist, parms[1]);
 	obj_p new_obj;
@@ -763,6 +767,7 @@
 	MODULE_SUB_INIT(Object);
 	MODULE_ADD_SYM(Object, call_);
 	MODULE_ADD_SYM(Object, init_);
+	MODULE_ADD_SYM(Object, objId_);
 	MODULE_ADD_SYM(Object, Proto);
 	MODULE_ADD_SYM(Object, copy);
 	MODULE_ADD_SYM(Object, setReadAccess);

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2004-05-19 23:26:17 UTC (rev 511)
+++ trunk/src/object.c	2004-05-20 07:54:49 UTC (rev 512)
@@ -767,7 +767,7 @@
 }
 
 //********************************* proto_list *****************************
-obj_p proto_list(isp ist, obj_p obj){
+obj_p proto_list(isp ist, obj_p obj) {
 	i32_t i, j, k = 0, len;
 	obj_p proto, list_obj;
 	clist_t *pao_list;