diff lwasm/pass1.c @ 370:6b33faa21a0a

Debugging output and bugfixing pass 0
author lost@starbug
date Tue, 20 Apr 2010 21:59:58 -0600
parents d96c30e60ddf
children 90de73ba0cac
line wrap: on
line diff
--- a/lwasm/pass1.c	Thu Apr 15 22:26:49 2010 -0600
+++ b/lwasm/pass1.c	Tue Apr 20 21:59:58 2010 -0600
@@ -179,8 +179,8 @@
 			for (tok = p1; *p1 && !isspace(*p1); p1++)
 				/* do nothing */ ;
 		}
-
-		cl -> sym = sym;
+		if (sym)
+			cl -> sym = lw_strdup(sym);
 		cl -> symset = 0;
 		
 		// tok points to the opcode for the line or NUL if none
@@ -188,7 +188,7 @@
 		{
 			// look up operation code
 			sym = lw_strndup(tok, p1 - tok);
-			for (; *p1 && isspace(p1); p1++)
+			for (; *p1 && isspace(*p1); p1++)
 				/* do nothing */ ;
 
 			for (opnum = 0; instab[opnum].opcode; opnum++)
@@ -252,19 +252,19 @@
 		{
 			if (cl -> sym && cl -> symset == 0)
 			{
-				printf("Register symbol %s:", sym);
-				lw_expr_print(cl -> addr);
+				printf("Register symbol %s:", cl -> sym);
+				lw_expr_print(cl -> addr, stderr);
 				printf("\n");
 	
 				// register symbol at line address
 				if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none))
 				{
 					// symbol error
-					lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym);
+					// lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym);
 				}
 			}
 		
-			lw_expr_print(cl -> addr);
+			lw_expr_print(cl -> addr, stderr);
 			printf("\n");
 		}