comparison src/parse.c @ 38:9bd584bb6296

Added debugging message infrastructure
author lost
date Sat, 03 Jan 2009 04:53:49 +0000
parents 538e15927776
children 2330b88f9600
comparison
equal deleted inserted replaced
37:538e15927776 38:9bd584bb6296
60 memcpy(sym, p, p2 - p); 60 memcpy(sym, p, p2 - p);
61 61
62 l -> sym = sym; 62 l -> sym = sym;
63 // have a symbol; now determine if it is valid and register it 63 // have a symbol; now determine if it is valid and register it
64 // at the current address of the line 64 // at the current address of the line
65 debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr);
65 if (lwasm_register_symbol(as, l, sym, as -> addr) < 0) 66 if (lwasm_register_symbol(as, l, sym, as -> addr) < 0)
66 l -> sym = NULL; 67 l -> sym = NULL;
67 } 68 }
68 else 69 else
69 { 70 {
70 while (*p && isspace(*p)) 71 while (*p && isspace(*p))
71 (*p)++; 72 p++;
72 if (!*p) 73 if (!*p)
73 { 74 {
74 as -> context += 1; 75 as -> context += 1;
75 return 0; 76 return 0;
76 } 77 }
92 /* do nothing */ ; 93 /* do nothing */ ;
93 94
94 opc = lwasm_alloc((p2 - p) + 1); 95 opc = lwasm_alloc((p2 - p) + 1);
95 memcpy(opc, p, p2 - p); 96 memcpy(opc, p, p2 - p);
96 opc[p2 - p] = '\0'; 97 opc[p2 - p] = '\0';
98
99 debug_message(2, "Found operation code: '%s'", opc);
97 100
98 // skip intervening whitespace if present 101 // skip intervening whitespace if present
99 while (*p2 && isspace(*p2)) 102 while (*p2 && isspace(*p2))
100 p2++; 103 p2++;
101 104