rev 131 - in trunk: . modules modules/Int src

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

Modified:
   trunk/Rules.mk.in
   trunk/modules/Int/Int.c
   trunk/modules/Makefile.in
   trunk/src/Makefile.in
   trunk/src/builtins.c
   trunk/src/prothon.y
Log:
Woo, reduced the conflicts by about 10 more. Fixed usages like:

	if a is b is not True:

Also fixed usage of:

	if not b:

...by adding __not__ objects to the base objects (you know, none of them
had this?). So OBJ, NONE, TRUE, FALSE all have defaults. Added an Int
__not__ which basically checks if the value is 0 or not.


Modified: trunk/Rules.mk.in
===================================================================
--- trunk/Rules.mk.in	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/Rules.mk.in	2004-03-26 16:23:00 UTC (rev 131)
@@ -9,12 +9,16 @@
 sysconfdir = @sysconfdir@
 mandir = @mandir@
 
+PROTHON_DEFAULT_MODDIR = @PROTHON_DEFAULT_MODDIR@
+
 CC=@CC@
 LD=$(CC)
 YACC=@YACC@
 
 CFLAGS=@CFLAGS@
-CPPFLAGS=@CPPFLAGS@
+CPPFLAGS=@CPPFLAGS@ -I$(top_srcdir)/include -I. \
+	-DPROTHON_DEFAULT_MODDIR="\"$(PROTHON_DEFAULT_MODDIR)\""
+
 LDFLAGS=@LDFLAGS@
 LIBS=@LIBS@
 
@@ -22,5 +26,3 @@
 INSTALL_DATA=$(INSTALL) -m 644
 INSTALL_PROGRAM=$(INSTALL) -m 755
 INSTALL_DIR=$(INSTALL) -d -m 755
-
-PROTHON_DEFAULT_MODDIR = @PROTHON_DEFAULT_MODDIR@

Modified: trunk/modules/Int/Int.c
===================================================================
--- trunk/modules/Int/Int.c	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/modules/Int/Int.c	2004-03-26 16:23:00 UTC (rev 131)
@@ -69,6 +69,11 @@
 	else				 return OBJ(FALSE);
 }
 
+DEF(INT_PROTO_OBJ, __not__, NULL) {
+	if (Int_value(self))	return OBJ(TRUE);
+	else			return OBJ(FALSE);
+}
+
 DEF(INT_PROTO_OBJ, __hash__, NULL) { 
 	i32_t i32 = (i32_t) Int_value(self);
 	return new_hash_obj((((i32*i32)<<(i32 & 16))+i32)*17);
@@ -304,6 +309,7 @@
 
 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/modules/Makefile.in
===================================================================
--- trunk/modules/Makefile.in	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/modules/Makefile.in	2004-03-26 16:23:00 UTC (rev 131)
@@ -8,8 +8,6 @@
 
 include ../Rules.mk
 
-CPPFLAGS += -I$(top_srcdir)/include
-
 HAVE_BOOST_REGEX = @HAVE_BOOST_REGEX@
 BOOST_REGEX_LIBS = @BOOST_REGEX_LIBS@
 

Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/src/Makefile.in	2004-03-26 16:23:00 UTC (rev 131)
@@ -9,9 +9,6 @@
 
 include ../Rules.mk
 
-CPPFLAGS += -DPROTHON_DEFAULT_MODDIR="\"$(PROTHON_DEFAULT_MODDIR)\"" \
-	-I$(top_srcdir)/include -I$(srcdir)/
-
 # The -rdynamic makes it so that the binary can export symbols to the
 # modules. This is needed.
 LDFLAGS += -rdynamic

Modified: trunk/src/builtins.c
===================================================================
--- trunk/src/builtins.c	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/src/builtins.c	2004-03-26 16:23:00 UTC (rev 131)
@@ -120,6 +120,7 @@
 }
 
 DEF(OBJECT_OBJ, __bool__, NULL) { return OBJ(TRUE); }
