# HG changeset patch # User lost # Date 1237739320 0 # Node ID bfd0fb0a85c264bddadf74153be8295aa9560140 # Parent 29ba546ceea077a70eec7b2768234afafefd88ac Allow exporting multiple symbols on a single directive diff -r 29ba546ceea0 -r bfd0fb0a85c2 ChangeLog --- a/ChangeLog Sun Mar 22 16:12:06 2009 +0000 +++ b/ChangeLog Sun Mar 22 16:28:40 2009 +0000 @@ -23,6 +23,7 @@ [+] added support for "sym=expr" in the opcode field; this will define a global symbol (non-section) if it resolves to a constant [+] added operator ~ as a prefix operator for a 1s complement in LWASM +[+] allow exporting multiple symbols (export sym,sym,sym...) [b] arranged for output files for lwasm/lwlink to be removed if the assembly or linking fails [ ] DECB output of LWLINK now collapses contiguous output blocks into single diff -r 29ba546ceea0 -r bfd0fb0a85c2 lwasm/pseudo.c --- a/lwasm/pseudo.c Sun Mar 22 16:12:06 2009 +0000 +++ b/lwasm/pseudo.c Sun Mar 22 16:28:40 2009 +0000 @@ -1039,6 +1039,7 @@ lwasm_symbol_ent_t *se; export_list_t *ex; char *sym2, *sym3; + int after = 0; if (as -> outformat != OUTPUT_OBJ) { @@ -1049,18 +1050,26 @@ if (as -> passnum == 1) return; - if (!(l -> sym)) +again: + if (!(l -> sym) || after == 1) { + + after = 1; // look for symbol after op if (**p) { - for (sym2 = *p; **p && !isspace(**p); (*p)++) + for (sym2 = *p; **p && !isspace(**p) && **p != ','; (*p)++) /* do nothing */ ; + + debug_message(2, "export expression: %s", sym2); + if (l -> sym) + lwasm_free(l -> sym); sym3 = lwasm_alloc(*p - sym2 + 1); memcpy(sym3, sym2, *p - sym2); sym3[*p - sym2] = '\0'; l -> sym = sym3; + debug_message(2, "export symbol: '%s'", sym3); } } if (!(l -> sym)) @@ -1116,4 +1125,15 @@ se -> sect -> exports = ex; ex -> offset = se -> value; ex -> sym = lwasm_strdup(se -> sym); + if (after == 1) + { + if (**p == ',') + { + debug_message(2, "Export another symbol: %s", *p); + (*p)++; + for ( ; **p && isspace(**p); (*p)++) + /* do nothing */ ; + goto again; + } + } }