changeset 224:82a55cc6b5fc

*** empty log message ***
author kono
date Mon, 26 Apr 2004 12:17:19 +0900
parents 1ac647873577
children 8675ea3d2c7f
files Changes Makefile mc-code-ia32.c mc-parse.c
diffstat 4 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Mon Apr 26 11:01:43 2004 +0900
+++ b/Changes	Mon Apr 26 12:17:19 2004 +0900
@@ -4050,3 +4050,5 @@
 一応、no long long は通ったみたいだが。。
 
 構造体の戻値を持つ場合に、引数がないとうまくいかない。
+
+#include "" は、今読んでいるファイルのcurrent directry も探す。
--- a/Makefile	Mon Apr 26 11:01:43 2004 +0900
+++ b/Makefile	Mon Apr 26 12:17:19 2004 +0900
@@ -92,11 +92,12 @@
 	( cd nkf203; $(CC) -g -o nkf nkf.s utf8tbl.s )
 	( cd nkf203; perl test.pl )
 
+#	-./$(MC) -Itest/ -s $(TARGET).c
 
 check: $(MC)
 	-gcc $(TARGET).c -o b.out $(MLIB)
 	-./b.out > $(TARGET).gcc.out
-	-./$(MC) -Itest/ -s $(TARGET).c
+	-./$(MC) -s $(TARGET).c
 	-gcc $(TARGET).s $(MLIB)
 	-./a.out > $(TARGET).$(MC).out
 	-diff  $(TARGET).gcc.out $(TARGET).$(MC).out
--- a/mc-code-ia32.c	Mon Apr 26 11:01:43 2004 +0900
+++ b/mc-code-ia32.c	Mon Apr 26 12:17:19 2004 +0900
@@ -23,6 +23,8 @@
 static int output_mode = TEXT_EMIT_MODE;
 static int data_alignment = 0;
 
+static int creg;
+
 int size_of_int = 4;
 int size_of_short = 2;
 int size_of_float = 4;
--- a/mc-parse.c	Mon Apr 26 11:01:43 2004 +0900
+++ b/mc-parse.c	Mon Apr 26 12:17:19 2004 +0900
@@ -111,6 +111,9 @@
 int include_path_count;
 extern char *l_include_path[];
 
+static
+char current_file_dir[LBUFSIZE];
+
 int
 main(int argc, char **argv)
 {
@@ -121,6 +124,8 @@
     lsrc = chk = asmf = 0;
     ac=argc;
     av=argv;
+    current_file_dir[0] = 0;
+    include_path[include_path_count++] = current_file_dir;
     for (ac2=1; (ac2 < ac) && (*av[ac2] == '-'); ++ac2) {
 	switch (*(av[ac2]+1)) {
 	case 's':
@@ -172,6 +177,8 @@
     /*NOTREACHED*/
 }
 
+static void copy_current_file_dir(char *name);
+
 void
 error(int n)
 {
@@ -180,6 +187,7 @@
 	    fclose(filep->fcb);
 	    lineno=filep->ln;
 	    --filep;
+	    copy_current_file_dir(filep->name0);
 	    return;
 	} else if(ac2!=ac) {
 	    fclose(filep->fcb);
@@ -331,6 +339,19 @@
     getch();
 }
 
+static void
+copy_current_file_dir(char *name)
+{
+    char *s = name;
+    char *d = current_file_dir;
+    char *p;
+    for(p = d;d<current_file_dir+LBUFSIZE && *s; ) {
+	if (*s=='/') p = d+1;
+	*d++ = *s++;
+    }
+    *p = 0;
+}
+
 static int first_newfile = 1;
 
 static void
@@ -348,6 +369,7 @@
     if (chk) fprintf(stderr,"%s:\n",av[ac2]);
     if ( (filep->fcb = fopen(av[ac2++],"r")) == NULL ) error(FILERR);
     s = av[ac2-1];
+    copy_current_file_dir(s);
     filep->name0 = cheapp;
     filep->inc = 0;
     while((*cheapp++ = *s++));
@@ -4201,7 +4223,7 @@
 	}
     }
     if(!fp) { error(FILERR); return filep->fcb; }
-    s = p;
+    copy_current_file_dir(s=p);
     (filep+1)->name0 = cheapp;
     (filep+1)->inc = end;
     while((*cheapp++ = *s++));