Mercurial > hg-old > index.cgi
comparison lwasm/pseudo.c @ 257:e27279180a73 2.x
Added support for include path to LWASM
author | lost |
---|---|
date | Tue, 22 Dec 2009 04:53:20 +0000 |
parents | c7a41b4c89b3 |
children | c79b3c88adbc |
comparison
equal
deleted
inserted
replaced
256:6e2d03188d24 | 257:e27279180a73 |
---|---|
127 fn[v1] = '\0'; | 127 fn[v1] = '\0'; |
128 | 128 |
129 (*p) += v1; | 129 (*p) += v1; |
130 if (**p == '"') | 130 if (**p == '"') |
131 (*p)++; | 131 (*p)++; |
132 | |
133 // resolve file name | |
134 if (*fn != '/') | |
135 { | |
136 char *path; | |
137 int i; | |
138 FILE *fp; | |
139 | |
140 fp = fopen(fn, "r"); | |
141 if (!fp) | |
142 { | |
143 | |
144 | |
145 for (i = 0; i < as -> nincludedirs; i++) | |
146 { | |
147 0 == asprintf(&path, "%s/%s", as -> includedirs[i], fn); | |
148 fp = fopen(path, "r"); | |
149 if (fp) | |
150 { | |
151 fclose(fp); | |
152 lwasm_free(fn); | |
153 fn = path; | |
154 break; | |
155 } | |
156 lwasm_free(path); | |
157 } | |
158 } | |
159 else | |
160 { | |
161 fclose(fp); | |
162 } | |
163 } | |
132 | 164 |
133 // end local label context on include | 165 // end local label context on include |
134 as -> context = lwasm_next_context(as); | 166 as -> context = lwasm_next_context(as); |
135 if (lwasm_read_file(as, fn) < 0) | 167 if (lwasm_read_file(as, fn) < 0) |
136 { | 168 { |