diff lwlib/lw_expr.c @ 370:6b33faa21a0a

Debugging output and bugfixing pass 0
author lost@starbug
date Tue, 20 Apr 2010 21:59:58 -0600
parents 34dfc9747f23
children 9c24d9d485b9
line wrap: on
line diff
--- a/lwlib/lw_expr.c	Thu Apr 15 22:26:49 2010 -0600
+++ b/lwlib/lw_expr.c	Tue Apr 20 21:59:58 2010 -0600
@@ -192,7 +192,7 @@
 	return r;
 }
 
-void lw_expr_print(lw_expr_t E)
+void lw_expr_print(lw_expr_t E, FILE *fp)
 {
 	struct lw_expr_opers *o;
 	int c = 0;
@@ -200,86 +200,86 @@
 	for (o = E -> operands; o; o = o -> next)
 	{
 		c++;
-		lw_expr_print(o -> p);
+		lw_expr_print(o -> p, fp);
 	}
 	
 	switch (E -> type)
 	{
 	case lw_expr_type_int:
-		printf("%d ", E -> value);
+		fprintf(fp, "%d ", E -> value);
 		break;
 	
 	case lw_expr_type_var:
-		printf("V(%s) ", (char *)(E -> value2));
+		fprintf(fp, "V(%s) ", (char *)(E -> value2));
 		break;
 	
 	case lw_expr_type_special:
-		printf("S(%d,%p) ", E -> value, E -> value2);
+		fprintf(fp, "S(%d,%p) ", E -> value, E -> value2);
 		break;
 
 	case lw_expr_type_oper:
-		printf("[%d]", c);
+		fprintf(fp, "[%d]", c);
 		switch (E -> value)
 		{
 		case lw_expr_oper_plus:
-			printf("+ ");
+			fprintf(fp, "+ ");
 			break;
 			
 		case lw_expr_oper_minus:
-			printf("- ");
+			fprintf(fp, "- ");
 			break;
 			
 		case lw_expr_oper_times:
-			printf("* ");
+			fprintf(fp, "* ");
 			break;
 			
 		case lw_expr_oper_divide:
-			printf("/ ");
+			fprintf(fp, "/ ");
 			break;
 			
 		case lw_expr_oper_mod:
-			printf("%% ");
+			fprintf(fp, "%% ");
 			break;
 			
 		case lw_expr_oper_intdiv:
-			printf("\\ ");
+			fprintf(fp, "\\ ");
 			break;
 			
 		case lw_expr_oper_bwand:
-			printf("BWAND ");
+			fprintf(fp, "BWAND ");
 			break;
 			
 		case lw_expr_oper_bwor:
-			printf("BWOR ");
+			fprintf(fp, "BWOR ");
 			break;
 			
 		case lw_expr_oper_bwxor:
-			printf("BWXOR ");
+			fprintf(fp, "BWXOR ");
 			break;
 			
 		case lw_expr_oper_and:
-			printf("AND ");
+			fprintf(fp, "AND ");
 			break;
 			
 		case lw_expr_oper_or:
-			printf("OR ");
+			fprintf(fp, "OR ");
 			break;
 			
 		case lw_expr_oper_neg:
-			printf("NEG ");
+			fprintf(fp, "NEG ");
 			break;
 			
 		case lw_expr_oper_com:
-			printf("COM ");
+			fprintf(fp, "COM ");
 			break;
 			
 		default:
-			printf("OPER ");
+			fprintf(fp, "OPER ");
 			break;
 		}
 		break;
 	default:
-		printf("ERR ");
+		fprintf(fp, "ERR ");
 		break;
 	}
 }
@@ -783,7 +783,7 @@
 	
 	if (!**p || isspace(**p) || **p == ')' || **p == ',' || **p == ']')
 		return NULL;
-	
+
 	term1 = lw_expr_parse_term(p, priv);
 	if (!term1)
 		return NULL;