diff lwasm/input.c @ 386:af5f2c51db76

Bugfixing on includes
author lost@starbug
date Sun, 16 May 2010 13:03:17 -0600
parents 38b50ce6967a
children e3567a9f0d54
line wrap: on
line diff
--- a/lwasm/input.c	Sun May 16 11:50:00 2010 -0600
+++ b/lwasm/input.c	Sun May 16 13:03:17 2010 -0600
@@ -168,6 +168,7 @@
 		{
 			/* absolute path */
 			IS -> data = fopen(s, "rb");
+			debug_message(as, 1, "Opening (abs) %s", s);
 			if (!IS -> data)
 			{
 				lw_error("Cannot open file '%s': %s", s, strerror(errno));
@@ -179,6 +180,7 @@
 		/* relative path, check relative to "current file" directory */
 		p = lw_stack_top(as -> file_dir);
 		0 == asprintf(&p2, "%s/%s", p, s);
+		debug_message(as, 1, "Open: (cd) %s\n", p2);
 		IS -> data = fopen(p2, "rb");
 		if (IS -> data)
 		{
@@ -193,6 +195,7 @@
 		while (p = lw_stringlist_current(as -> include_list))
 		{
 			0 == asprintf(&p2, "%s/%s", p, s);
+		debug_message(as, 1, "Open (sp): %s\n", p2);
 			IS -> data = fopen(p2, "rb");
 			if (IS -> data)
 			{
@@ -206,6 +209,7 @@
 		lw_error("Cannot open include file '%s': %s", s, strerror(errno));
 		
 	case input_type_file:
+		debug_message(as, 1, "Opening (reg): %s\n", s);
 		IS -> data = fopen(s, "rb");
 
 		if (!IS -> data)
@@ -229,6 +233,7 @@
 	if (*s == '/')
 	{
 		/* absolute path */
+		debug_message(as, 2, "Open file (st abs) %s", s);
 		fp = fopen(s, "rb");
 		if (!fp)
 		{
@@ -240,6 +245,7 @@
 	/* relative path, check relative to "current file" directory */
 	p = lw_stack_top(as -> file_dir);
 	0 == asprintf(&p2, "%s/%s", p, s);
+	debug_message(as, 2, "Open file (st cd) %s", p2);
 	fp = fopen(p2, "rb");
 	if (fp)
 	{
@@ -253,6 +259,7 @@
 	while (p = lw_stringlist_current(as -> include_list))
 	{
 		0 == asprintf(&p2, "%s/%s", p, s);
+		debug_message(as, 2, "Open file (st ip) %s", p2);
 		fp = fopen(p2, "rb");
 		if (fp)
 		{