comparison lwasm/lwasm.c @ 344:0215a0fbf61b

Added assembly error system and additional checks for symbol syntax
author lost@starbug
date Thu, 25 Mar 2010 22:06:50 -0600
parents 04c80c51b16a
children 7416c3f9c321
comparison
equal deleted inserted replaced
343:b4157778d354 344:0215a0fbf61b
17 17
18 You should have received a copy of the GNU General Public License along with 18 You should have received a copy of the GNU General Public License along with
19 this program. If not, see <http://www.gnu.org/licenses/>. 19 this program. If not, see <http://www.gnu.org/licenses/>.
20 */ 20 */
21 21
22 #define ___lwasm_c_seen___
23
22 #include <config.h> 24 #include <config.h>
23 25
26 #include <stdio.h>
27 #include <stdarg.h>
28
24 #include <lw_expr.h> 29 #include <lw_expr.h>
30 #include <lw_alloc.h>
31 #include <lw_string.h>
25 32
26 #include "lwasm.h" 33 #include "lwasm.h"
27
28 #define NULL 0;
29 34
30 lw_expr_t lwasm_evaluate_var(char *var) 35 lw_expr_t lwasm_evaluate_var(char *var)
31 { 36 {
32 return NULL; 37 return NULL;
33 } 38 }
45 } 50 }
46 break; 51 break;
47 } 52 }
48 return NULL; 53 return NULL;
49 } 54 }
55
56 void lwasm_register_error(asmstate_t *as, line_t *l, const char *msg, ...)
57 {
58 lwasm_error_t *e;
59 va_list args;
60 char errbuff[1024];
61 int r;
62
63 if (!l)
64 return;
65
66 va_start(args, msg);
67
68 e = lw_alloc(sizeof(lwasm_error_t));
69
70 e -> next = l -> err;
71 l -> err = e;
72
73 as -> errorcount++;
74
75 r = vsnprintf(errbuff, 1024, msg, args);
76 e -> mess = lw_strdup(errbuff);
77
78 va_end(args);
79 }