diff src/lwasm.h @ 77:a338d496350e

Checkpointing conversion to allow object target
author lost
date Fri, 09 Jan 2009 04:23:00 +0000
parents 2fe5fd7d65a3
children 121bf4a588ea
line wrap: on
line diff
--- a/src/lwasm.h	Thu Jan 08 02:57:24 2009 +0000
+++ b/src/lwasm.h	Fri Jan 09 04:23:00 2009 +0000
@@ -62,6 +62,10 @@
 };
 
 // structure for keeping track of lines
+// it also as space for 4 expressions which is enough for all known
+// instructions and addressing modes
+// on pass 1, the expressions are parsed, on pass 2 they are re-evaluated
+// to determine constancy
 typedef struct lwasm_line_s lwasm_line_t;
 struct lwasm_line_s {
 	char *text;			// the actual text of the line
@@ -84,8 +88,9 @@
 	// the following are used for obj format - for external references, inter-section
 	// references, and intrasection relocations
 	int relocoff;		// offset into insn where relocation value goes
-	// the incomplete reference expression
-	lwasm_expr_stack_t *expr;
+	lwasm_expr_stack_t *exprs[4];	// non-constant expression values
+	int exprvals[4];	// constant expression values
+	char *exprends[4];	// pointer to character after end of expression
 };
 
 // for keeping track of symbols
@@ -175,8 +180,10 @@
 #define EXPR_PASS2CONST		2	// no undefined references on pass 2
 #define EXPR_BYTE			4	// the result must fit within 8 bits
 #define EXPR_COMPLEX		8	// a non-constant result is permitted (stored in l -> expr)
+#define EXPR_NOINTERSECT	16	// only allow intra-section values (pass 2)
 
 __lwasm_E__ int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val);
+__lwasm_E__ int lwasm_expr_result2(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val, int slot);
 
 #undef __lwasm_E__