comparison lwasm/main.c @ 257:e27279180a73 2.x

Added support for include path to LWASM
author lost
date Tue, 22 Dec 2009 04:53:20 +0000
parents a58f49a77441
children c79b3c88adbc
comparison
equal deleted inserted replaced
256:6e2d03188d24 257:e27279180a73
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <unistd.h> 31 #include <unistd.h>
32 32
33 #include "lwasm.h" 33 #include "lwasm.h"
34 #include "util.h"
34 35
35 // external declarations 36 // external declarations
36 extern void lwasm_pass1(asmstate_t *as); 37 extern void lwasm_pass1(asmstate_t *as);
37 extern void lwasm_pass2(asmstate_t *as); 38 extern void lwasm_pass2(asmstate_t *as);
38 extern void lwasm_list(asmstate_t *as); 39 extern void lwasm_list(asmstate_t *as);
48 asmstate_t *as = state -> input; 49 asmstate_t *as = state -> input;
49 char *p; 50 char *p;
50 51
51 switch (key) 52 switch (key)
52 { 53 {
54 case 'I':
55 as -> includedirs = lwasm_realloc(as -> includedirs, (as -> nincludedirs + 1) * sizeof(char *));
56 as -> includedirs[as -> nincludedirs++] = arg;
57 break;
58
53 case 'o': 59 case 'o':
54 // output 60 // output
55 if (as -> outfile) 61 if (as -> outfile)
56 { 62 {
57 } 63 }
164 "Set an assembler pragma to any value understood by the \"pragma\" pseudo op"}, 170 "Set an assembler pragma to any value understood by the \"pragma\" pseudo op"},
165 { "6809", '9', 0, 0, 171 { "6809", '9', 0, 0,
166 "Set assembler to 6809 only mode" }, 172 "Set assembler to 6809 only mode" },
167 { "6309", '3', 0, 0, 173 { "6309", '3', 0, 0,
168 "Set assembler to 6309 mode (default)" }, 174 "Set assembler to 6309 mode (default)" },
175 { "includedir", 'I', "PATH", 0,
176 "Add entry to include path" },
169 { 0 } 177 { 0 }
170 }; 178 };
171 179
172 static struct argp argp = 180 static struct argp argp =
173 { 181 {