Mercurial > hg > index.cgi
annotate lwasm/pass1.c @ 147:9cf1796259b2
Fixed segfault in fcb,fdb,fqb with empty operands
author | lost@l-w.ca |
---|---|
date | Thu, 25 Aug 2011 22:29:58 -0600 |
parents | 697bc543368c |
children | 324f28905144 |
rev | line source |
---|---|
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
1 /* |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
2 pass1.c |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
3 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
4 Copyright © 2010 William Astle |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
5 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
6 This file is part of LWTOOLS. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
7 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
8 LWTOOLS is free software: you can redistribute it and/or modify it under the |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
9 terms of the GNU General Public License as published by the Free Software |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
10 Foundation, either version 3 of the License, or (at your option) any later |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
11 version. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
12 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, but WITHOUT |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
16 more details. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
17 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License along with |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
19 this program. If not, see <http://www.gnu.org/licenses/>. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
20 */ |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
21 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
22 #include <stdio.h> |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
23 #include <string.h> |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
0
diff
changeset
|
24 #include <ctype.h> |
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
0
diff
changeset
|
25 #include <stdlib.h> |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
26 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
27 #include <lw_alloc.h> |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
28 #include <lw_string.h> |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
29 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
30 #include "lwasm.h" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
31 #include "instab.h" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
32 #include "input.h" |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
33 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
34 extern int expand_macro(asmstate_t *as, line_t *l, char **p, char *opc); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
35 extern int expand_struct(asmstate_t *as, line_t *l, char **p, char *opc); |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
0
diff
changeset
|
36 extern int add_macro_line(asmstate_t *as, char *optr); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
37 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
38 /* |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
39 pass 1: parse the lines |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
40 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
41 line format: |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
42 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
43 [<symbol>] <opcode> <operand>[ <comment>] |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
44 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
45 If <symbol> is followed by a :, whitespace may precede the symbol |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
46 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
47 A line may optionally start with a number which must not be preceded by |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
48 white space and must be followed by a single whitespace character. After |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
49 that whitespace character, the line is parsed as if it had no line number. |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
50 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
51 */ |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
52 void do_pass1(asmstate_t *as) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
53 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
54 char *line; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
55 line_t *cl; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
56 char *p1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
57 int stspace; |
93
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
58 char *tok, *sym = NULL; |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
59 int opnum; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
60 int lc = 1; |
59
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
61 int nomacro; |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
62 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
63 for (;;) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
64 { |
59
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
65 nomacro = 0; |
93
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
66 if (sym) |
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
67 lw_free(sym); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
68 sym = NULL; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
69 line = input_readline(as); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
70 if (!line) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
71 break; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
72 if (line[0] == 1 && line[1] == 1) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
73 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
74 // special internal directive |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
75 // these DO NOT appear in the output anywhere |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
76 // they are generated by the parser to pass information |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
77 // forward |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
78 for (p1 = line + 2; *p1 && !isspace(*p1); p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
79 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
80 *p1++ = '\0'; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
81 if (!strcmp(line + 2, "SETCONTEXT")) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
82 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
83 as -> context = strtol(p1, NULL, 10); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
84 } |
40
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
85 else if (!strcmp(line + 2, "SETLINENO")) |
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
86 { |
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
87 lc = strtol(p1, NULL, 10); |
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
88 } |
49
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
89 else if (!strcmp(line + 2, "SETNOEXPANDSTART")) |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
90 { |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
91 as -> line_tail -> noexpand_start = 1; |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
92 } |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
93 else if (!strcmp(line + 2, "SETNOEXPANDEND")) |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
94 { |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
95 as -> line_tail -> noexpand_end = 1; |
bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
lost@l-w.ca
parents:
43
diff
changeset
|
96 } |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
97 lw_free(line); |
40
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
98 if (lc == 0) |
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
99 lc = 1; |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
100 continue; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
101 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
102 debug_message(as, 75, "Read line: %s", line); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
103 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
104 cl = lw_alloc(sizeof(line_t)); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
105 memset(cl, 0, sizeof(line_t)); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
106 cl -> outputl = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
107 cl -> linespec = lw_strdup(input_curspec(as)); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
108 cl -> prev = as -> line_tail; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
109 cl -> insn = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
110 cl -> as = as; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
111 cl -> inmod = as -> inmod; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
112 cl -> csect = as -> csect; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
113 cl -> pragmas = as -> pragmas; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
114 cl -> context = as -> context; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
115 cl -> ltext = lw_strdup(line); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
116 cl -> soff = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
117 cl -> dshow = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
118 cl -> dsize = 0; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
119 cl -> dptr = NULL; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
120 cl -> isbrpt = 0; |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
121 cl -> dlen = 0; |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
122 as -> cl = cl; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
123 if (!as -> line_tail) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
124 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
125 as -> line_head = cl; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
126 cl -> addr = lw_expr_build(lw_expr_type_int, 0); |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
127 cl -> daddr = lw_expr_build(lw_expr_type_int, 0); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
128 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
129 else |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
130 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
131 lw_expr_t te; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
132 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
133 cl -> lineno = as -> line_tail -> lineno + 1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
134 as -> line_tail -> next = cl; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
135 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
136 // set the line address |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
137 te = lw_expr_build(lw_expr_type_special, lwasm_expr_linelen, cl -> prev); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
138 cl -> addr = lw_expr_build(lw_expr_type_oper, lw_expr_oper_plus, cl -> prev -> addr, te); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
139 lw_expr_destroy(te); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
140 lwasm_reduce_expr(as, cl -> addr); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
141 // lw_expr_simplify(cl -> addr, as); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
142 |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
143 // set the data address if relevant |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
144 te = lw_expr_build(lw_expr_type_special, lwasm_expr_linedlen, cl -> prev); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
145 cl -> daddr = lw_expr_build(lw_expr_type_oper, lw_expr_oper_plus, cl -> prev -> daddr, te); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
146 lw_expr_destroy(te); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
147 lwasm_reduce_expr(as, cl -> daddr); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
148 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
149 // carry DP value forward |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
150 cl -> dpval = cl -> prev -> dpval; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
151 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
152 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
153 if (!lc && strcmp(cl -> linespec, cl -> prev -> linespec)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
154 lc = 1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
155 if (lc) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
156 { |
40
d96037ea0b80
Fixed line number counting being broken by macros
lost@l-w.ca
parents:
2
diff
changeset
|
157 cl -> lineno = lc; |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
158 lc = 0; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
159 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
160 as -> line_tail = cl; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
161 // blank lines don't count for anything |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
162 // except a local symbol context break |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
163 if (!*line) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
164 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
165 as -> context = lwasm_next_context(as); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
166 goto nextline; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
167 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
168 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
169 // skip comments |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
170 // commends do not create a context break |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
171 if (*line == '*' || *line == ';' || *line == '#') |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
172 goto nextline; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
173 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
174 p1 = line; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
175 if (isdigit(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
176 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
177 // skip line number |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
178 while (*p1 && isdigit(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
179 p1++; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
180 if (!*p1 && !isspace(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
181 p1 = line; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
182 else if (*p1 && !isspace(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
183 p1 = line; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
184 else if (*p1 && isspace(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
185 p1++; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
186 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
187 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
188 // blank line - context break |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
189 if (!*p1) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
190 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
191 as -> context = lwasm_next_context(as); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
192 goto nextline; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
193 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
194 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
195 // comment - no context break |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
196 if (*p1 == '*' || *p1 == ';' || *p1 == '#') |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
197 goto nextline; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
198 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
199 if (isspace(*p1)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
200 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
201 for (; *p1 && isspace(*p1); p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
202 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
203 stspace = 1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
204 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
205 else |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
206 stspace = 0; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
207 |
85 | 208 // if (*p1 == '*' || *p1 == ';' || *p1 == '#') |
209 // goto nextline; | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
210 if (!*p1) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
211 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
212 // nothing but whitespace - context break |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
213 as -> context = lwasm_next_context(as); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
214 goto nextline; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
215 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
216 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
217 // find the end of the first token |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
218 for (tok = p1; *p1 && !isspace(*p1) && *p1 != ':' && *p1 != '='; p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
219 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
220 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
221 if (*p1 == ':' || *p1 == '=' || stspace == 0) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
222 { |
85 | 223 if (*tok == '*' || *tok == ';' || *tok == '#') |
224 goto nextline; | |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
225 // have a symbol here |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
226 sym = lw_strndup(tok, p1 - tok); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
227 if (*p1 == ':') |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
228 p1++; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
229 for (; *p1 && isspace(*p1); p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
230 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
231 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
232 if (*p1 == '=') |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
233 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
234 tok = p1++; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
235 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
236 else |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
237 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
238 for (tok = p1; *p1 && !isspace(*p1); p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
239 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
240 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
241 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
242 if (sym && strcmp(sym, "!") == 0) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
243 cl -> isbrpt = 1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
244 else if (sym) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
245 cl -> sym = lw_strdup(sym); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
246 cl -> symset = 0; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
247 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
248 // tok points to the opcode for the line or NUL if none |
59
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
249 |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
250 // if the first two chars of the opcode are "??", that's |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
251 // a flag to inhibit macro expansion |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
252 if (*tok && tok[0] == '?' && tok[1] == '?') |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
253 { |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
254 nomacro = 1; |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
255 tok += 2; |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
256 } |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
257 if (*tok) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
258 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
259 // look up operation code |
93
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
260 lw_free(sym); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
261 sym = lw_strndup(tok, p1 - tok); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
262 for (; *p1 && isspace(*p1); p1++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
263 /* do nothing */ ; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
264 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
265 for (opnum = 0; instab[opnum].opcode; opnum++) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
266 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
267 if (!strcasecmp(instab[opnum].opcode, sym)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
268 break; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
269 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
270 |
107
b3557f8325f7
Fixed bug with symbol on a line with a comment not getting registered
lost@l-w.ca
parents:
93
diff
changeset
|
271 // have to go to linedone here in case there was a symbol |
b3557f8325f7
Fixed bug with symbol on a line with a comment not getting registered
lost@l-w.ca
parents:
93
diff
changeset
|
272 // to register on this line |
85 | 273 if (instab[opnum].opcode == NULL && (*tok == '*' || *tok == ';' || *tok == '#')) |
107
b3557f8325f7
Fixed bug with symbol on a line with a comment not getting registered
lost@l-w.ca
parents:
93
diff
changeset
|
274 goto linedone; |
85 | 275 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
276 // p1 points to the start of the operand |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
277 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
278 // if we're inside a macro definition and not at ENDM, |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
279 // add the line to the macro definition and continue |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
280 if (as -> inmacro && !(instab[opnum].flags & lwasm_insn_endm)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
281 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
282 add_macro_line(as, line); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
283 goto linedone; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
284 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
285 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
286 // if skipping a condition and the operation code doesn't |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
287 // operate within a condition (not a conditional) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
288 // do nothing |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
289 if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond)) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
290 goto linedone; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
291 |
59
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
292 if (!nomacro && (as -> pragmas & PRAGMA_SHADOW)) |
53
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
293 { |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
294 // check for macros even if they shadow real operations |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
295 // NOTE: "ENDM" cannot be shadowed |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
296 if (expand_macro(as, cl, &p1, sym) == 0) |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
297 { |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
298 // a macro was expanded here |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
299 goto linedone; |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
300 } |
cb4efc47ce9d
Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
lost@l-w.ca
parents:
49
diff
changeset
|
301 } |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
302 if (instab[opnum].opcode == NULL) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
303 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
304 cl -> insn = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
305 if (*tok != ';' && *tok != '*') |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
306 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
307 // bad opcode; check for macro here |
59
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
308 // but don't expand it if "nomacro" is in effect |
1830faeef332
Added ?? prefix for opcode to inhibit macro expansion
lost@l-w.ca
parents:
53
diff
changeset
|
309 if (nomacro || expand_macro(as, cl, &p1, sym) != 0) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
310 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
311 // macro expansion failed |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
312 if (expand_struct(as, cl, &p1, sym) != 0) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
313 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
314 // structure expansion failed |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
315 lwasm_register_error(as, cl, "Bad opcode"); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
316 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
317 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
318 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
319 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
320 else |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
321 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
322 cl -> insn = opnum; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
323 // no parse func means operand doesn't matter |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
324 if (instab[opnum].parse) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
325 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
326 if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
327 { |
43
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
328 struct line_expr_s *le; |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
329 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
330 cl -> len = -1; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
331 // call parse function |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
332 debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
333 (instab[opnum].parse)(as, cl, &p1); |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
334 if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
335 { |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
336 if (cl -> len == 0) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
337 cl -> len = cl -> dlen; |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
338 else |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
339 cl -> dlen = cl -> len; |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
340 } |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
341 |
147
9cf1796259b2
Fixed segfault in fcb,fdb,fqb with empty operands
lost@l-w.ca
parents:
142
diff
changeset
|
342 if (*p1 && !isspace(*p1) && !(cl -> err)) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
343 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
344 // flag bad operand error |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
345 lwasm_register_error(as, cl, "Bad operand (%s)", p1); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
346 } |
43
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
347 |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
348 /* do a reduction on the line expressions to avoid carrying excessive expression baggage if not needed */ |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
349 as -> cl = cl; |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
350 |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
351 // simplify address |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
352 lwasm_reduce_expr(as, cl -> addr); |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
353 |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
354 // simplify each expression |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
355 for (le = cl -> exprs; le; le = le -> next) |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
356 lwasm_reduce_expr(as, le -> expr); |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
357 |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
358 /* try resolving the instruction as well */ |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
359 if (cl -> insn >= 0 && instab[cl -> insn].resolve) |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
360 { |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
361 (instab[cl -> insn].resolve)(as, cl, 0); |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
362 if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
363 { |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
364 if (cl -> len == 0) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
365 cl -> len = cl -> dlen; |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
366 else |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
367 cl -> dlen = cl -> len; |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
368 } |
43
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
369 } |
18b49cf10ae9
Added an instruction reduction immediately after instruction parsing to minimize memory footprint and expression complexity
lost@l-w.ca
parents:
40
diff
changeset
|
370 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
371 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
372 else if (as -> instruct == 1) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
373 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
374 lwasm_register_error(as, cl, "Bad operand (%s)", p1); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
375 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
376 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
377 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
378 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
379 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
380 linedone: |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
381 if (!as -> skipcond && !as -> inmacro) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
382 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
383 if (cl -> sym && cl -> symset == 0) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
384 { |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
385 debug_message(as, 50, "Register symbol %s: %s", cl -> sym, lw_expr_print(cl -> addr)); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
386 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
387 // register symbol at line address |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
388 if (instab[cl -> insn].flags & lwasm_insn_setdata) |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
389 { |
142
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
390 if (!register_symbol(as, cl, cl -> sym, cl -> daddr, symbol_flag_none)) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
391 { |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
392 // symbol error |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
393 // lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
394 } |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
395 } |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
396 else |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
397 { |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
398 if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none)) |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
399 { |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
400 // symbol error |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
401 // lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); |
697bc543368c
Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents:
107
diff
changeset
|
402 } |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
403 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
404 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
405 debug_message(as, 40, "Line address: %s", lw_expr_print(cl -> addr)); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
406 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
407 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
408 nextline: |
93
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
409 if (sym) |
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
410 lw_free(sym); |
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
411 sym = NULL; |
5bf9edabd661
Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents:
85
diff
changeset
|
412 |
0
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
413 lw_free(line); |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
414 |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
415 // if we've hit the "end" bit, finish out |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
416 if (as -> endseen) |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
417 return; |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
418 } |
2c24602be78f
Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff
changeset
|
419 } |