comparison lwasm/pseudo.c @ 379:d791d47afc48

Add m80ext pragma for Macro-80C compatibility and ignore END in includes For compatibility with Macro-80C source, add pragma for it. Also implement ignoring END in include files rather than treating it as the total end of assembly. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 20:59:02 -0600
parents 8e25147c2aa8
children e3f4aaa2a4e8
comparison
equal deleted inserted replaced
378:b0ec15f95563 379:d791d47afc48
93 // for "end" 93 // for "end"
94 PARSEFUNC(pseudo_parse_end) 94 PARSEFUNC(pseudo_parse_end)
95 { 95 {
96 lw_expr_t addr; 96 lw_expr_t addr;
97 97
98 as -> endseen = 1; 98 l -> len = 0;
99 l -> len = 0; 99
100 100 if (CURPRAGMA(l, PRAGMA_M80EXT) && input_isinclude(as))
101 return; /* ignore END inside includes */
102
103 as->endseen = 1;
104
101 if (as -> output_format != OUTPUT_DECB) 105 if (as -> output_format != OUTPUT_DECB)
102 { 106 {
103 skip_operand(p); 107 skip_operand(p);
104 return; 108 return;
105 } 109 }
121 } 125 }
122 126
123 EMITFUNC(pseudo_emit_end) 127 EMITFUNC(pseudo_emit_end)
124 { 128 {
125 lw_expr_t addr; 129 lw_expr_t addr;
126 130
131 if (CURPRAGMA(l, PRAGMA_M80EXT) && input_isinclude(as))
132 return; /* ignore END inside includes */
133
127 addr = lwasm_fetch_expr(l, 0); 134 addr = lwasm_fetch_expr(l, 0);
128 135
129 if (addr) 136 if (addr)
130 { 137 {
131 if (!lw_expr_istype(addr, lw_expr_type_int)) 138 if (!lw_expr_istype(addr, lw_expr_type_int))