rev 134 - in trunk: modules/Int src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: bcollins
Date: 2004-03-26 16:24:41 -0500 (Fri, 26 Mar 2004)
New Revision: 134

Modified:
   trunk/modules/Int/Int.c
   trunk/src/builtins.c
Log:
Redo the __not__ to use __BOOL__


Modified: trunk/modules/Int/Int.c
===================================================================
--- trunk/modules/Int/Int.c	2004-03-26 20:09:15 UTC (rev 133)
+++ trunk/modules/Int/Int.c	2004-03-26 21:24:41 UTC (rev 134)
@@ -69,11 +69,6 @@
 	else				 return OBJ(FALSE);
 }
 
-DEF(INT_PROTO_OBJ, __not__, NULL) {
-	if (Int_value(self))	return OBJ(FALSE);
-	else			return OBJ(TRUE);
-}
-
 DEF(INT_PROTO_OBJ, __hash__, NULL) { 
 	i32_t i32 = (i32_t) Int_value(self);
 	return new_hash_obj((((i32*i32)<<(i32 & 16))+i32)*17);
@@ -309,7 +304,6 @@
 
 INT_PROTO_OBJ__str__init();
 INT_PROTO_OBJ__bool__init();
-INT_PROTO_OBJ__not__init();
 INT_PROTO_OBJ__hash__init();
 INT_PROTO_OBJcmpinit();
 INT_PROTO_OBJ__eq__init();

Modified: trunk/src/builtins.c
===================================================================
--- trunk/src/builtins.c	2004-03-26 20:09:15 UTC (rev 133)
+++ trunk/src/builtins.c	2004-03-26 21:24:41 UTC (rev 134)
@@ -120,7 +120,13 @@
 }
 
 DEF(OBJECT_OBJ, __bool__, NULL) { return OBJ(TRUE); }
-DEF(OBJECT_OBJ, __not__, NULL)  { return OBJ(FALSE); }
+DEF(OBJECT_OBJ, __not__, NULL)
+{
+	if (call_func0(ist, self, SYM(__BOOL__)) == OBJ(TRUE))
+		return OBJ(FALSE);
+	else
+		return OBJ(TRUE);
+}
 
 DEF(OBJECT_OBJ, __is__, FORM_RPARAM) { 
 	if (self == parms[1]) return OBJ(TRUE);
@@ -193,7 +199,6 @@
 #define FALSE_OBJ    OBJ(FALSE)
 DEF(FALSE_OBJ, __str__,  NULL) { return new_string_obj("False"); }
 DEF(FALSE_OBJ, __bool__, NULL) { return OBJ(FALSE); }
-DEF(FALSE_OBJ, __not__, NULL)  { return OBJ(TRUE); }
 DEF(FALSE_OBJ, cmp, FORM_RPARAM) { 
 	if (parms[1] == OBJ(FALSE)) return new_int_obj(0); 
 	return new_int_obj(-1); 
@@ -203,7 +208,6 @@
 #define TRUE_OBJ    OBJ(TRUE)
 DEF(TRUE_OBJ, __str__,  NULL)  { return new_string_obj("True"); }
 DEF(TRUE_OBJ, __bool__, NULL)  { return OBJ(TRUE); }
-DEF(TRUE_OBJ, __not__, NULL)  { return OBJ(FALSE); }
 DEF(TRUE_OBJ, cmp, FORM_RPARAM) { 
 	if (parms[1] == OBJ(FALSE)) return new_int_obj(1); 
 	if (parms[1] == OBJ(TRUE))  return new_int_obj(0); 
@@ -214,7 +218,6 @@
 #define NONE_OBJ    OBJ(NONE)
 DEF(NONE_OBJ, __str__,  NULL) { return new_string_obj("None"); }
 DEF(NONE_OBJ, __bool__, NULL) { return OBJ(FALSE); }
-DEF(NONE_OBJ, __not__, NULL)  { return OBJ(TRUE); }
 
 // ***************************** EXCEPTION ************************************
 #define EXCEPTION_OBJ    OBJ(EXCEPTION)
@@ -819,15 +822,12 @@
 	OBJECT_OBJ__notin__init();
 	FALSE_OBJ__str__init();
 	FALSE_OBJ__bool__init();
-	FALSE_OBJ__not__init();
 	FALSE_OBJcmpinit();
 	TRUE_OBJ__str__init();
 	TRUE_OBJ__bool__init();
-	TRUE_OBJ__not__init();
 	TRUE_OBJcmpinit();
 	NONE_OBJ__str__init();
 	NONE_OBJ__bool__init();
-	NONE_OBJ__not__init();
 	EXCEPTION_OBJ__init__init();
 	GEN_OBJ__gen__init();
 	STRING_OBJ__str__init();


_______________________________________________
Prothon-commits mailing list
[email protected]
http://lists.prothon.org/mailman/listinfo/prothon-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.