Mercurial > hg-old > index.cgi
comparison lwasm/parse.c @ 190:563adfccb645
Added 'sym=expr' opcode handling
author | lost |
---|---|
date | Sun, 22 Mar 2009 16:08:20 +0000 |
parents | 99300be2d3bd |
children | bae1e3ecdce1 |
comparison
equal
deleted
inserted
replaced
189:1936ea52b83e | 190:563adfccb645 |
---|---|
109 | 109 |
110 opc = lwasm_alloc((p2 - p) + 1); | 110 opc = lwasm_alloc((p2 - p) + 1); |
111 memcpy(opc, p, p2 - p); | 111 memcpy(opc, p, p2 - p); |
112 opc[p2 - p] = '\0'; | 112 opc[p2 - p] = '\0'; |
113 | 113 |
114 l -> forceglobal = 0; | |
115 // if the opcode contains an =, treat it as "symbol = expr" | |
116 if (!sym && strchr(opc, '=')) | |
117 { | |
118 for (p2 = opc; *p2 && *p2 != '='; p2++) | |
119 /* do nothing */ ; | |
120 sym = lwasm_alloc((p2 - opc) + 1); | |
121 memcpy(sym, opc, p2 - opc); | |
122 sym[p2 - opc] = '\0'; | |
123 l -> sym = sym; | |
124 | |
125 p2 = p + (p2 - opc) + 1; | |
126 // p2++; | |
127 opc[0] = '='; | |
128 opc[1] = '\0'; | |
129 debug_message(2, "Found opcode = with symbol %s and operand %s", sym, p2); | |
130 l -> forceglobal = 1; | |
131 } | |
132 | |
114 debug_message(2, "Found operation code: '%s'", opc); | 133 debug_message(2, "Found operation code: '%s'", opc); |
115 | 134 |
116 // skip intervening whitespace if present | 135 // skip intervening whitespace if present |
117 while (*p2 && isspace(*p2)) | 136 while (*p2 && isspace(*p2)) |
118 p2++; | 137 p2++; |