comparison lwasm/input.c @ 186:1824cabf25ce

Various enhancements to lwasm
author lost@l-w.ca
date Thu, 22 Dec 2011 18:04:13 -0700
parents a88b04ba5ab8
children afd50d6b4113
comparison
equal deleted inserted replaced
185:cca933d32298 186:1824cabf25ce
262 /* first check for absolute path and if so, skip path */ 262 /* first check for absolute path and if so, skip path */
263 if (*s == '/') 263 if (*s == '/')
264 { 264 {
265 /* absolute path */ 265 /* absolute path */
266 debug_message(as, 2, "Open file (st abs) %s", s); 266 debug_message(as, 2, "Open file (st abs) %s", s);
267 if (as -> flags & FLAG_DEPEND)
268 printf("%s\n", s);
267 fp = fopen(s, "rb"); 269 fp = fopen(s, "rb");
268 if (!fp) 270 if (!fp)
269 { 271 {
270 return NULL; 272 return NULL;
271 } 273 }
277 p2 = make_filename(p ? p : "", s); 279 p2 = make_filename(p ? p : "", s);
278 debug_message(as, 2, "Open file (st cd) %s", p2); 280 debug_message(as, 2, "Open file (st cd) %s", p2);
279 fp = fopen(p2, "rb"); 281 fp = fopen(p2, "rb");
280 if (fp) 282 if (fp)
281 { 283 {
284 if (as -> flags & FLAG_DEPEND)
285 printf("%s\n", p2);
282 lw_free(p2); 286 lw_free(p2);
283 return fp; 287 return fp;
284 } 288 }
285 lw_free(p2); 289 lw_free(p2);
286 290
291 p2 = make_filename(p, s); 295 p2 = make_filename(p, s);
292 debug_message(as, 2, "Open file (st ip) %s", p2); 296 debug_message(as, 2, "Open file (st ip) %s", p2);
293 fp = fopen(p2, "rb"); 297 fp = fopen(p2, "rb");
294 if (fp) 298 if (fp)
295 { 299 {
300 if (as -> flags & FLAG_DEPEND)
301 printf("%s\n", p2);
296 lw_free(p2); 302 lw_free(p2);
297 return fp; 303 return fp;
298 } 304 }
299 lw_free(p2); 305 lw_free(p2);
300 lw_stringlist_next(as -> include_list); 306 lw_stringlist_next(as -> include_list);
307 }
308
309 // last ditch output for dependencies
310 if (as -> flags & FLAG_DEPEND)
311 {
312 p = lw_stack_top(as -> file_dir);
313 p2 = make_filename(p ? p : "", s);
314 printf("%s\n", p2);
315 lw_free(p2);
301 } 316 }
302 317
303 return NULL; 318 return NULL;
304 } 319 }
305 320