diff lwasm/lwasm.h @ 363:d96c30e60ddf

Added pass2 and various supporting logic including symbol lookups
author lost@starbug
date Tue, 06 Apr 2010 21:03:19 -0600
parents 105393e31f20
children 34dfc9747f23
line wrap: on
line diff
--- a/lwasm/lwasm.h	Thu Apr 01 20:56:19 2010 -0600
+++ b/lwasm/lwasm.h	Tue Apr 06 21:03:19 2010 -0600
@@ -39,7 +39,9 @@
 	lwasm_expr_linelen = 1,			// length of ref'd line
 	lwasm_expr_lineaddr = 2,		// addr of ref'd line
 	lwasm_expr_nextbp = 3,			// next branch point
-	lwasm_expr_prevbp = 4			// previous branch point
+	lwasm_expr_prevbp = 4,			// previous branch point
+	lwasm_expr_syment = 5,			// symbol table entry
+	lwasm_expr_import = 6			// symbol import entry
 };
 
 enum lwasm_output_e
@@ -104,10 +106,13 @@
 	struct line_expr_s *next;
 };
 
+typedef struct line_s line_t;
+
 typedef struct exportlist_s exportlist_t;
 struct exportlist_s
 {
 	char *symbol;						// symbol to export
+	line_t *line;						// line the export is on
 	exportlist_t *next;					// next in the export list
 };
 
@@ -118,7 +123,6 @@
 	importlist_t *next;					// next in the import list
 };
 
-typedef struct line_s line_t;
 struct line_s
 {
 	lw_expr_t addr;						// assembly address of the line
@@ -143,6 +147,7 @@
 	int lint2;							// another pass forward integer
 	asmstate_t *as;						// assembler state data ptr
 	int pragmas;						// pragmas in effect for the line
+	int context;						// the symbol context number
 };
 
 enum
@@ -190,6 +195,7 @@
 	int execaddr;						// address from "end"
 	int inmod;							// inside an os9 module?
 	unsigned char crc[3];				// crc accumulator
+	int badsymerr;						// throw error on undef sym if set
 
 	line_t *line_head;					// start of lines list
 	line_t *line_tail;					// tail of lines list
@@ -217,7 +223,7 @@
 #ifndef ___symbol_c_seen___
 
 extern struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t value, int flags);
-extern struct symtabe *lookup_symbol(asmstate_t *as, line_t *cl, char *sym, int context, int version);
+extern struct symtabe *lookup_symbol(asmstate_t *as, line_t *cl, char *sym);
 
 #endif
 
@@ -239,6 +245,10 @@
 extern int lwasm_lookupreg2(const char *rlist, char **p);
 extern int lwasm_lookupreg3(const char *rlist, char **p);
 
+extern void lwasm_show_errors(asmstate_t *as);
+
+extern int lwasm_reduce_expr(asmstate_t *as, lw_expr_t expr);
+
 #endif
 
 #define OPLEN(op) (((op)>0xFF)?2:1)