changeset 181:4beb7f079055

new file
author kono
date Sun, 30 Nov 2003 18:38:43 +0900
parents f00e3bfa1b45
children e1e9ec8c96a7
files mc-parse.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mc-parse.c	Sun Nov 30 18:26:36 2003 +0900
+++ b/mc-parse.c	Sun Nov 30 18:38:43 2003 +0900
@@ -252,10 +252,10 @@
 }
 
 static void
-init(void)
+reinit(void)
 {
+    int i;
     NMTBL *nptr;
-    int i;
 
     cheapp=cheap;
     for(nptr = ntable,i = GSYMS; i--;) (nptr++)->sc = 0;
@@ -301,7 +301,6 @@
     lfree=HEAPSIZE;
     filep=filestack;
     codegen_init();
-    newfile();
 
     macro_define("__micro_c__ 1\n");
     // macro_define("__pure2\n"); 
@@ -315,16 +314,32 @@
     macro_define("bsd 1\n");
 #endif
 
+}
+
+static void
+init(void)
+{
+
+    reinit();
+    newfile();
+
     getline();
     getch();
 }
 
+static int first_newfile = 1;
+
 static void
 newfile(void)
 {
     char *s;
     int flag = 0;
 
+    if (!first_newfile) {
+	closing();
+	reinit();
+    } else
+	first_newfile = 0;
     lineno=0;
     if (chk) fprintf(stderr,"%s:\n",av[ac2]);
     if ( (filep->fcb = fopen(av[ac2++],"r")) == NULL ) error(FILERR);