changeset 41:c6b8b455d67f

Fix line number sequence after including a file
author lost@l-w.ca
date Sat, 02 Apr 2011 22:33:39 -0600
parents d96037ea0b80
children 31adb7c09b4e
files lwasm/pseudo.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/pseudo.c	Sat Apr 02 22:28:22 2011 -0600
+++ b/lwasm/pseudo.c	Sat Apr 02 22:33:39 2011 -0600
@@ -1044,7 +1044,8 @@
 	char *p3;
 	int delim = 0;
 	int len;
-	
+	char buf[110];
+		
 	if (!**p)
 	{
 		lwasm_register_error(as, l, "Missing filename");
@@ -1068,6 +1069,10 @@
 	(*p) = p2;
 	if (delim && **p)
 		(*p)++;
+
+	/* add a book-keeping entry for line numbers */
+	snprintf(buf, 100, "\001\001SETLINENO %d\n", l -> lineno + 1);
+	input_openstring(as, "INTERNAL", buf);
 	
 	len = strlen(fn) + 8;
 	p3 = lw_alloc(len + 1);