annotate lwasm/pseudo.c @ 377:67373a053c49

Add ?rts target for branch instructions Add a ?rts target for branch instructions, which brances to the nearest RTS or inverts the branch logic to branch around a generated RTS. Activated by a pragma "qrts". Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 20:50:02 -0600
parents 8e25147c2aa8
children d791d47afc48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 pseudo.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 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
4
2c24602be78f 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 This file is part of LWASM.
2c24602be78f 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
2c24602be78f 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 LWASM 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
8 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
9 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
10 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
11
2c24602be78f 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 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
13 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
14 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
15 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
16
2c24602be78f 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 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
18 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
19
2c24602be78f 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
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
22 #include "lwasm.h"
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
23
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
24 #include <stdio.h>
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
25 #include <ctype.h>
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 2
diff changeset
26 #include <string.h>
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
27 #include <stdlib.h>
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
28 #include <time.h>
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
29
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
30 #include <lw_alloc.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
31
2c24602be78f 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 "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
33 #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
34
2c24602be78f 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 #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
36
374
8e25147c2aa8 Clean up various "externs"
William Astle <lost@l-w.ca>
parents: 370
diff changeset
37 void register_struct_entry(asmstate_t *as, line_t *l, int size, structtab_t *ss);
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
38
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
39 // for "dts"
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
40 PARSEFUNC(pseudo_parse_dts)
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
41 {
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
42 time_t tp;
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
43 char *t;
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
44
135
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
45 skip_operand(p);
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
46 l -> len = 0;
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
47
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
48 tp = time(NULL);
281
cb24ffb23f7c Make DTS not have problems if used multiple times.
William Astle <lost@l-w.ca>
parents: 280
diff changeset
49 t = l ->lstr = lw_strdup(ctime(&tp));
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
50
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
51 while (*t)
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
52 {
233
7887a48b74df Remove stray \n from dts
William Astle <lost@l-w.ca>
parents: 225
diff changeset
53 if (*t == '\n')
7887a48b74df Remove stray \n from dts
William Astle <lost@l-w.ca>
parents: 225
diff changeset
54 break;
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
55 t++;
135
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
56 l -> len += 1;
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
57 }
280
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
58
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
59 }
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
60
135
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
61 EMITFUNC(pseudo_emit_dts)
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
62 {
280
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
63 char *t;
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
64 int i;
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
65
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
66 for (t = l -> lstr, i = 0; i < l -> len; i++, t++)
4370370f38d1 Correct CRC problems with DTS pseudo op
William Astle <lost@l-w.ca>
parents: 266
diff changeset
67 lwasm_emit(l, *t);
135
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
68 }
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
69
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
70 // for "dtb"
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
71 PARSEFUNC(pseudo_parse_dtb)
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
72 {
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
73 skip_operand(p);
135
fe117454a1e7 Adjustments to dts/dtb
lost@l-w.ca
parents: 133
diff changeset
74 l -> len = 6;
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
75 }
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
76
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
77 EMITFUNC(pseudo_emit_dtb)
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
78 {
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
79 time_t tp;
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
80 struct tm *t;
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
81
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
82 tp = time(NULL);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
83 t = localtime(&tp);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
84
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
85 lwasm_emit(l, t -> tm_year);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
86 lwasm_emit(l, t -> tm_mon + 1);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
87 lwasm_emit(l, t -> tm_mday);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
88 lwasm_emit(l, t -> tm_hour);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
89 lwasm_emit(l, t -> tm_min);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
90 lwasm_emit(l, t -> tm_sec);
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
91 }
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
92
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
93 // for "end"
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
94 PARSEFUNC(pseudo_parse_end)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
95 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
96 lw_expr_t 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
97
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
98 as -> endseen = 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
99 l -> len = 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
2c24602be78f 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 if (as -> output_format != OUTPUT_DECB)
2c24602be78f 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 {
2c24602be78f 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 skip_operand(p);
2c24602be78f 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 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
105 }
2c24602be78f 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
2c24602be78f 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 if (!**p)
2c24602be78f 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 {
2c24602be78f 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 addr = lw_expr_build(lw_expr_type_int, 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
110 }
2c24602be78f 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 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
112 {
2c24602be78f 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 addr = lwasm_parse_expr(as, p);
2c24602be78f 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 }
2c24602be78f 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 if (!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
116 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
117 lwasm_register_error(as, as->cl, E_EXPRESSION_BAD);
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
118 addr = lw_expr_build(lw_expr_type_int, 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 }
2c24602be78f 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 lwasm_save_expr(l, 0, 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
121 }
2c24602be78f 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
2c24602be78f 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 EMITFUNC(pseudo_emit_end)
2c24602be78f 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 lw_expr_t 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
126
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
127 addr = lwasm_fetch_expr(l, 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 if (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
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 if (!lw_expr_istype(addr, lw_expr_type_int))
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
132 lwasm_register_error(as, l, E_EXEC_ADDRESS);
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
133 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
134 as -> execaddr = lw_expr_intval(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
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 as -> endseen = 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
137 }
2c24602be78f 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
2c24602be78f 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 PARSEFUNC(pseudo_parse_fcb)
2c24602be78f 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 {
2c24602be78f 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 int i = 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
142 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
143
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
144 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
145 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
146 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
147 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
148 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
149 lwasm_register_error2(as, l, E_EXPRESSION_BAD, "(#%d)", i);
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
150 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
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 lwasm_save_expr(l, i++, e);
2c24602be78f 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 (**p != ',')
2c24602be78f 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 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
155 (*p)++;
2c24602be78f 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 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
157
2c24602be78f 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 l -> len = i;
2c24602be78f 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
2c24602be78f 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 EMITFUNC(pseudo_emit_fcb)
2c24602be78f 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 {
2c24602be78f 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 int i;
2c24602be78f 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 lw_expr_t e;
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
165 // int v;
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
166
2c24602be78f 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 for (i = 0; i < l -> len; i++)
2c24602be78f 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 e = lwasm_fetch_expr(l, i);
2c24602be78f 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 lwasm_emitexpr(l, e, 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
171 }
2c24602be78f 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 }
2c24602be78f 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 PARSEFUNC(pseudo_parse_fdb)
2c24602be78f 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 {
2c24602be78f 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 int i = 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
177 lw_expr_t e;
2c24602be78f 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
2c24602be78f 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 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
180 {
2c24602be78f 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 e = lwasm_parse_expr(as, p);
2c24602be78f 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 if (!e)
2c24602be78f 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 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
184 lwasm_register_error2(as, l, E_EXPRESSION_BAD, "(#%d)", i);
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
185 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
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 lwasm_save_expr(l, i++, e);
2c24602be78f 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 if (**p != ',')
2c24602be78f 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 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
190 (*p)++;
2c24602be78f 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 }
2c24602be78f 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
2c24602be78f 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 l -> len = i * 2;
2c24602be78f 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
2c24602be78f 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 EMITFUNC(pseudo_emit_fdb)
2c24602be78f 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 {
2c24602be78f 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 int i;
2c24602be78f 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 lw_expr_t e;
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
200 // int v;
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
201
2c24602be78f 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 for (i = 0; i < (l -> len)/2; i++)
2c24602be78f 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 {
2c24602be78f 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 e = lwasm_fetch_expr(l, i);
2c24602be78f 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 lwasm_emitexpr(l, e, 2);
2c24602be78f 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 }
2c24602be78f 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 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
208
218
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
209 PARSEFUNC(pseudo_parse_fdbs)
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
210 {
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
211 int i = 0;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
212 lw_expr_t e;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
213
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
214 for (;;)
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
215 {
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
216 e = lwasm_parse_expr(as, p);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
217 if (!e)
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
218 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
219 lwasm_register_error2(as, l, E_EXPRESSION_BAD, "(#%d)", i);
218
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
220 break;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
221 }
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
222 lwasm_save_expr(l, i++, e);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
223 if (**p != ',')
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
224 break;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
225 (*p)++;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
226 }
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
227
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
228 l -> len = i * 2;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
229 }
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
230
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
231 EMITFUNC(pseudo_emit_fdbs)
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
232 {
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
233 int i;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
234 lw_expr_t e;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
235 lw_expr_t t;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
236 lw_expr_t t2;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
237 // int v;
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
238
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
239 for (i = 0; i < (l -> len)/2; i++)
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
240 {
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
241 e = lwasm_fetch_expr(l, i);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
242 t = lw_expr_build(lw_expr_type_int, 256);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
243 t2 = lw_expr_build(lw_expr_type_oper, lw_expr_oper_divide, e, t);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
244 lwasm_reduce_expr(as, t2);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
245 lw_expr_destroy(t);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
246 lwasm_emitexpr(l, e, 1);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
247 lwasm_emitexpr(l, t2, 1);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
248 lw_expr_destroy(t2);
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
249 }
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
250 }
b0c9df865b25 Add FDBS pseudo op.
William Astle <lost@l-w.ca>
parents: 217
diff changeset
251
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
252 PARSEFUNC(pseudo_parse_fqb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
253 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
254 int i = 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
255 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
256
2c24602be78f 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 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
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 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
260 if (!e)
2c24602be78f 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 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
262 lwasm_register_error2(as, l, E_EXPRESSION_BAD, "(#%d)", i);
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
263 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
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 lwasm_save_expr(l, i++, e);
2c24602be78f 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 if (**p != ',')
2c24602be78f 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 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
268 (*p)++;
2c24602be78f 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
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
271 l -> len = i * 4;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
272 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
273
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
274 EMITFUNC(pseudo_emit_fqb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
275 {
2c24602be78f 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 int i;
2c24602be78f 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 lw_expr_t e;
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 0
diff changeset
278 // int v;
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
279
2c24602be78f 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 for (i = 0; i < (l -> len)/4; i++)
2c24602be78f 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 e = lwasm_fetch_expr(l, i);
2c24602be78f 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 lwasm_emitexpr(l, e, 4);
2c24602be78f 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
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
287 static int cstringlen(asmstate_t *as, line_t *ln, char **p, char delim)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
288 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
289 int l = 0;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
290 char *str = NULL;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
291 int blen = 0;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
292 int bsize = 0;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
293
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
294 if (!(as -> pragmas & PRAGMA_CESCAPES))
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
295 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
296 for (; **p && **p != delim; (*p)++)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
297 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
298 l++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
299 if (blen >= bsize)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
300 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
301 str = lw_realloc(str, bsize + 32);
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
302 bsize++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
303 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
304 str[blen++] = **p;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
305 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
306 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
307 else
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
308 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
309 while (**p && **p != delim)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
310 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
311 int wch = **p;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
312 if (**p == '\\')
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
313 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
314 /* escape sequence */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
315
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
316 (*p)++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
317 if (!**p)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
318 break;
76
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
319
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
320 switch (**p)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
321 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
322 /* octal sequence or NUL */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
323 /* skip the "0", then skip up to two more digits */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
324 case '0':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
325 case '1':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
326 case '2':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
327 case '3':
76
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
328 wch = **p;
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
329 wch -= 0x30;
76
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
330 if ((*p)[1] >= '0' && (*p)[1] < '8')
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
331 {
76
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
332 (*p)++;
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
333 wch *= 8;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
334 wch += **p - 0x30;
76
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
335 }
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
336 if ((*p)[1] >= '0' && (*p)[1] < '8')
da74ccf4278c Fixed bug parsing octal constants under cescapes pragma
lost@l-w.ca
parents: 75
diff changeset
337 {
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
338 (*p)++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
339 wch *= 8;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
340 wch += **p -0x30;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
341 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
342 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
343
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
344 /* hexadecimal value */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
345 case 'x':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
346 (*p)++; // ignore "x"
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
347 wch = 0;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
348 if (**p) // skip digit 1
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
349 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
350 wch = **p - 0x30;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
351 if (wch > 9)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
352 wch -= 7;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
353 if (wch > 9)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
354 wch -= 32;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
355 (*p)++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
356 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
357 if (**p)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
358 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
359 int i;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
360 i = **p - 0x30;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
361 if (i > 9)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
362 i -= 7;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
363 if (i > 9)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
364 i -= 32;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
365 wch = wch * 16 + i;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
366 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
367 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
368
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
369 case 'a':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
370 wch = 7;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
371 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
372
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
373 case 'b':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
374 wch = 8;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
375 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
376
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
377 case 't':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
378 wch = 9;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
379 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
380
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
381 case 'n':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
382 wch = 10;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
383 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
384
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
385 case 'v':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
386 wch = 11;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
387 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
388
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
389 case 'f':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
390 wch = 12;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
391 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
392
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
393 case 'r':
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
394 wch = 13;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
395
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
396 /* everything else represents itself */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
397 default:
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
398 break;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
399 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
400 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
401 /* now "wch" is the character to write out */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
402 l++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
403 (*p)++;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
404 if (blen >= bsize)
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
405 {
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
406 str = lw_realloc(str, bsize + 32);
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
407 bsize += 32;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
408 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
409 str[blen++] = wch;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
410 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
411 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
412 /* do something with the string here */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
413 /* l is the string length, str is the string itself */
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
414 ln -> lstr = str;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
415 return l;
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
416 }
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
417
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
418 PARSEFUNC(pseudo_parse_fcc)
2c24602be78f 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 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
420 char delim;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
421 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
422
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
423 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
424 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
425 lwasm_register_error(as, l, E_OPERAND_BAD);
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
426 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
427 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
428
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
429 delim = **p;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
430 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
431
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
432
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
433 i = cstringlen(as, l, p, delim);
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
434
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
435 if (**p != delim)
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
436 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
437 lwasm_register_error(as, l, E_OPERAND_BAD);
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
438 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
439 }
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
440 (*p)++;
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
441 l -> len = i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
442 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
443
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
444 EMITFUNC(pseudo_emit_fcc)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
445 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
446 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
447
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
448 for (i = 0; i < l -> len; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
449 lwasm_emit(l, l -> lstr[i]);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
450 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
451
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
452 PARSEFUNC(pseudo_parse_fcs)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
453 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
454 char delim;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
455 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
456
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
457 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
458 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
459 lwasm_register_error(as, l, E_OPERAND_BAD);
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
460 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
461 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
462
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
463 delim = **p;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
464 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
465
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
466 i = cstringlen(as, l, p, delim);
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
467
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
468 if (**p != delim)
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
469 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
470 lwasm_register_error(as, l, E_OPERAND_BAD);
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
471 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
472 }
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
473 (*p)++;
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
474 l -> len = i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
475 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
476
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
477 EMITFUNC(pseudo_emit_fcs)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
478 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
479 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
480
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
481 for (i = 0; i < l -> len - 1; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
482 lwasm_emit(l, l -> lstr[i]);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
483 lwasm_emit(l, l -> lstr[i] | 0x80);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
484 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
485
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
486 PARSEFUNC(pseudo_parse_fcn)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
487 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
488 char delim;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
489 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
490
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
491 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
492 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
493 lwasm_register_error(as, l, E_OPERAND_BAD);
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
494 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
495 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
496
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
497 delim = **p;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
498 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
499
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
500 i = cstringlen(as, l, p, delim);
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
501
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
502 if (**p != delim)
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
503 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
504 lwasm_register_error(as, l, E_OPERAND_BAD);
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
505 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
506 }
75
3d50022e16e7 Restored pragma cescapes functionality
lost@l-w.ca
parents: 63
diff changeset
507 (*p)++;
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
508 l -> len = i + 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
509 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
510
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
511 EMITFUNC(pseudo_emit_fcn)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
512 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
513 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
514
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
515 for (i = 0; i < (l -> len - 1); i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
516 lwasm_emit(l, l -> lstr[i]);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
517 lwasm_emit(l, 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
518 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
519
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
520 PARSEFUNC(pseudo_parse_rmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
521 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
522 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
523
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
524 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
525 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
526 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
527 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
528 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
529
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
530 l -> lint = 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
531 if (as -> instruct)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
532 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
533 lwasm_reduce_expr(as, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
534 if (!lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
535 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
536 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
537 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
538 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
539 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
540 int e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
541 e = lw_expr_intval(expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
542 register_struct_entry(as, l, e, 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
543 l -> len = 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
544 l -> lint = 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
545 l -> symset = 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
546 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
547 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
548 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
549 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
550 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
551 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
552 l -> dlen = -1;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
553 l -> len = 0;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
554 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
555 }
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
556 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
557 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
558
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
559 RESOLVEFUNC(pseudo_resolve_rmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
560 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
561 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
562
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
563 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
564 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
565
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
566 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
567 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
568 if (l -> dlen >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
569 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
570 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
571 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
572 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
573 if (l -> len >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
574 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
575 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
576
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
577 expr = lwasm_fetch_expr(l, 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
578
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
579 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
580 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
581 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
582 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
583 lwasm_register_error2(as, l, E_NEGATIVE_RESERVATION, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
584 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
585 l -> dlen = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
586 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
587 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
588 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
589 l -> dlen = lw_expr_intval(expr);
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
590 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
591 l -> len = lw_expr_intval(expr);
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
592 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
593 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
594
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
595 EMITFUNC(pseudo_emit_rmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
596 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
597 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
598 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
599
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
600 if (l -> len < 0 || l -> dlen < 0)
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
601 lwasm_register_error2(as, l, E_EXPRESSION_NOT_CONST, "%d %d", l -> len, l -> 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
602 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
603
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
604 PARSEFUNC(pseudo_parse_rmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
605 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
606 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
607
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
608 l -> lint = 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
609 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
610 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
611 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
612 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
613 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
614
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
615 if (as -> instruct)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
616 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
617 lwasm_reduce_expr(as, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
618 if (!lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
619 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
620 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
621 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
622 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
623 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
624 int e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
625 e = lw_expr_intval(expr) * 2;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
626 register_struct_entry(as, l, e, 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
627 l -> len = 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
628 l -> symset = 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
629 l -> lint = 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
630 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
631 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
632 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
633 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
634 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
635 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
636 l -> dlen = -1;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
637 l -> len = 0;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
638 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
639 }
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
640 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
641 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
642
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
643 RESOLVEFUNC(pseudo_resolve_rmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
644 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
645 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
646
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
647 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
648 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
649
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
650 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
651 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
652 if (l -> dlen >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
653 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
654 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
655 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
656 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
657 if (l -> len >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
658 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
659 }
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
660
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
661 expr = lwasm_fetch_expr(l, 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
662
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
663 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
664 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
665 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
666 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
667 lwasm_register_error2(as, l, E_NEGATIVE_RESERVATION, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
668 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
669 l -> dlen = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
670 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
671 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
672 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
673 l -> dlen = lw_expr_intval(expr) * 2;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
674 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
675 l -> len = lw_expr_intval(expr) * 2;
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
676 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
677 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
678
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
679 EMITFUNC(pseudo_emit_rmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
680 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
681 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
682 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
683
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
684 if (l -> len < 0 || l -> dlen < 0)
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
685 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
686 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
687
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
688
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
689 PARSEFUNC(pseudo_parse_rmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
690 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
691 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
692
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
693 l -> lint = 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
694 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
695 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
696 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
697 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
698 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
699 if (as -> instruct)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
700 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
701 lwasm_reduce_expr(as, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
702 if (!lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
703 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
704 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
705 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
706 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
707 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
708 int e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
709 e = lw_expr_intval(expr) * 4;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
710 register_struct_entry(as, l, e, 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
711 l -> len = 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
712 l -> symset = 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
713 l -> lint = 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
714 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
715 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
716 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
717 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
718 if (as -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
719 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
720 l -> dlen = -1;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
721 l -> len = 0;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
722 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
723 }
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
724 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
725 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
726
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
727 RESOLVEFUNC(pseudo_resolve_rmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
728 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
729 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
730
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
731 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
732 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
733
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
734 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
735 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
736 if (l -> dlen >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
737 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
738 }
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
739 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
740 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
741 if (l -> len >= 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
742 return;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
743 }
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
744
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
745 expr = lwasm_fetch_expr(l, 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
746
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
747 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
748 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
749 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
750 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
751 lwasm_register_error2(as, l, E_NEGATIVE_RESERVATION, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
752 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
753 l -> dlen = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
754 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
755 }
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
756 if (l -> inmod)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
757 l -> dlen = lw_expr_intval(expr) * 4;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
758 else
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
759 l -> len = lw_expr_intval(expr) * 4;
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
760 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
761 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
762
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
763 EMITFUNC(pseudo_emit_rmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
764 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
765 if (l -> lint)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
766 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
767
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
768 if (l -> len < 0 || l -> dlen < 0)
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
769 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
770 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
771
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
772
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
773 PARSEFUNC(pseudo_parse_zmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
774 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
775 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
776
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
777 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
778 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
779 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
780 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
781 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
782
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
783 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
784 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
785
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
786 RESOLVEFUNC(pseudo_resolve_zmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
787 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
788 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
789
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
790 if (l -> len >= 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
791 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
792
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
793 expr = lwasm_fetch_expr(l, 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
794
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
795 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
796 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
797 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
798 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
799 lwasm_register_error2(as, l, E_NEGATIVE_BLOCKSIZE, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
800 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
801 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
802 }
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
803 l -> len = lw_expr_intval(expr) * 4;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
804 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
805 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
806
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
807 EMITFUNC(pseudo_emit_zmq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
808 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
809 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
810
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
811 if (l -> len < 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
812 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
813 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
814 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
815 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
816
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
817 for (i = 0; i < l -> len; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
818 lwasm_emit(l, 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
819 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
820
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
821
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
822 PARSEFUNC(pseudo_parse_zmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
823 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
824 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
825
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
826 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
827 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
828 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
829 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
830 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
831
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
832 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
833 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
834
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
835 RESOLVEFUNC(pseudo_resolve_zmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
836 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
837 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
838
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
839 if (l -> len >= 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
840 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
841
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
842 expr = lwasm_fetch_expr(l, 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
843
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
844 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
845 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
846 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
847 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
848 lwasm_register_error2(as, l, E_NEGATIVE_BLOCKSIZE, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
849 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
850 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
851 }
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
852 l -> len = lw_expr_intval(expr) * 2;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
853 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
854 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
855
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
856 EMITFUNC(pseudo_emit_zmd)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
857 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
858 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
859
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
860 if (l -> len < 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
861 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
862 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
863 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
864 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
865
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
866 for (i = 0; i < l -> len; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
867 lwasm_emit(l, 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
868 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
869
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
870 PARSEFUNC(pseudo_parse_zmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
871 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
872 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
873
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
874 expr = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
875 if (!expr)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
876 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
877 lwasm_register_error(as, l, E_EXPRESSION_BAD);
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
878 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
879
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
880 lwasm_save_expr(l, 0, expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
881 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
882
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
883 RESOLVEFUNC(pseudo_resolve_zmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
884 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
885 lw_expr_t expr;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
886
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
887 if (l -> len >= 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
888 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
889
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
890 expr = lwasm_fetch_expr(l, 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
891
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
892 if (lw_expr_istype(expr, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
893 {
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
894 if (lw_expr_intval(expr) < 0)
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
895 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
896 lwasm_register_error2(as, l, E_NEGATIVE_BLOCKSIZE, "(%d)", lw_expr_intval(expr));
159
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
897 l -> len = 0;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
898 return;
8967eb907324 Trap negative sizes for [rz]m[bdq] and flag error
lost@l-w.ca
parents: 147
diff changeset
899 }
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
900 l -> len = lw_expr_intval(expr);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
901 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
902 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
903
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
904 EMITFUNC(pseudo_emit_zmb)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
905 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
906 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
907
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
908 if (l -> len < 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
909 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
910 lwasm_register_error(as, l, E_EXPRESSION_NOT_CONST);
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
911 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
912 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
913
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
914 for (i = 0; i < l -> len; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
915 lwasm_emit(l, 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
916 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
917
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
918 PARSEFUNC(pseudo_parse_org)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
919 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
920 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
921
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
922 l -> len = 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
923
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
924 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
925 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
926 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
927 lwasm_register_error(as, l, E_OPERAND_BAD);
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
928 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
929 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
930
142
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
931 lw_expr_destroy(l -> daddr);
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
932 l -> daddr = e;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
933
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
934 if (l -> inmod == 0)
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
935 {
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
936 lw_expr_destroy(l -> addr);
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
937 l -> addr = e;
697bc543368c Implement distinction between . and * for OS9 modules
lost@l-w.ca
parents: 135
diff changeset
938 }
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
939 l -> len = 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
940 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
941
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
942 PARSEFUNC(pseudo_parse_equ)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
943 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
944 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
945
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
946 l -> len = 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
947
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
948 if (!(l -> 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
949 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
950 lwasm_register_error(as, l, E_SYMBOL_MISSING);
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
951 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
952 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
953
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
954 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
955 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
956 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
957 lwasm_register_error(as, l, E_OPERAND_BAD);
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
958 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
959 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
960
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
961 register_symbol(as, l, l -> sym, e, symbol_flag_none);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
962 l -> symset = 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
963 l -> dptr = lookup_symbol(as, l, l -> sym);
88
1a1fdfe860d0 Fixed several memory leaks revealed by valgrind
lost@l-w.ca
parents: 84
diff changeset
964 lw_expr_destroy(e);
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
965 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
966
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
967 PARSEFUNC(pseudo_parse_set)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
968 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
969 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
970
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
971 l -> len = 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
972
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
973 if (!(l -> 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
974 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
975 lwasm_register_error(as, l, E_SYMBOL_MISSING);
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
976 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
977 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
978
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
979 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
980 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
981 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
982 lwasm_register_error(as, l, E_OPERAND_BAD);
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
983 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
984 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
985
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
986 register_symbol(as, l, l -> sym, e, symbol_flag_set);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
987 l -> symset = 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
988 l -> dptr = lookup_symbol(as, l, l -> sym);
88
1a1fdfe860d0 Fixed several memory leaks revealed by valgrind
lost@l-w.ca
parents: 84
diff changeset
989 lw_expr_destroy(e);
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
990 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
991
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
992 PARSEFUNC(pseudo_parse_setdp)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
993 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
994 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
995
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
996 l -> len = 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
997
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
998 if (as -> output_format == OUTPUT_OBJ)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
999 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1000 lwasm_register_error(as, l, E_SETDP_INVALID);
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
1001 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
1002 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1003
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1004 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1005 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1006 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1007 lwasm_register_error(as, l, E_OPERAND_BAD);
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
1008 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
1009 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1010
38
7e92484cfbc3 Caused expressions used in setdp and conditionals to be reduced on pass 1
lost@l-w.ca
parents: 10
diff changeset
1011 // try simplifying the expression and see if it turns into an int
7e92484cfbc3 Caused expressions used in setdp and conditionals to be reduced on pass 1
lost@l-w.ca
parents: 10
diff changeset
1012 lwasm_reduce_expr(as, e);
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
1013 if (!lw_expr_istype(e, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1014 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1015 lwasm_register_error(as, l, E_SETDP_NOT_CONST);
88
1a1fdfe860d0 Fixed several memory leaks revealed by valgrind
lost@l-w.ca
parents: 84
diff changeset
1016 lw_expr_destroy(e);
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
1017 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
1018 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1019 l -> dpval = lw_expr_intval(e) & 0xff;
88
1a1fdfe860d0 Fixed several memory leaks revealed by valgrind
lost@l-w.ca
parents: 84
diff changeset
1020 lw_expr_destroy(e);
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
1021 l -> dshow = l -> 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
1022 l -> dsize = 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
1023 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1024
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1025 PARSEFUNC(pseudo_parse_ifp1)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1026 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1027 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1028 l -> hideline = 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
1029
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1030 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1031 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1032 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1033 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1034 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
1035 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1036
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1037 lwasm_register_error2(as, l, W_NOT_SUPPORTED, "%s", "IFP1");
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
1038 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1039
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1040 PARSEFUNC(pseudo_parse_ifp2)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1041 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1042 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1043 l -> hideline = 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
1044
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1045 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1046 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1047 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1048 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1049 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
1050 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1051
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1052 lwasm_register_error2(as, l, W_NOT_SUPPORTED, "%s", "IFP2");
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
1053 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1054
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1055 PARSEFUNC(pseudo_parse_ifeq)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1056 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1057 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1058
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1059 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1060 l -> hideline = 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
1061
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1062 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1063 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1064 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1065 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1066 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
1067 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1068
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1069 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1070 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1071 lwasm_reduce_expr(as, e);
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
1072 if (e && lw_expr_intval(e) != 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
1073 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1074 as -> skipcond = 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
1075 as -> skipcount = 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
1076 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1077 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1078
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1079 PARSEFUNC(pseudo_parse_ifne)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1080 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1081 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1082
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1083 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1084 l -> hideline = 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
1085
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1086 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1087 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1088 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1089 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1090 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
1091 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1092
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1093 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1094 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1095 lwasm_reduce_expr(as, e);
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
1096 if (e && lw_expr_intval(e) == 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
1097 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1098 as -> skipcond = 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
1099 as -> skipcount = 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
1100 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1101 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1102
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1103
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1104 PARSEFUNC(pseudo_parse_ifgt)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1105 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1106 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1107
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1108 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1109 l -> hideline = 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
1110
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1111 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1112 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1113 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1114 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1115 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
1116 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1117
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1118 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1119 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1120 lwasm_reduce_expr(as, e);
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
1121 if (e && lw_expr_intval(e) <= 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
1122 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1123 as -> skipcond = 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
1124 as -> skipcount = 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
1125 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1126 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1127
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1128 PARSEFUNC(pseudo_parse_ifge)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1129 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1130 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1131
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1132 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1133 l -> hideline = 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
1134
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1135 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1136 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1137 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1138 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1139 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
1140 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1141
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1142 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1143 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1144 lwasm_reduce_expr(as, e);
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
1145 if (e && lw_expr_intval(e) < 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
1146 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1147 as -> skipcond = 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
1148 as -> skipcount = 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
1149 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1150 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1151
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1152 PARSEFUNC(pseudo_parse_iflt)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1153 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1154 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1155
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1156 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1157 l -> hideline = 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
1158
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1159 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1160 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1161 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1162 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1163 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
1164 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1165
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1166 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1167 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1168 lwasm_reduce_expr(as, e);
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
1169 if (e && lw_expr_intval(e) >= 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
1170 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1171 as -> skipcond = 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
1172 as -> skipcount = 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
1173 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1174 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1175
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1176 PARSEFUNC(pseudo_parse_ifle)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1177 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1178 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1179
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1180 l -> hideline = 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
1181 l -> len = 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
1182
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1183 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1184 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1185 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1186 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1187 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
1188 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1189
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1190 e = lwasm_parse_cond(as, p);
208
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1191 if (e)
fa835b780ffb Fix crash on conditionals with undefined symbols
William Astle <lost@l-w.ca>
parents: 186
diff changeset
1192 lwasm_reduce_expr(as, e);
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
1193 if (e && lw_expr_intval(e) > 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
1194 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1195 as -> skipcond = 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
1196 as -> skipcount = 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
1197 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1198 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1199
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1200 PARSEFUNC(pseudo_parse_endc)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1201 {
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1202 l -> hideline = 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
1203 l -> len = 0;
145
d6e9cc4484f6 Fixed ENDC to work with comments after it
lost@l-w.ca
parents: 142
diff changeset
1204 skip_operand(p);
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
1205 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1206 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1207 as -> skipcount--;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1208 if (as -> skipcount <= 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
1209 as -> skipcond = 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
1210 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1211 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1212
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1213 PARSEFUNC(pseudo_parse_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
1214 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1215 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1216 l -> hideline = 1;
217
f87c86668d6b Fix handling of comments on ELSE lines
William Astle <lost@l-w.ca>
parents: 208
diff changeset
1217 skip_operand(p);
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
1218
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1219 if (as -> skipmacro)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1220 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
1221
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1222 if (as -> skipcond)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1223 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1224 if (as -> skipcount == 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
1225 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1226 as -> skipcount = 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
1227 as -> skipcond = 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
1228 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1229 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
1230 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1231 as -> skipcond = 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
1232 as -> skipcount = 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
1233 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1234
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1235 PARSEFUNC(pseudo_parse_ifdef)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1236 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1237 char *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
1238 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1239 struct symtabe *s;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1240
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1241 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1242 l -> hideline = 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
1243
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1244 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1245 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1246 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1247 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1248 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
1249 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1250
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
1251 again:
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
1252 for (i = 0; (*p)[i] && !isspace((*p)[i]) && (*p)[i] != '|' && (*p)[i] != '&'; i++)
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
1253 /* 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
1254
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1255 sym = lw_strndup(*p, i);
84
16a72d9b6eb6 Make ifdef work correctly
lost@l-w.ca
parents: 76
diff changeset
1256 (*p) += i;
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
1257
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1258 s = lookup_symbol(as, l, 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
1259
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1260 lw_free(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
1261
133
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1262 if (!s)
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
1263 {
133
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1264 if (**p == '|')
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1265 {
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1266 (*p)++;
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1267 goto again;
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1268 }
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
1269 as -> skipcond = 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
1270 as -> skipcount = 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
1271 }
133
3c1a80c2fb95 ifdef sym1|sym2 now works
lost@l-w.ca
parents: 132
diff changeset
1272 skip_operand(p);
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
1273 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1274
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1275 PARSEFUNC(pseudo_parse_ifndef)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1276 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1277 char *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
1278 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1279 struct symtabe *s;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1280
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1281 l -> len = 0;
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1282 l -> hideline = 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
1283
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1284 if (as -> skipcond && !(as -> skipmacro))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1285 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1286 as -> skipcount++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1287 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1288 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
1289 }
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
1290 for (i = 0; (*p)[i] && !isspace((*p)[i]) && (*p)[i] != '&' && (*p)[i] != '|'; i++)
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
1291 /* 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
1292
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1293 sym = lw_strndup(*p, i);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1294 (*p) += i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1295
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1296 s = lookup_symbol(as, l, 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
1297
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1298 lw_free(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
1299
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1300 if (s)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1301 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1302 as -> skipcond = 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
1303 as -> skipcount = 1;
132
4cf44ff89b08 Added DTS and DTB pseudo ops; initial attempt to allow ifdef SYM1|SYM2
lost@l-w.ca
parents: 114
diff changeset
1304 return;
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
1305 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1306 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1307
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1308 PARSEFUNC(pseudo_parse_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
1309 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1310 lwasm_register_error2(as, l, E_USER_SPECIFIED, "%s", *p);
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
1311 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1312 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1313
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1314 PARSEFUNC(pseudo_parse_warning)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1315 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1316 lwasm_register_error2(as, l, W_USER_SPECIFIED, "%s", *p);
225
823560a8c251 Prevent infinite loop due to warning directive
William Astle <lost@l-w.ca>
parents: 224
diff changeset
1317 l -> len = 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
1318 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1319 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1320
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1321 PARSEFUNC(pseudo_parse_includebin)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1322 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1323 char *fn, *p2;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1324 int delim = 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
1325 FILE *fp;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1326 long flen;
224
3864d96ee8c7 Make unicorns notice referenced files better
William Astle <lost@l-w.ca>
parents: 219
diff changeset
1327 char *rfn;
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
1328
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1329 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1330 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1331 lwasm_register_error(as, l, E_FILENAME_MISSING);
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
1332 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
1333 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1334
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1335 if (**p == '"' || **p == '\'')
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1336 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1337 delim = **p;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1338 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1339
63
74b82202d355 Make for condition clearer
lost@l-w.ca
parents: 62
diff changeset
1340 for (p2 = *p; *p2 && (*p2 != delim); p2++)
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
1341 /* 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
1342 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1343 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
1344 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1345 for (p2 = *p; *p2 && !isspace(*p2); p2++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1346 /* 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
1347 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1348 fn = lw_strndup(*p, p2 - *p);
62
5b10ff307463 Fixed problem with filename handling in includebin
lost@l-w.ca
parents: 58
diff changeset
1349 *p = p2;
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
1350 if (delim && **p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1351 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1352
224
3864d96ee8c7 Make unicorns notice referenced files better
William Astle <lost@l-w.ca>
parents: 219
diff changeset
1353 fp = input_open_standalone(as, fn, &rfn);
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
1354 if (!fp)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1355 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1356 lwasm_register_error(as, l, E_FILE_OPEN);
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
1357 lw_free(fn);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1358 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
1359 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1360
224
3864d96ee8c7 Make unicorns notice referenced files better
William Astle <lost@l-w.ca>
parents: 219
diff changeset
1361 l -> lstr = rfn;
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
1362
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1363 fseek(fp, 0, SEEK_END);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1364 flen = ftell(fp);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1365 fclose(fp);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1366
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1367 l -> len = flen;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1368 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1369
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1370 EMITFUNC(pseudo_emit_includebin)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1371 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1372 FILE *fp;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1373 int 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
1374
349
b62af915c2cc Fix includebin to use binary mode when emitting the contents of the file.
William Astle <lost@l-w.ca>
parents: 281
diff changeset
1375 fp = fopen(l -> lstr, "rb");
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
1376 if (!fp)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1377 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1378 lwasm_register_error2(as, l, E_FILE_OPEN, "%s", "(emit)!");
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
1379 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
1380 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1381
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1382 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
1383 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1384 c = fgetc(fp);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1385 if (c == EOF)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1386 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1387 fclose(fp);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1388 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
1389 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1390 lwasm_emit(l, 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
1391 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1392 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1393
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1394 PARSEFUNC(pseudo_parse_include)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1395 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1396 char *fn, *p2;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1397 char *p3;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1398 int delim = 0;
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 2
diff changeset
1399 int len;
41
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1400 char buf[110];
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1401
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
1402 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1403 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1404 lwasm_register_error(as, l, E_FILENAME_MISSING);
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
1405 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
1406 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1407
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1408 if (**p == '"' || **p == '\'')
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1409 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1410 delim = **p;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1411 (*p)++;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1412
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1413 for (p2 = *p; *p2 && *p2 != delim; p2++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1414 /* 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
1415 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1416 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
1417 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1418 for (p2 = *p; *p2 && !isspace(*p2); p2++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1419 /* 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
1420 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1421 fn = lw_strndup(*p, p2 - *p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1422 (*p) = p2;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1423 if (delim && **p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1424 (*p)++;
41
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1425
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1426 /* add a book-keeping entry for line numbers */
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1427 snprintf(buf, 100, "\001\001SETLINENO %d\n", l -> lineno + 1);
c6b8b455d67f Fix line number sequence after including a file
lost@l-w.ca
parents: 38
diff changeset
1428 input_openstring(as, "INTERNAL", buf);
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
1429
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 2
diff changeset
1430 len = strlen(fn) + 8;
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 2
diff changeset
1431 p3 = lw_alloc(len + 1);
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 2
diff changeset
1432 sprintf(p3, "include:%s", fn);
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1433 as -> fileerr = 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
1434 input_open(as, p3);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1435 lw_free(p3);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1436
219
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1437 if (as -> fileerr == 0)
afd50d6b4113 Add --preprocess option
William Astle <lost@l-w.ca>
parents: 218
diff changeset
1438 l -> hideline = 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
1439 l -> len = 0;
93
5bf9edabd661 Squashed the remaining memory leaks revealed by valgrind
lost@l-w.ca
parents: 88
diff changeset
1440 lw_free(fn);
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
1441 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1442
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1443 PARSEFUNC(pseudo_parse_align)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1444 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1445 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1446 if (!**p)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1447 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1448 lwasm_register_error(as, l, E_OPERAND_BAD);
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
1449 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
1450 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1451
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1452 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1453
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1454 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1455 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1456 lwasm_register_error(as, l, E_OPERAND_BAD);
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
1457 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
1458 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1459
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1460 lwasm_save_expr(l, 0, e);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1461
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1462 if (**p == ',')
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1463 {
114
707eda49ad60 Fix parsing padding argument for align pseudo op
lost@l-w.ca
parents: 93
diff changeset
1464 (*p)++;
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
1465 e = lwasm_parse_expr(as, p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1466 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1467 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
1468 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1469 e = lw_expr_build(lw_expr_type_int, 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
1470 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1471 if (!e)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1472 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1473 lwasm_register_error(as, l, E_PADDING_BAD);
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
1474 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
1475 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1476
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1477 lwasm_save_expr(l, 1, e);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1478 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1479
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1480 RESOLVEFUNC(pseudo_resolve_align)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1481 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1482 lw_expr_t e;
264
346966cffeef Clean up various warnings when building under -Wall
William Astle <lost@l-w.ca>
parents: 251
diff changeset
1483 int align = 1;
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1484 lw_expr_t te;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1485 int a;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1486
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
1487 e = lwasm_fetch_expr(l, 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
1488
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1489 if (lw_expr_istype(e, lw_expr_type_int))
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1490 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1491 align = lw_expr_intval(e);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1492 if (align < 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
1493 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1494 lwasm_register_error(as, l, E_ALIGNMENT_INVALID);
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
1495 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
1496 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1497 }
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1498 else
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
1499 {
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1500 return;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1501 }
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1502
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1503
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1504 te = lw_expr_copy(l -> addr);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1505 as -> exportcheck = 1;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1506 lwasm_reduce_expr(as, te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1507 as -> exportcheck = 0;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1508
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1509 if (lw_expr_istype(te, lw_expr_type_int))
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1510 {
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1511 a = lw_expr_intval(te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1512 }
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1513 else
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1514 {
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1515 a = -1;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1516 }
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1517 lw_expr_destroy(te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1518
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1519 if (a >= 0)
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1520 {
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
1521 if (a % align == 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
1522 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1523 l -> len = 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
1524 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
1525 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1526 l -> len = align - (a % align);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1527 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
1528 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1529 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1530
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1531 EMITFUNC(pseudo_emit_align)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1532 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1533 lw_expr_t e;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1534 int i;
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1535
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1536 if (l -> csect && (l -> csect -> flags & (section_flag_bss | section_flag_constant)))
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1537 return;
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
1538 e = lwasm_fetch_expr(l, 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
1539 for (i = 0; i < l -> len; i++)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1540 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1541 lwasm_emitexpr(l, e, 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
1542 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1543 }
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1544
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1545 PARSEFUNC(pseudo_parse_fill)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1546 {
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1547 lw_expr_t e, e1;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1548 if (!**p)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1549 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1550 lwasm_register_error(as, l, E_OPERAND_BAD);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1551 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1552 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1553
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1554 e1 = lwasm_parse_expr(as, p);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1555 if (**p != ',')
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1556 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1557 lwasm_register_error(as, l, E_OPERAND_BAD);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1558 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1559 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1560 (*p)++;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1561 e = lwasm_parse_expr(as, p);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1562
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1563 if (!e)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1564 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1565 lwasm_register_error(as, l, E_OPERAND_BAD);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1566 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1567 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1568
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1569 lwasm_save_expr(l, 0, e);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1570 lwasm_save_expr(l, 1, e1);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1571
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1572 if (!e1)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1573 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1574 lwasm_register_error(as, l, E_PADDING_BAD);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1575 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1576 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1577 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1578
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1579 RESOLVEFUNC(pseudo_resolve_fill)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1580 {
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1581 lw_expr_t e, te;
264
346966cffeef Clean up various warnings when building under -Wall
William Astle <lost@l-w.ca>
parents: 251
diff changeset
1582 int align = 1;
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1583
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1584 e = lwasm_fetch_expr(l, 0);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1585
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1586 te = lw_expr_copy(e);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1587 as -> exportcheck = 1;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1588 lwasm_reduce_expr(as, te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1589 as -> exportcheck = 0;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1590
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1591 if (lw_expr_istype(te, lw_expr_type_int))
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1592 {
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1593 align = lw_expr_intval(te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1594 if (align < 0)
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1595 {
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1596 lw_expr_destroy(te);
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
1597 lwasm_register_error(as, l, E_FILL_INVALID);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1598 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1599 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1600 }
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1601 else
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1602 {
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1603 lw_expr_destroy(te);
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1604 return;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1605 }
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1606 lw_expr_destroy(te);
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1607
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1608 l -> len = align;
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1609 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1610
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1611 EMITFUNC(pseudo_emit_fill)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1612 {
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1613 lw_expr_t e;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1614 int i;
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1615
266
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1616 /* don't emit anything in bss */
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1617 if (l -> csect && (l -> csect -> flags & (section_flag_bss | section_flag_constant)))
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1618 return;
35c051bffbff Make fill and align do something useful in the object target
William Astle <lost@l-w.ca>
parents: 264
diff changeset
1619
186
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1620 e = lwasm_fetch_expr(l, 1);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1621 for (i = 0; i < l -> len; i++)
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1622 {
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1623 lwasm_emitexpr(l, e, 1);
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1624 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1625 }
1824cabf25ce Various enhancements to lwasm
lost@l-w.ca
parents: 162
diff changeset
1626
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1627 /* string conditional argument parser */
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1628 /*
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1629 argument syntax:
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1630
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1631 a bare word ended by whitespace, comma, or NUL
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1632 a double quote delimited string containing arbitrary printable characters
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1633 a single quote delimited string containing arbitrary printable characters
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1634
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1635 In a double quoted string, a double quote cannot be represented.
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1636 In a single quoted string, a single quote cannot be represented.
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1637
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1638 */
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1639 char *strcond_parsearg(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1640 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1641 char *arg;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1642 char *tstr;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1643 int i;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1644 tstr = *p;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1645
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1646 if (!**p || isspace(**p))
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1647 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1648 return lw_strdup("");
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1649 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1650
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1651 if (*tstr == '"')
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1652 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1653 // double quote delim
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1654 tstr++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1655 for (i = 0; tstr[i] && tstr[i] != '"'; i++)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1656 /* do nothing */ ;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1657
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1658 arg = lw_alloc(i + 1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1659 strncpy(arg, tstr, i);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1660 arg[i] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1661
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1662 if (tstr[i])
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1663 i++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1664
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1665 *p += i;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1666 return arg;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1667 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1668 else if (*tstr == '\'')
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1669 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1670 // single quote delim
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1671 tstr++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1672 for (i = 0; tstr[i] && tstr[i] != '\''; i++)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1673 /* do nothing */ ;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1674
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1675 arg = lw_alloc(i + 1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1676 strncpy(arg, tstr, i);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1677 arg[i] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1678
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1679 if (tstr[i])
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1680 i++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1681
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1682 *p += i;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1683 return arg;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1684 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1685 else
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1686 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1687 // bare word - whitespace or comma delim
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1688 for (i = 0; tstr[i] && !isspace(tstr[i]) && tstr[i] != ','; i++)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1689 /* do nothing */ ;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1690
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1691 arg = lw_alloc(i + 1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1692 strncpy(arg, tstr, i);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1693 arg[i] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1694 if (tstr[i] == ',')
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1695 i++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1696
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1697 *p += i;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1698 return arg;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1699 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1700 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1701
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1702 /* string conditional helpers */
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1703 /* return "1" for true, "0" for false */
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1704 int strcond_eq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1705 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1706 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1707 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1708 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1709
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1710 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1711 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1712
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1713 if (strcmp(arg1, arg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1714 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1715 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1716 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1717 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1718 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1719
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1720 int strcond_ieq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1721 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1722 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1723 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1724 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1725
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1726 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1727 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1728
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1729 if (strcasecmp(arg1, arg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1730 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1731 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1732 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1733 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1734 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1735
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1736 int strcond_ne(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1737 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1738 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1739 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1740 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1741
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1742 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1743 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1744
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1745 if (strcmp(arg1, arg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1746 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1747 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1748 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1749 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1750 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1751
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1752 int strcond_ine(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1753 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1754 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1755 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1756 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1757
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1758 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1759 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1760
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1761 if (strcasecmp(arg1, arg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1762 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1763 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1764 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1765 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1766 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1767
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1768 int strcond_peq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1769 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1770 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1771 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1772 char *arg2;
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1773 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1774 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1775
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1776 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1777 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1778 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1779
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1780 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1781 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1782 arg1[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1783 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1784 arg2[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1785
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1786 if (strcmp(arg1, arg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1787 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1788 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1789 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1790 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1791 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1792 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1793
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1794 int strcond_ipeq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1795 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1796 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1797 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1798 char *arg2;
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1799 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1800 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1801
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1802 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1803 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1804 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1805
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1806 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1807 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1808 arg1[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1809 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1810 arg2[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1811
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1812 if (strcasecmp(arg1, arg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1813 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1814 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1815 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1816 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1817 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1818 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1819
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1820 int strcond_pne(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1821 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1822 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1823 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1824 char *arg2;
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1825 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1826 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1827
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1828 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1829 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1830 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1831
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1832 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1833 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1834 arg1[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1835 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1836 arg2[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1837
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1838 if (strcmp(arg1, arg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1839 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1840 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1841 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1842 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1843 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1844 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1845
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1846 int strcond_ipne(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1847 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1848 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1849 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1850 char *arg2;
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1851 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1852 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1853
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1854 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1855 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1856 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1857
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1858 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1859 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1860 arg1[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1861 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1862 arg2[plen] = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1863
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1864 if (strcasecmp(arg1, arg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1865 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1866 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1867 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1868 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1869 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1870 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1871
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1872 int strcond_seq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1873 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1874 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1875 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1876 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1877 char *rarg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1878 char *rarg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1879
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1880 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1881 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1882
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1883 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1884 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1885 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1886
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1887 rarg1 = arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1888 rarg2 = arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1889
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1890 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1891 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1892 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1893 rarg1 += strlen(arg1) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1894 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1895 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1896 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1897 rarg2 += strlen(arg2) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1898 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1899 if (strcmp(rarg1, rarg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1900 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1901 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1902 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1903 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1904 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1905 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1906
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1907 int strcond_iseq(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1908 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1909 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1910 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1911 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1912 char *rarg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1913 char *rarg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1914
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1915 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1916 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1917
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1918 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1919 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1920 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1921
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1922 rarg1 = arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1923 rarg2 = arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1924
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1925 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1926 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1927 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1928 rarg1 += strlen(arg1) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1929 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1930 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1931 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1932 rarg2 += strlen(arg2) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1933 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1934
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1935 if (strcasecmp(rarg1, rarg2) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1936 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1937 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1938 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1939 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1940 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1941 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1942
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1943
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1944 int strcond_sne(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1945 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1946 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1947 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1948 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1949 char *rarg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1950 char *rarg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1951
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1952 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1953 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1954
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1955 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1956 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1957 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1958
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1959 rarg1 = arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1960 rarg2 = arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1961
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1962 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1963 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1964 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1965 rarg1 += strlen(arg1) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1966 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1967 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1968 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1969 rarg2 += strlen(arg2) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1970 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1971
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1972 if (strcmp(rarg1, rarg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1973 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1974 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1975 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1976 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1977 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1978 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1979
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1980 int strcond_isne(char **p)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1981 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1982 char *arg0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1983 char *arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1984 char *arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1985 char *rarg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1986 char *rarg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1987
359
f318407d2469 Fix some signedness mismatches
William Astle <lost@l-w.ca>
parents: 349
diff changeset
1988 size_t plen;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1989 int c = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1990
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1991 arg0 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1992 arg1 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1993 arg2 = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1994
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1995 rarg1 = arg1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1996 rarg2 = arg2;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1997
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1998 plen = strtol(arg0, NULL, 10);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
1999 if (strlen(arg1) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2000 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2001 rarg1 += strlen(arg1) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2002 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2003 if (strlen(arg2) > plen)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2004 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2005 rarg2 += strlen(arg2) - plen;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2006 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2007
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2008 if (strcasecmp(rarg1, rarg2) != 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2009 c = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2010 lw_free(arg0);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2011 lw_free(arg1);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2012 lw_free(arg2);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2013 return c;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2014 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2015
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2016 /* string conditionals */
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2017 PARSEFUNC(pseudo_parse_ifstr)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2018 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2019 static struct strconds
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2020 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2021 char *str;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2022 int (*fn)(char **ptr);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2023 } strops[] = {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2024 { "eq", strcond_eq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2025 { "ieq", strcond_ieq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2026 { "ne", strcond_ne },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2027 { "ine", strcond_ine },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2028 { "peq", strcond_peq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2029 { "ipeq", strcond_ipeq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2030 { "pne", strcond_pne },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2031 { "ipne", strcond_ipne },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2032 { "seq", strcond_seq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2033 { "iseq", strcond_iseq },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2034 { "sne", strcond_sne },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2035 { "isne", strcond_isne },
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2036 { NULL, 0 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2037 };
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2038 int tv = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2039 char *tstr;
58
62372522ce9c Clean up warning about unused variable
lost@l-w.ca
parents: 55
diff changeset
2040 int strop;
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2041
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2042 l -> len = 0;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2043
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2044 if (as -> skipcond && !(as -> skipmacro))
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2045 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2046 as -> skipcount++;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2047 skip_operand(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2048 return;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2049 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2050
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2051 tstr = strcond_parsearg(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2052 if (!**p || isspace(**p))
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2053 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
2054 lwasm_register_error(as, l, E_STRING_BAD);
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2055 return;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2056 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2057
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2058 for (strop = 0; strops[strop].str != NULL; strop++)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2059 if (strcasecmp(strops[strop].str, tstr) == 0)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2060 break;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2061
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2062 lw_free(tstr);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2063
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2064 if (strops[strop].str == NULL)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2065 {
370
8764142b3192 Convert internal error/warning handling framework to a new unified system
William Astle <lost@l-w.ca>
parents: 359
diff changeset
2066 lwasm_register_error(as, l, E_STRING_BAD);
55
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2067 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2068
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2069 tv = (*(strops[strop].fn))(p);
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2070
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2071 if (!tv)
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2072 {
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2073 as -> skipcond = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2074 as -> skipcount = 1;
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2075 }
bad2ee25acdd Added string comparison pseudo ops
lost@l-w.ca
parents: 41
diff changeset
2076 }