+DEF(OBJECT_OBJ, __not__, NULL)  { return OBJ(FALSE); }
 
 DEF(OBJECT_OBJ, __is__, FORM_RPARAM) { 
 	if (self == parms[1]) return OBJ(TRUE);
@@ -192,6 +193,7 @@
 #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); 
@@ -199,8 +201,9 @@
 
 // ***************************** TRUE *****************************************
 #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, __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); 
@@ -211,6 +214,7 @@
 #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)
@@ -800,6 +804,7 @@
 	OBJECT_OBJMaxinit();
 	OBJECT_OBJproto_listinit();
 	OBJECT_OBJ__bool__init();
+	OBJECT_OBJ__not__init();
 	OBJECT_OBJ__is__init();
 	OBJECT_OBJ__isnot__init();
 	OBJECT_OBJ__str__init();
@@ -814,12 +819,15 @@
 	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();

Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y	2004-03-26 04:59:03 UTC (rev 130)
+++ trunk/src/prothon.y	2004-03-26 16:23:00 UTC (rev 131)
@@ -143,15 +143,12 @@
 %left	  ','	   
 
 %nonassoc LAMBDA
-%left	  OR_TEST
 %left	  OR
-%left	  AND_TEST
 %left	  AND
-%nonassoc NOT
 %nonassoc IN_
 %nonassoc NOT_IN
-%nonassoc IS
-%nonassoc IS_NOT
+%left     IS
+%right     NOT
 %left	  '<'	 
 %left	  LE	 
 %left	  '>' 	 
@@ -169,8 +166,8 @@
 %left	  '/'	   
 %left	  TDV	 
 %left	  '%'	   
-%nonassoc UPL     
-%nonassoc UMI    
+%left     UPL     
+%left     UMI    
 %nonassoc '~'	   
 %right	  EXP	 
 %left	  '.'	   
@@ -211,7 +208,7 @@
 			ass_div_statement  ass_tdv_statement ass_rem_statement
 			ass_band_statement ass_bor_statement ass_bxor_statement
 			ass_shr_statement  ass_shl_statement ass_exp_statement
-			compound_body else slice slice_param formal_param
+			compound_body else slice slice_param formal_param is_not_check
 			function_param break_statement return_statement yield_statement with_statement
 			continue_statement del_statement del_tgt exec_statement raise_statement
 					
@@ -439,29 +436,31 @@
 		PRINT arg_list												{ $$ = print_arglist(yylex_param, $2); }
 	;
 
+is_not_check:
+		{ $$ = (void *)(unsigned long)__IS__; }
+	|	NOT
+		{ $$ = (void *)(unsigned long)__ISNOT__; }
+
 expr:
- 	LAMBDA formal_params ':' expr		%prec LAMBDA
+ 	LAMBDA formal_params ':' expr
 		{ $$ = ref_parm_body_to_def_lambda(yylex_param, NULL, $2, NULL, $4, LAM_FLG); }
+	
+	|	expr OR expr
+		{ $$ = expr_andor_expr(yylex_param, $1, $3, OR_FLAG); }
 
-	| 	expr AND expr		%prec AND
+	| 	expr AND expr
 		{ $$ = expr_andor_expr(yylex_param, $1, $3, AND_FLAG); }
 
-	| 	expr OR expr		%prec OR
-		{ $$ = expr_andor_expr(yylex_param, $1, $3, OR_FLAG); }
-
-	| 	expr IN_ expr		%prec IN_
+	| 	expr IN_ expr
 		{ $$ = binary(yylex_param, $1, __IN__, $3); }
 
-	| 	expr NOT IN_ expr	%prec NOT_IN
+	| 	expr NOT IN_ expr		%prec NOT_IN
 		{ $$ = binary(yylex_param, $1, __NOTIN__, $4); }
 	
-	|	expr IS NOT expr	%prec IS_NOT
-		{ $$ = binary(yylex_param, $1, __ISNOT__, $4); }
-
-	| 	expr IS expr		%prec IS
-		{ $$ = binary(yylex_param, $1, __IS__, $3); }
+	| 	expr IS is_not_check expr
+		{ $$ = binary(yylex_param, $1, (int)(unsigned long)$3, $4); }
 	
-	|	NOT expr		%prec NOT
+	|	NOT expr
 		{ $$ = unary(yylex_param, __NOT__, $2); }
 
 	| 	expr '<' expr


_______________________________________________
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.