diff lwasm/input.c @ 219:afd50d6b4113

Add --preprocess option Add --preprocess option which expands macros, resolves conditions, and resolves include files if possible. If an include file is not available, it the include directive is retained.
author William Astle <lost@l-w.ca>
date Sun, 10 Jun 2012 18:24:31 -0600
parents 1824cabf25ce
children 3864d96ee8c7
line wrap: on
line diff
--- a/lwasm/input.c	Sun Jun 10 14:55:27 2012 -0600
+++ b/lwasm/input.c	Sun Jun 10 18:24:31 2012 -0600
@@ -41,7 +41,7 @@
 Data type for storing input buffers
 */
 
-#define IGNOREERROR (errno == ENOENT && (as -> flags & FLAG_DEPENDNOERR))
+#define IGNOREERROR (errno == ENOENT && (as -> preprocess || as -> flags & FLAG_DEPENDNOERR))
 
 enum input_types_e
 {
@@ -195,6 +195,10 @@
 			{
 				lw_error("Cannot open file '%s': %s\n", s, strerror(errno));
 			}
+			else
+			{
+				as -> fileerr = 1;
+			}
 			input_pushpath(as, s);
 			return;
 		}
@@ -233,6 +237,7 @@
 		if (IGNOREERROR)
 		{
 			input_pushpath(as, s);
+			as -> fileerr = 1;
 			return;
 		}
 		lw_error("Cannot open include file '%s': %s\n", s, strerror(errno));