changeset 861:c005a392e27e

fix for Marvaricks
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 31 Mar 2014 18:33:20 +0900
parents 467be346ae47
children 68cbc637f486
files Changes Makefile Makefile.i64 Makefile.ia32 README README.jp mc-code-ia32.c mc-codegen.c mc-macro.c mc-parse.c mc-tree.c stdio.h stdio.template tools/find-gcc-include-path
diffstat 14 files changed, 751 insertions(+), 695 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Mon Sep 16 18:02:58 2013 +0900
+++ b/Changes	Mon Mar 31 18:33:20 2014 +0900
@@ -9986,4 +9986,15 @@
 
 #sym が、"sym" に置き換わっている。sym をmacro変換してから置き換える必要がある。
 
-
+Mon Sep 16 18:05:18 JST 2013
+
+strinit が、まだおかしい。
+
+recursive macro の結果が逆。
+
+
+
+
+
+
+
--- a/Makefile	Mon Sep 16 18:02:58 2013 +0900
+++ b/Makefile	Mon Mar 31 18:33:20 2014 +0900
@@ -1,4 +1,4 @@
-GCC = gcc
+GCC = clang
 CC = $(GCC) -std=c99 $(CCEXT) $(M)  -fgnu89-inline 
 # -O3
 # MCFLAG = -DUSE_CODE_KEYWORD
@@ -66,9 +66,12 @@
 conv/null.c: conv_func.tbl tools/conv_func.pl
 	perl tools/conv_func.pl
 
-mc-include.c:
+mc-include.c: stdio.h
 	perl tools/find-gcc-include-path -l $(CC) > mc-include.c
 
+stdio.h:
+	perl tools/find-gcc-include-path -s $(CC) > stdio.h
+
 mc.h-new:
 	perl tools/mc-h-renum.pl mc.h > mc.h.1
 	mv mc.h.1 mc.h
@@ -210,7 +213,7 @@
 tags:   tags-$(ARCH)
 
 tags-$(ARCH):  
-	ctags mc.h mc-code.h mc-code-$(ARCH).c  mc-codegen.c mc-codegen.h \
+	ctags -w mc.h mc-code.h mc-code-$(ARCH).c  mc-codegen.c mc-codegen.h \
 		mc-parse.h mc-tree.c mc-inline.h mc-switch.h \
 		mc-macro.h mc-macro.c \
 	    conv/c.c conv/c.h \
@@ -231,7 +234,7 @@
                 mc-code-mips.c
 
 clean :
-	-rm -rf mc mc-spu mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c *.dSYM
+	-rm -rf mc mc-spu mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c *.dSYM stdio.h
 
 mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER)
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER)
--- a/Makefile.i64	Mon Sep 16 18:02:58 2013 +0900
+++ b/Makefile.i64	Mon Mar 31 18:33:20 2014 +0900
@@ -1,4 +1,4 @@
-GCC = gcc
+GCC = clang
 CC = $(GCC) -std=c99 $(CCEXT) $(M)  -fgnu89-inline 
 # -O3
 # MCFLAG = -DUSE_CODE_KEYWORD
@@ -66,9 +66,12 @@
 conv/null.c: conv_func.tbl tools/conv_func.pl
 	perl tools/conv_func.pl
 
-mc-include.c:
+mc-include.c: stdio.h
 	perl tools/find-gcc-include-path -l $(CC) > mc-include.c
 
+stdio.h:
+	perl tools/find-gcc-include-path -s $(CC) > stdio.h
+
 mc.h-new:
 	perl tools/mc-h-renum.pl mc.h > mc.h.1
 	mv mc.h.1 mc.h
@@ -210,7 +213,7 @@
 tags:   tags-$(ARCH)
 
 tags-$(ARCH):  
-	ctags mc.h mc-code.h mc-code-$(ARCH).c  mc-codegen.c mc-codegen.h \
+	ctags -w mc.h mc-code.h mc-code-$(ARCH).c  mc-codegen.c mc-codegen.h \
 		mc-parse.h mc-tree.c mc-inline.h mc-switch.h \
 		mc-macro.h mc-macro.c \
 	    conv/c.c conv/c.h \
@@ -231,7 +234,7 @@
                 mc-code-mips.c
 
 clean :
-	-rm -rf mc mc-spu mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c *.dSYM
+	-rm -rf mc mc-spu mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c *.dSYM stdio.h
 
 mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER)
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER)
--- a/Makefile.ia32	Mon Sep 16 18:02:58 2013 +0900
+++ b/Makefile.ia32	Mon Mar 31 18:33:20 2014 +0900
@@ -1,4 +1,4 @@
-CC = gcc $(M) -std=c99 $(CCEXT)
+CC = clang $(M) -std=c99 $(CCEXT)
 # -O3
 MCFLAGS = -DUSE_CODE_KEYWORD
 CFLAGS = -g -O -Wall -I. $(MCFLAGS)
@@ -53,9 +53,13 @@
 conv/null.c: conv_func.tbl tools/conv_func.pl
 	perl tools/conv_func.pl
 
-mc-include.c:
+mc-include.c: stdio.h
 	perl tools/find-gcc-include-path -l $(CC) > mc-include.c
 
+stdio.h:
+	perl tools/find-gcc-include-path -s $(CC) > stdio.h
+
+
 mc.h-new:
 	perl tools/mc-h-renum.pl mc.h > mc.h.1
 	mv mc.h.1 mc.h
--- a/README	Mon Sep 16 18:02:58 2013 +0900
+++ b/README	Mon Mar 31 18:33:20 2014 +0900
@@ -5,6 +5,8 @@
 
 0. What is this.
 
+We have gcc and LLVM version. You should use these.
+
 This is a extension of C ( and a subset of C ). It has a 
 programming unit which is called code segment.  Code
 segment can be communicate with so called light weight continuation.
--- a/README.jp	Mon Sep 16 18:02:58 2013 +0900
+++ b/README.jp	Mon Mar 31 18:33:20 2014 +0900
@@ -4,6 +4,8 @@
 
 0. What is this.
 
+この compile よりも、gcc / LLVM 版を使った方が良いでしょう。
+
 これはC言語の拡張であり、下位言語でもあります。サブルーチン
 の代わりに code segment というプログラミング単位を持つ言語
 です。code segment は、軽量継続(light weight continuation)
--- a/mc-code-ia32.c	Mon Sep 16 18:02:58 2013 +0900
+++ b/mc-code-ia32.c	Mon Mar 31 18:33:20 2014 +0900
@@ -2401,7 +2401,9 @@
 code_opening(char *filename)
 {
     printf("\t.file \"%s\"\n",filename);
+#ifndef __llvm__
     printf("\t.version\t\"01.01\"\n");
+#endif
     /* printf("gcc2_compiled.:\n"); */
     // printf(".text\n");
 }
--- a/mc-codegen.c	Mon Sep 16 18:02:58 2013 +0900
+++ b/mc-codegen.c	Mon Mar 31 18:33:20 2014 +0900
@@ -2271,7 +2271,8 @@
 	case ULONGLONG: break;
 	default:
 	    if(integral(type)) e2 = list3(CONV,e2,I2LL);
-            else if(lp64);
+            else if(lp64)
+               ;
 	    // else { error(TYERR); e2 = llist2(LCONST,0LL); }
 	}
     }
@@ -2303,7 +2304,8 @@
 	case ULONGLONG: break;
 	default:
 	    if(integral(type)) e2 = list3(CONV,e2,I2ULL);
-            else if(lp64);
+            else if(lp64)
+              ;
 	    // else { error(TYERR); e2 = llist2(LCONST,0LL); }
 	}
     }
@@ -3376,7 +3378,7 @@
     if (stmode==EXTRN||mode==GDECL)
 	n->ty = type;  /* must be in global table/heap */
     if(type0>0&&(car(type0)==FUNCTION || car(type0)==CODE)) {
-	if ((mode==GDECL)) {
+	if (mode==GDECL) {
 	    fcheck(n);
 	    set_ctmode(n,ctmode);
 	    set_attributes(n,attr);
--- a/mc-macro.c	Mon Sep 16 18:02:58 2013 +0900
+++ b/mc-macro.c	Mon Mar 31 18:33:20 2014 +0900
@@ -63,12 +63,12 @@
 
     In macro_function and macro_eavl,
     expand result is put into macrop local variable.
-	list3s(STRING,next,char*)
+        list3s(STRING,next,char*)
     to generate result, mappend/reverse0 is necessary.
     
  */
 
-extern void
+void
 macro_expansion(NMTBL *nptrm)
 {
     int i = mode;
@@ -110,37 +110,37 @@
 
     while (mconcat) {
         // ## re-eval macro
-if (lsrc) printf("## before %s",macropp);
+        if (lsrc) printf("## before %s",macropp);
         mconcat = 0;
         macrop = 0;
-	for(s=t=macropp;*s;) {
-	    if ((c=*s++)=='#'&&*s=='#') {
-		if (t>s-3) t=s-2; else t--;
-		while(*t<=' '&&t>macropp) t--; t++;
-		for(s++;*s && *s<=' ';) s++;
-		continue;
-	    } else if (c==STRING) {
-		c = '"';
-	    }
-	    *t++=c;
-	}
-	*t++=0;
-	// evaluate generated result again
+        for(s=t=macropp;*s;) {
+            if ((c=*s++)=='#'&&*s=='#') {
+                if (t>s-3) t=s-2; else t--;
+                while(*t<=' '&&t>macropp) t--; t++;
+                for(s++;*s && *s<=' ';) s++;
+                continue;
+            } else if (c==STRING) {
+                c = '"';
+            }
+            *t++=c;
+        }
+        *t++=0;
 #if 0
-if (1 && lsrc) {
-     printf("\n### %s\n",macropp);
-     if (t[-2]!='\n') putchar('\n');
-}
+        if (1 && lsrc) {
+           printf("\n### %s\n",macropp);
+           if (t[-2]!='\n') putchar('\n');
+        }
 #endif
+        // evaluate generated result again
         macrop=macro_eval(macrop,macropp,macro_history);
-	cheap = reset_cheap(&scheap);
-	macropp = cheap->ptr;
-	// will not override evaled list
+        cheap = reset_cheap(&scheap);
+        macropp = cheap->ptr;
+        // will not override evaled list
         mappend0(reverse0(macrop),&macropp);
-	// cheap->ptr[-1] ='\n';
-	cheap->ptr[-1] =0;
-	cheap->ptr[0] =0;
-	cheap = increment_cheap(cheap,&macropp);
+        // cheap->ptr[-1] ='\n';
+        cheap->ptr[-1] =0;
+        cheap->ptr[0] =0;
+        cheap = increment_cheap(cheap,&macropp);
     }
     cheap = reset_cheap(&scheap);
     // genrated macro will be overwrited by cheap, but it's OK, again
@@ -148,8 +148,8 @@
     set_lfree(slfree);
 #if 0
      if (lsrc && !asmf && nptrm->sc==FMACRO) {
- 	gen_comment(macropp);
- 	if (0 && t[-2]!='\n') putchar('\n');
+        gen_comment(macropp);
+        if (0 && t[-2]!='\n') putchar('\n');
      }
 #endif
     // push previous chptr, and change it to the generate macro
@@ -164,7 +164,7 @@
 
 /*
     file name concatenation
-	on cheap
+        on cheap
  */
 
 static char *
@@ -174,7 +174,7 @@
     if (! *path) return name;
     while(( *cheap->ptr = *path++ )) cheap = increment_cheap(cheap,&p);
     if (cheap->ptr[-1]!='/') {
-	*cheap->ptr = '/'; cheap = increment_cheap(cheap,&p);
+        *cheap->ptr = '/'; cheap = increment_cheap(cheap,&p);
     }
     while(( *cheap->ptr = *name++ )) cheap = increment_cheap(cheap,&p);
     *cheap->ptr = 0;
@@ -218,7 +218,7 @@
             "name" =>   name
                         current_file_name_dir / name
                         include_path / name
-	    (no difference?)
+            (no difference?)
       next flag ignores the first occurence.
  */
 
@@ -238,8 +238,8 @@
     } else { error(INCERR); err=1; 
     }
     for(i=0;(getch()!=end && ch!='\n');) {
-	*cheap->ptr = ch;
-	cheap = increment_cheap(cheap,&name);
+        *cheap->ptr = ch;
+        cheap = increment_cheap(cheap,&name);
     }
     if(ch=='\n') error(INCERR);
     if (err) return filep->fcb;
@@ -250,31 +250,31 @@
     if (next && fp) { fclose(fp); fp=0; next=0; prev=name; }
     p = name;
     if (!fp) {
-	// no deferenced on "" and <>?
-	for(pp=include_path; *pp;pp++) {
-	    p = expand_file_name(*pp,name);
-	    if(prev && nameeq(p,prev)) continue;
-	    if ((fp = fopen(p,"r"))) {
-		if (next) {
-		    fclose(fp); fp=0; next=0; prev=p;
-		    continue;
-		} else
-		    break ;
-	    }
-	}
+        // no deferenced on "" and <>?
+        for(pp=include_path; *pp;pp++) {
+            p = expand_file_name(*pp,name);
+            if(prev && nameeq(p,prev)) continue;
+            if ((fp = fopen(p,"r"))) {
+                if (next) {
+                    fclose(fp); fp=0; next=0; prev=p;
+                    continue;
+                } else
+                    break ;
+            }
+        }
         if (!fp /* && (end=='>'||filep->inc=='>') */ ) {  // <> case only
-	    for(pp=l_include_path; *pp;pp++) {
-		p = expand_file_name(*pp,name);
-		if(prev && nameeq(p,prev)) continue;
-		if ((fp = fopen(p,"r"))) {
-		    if (next) {
-			fclose(fp); fp=0; next=0; prev=p;
-			continue;
-		    } else
-			break ;
-		}
-	    }
-	}
+            for(pp=l_include_path; *pp;pp++) {
+                p = expand_file_name(*pp,name);
+                if(prev && nameeq(p,prev)) continue;
+                if ((fp = fopen(p,"r"))) {
+                    if (next) {
+                        fclose(fp); fp=0; next=0; prev=p;
+                        continue;
+                    } else
+                        break ;
+                }
+            }
+        }
     }
     if(!fp) { error(FILERR); return filep->fcb; }
     //  we have so search current directory of the included file
@@ -284,10 +284,10 @@
     cheap = reset_cheap(&scheap);
     //  Generated name needs copy.
     if (p!=name) {
-	name = cheap->ptr;
-	while((*cheap->ptr = *s++)) cheap = increment_cheap(cheap,&name);
-	*cheap->ptr = 0;
-	cheap = increment_cheap(cheap,&name);
+        name = cheap->ptr;
+        while((*cheap->ptr = *s++)) cheap = increment_cheap(cheap,&name);
+        *cheap->ptr = 0;
+        cheap = increment_cheap(cheap,&name);
     }
     // should check filep over flow (sigh...)
     (filep+1)->inc = end;
@@ -302,7 +302,7 @@
 static int macro_if_skip ;
 
 /* there may extra non-terminate comment after #if/#else directive */
-/*      #endif / * hoge						   */
+/*      #endif / * hoge                                            */
 /*           */
 /*                                                                 */
 
@@ -311,26 +311,26 @@
 {
     getch();
     do {
-	while(ch!='\n'&&ch!='\r') {
-	    if (!in_comment) {
-		if (ch=='/') {
-		    getch();
-		    if (ch=='/') in_comment=2;
-		    else if (ch=='*') {
-			in_comment=1;
-		    } else continue;
-		}
-	    } else if (ch=='*') {
-		getch();
-		if (ch=='/') {
-		    in_comment=0; 
-		    return macro_if_skip?0:1;
-		}
-		else continue;
-	    }
-	    getch();
-	}
-	if (in_comment==1) { getline1(); getch(); }
+        while(ch!='\n'&&ch!='\r') {
+            if (!in_comment) {
+                if (ch=='/') {
+                    getch();
+                    if (ch=='/') in_comment=2;
+                    else if (ch=='*') {
+                        in_comment=1;
+                    } else continue;
+                }
+            } else if (ch=='*') {
+                getch();
+                if (ch=='/') {
+                    in_comment=0; 
+                    return macro_if_skip?0:1;
+                }
+                else continue;
+            }
+            getch();
+        }
+        if (in_comment==1) { getline1(); getch(); }
     } while(in_comment==1);
     in_comment=0;
     return 0;
@@ -339,8 +339,8 @@
 /*
      getline1 from chptr or chinput (for internal source)
         with macro processing 
-	generate comment
-	generate ST_COMMENT parse tree, in inline mode
+        generate comment
+        generate ST_COMMENT parse tree, in inline mode
     In getch, if chptr is empty, pop chptr stack, if stack is empy
     read from fp.
  */
@@ -359,92 +359,92 @@
     char *p;
 
     if (next_eof) {
-	next_eof=0;
-	error(EOFERR);
+        next_eof=0;
+        error(EOFERR);
     }
     do {
-	if (chinput) {
-	    //  some another input source ( init string )
-	    if (! *chinput) {
-		chinput=0;
-		continue;
-	    }
-	    chptr=linebuf;
-	    i=0;
-	    while((*chptr++=c=*chinput++)&&(c!='\n')) {
-		if (++i > LBUFSIZE-2) error(LNERR);
-	    }
-	} else {
-	    // get the line from input stream
-	    lineno++;
-	    glineno++;
-	    chptr=linebuf;
-	    i=0;
-	    while ((*chptr++ = c = getc(filep->fcb)) != '\n') {
-		if (++i > LBUFSIZE-2) error(LNERR);
-		if (c=='\r') {
-		    c = getc(filep->fcb);
-		    if (c == '\n') {
-			chptr[-1]='\n'; break;
-		    } else {
-			// single cr equal to nl
-			ungetc(c,filep->fcb);
-			chptr[-1]=c='\n'; i--; break;
-		    }
-		}
-		if (c==EOF) {
-		    next_eof=1;
-		    --chptr;
-		    break;
-		}
-	    }
-	}
+        if (chinput) {
+            //  some another input source ( init string )
+            if (! *chinput) {
+                chinput=0;
+                continue;
+            }
+            chptr=linebuf;
+            i=0;
+            while((*chptr++=c=*chinput++)&&(c!='\n')) {
+                if (++i > LBUFSIZE-2) error(LNERR);
+            }
+        } else {
+            // get the line from input stream
+            lineno++;
+            glineno++;
+            chptr=linebuf;
+            i=0;
+            while ((*chptr++ = c = getc(filep->fcb)) != '\n') {
+                if (++i > LBUFSIZE-2) error(LNERR);
+                if (c=='\r') {
+                    c = getc(filep->fcb);
+                    if (c == '\n') {
+                        chptr[-1]='\n'; break;
+                    } else {
+                        // single cr equal to nl
+                        ungetc(c,filep->fcb);
+                        chptr[-1]=c='\n'; i--; break;
+                    }
+                }
+                if (c==EOF) {
+                    next_eof=1;
+                    --chptr;
+                    break;
+                }
+            }
+        }
 
-	*chptr = '\0';
-	if (lsrc && !asmf && !macro_if_skip && linebuf[0]) {
-	    if (!inmode)
-		gen_comment(linebuf);  // #if ed line will not be commented
-	    if (inmode) {
-		// inline mode 
+        *chptr = '\0';
+        if (lsrc && !asmf && !macro_if_skip && linebuf[0]) {
+            if (!inmode)
+                gen_comment(linebuf);  // #if ed line will not be commented
+            if (inmode) {
+                // inline mode 
 
-		// generate inlined line in assembler output
+                // generate inlined line in assembler output
 
-		int i=0;
-		int c;
-		// should be done in some init
-		if (!st_cheap) {
-		    st_cheap = cheap1 = new_cheap();
-		}
+                int i=0;
+                int c;
+                // should be done in some init
+                if (!st_cheap) {
+                    st_cheap = cheap1 = new_cheap();
+                }
 
-		p = st_cheap->ptr;
-		sprintf(num,"%d: ",lineno);
-		parse = list4n(ST_COMMENT,parse,lineno,(NMTBL*)p);
-		// should contain file name
-		c = 0;
-		while((*st_cheap->ptr = num[c++])) 
-		    st_cheap = increment_cheap(st_cheap,&p);
-		while((c = *st_cheap->ptr = linebuf[i++])) {
-		    st_cheap = increment_cheap(st_cheap,&p);
-		    if (c=='\n') {
-			*st_cheap->ptr = 0;
-			st_cheap = increment_cheap(st_cheap,&p);
-			p = st_cheap->ptr;
-			// parse = list3n(ST_COMMENT,parse,(NMTBL*)p);
-			sprintf(num,"%d: ",lineno);
-			c = 0;
-			while((*cheap->ptr = num[c++])) 
-			    st_cheap = increment_cheap(st_cheap,&p);
-		    }
-		}
-	    }
-	}
-	p = chptr = linebuf; while(*p==' '||*p=='\t') p++;
-	if (*p == '#' && !in_comment && !in_quote) {
-	    // macro directive
-	    chptr = p;
-	    if (macro_processing()) return;
-	}
-	if (c==EOF) break;
+                p = st_cheap->ptr;
+                sprintf(num,"%d: ",lineno);
+                parse = list4n(ST_COMMENT,parse,lineno,(NMTBL*)p);
+                // should contain file name
+                c = 0;
+                while((*st_cheap->ptr = num[c++])) 
+                    st_cheap = increment_cheap(st_cheap,&p);
+                while((c = *st_cheap->ptr = linebuf[i++])) {
+                    st_cheap = increment_cheap(st_cheap,&p);
+                    if (c=='\n') {
+                        *st_cheap->ptr = 0;
+                        st_cheap = increment_cheap(st_cheap,&p);
+                        p = st_cheap->ptr;
+                        // parse = list3n(ST_COMMENT,parse,(NMTBL*)p);
+                        sprintf(num,"%d: ",lineno);
+                        c = 0;
+                        while((*cheap->ptr = num[c++])) 
+                            st_cheap = increment_cheap(st_cheap,&p);
+                    }
+                }
+            }
+        }
+        p = chptr = linebuf; while(*p==' '||*p=='\t') p++;
+        if (*p == '#' && !in_comment && !in_quote) {
+            // macro directive
+            chptr = p;
+            if (macro_processing()) return;
+        }
+        if (c==EOF) break;
     } while(!in_quote && (macro_if_skip || linebuf[0] == '#'));
 }
 
@@ -459,13 +459,13 @@
     // can't be in macro expansion
     for(c=0;c<LBUFSIZE-3&&chptr[c];c++);
     if (c>0&&chptr[c-1]=='\\') {
-	return;
+        return;
     } else if (c>0&&chptr[c-1]=='\n') {
-	if (c>0&&chptr[c-2]=='\\') {
-	    return;
-	} else {
-	    c--;
-	}
+        if (c>0&&chptr[c-2]=='\\') {
+            return;
+        } else {
+            c--;
+        }
     } 
     chptr[c] = ';';
     chptr[c+1] = '\n';
@@ -489,11 +489,11 @@
     if (car(i)==CONST) i=cadr(i);
     else i=0;
     if (ch) {
-	if (chptr[-1]==ch) {
-	/* we are fall into getch(), which lost the last ch */
-	/* chptr[-1]==ch check is fanatic, but ... */
-	    chptr--;
-	} else error(-1);
+        if (chptr[-1]==ch) {
+        /* we are fall into getch(), which lost the last ch */
+        /* chptr[-1]==ch check is fanatic, but ... */
+            chptr--;
+        } else error(-1);
     }
     macro_if_depth = macro_if_current;
     macro_if_skip = !i;
@@ -519,140 +519,140 @@
     while (*chptr==' '||*chptr=='\t') ++chptr;
     switch(chptr[0]*chptr[1]) {
     case 'i'*'f':
-	if ((macroeq("ifdef") || macroeq("ifndef"))) {
-	    c = (chptr[-4]=='n');
-	    macro_if_current++;
-	    if (!macro_if_skip) {
-		// try getsym in IFDEF mode to avoid symbol define
-		mode_save = mode; mode = IFDEF;
-		ch= *chptr;
-		i = getsym(0);
-		mode = mode_save;
-		macro_if_depth = macro_if_current;
-		macro_if_skip = (!i)^c;
-	    }
-	    return 0;
-	} else if (macroeq("if")) {
-	    macro_if_current++;
-	    if (!macro_if_skip) {
-		macro_if();
-	    }
-	    return 0;
-	}
-	break;
+        if ((macroeq("ifdef") || macroeq("ifndef"))) {
+            c = (chptr[-4]=='n');
+            macro_if_current++;
+            if (!macro_if_skip) {
+                // try getsym in IFDEF mode to avoid symbol define
+                mode_save = mode; mode = IFDEF;
+                ch= *chptr;
+                i = getsym(0);
+                mode = mode_save;
+                macro_if_depth = macro_if_current;
+                macro_if_skip = (!i)^c;
+            }
+            return 0;
+        } else if (macroeq("if")) {
+            macro_if_current++;
+            if (!macro_if_skip) {
+                macro_if();
+            }
+            return 0;
+        }
+        break;
     case 'e'*'l':
-	if (macroeq("elif")) {
-	    if (macro_if_current==0) {
-		error(MCERR); /* extra #else */
-		return 0;
-	    }
-	    if (macro_if_current == macro_if_depth) {
-		if (!macro_if_skip || macro_if_skip==2) {
-		    macro_if_skip=2;
-		    return 0;
-		}
-		macro_if();
-	    }
-	    return 0;
-	} else if (macroeq("else")) {
-	    if (macro_if_current==0) {
-		error(MCERR); /* extra #else */
-		return 0;
-	    }
-	    if (macro_if_current == macro_if_depth) {
-		if (macro_if_skip==2) ;
-		else if (macro_if_skip) macro_if_skip=0;
-		else macro_if_skip=1;
-	    }
-	    return skip_rest_of_line();
-	}
-	break;
+        if (macroeq("elif")) {
+            if (macro_if_current==0) {
+                error(MCERR); /* extra #else */
+                return 0;
+            }
+            if (macro_if_current == macro_if_depth) {
+                if (!macro_if_skip || macro_if_skip==2) {
+                    macro_if_skip=2;
+                    return 0;
+                }
+                macro_if();
+            }
+            return 0;
+        } else if (macroeq("else")) {
+            if (macro_if_current==0) {
+                error(MCERR); /* extra #else */
+                return 0;
+            }
+            if (macro_if_current == macro_if_depth) {
+                if (macro_if_skip==2) ;
+                else if (macro_if_skip) macro_if_skip=0;
+                else macro_if_skip=1;
+            }
+            return skip_rest_of_line();
+        }
+        break;
     case 'e'*'n':
-	if (macroeq("endif")) {
-	    if (macro_if_current == macro_if_depth) {
-		macro_if_skip = 0;
-		macro_if_depth = --macro_if_current;
-	    } else {
-		if (macro_if_current<=0) {
-		    error(MCERR); /* extra #if */
-		    return 0;
-		}
-		macro_if_current--;
-	    }
-	    return skip_rest_of_line();
-	}
+        if (macroeq("endif")) {
+            if (macro_if_current == macro_if_depth) {
+                macro_if_skip = 0;
+                macro_if_depth = --macro_if_current;
+            } else {
+                if (macro_if_current<=0) {
+                    error(MCERR); /* extra #if */
+                    return 0;
+                }
+                macro_if_current--;
+            }
+            return skip_rest_of_line();
+        }
     }
     if (macro_if_skip) return 0;
     switch(chptr[0]) {
     case 'd':
-	if (macroeq("define")) {
-	    ch= *chptr;
-	    macro_define0();
-	    *(chptr = linebuf) = '\0';
-	    return 0;
-	}
-	break;
+        if (macroeq("define")) {
+            ch= *chptr;
+            macro_define0();
+            *(chptr = linebuf) = '\0';
+            return 0;
+        }
+        break;
     case 'u':
-	if (macroeq("undef")) {
-	    i=mode;
-	    mode=IFDEF;
-	    ch= *chptr;
-	    if (getsym(0)) {
-		// make it EMPTY
-		if (nptr->sc == MACRO) {
-		    nptr->sc = EMPTY;
-		} else if (nptr->sc == FMACRO) {
-		    nptr->sc = EMPTY;
-		    /* we cannot reclaim it's arg */
-		} else error(MCERR);
-	    }
-	    mode=i;
-	    return 0;
-	}
-	break;
+        if (macroeq("undef")) {
+            i=mode;
+            mode=IFDEF;
+            ch= *chptr;
+            if (getsym(0)) {
+                // make it EMPTY
+                if (nptr->sc == MACRO) {
+                    nptr->sc = EMPTY;
+                } else if (nptr->sc == FMACRO) {
+                    nptr->sc = EMPTY;
+                    /* we cannot reclaim it's arg */
+                } else error(MCERR);
+            }
+            mode=i;
+            return 0;
+        }
+        break;
     case 'i':
-	next = 1;
-	if (macroeq("include_next")|| (next=0, macroeq("include"))) {
-	    if(filep+1 >= filestack + FILES) error(FILERR);
-	    if ( ((filep+1)->fcb=getfname(next)) == NULL) error(FILERR);
-	    (filep+1)->ln=lineno;
-	    lineno=0;
-	    ++filep;
-	    *(chptr = linebuf) = '\0';
-	    return 0;
-	}
-	break;
+        next = 1;
+        if (macroeq("include_next")|| (next=0, macroeq("include"))) {
+            if(filep+1 >= filestack + FILES) error(FILERR);
+            if ( ((filep+1)->fcb=getfname(next)) == NULL) error(FILERR);
+            (filep+1)->ln=lineno;
+            lineno=0;
+            ++filep;
+            *(chptr = linebuf) = '\0';
+            return 0;
+        }
+        break;
     case 'p':
-	if (macroeq("pragma")) {
-	    getline1();
-	    return 0;
-	}
-	break;
+        if (macroeq("pragma")) {
+            getline1();
+            return 0;
+        }
+        break;
 #if ASM_CODE
     // deprecated, use asm function
     case 'a':
-	if (macroeq("asm")) {
-	    if (asmf) error(MCERR);
-	    asmf = 1;
-	    getline1();
-	    while (asmf) {
-		 printf("%s",linebuf);
-		getline1();
-	    }
-	    return 0;
-	}
-	break;
+        if (macroeq("asm")) {
+            if (asmf) error(MCERR);
+            asmf = 1;
+            getline1();
+            while (asmf) {
+                 printf("%s",linebuf);
+                getline1();
+            }
+            return 0;
+        }
+        break;
     case 'e':
-	if (macroeq("endasm")) {
-	    if (!asmf) error(MCERR);
-	    asmf = 0;
-	    return 0;
-	}
-	break;
+        if (macroeq("endasm")) {
+            if (!asmf) error(MCERR);
+            asmf = 0;
+            return 0;
+        }
+        break;
 #endif
     case ' ': case '\t': case '\n': case 0:
-	getline1();
-	return 0;
+        getline1();
+        return 0;
     }
     error(MCERR);
     return 0;
@@ -690,7 +690,7 @@
 /* macro define from chptr 
 
        body will be copied and stored in nptr->dsp 
-	    list3s( STRING, list of argments (if any), char *)
+            list3s( STRING, list of argments (if any), char *)
        We don't expand macro here, it just copied.
 
  */
@@ -711,11 +711,11 @@
     }
     args = 0;
     if (ch=='(') {
-	nptr->sc = FMACRO;
-	args = macro_args(&chptr);
+        nptr->sc = FMACRO;
+        args = macro_args(&chptr);
     } else {
-	nptr->sc = MACRO;
-	nptr->ty = -1;
+        nptr->sc = MACRO;
+        nptr->ty = -1;
     }
     // equal is allowed for -Dhoge=aho option
     // if (ch=='=') chptr++;
@@ -725,33 +725,35 @@
 
     // now copy it to the body
     while ((*cheap->ptr = c = *chptr++)
-	&& c != '\n') {
-	cheap = increment_cheap(cheap,body);
-	if (c=='/'&&chptr[0]=='/') {
-	    cheap->ptr--; 
-	    *cheap->ptr = '\0';
-	    while(*chptr++); break;
-	} else if (c=='/'&&chptr[0]=='*') {
-	    cheap->ptr--; chptr++;
-	    for(;;) {
-		c = *chptr++;
-		if (!c) {
-		    getline1();
-		    continue;
-		}
-		if (c=='*'&&chptr[0]=='/') {
-		    c = *chptr++; break;
-		}
-	    }
-	    if (!c) break;
-	} else if (c=='\\' && (*chptr=='\n'||*chptr==0)) {
-	    chptr++;
-	    cheap->ptr--;
-	    getline1();
-	}
+        && c != '\n') {
+        cheap = increment_cheap(cheap,body);
+        if (c=='/'&&chptr[0]=='/') {
+            cheap->ptr--; 
+            *cheap->ptr = '\0';
+            while(*chptr++)
+              ; 
+            break;
+        } else if (c=='/'&&chptr[0]=='*') {
+            cheap->ptr--; chptr++;
+            for(;;) {
+                c = *chptr++;
+                if (!c) {
+                    getline1();
+                    continue;
+                }
+                if (c=='*'&&chptr[0]=='/') {
+                    c = *chptr++; break;
+                }
+            }
+            if (!c) break;
+        } else if (c=='\\' && (*chptr=='\n'||*chptr==0)) {
+            chptr++;
+            cheap->ptr--;
+            getline1();
+        }
     }
     if (c=='\n') {
-	*cheap->ptr = '\0';
+        *cheap->ptr = '\0';
     }
     cheap = increment_cheap(cheap,body);
 // fprintf(stderr,"%s\n",(char *)car(nptr->dsp));
@@ -776,82 +778,82 @@
     body = (char **)&scaddr(args);
     for(;;) {
         *cheap->ptr = c = *chptr++;
-	cheap = increment_cheap(cheap,body);
-	if (c=='\\') {
-	    if (*chptr=='\n') {
-		cheap->ptr--;
-		getline1();
-		chptr = *pchptr;
-		continue;
-	    }
-	}
-	if (!c)  {
-	    chptr--;
-	    error(MCERR);
-	    *pchptr = chptr;
-	    return reverse0(args);
-	}
-	if (in_quote) {
-	    if (c=='\\') {
-		if (*chptr != '\n') {
-		    *cheap->ptr = *chptr++;
-		    cheap = increment_cheap(cheap,body);
-		} else {
-		    getline1();
-		    chptr = *pchptr;
-		}
-	    } else if (c=='\'') {
-		in_quote = 0;
-	    }
-	} else if (in_wquote) {
-	    if (c=='\\') {
-		if (*chptr !='\n') {
-		    *cheap->ptr = *chptr++;
-		    cheap = increment_cheap(cheap,body);
-		} else {
-		    *cheap->ptr = '\n';
-		    getline1();
-		    chptr = *pchptr;
-		}
-	    } else if (c=='"') {
-		in_wquote = 0;
-	    }
-	} else if (c=='"') {
-	    in_wquote = 1;
-	} else if (c=='\'') {
-	    in_quote = 1;
-	} if (plevel==0) {
-	    if (c==',') {
-		cheap->ptr[-1] = 0;
-		args = list3s(STRING,args,cheap->ptr);
-		body = (char **)&scaddr(args);
-	    } else if (c==')') {
-		cheap->ptr[-1] = 0;
-		break;
-	    } else if (c=='(') {
-		plevel++;
-	    } else if (c=='\\') {
-		if (*chptr=='\n') {
-		    cheap->ptr--;
-		    getline1();
-		    chptr = *pchptr;
-		}
-//	    } else if (c==' '||c=='\t') {
-//		cheap->ptr--;
-	    } else if (c=='\n') {
-		cheap->ptr--;
-		getline1();
-		chptr = *pchptr;
-	    }
-	} else if (c==')') {
-	    plevel--;
-	} else if (c=='(') {
-	    plevel++;
-	} else if (c=='\n') {
-	    cheap->ptr--;
-	    getline1();
-	    chptr = *pchptr;
-	}
+        cheap = increment_cheap(cheap,body);
+        if (c=='\\') {
+            if (*chptr=='\n') {
+                cheap->ptr--;
+                getline1();
+                chptr = *pchptr;
+                continue;
+            }
+        }
+        if (!c)  {
+            chptr--;
+            error(MCERR);
+            *pchptr = chptr;
+            return reverse0(args);
+        }
+        if (in_quote) {
+            if (c=='\\') {
+                if (*chptr != '\n') {
+                    *cheap->ptr = *chptr++;
+                    cheap = increment_cheap(cheap,body);
+                } else {
+                    getline1();
+                    chptr = *pchptr;
+                }
+            } else if (c=='\'') {
+                in_quote = 0;
+            }
+        } else if (in_wquote) {
+            if (c=='\\') {
+                if (*chptr !='\n') {
+                    *cheap->ptr = *chptr++;
+                    cheap = increment_cheap(cheap,body);
+                } else {
+                    *cheap->ptr = '\n';
+                    getline1();
+                    chptr = *pchptr;
+                }
+            } else if (c=='"') {
+                in_wquote = 0;
+            }
+        } else if (c=='"') {
+            in_wquote = 1;
+        } else if (c=='\'') {
+            in_quote = 1;
+        } if (plevel==0) {
+            if (c==',') {
+                cheap->ptr[-1] = 0;
+                args = list3s(STRING,args,cheap->ptr);
+                body = (char **)&scaddr(args);
+            } else if (c==')') {
+                cheap->ptr[-1] = 0;
+                break;
+            } else if (c=='(') {
+                plevel++;
+            } else if (c=='\\') {
+                if (*chptr=='\n') {
+                    cheap->ptr--;
+                    getline1();
+                    chptr = *pchptr;
+                }
+//          } else if (c==' '||c=='\t') {
+//              cheap->ptr--;
+            } else if (c=='\n') {
+                cheap->ptr--;
+                getline1();
+                chptr = *pchptr;
+            }
+        } else if (c==')') {
+            plevel--;
+        } else if (c=='(') {
+            plevel++;
+        } else if (c=='\n') {
+            cheap->ptr--;
+            getline1();
+            chptr = *pchptr;
+        }
     }
     *pchptr = chptr;
     return reverse0(args);
@@ -873,8 +875,8 @@
     sargs = args = cadr(nptr->dsp);
     values = macro_args(pchptr);
     if (pchptr==&chptr) {
-	getch();
-	// ch = *chptr++;
+        getch();
+        // ch = *chptr++;
     }
     // eval all argument list
     int evalues = 0;
@@ -892,9 +894,9 @@
     while(args) {
         mappend0(reverse0(car(evalues)),&macro);
         local_define(scaddr(args),macro, scaddr(values));
-	args = cadr(args);
-	evalues = cadr(evalues);
-	values = cadr(values);
+        args = cadr(args);
+        evalues = cadr(evalues);
+        values = cadr(values);
     }
     // process body replacement
     macro = scaddr(nptr->dsp);
@@ -933,8 +935,8 @@
 {
     if (c=='#' && body[0]=='#') return 1;
     while((c=*body++)) {
-	if (c=='#' && body[0]=='#') return 1;
-	if (c!=' ' && c!='\t' && c!='\n') return 0;
+        if (c=='#' && body[0]=='#') return 1;
+        if (c!=' ' && c!='\t' && c!='\n') return 0;
     }
     return 0;
 }
@@ -945,7 +947,7 @@
     This is a recursive interpreter. 
 
     reuslt:   list2("replaced string",next)
-	history is necessary to avoid recursion
+        history is necessary to avoid recursion
  */
 
 static int
@@ -965,122 +967,122 @@
     macrop = list3s(STRING,macrop,cheap->ptr);
     expand = (char **)&scaddr(macrop);
     for(; (c = *body++) ;) {
-	if (in_quote) {
-	    if (c=='\\') {
-		*cheap->ptr = c; c = *body++;
-		cheap = increment_cheap(cheap,expand);
-	    } else if (c=='\'') {
-		in_quote = 0;
-	    }
-	} else if (in_wquote) {
-	    if (c=='\\') {
-		*cheap->ptr = c; c = *body++;
-		cheap = increment_cheap(cheap,expand);
-	    } else if (c=='"') {
-		in_wquote = 0;
-	    }
-	} else if (c=='"') {
-	    in_wquote = 1; prev_concat = 0;
-	} else if (c=='\'') {
-	    in_quote = 1; prev_concat = 0;
-	} else if (c=='#' && *body=='#') {
-	    mconcat = 1; 
-	    prev_concat = 1;
-	    // name concatenation. flag only. remove and re-evaluate
-	    // in the top level. (and skip space)
-	} else if (!mconcat && c=='#' && alpha(*body)) {
-	    // turn into string next macro literal
-	    string_flag = 1;
-	    string_mark(expand);
-	    prev_concat = 0;
+        if (in_quote) {
+            if (c=='\\') {
+                *cheap->ptr = c; c = *body++;
+                cheap = increment_cheap(cheap,expand);
+            } else if (c=='\'') {
+                in_quote = 0;
+            }
+        } else if (in_wquote) {
+            if (c=='\\') {
+                *cheap->ptr = c; c = *body++;
+                cheap = increment_cheap(cheap,expand);
+            } else if (c=='"') {
+                in_wquote = 0;
+            }
+        } else if (c=='"') {
+            in_wquote = 1; prev_concat = 0;
+        } else if (c=='\'') {
+            in_quote = 1; prev_concat = 0;
+        } else if (c=='#' && *body=='#') {
+            mconcat = 1; 
+            prev_concat = 1;
+            // name concatenation. flag only. remove and re-evaluate
+            // in the top level. (and skip space)
+        } else if (!mconcat && c=='#' && alpha(*body)) {
+            // turn into string next macro literal
+            string_flag = 1;
+            string_mark(expand);
+            prev_concat = 0;
             goto names;
-	} else if (alpha(c)) {
-	    // find a name
-	    body--; // ungetc
+        } else if (alpha(c)) {
+            // find a name
+            body--; // ungetc
 names:
-	    nptrm = get_name(body,&len,NONDEF);
-	    if (!nptrm) {
-		while((*cheap->ptr = *body++) && len--)
-		    cheap = increment_cheap(cheap,expand);
-		body--;
-		if (string_flag) {
-		    string_flag = 0;
-		    string_mark(expand);
-		}
-		continue;
-	    }
-	    body += len;
-	    c = *body;
-	    nptrm = name_space_search(nptrm,MACRO);
-	    if (nptrm->dsp)
-		macro = scaddr(nptrm->dsp);
-	    else
-		macro="";
-	    if (check_recurse(nptrm->nm,history)) {
-		// should return the most original one, but how?
-		// save_cheap/reset_cheap and return here?
-		macro = nptrm->nm;
-		goto skip;
-	    }
-	    switch(nptrm->sc) {
-	    case FMACRO:
-		if (c==' '||c=='\t') {
-		    while (c==' '||c=='\t') c=*body++;
-		    body--;
-		}
-		if(c!='(') {
-		    macro = nptrm->nm;
-		    goto skip; // error(MCERR); this isn't error
-		}
-		*cheap->ptr = 0;
-		cheap = increment_cheap(cheap,expand);
-		body++;
-		macrop = macro_function(macrop,&body,nptrm,
-			glist3s(STRING,history,nptrm->nm));
-		macrop = list3s(STRING,macrop,cheap->ptr);
-		expand = (char **)&(scaddr(macrop));
-		break;
-	    default:
-		if (prev_concat) {
-		    prev_concat = 0;
-		    macro = nptrm->u.nm;
-		} else if (next_concat(c,body)) {
-		    prev_concat = 1;
-		    macro = nptrm->u.nm;
-		}  
-		if (macro==0 || !macro[0]) 
-		    macro = nptrm->nm;
-		goto skip;
-	    case MACRO:
-		if (neqname(nptrm->nm,macro)) {
-		    if (macro[0]==0)  {
-			if (string_flag) {
-			    string_flag = 0;
-			    string_mark(expand);
-			}
-			continue;
-		    }
-		    *cheap->ptr = 0;
-		    cheap = increment_cheap(cheap,expand);
-		    macrop=macro_eval(macrop,macro,glist3s(STRING,history,nptrm->nm));
-		    macrop = list3s(STRING,macrop,cheap->ptr);
-		    expand = (char **)&(scaddr(macrop));
-		    break;
-		}
-		macro = nptrm->nm;
+            nptrm = get_name(body,&len,NONDEF);
+            if (!nptrm) {
+                while((*cheap->ptr = *body++) && len--)
+                    cheap = increment_cheap(cheap,expand);
+                body--;
+                if (string_flag) {
+                    string_flag = 0;
+                    string_mark(expand);
+                }
+                continue;
+            }
+            body += len;
+            c = *body;
+            nptrm = name_space_search(nptrm,MACRO);
+            if (nptrm->dsp)
+                macro = scaddr(nptrm->dsp);
+            else
+                macro="";
+            if (check_recurse(nptrm->nm,history)) {
+                // should return the most original one, but how?
+                // save_cheap/reset_cheap and return here?
+                macro = nptrm->nm;
+                goto skip;
+            }
+            switch(nptrm->sc) {
+            case FMACRO:
+                if (c==' '||c=='\t') {
+                    while (c==' '||c=='\t') c=*body++;
+                    body--;
+                }
+                if(c!='(') {
+                    macro = nptrm->nm;
+                    goto skip; // error(MCERR); this isn't error
+                }
+                *cheap->ptr = 0;
+                cheap = increment_cheap(cheap,expand);
+                body++;
+                macrop = macro_function(macrop,&body,nptrm,
+                        glist3s(STRING,history,nptrm->nm));
+                macrop = list3s(STRING,macrop,cheap->ptr);
+                expand = (char **)&(scaddr(macrop));
+                break;
+            default:
+                if (prev_concat) {
+                    prev_concat = 0;
+                    macro = nptrm->u.nm;
+                } else if (next_concat(c,body)) {
+                    prev_concat = 1;
+                    macro = nptrm->u.nm;
+                }  
+                if (macro==0 || !macro[0]) 
+                    macro = nptrm->nm;
+                goto skip;
+            case MACRO:
+                if (neqname(nptrm->nm,macro)) {
+                    if (macro[0]==0)  {
+                        if (string_flag) {
+                            string_flag = 0;
+                            string_mark(expand);
+                        }
+                        continue;
+                    }
+                    *cheap->ptr = 0;
+                    cheap = increment_cheap(cheap,expand);
+                    macrop=macro_eval(macrop,macro,glist3s(STRING,history,nptrm->nm));
+                    macrop = list3s(STRING,macrop,cheap->ptr);
+                    expand = (char **)&(scaddr(macrop));
+                    break;
+                }
+                macro = nptrm->nm;
 skip:
-	    case LMACRO:
-		while((*cheap->ptr = *macro++)/* && len-- */)
-		    cheap = increment_cheap(cheap,expand);
-	    }
-	    if (string_flag) {
-		string_flag = 0;
-		string_mark(expand);
-	    }
-	    continue;
-	}
-	*cheap->ptr = c;
-	cheap = increment_cheap(cheap,expand);
+            case LMACRO:
+                while((*cheap->ptr = *macro++)/* && len-- */)
+                    cheap = increment_cheap(cheap,expand);
+            }
+            if (string_flag) {
+                string_flag = 0;
+                string_mark(expand);
+            }
+            continue;
+        }
+        *cheap->ptr = c;
+        cheap = increment_cheap(cheap,expand);
     }
     *cheap->ptr = 0;
     cheap = increment_cheap(cheap,expand);
@@ -1100,9 +1102,9 @@
     for(;lists;lists = cadr(lists)) {
         p = scaddr(lists);
         for(;(*cheap->ptr = *p++);cheap = increment_cheap(cheap,result)) {
-	    // in_quote + \n case ? should be \n.
-	    if (p[-1]=='\n') cheap->ptr[0]=' ';
-	}
+            // in_quote + \n case ? should be \n.
+            if (p[-1]=='\n') cheap->ptr[0]=' ';
+        }
     }
     cheap = increment_cheap(cheap,result);
     return *result;
@@ -1117,9 +1119,9 @@
     for(;lists;lists = cadr(lists)) {
         p = scaddr(lists);
         for(;(*cheap->ptr=*p++);cheap = increment_cheap(cheap,result)) {
-	    // in_quote + \n case ? should be \n.
-	    // if (p[-1]=='\n') cheap->ptr[0]=' ';
-	}
+            // in_quote + \n case ? should be \n.
+            // if (p[-1]=='\n') cheap->ptr[0]=' ';
+        }
     }
     cheap = increment_cheap(cheap,result);
     return *result;
@@ -1129,11 +1131,11 @@
 check_recurse(char *macro,int history)
 {
     for(;history;history = cadr(history)) {
-	if (macro==scaddr(history)) {
+        if (macro==scaddr(history)) {
 // fprintf(stderr,"check_recurse: %s %s = ",macro,scaddr(history)); 
 // fprintf(stderr,"1\n");
-	    return 1;
-	}
+            return 1;
+        }
     }
 // fprintf(stderr,"0\n");
     return 0;
--- a/mc-parse.c	Mon Sep 16 18:02:58 2013 +0900
+++ b/mc-parse.c	Mon Mar 31 18:33:20 2014 +0900
@@ -5363,8 +5363,8 @@
 extern NMTBL *
 name_space_search(NMTBL *hash,int sc)
 {
-    int ns;
-    NMTBL *n;
+    int ns = 0;
+    NMTBL *n = 0;
 
     for(ns=hash->dsp;ns;ns=cadr(ns)) { // iterate on possible scope
 	if (car(ns)==sc) {
@@ -5374,7 +5374,7 @@
     if (ns==0) {
 	n = get_nptr();
 	hash->dsp = glist3n(sc,hash->dsp,n); // make a scope for sc
-    }
+    } // else error ?
     n->nm = hash->nm;
     n->sc = EMPTY;
     n->dsp = 0;
--- a/mc-tree.c	Mon Sep 16 18:02:58 2013 +0900
+++ b/mc-tree.c	Mon Mar 31 18:33:20 2014 +0900
@@ -182,7 +182,7 @@
     case ASS: *name = "="; *args="ee"; *order=1; break;
     case ASSOP: *name = "assop"; *args="eev"; *order=1; break;
     case CASSOP: *name = "cassop"; *args="eev"; *order=1; break;
-    case COMMA: *name = "; *args=","ee"; *order=0; break;
+    case COMMA: *name = ","; *args="ee"; *order=0; break;
     case LPAR: *name = "("; *args=""; *order=-1; break;
     case RPAR: *name = ")"; *args=""; *order=-1; break;
     case LBRA: *name = "["; *args=""; *order=-1; break;
--- a/stdio.h	Mon Sep 16 18:02:58 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-#ifndef __micro_c___
-#ifndef __ARM_ARCH_4__
-#include "/usr/include/stdio.h"
-#else /* __ARM_ARCH_4__ */
-// #include "/usr/include/stdio.h"
-#include "/home/zaurus/develop/include/stdio.h"
-#endif /* __ARM_ARCH_4__ */
-long long strtoll(const char *, char **, int);
-#ifndef __ARM_ARCH_4__
-void * malloc(size_t size);
-void * realloc(void *ptr, size_t size);
-#else /* __ARM_ARCH_4__ */
-char *malloc(int);
-void * realloc(void *ptr, int size);
-#endif /* __ARM_ARCH_4__ */
-#else
-
-// typedef int size_t;
-#define size_t int
-
-#ifndef __ARM_ARCH_4__
-void * malloc(size_t size);
-#endif /* ! __ARM_ARCH_4__ */
-long long strtoll(const char *, char **, int);
-void * realloc(void *ptr, size_t size);
-
-#ifdef __APPLE__
-
-typedef	struct {
-	/* char	pad[96];	 */
-	char	pad[88];	
-} FILE;
-extern FILE __sF[];
-#define stdin   (&__sF[0])
-#define stdout  (&__sF[1])
-#define stderr  (&__sF[2])
-
-#else
-typedef	struct {
-	/* this is all wrong, but so what? */
-	/* char	pad[96];	 */
-	char	pad[148];	
-} FILE;
-#ifdef bsd
-extern FILE __sstdin;
-extern FILE __sstdout;
-extern FILE __sstderr;
-
-#define	stdin	(&__sstdin)
-#define	stdout	(&__sstdout)
-#define	stderr	(&__sstderr)
-#else
-/* new Linux */
-extern FILE *stdin;
-extern FILE *stdout;
-extern FILE *stderr;
-/*
-#define	stdin stdin
-#define	stdout stdout
-#define	stderr stderr
- */
-#endif
-#endif
-
-#define	BUFSIZ	1024		/* size of buffer used by setbuf */
-#define	EOF	(-1)
-#define	NULL	0
-
-typedef int SIZE_T_;
-typedef /*long*/ int fpos_t;
-// typedef void *__gnuc_va_list;
- 
-void	 clearerr(FILE *);
-int	 fclose(FILE *);
-int	 feof(FILE *);
-int	 ferror(FILE *);
-int	 fflush(FILE *);
-int	 fgetc(FILE *);
-int	 fgetpos(FILE *, fpos_t *);
-int	 fileno(FILE *);
-void	 flockfile();
-
-int	 fprintf(FILE *, const char *, ...);
-int	 fpurge();
-int	 fputc(int, FILE *);
-int	 fputs(const char *, FILE *);
-SIZE_T_	 fread(void *, size_t, size_t, FILE *);
-int	 fscanf(FILE *, const char *, ...);
-
-/* int	 fseek(FILE *, long int, int); */
-
-int	 fsetpos(FILE *, const fpos_t *);
-long	 ftell(FILE *);
-int	 ftrylockfile();
-void	 funlockfile();
-SIZE_T_	 fwrite(const void *, size_t, size_t, FILE *);
-int	 getc(FILE *);
-int	 getc_unlocked();
-int	 getchar(void);
-int	 getchar_unlocked();
-int	 getw(FILE *);
-int	 pclose(FILE *);
-void	 perror(const char *);
-int	 printf(const char *, ...);
-int	 putc(int, FILE *);
-int	 putc_unlocked();
-int	 putchar(int);
-int	 putchar_unlocked();
-int	 puts(const char *);
-int	 putw(int, FILE *);
-int	 remove(const char *);
-int	 rename (const char *, const char *);
-void	 rewind(FILE *);
-int	 scanf(const char *, ...);
-void	 setbuf(FILE *, char *);
-void	 setbuffer();
-int	 setlinebuf();
-int	 setvbuf(FILE *, char *, int, SIZE_T_);
-int	 snprintf();
-int	 sprintf(char *, const char *, ...);
-int	 sscanf(const char *, const char *, ...);
-int	 ungetc(int, FILE *);
-// int	 vfprintf(FILE *, const char *, __gnuc_va_list);
-int	 vfscanf();
-// int	 vprintf(const char *, __gnuc_va_list);
-int	 vscanf();
-int	 vsnprintf();
-// int	 vsprintf(char *, const char *, __gnuc_va_list);
-int	 vsscanf();
-char	*ctermid(char *);
-FILE	*fdopen(int, const char *);
-char	*fgetln();
-char	*fgets(char *, int, FILE *);
-FILE	*fopen(const char *, const char *);
-FILE	*freopen(const char *, const char *, FILE *);
-FILE	*funopen();
-char	*gets(char *);
-FILE	*popen(const char *, const char *);
-char	*tempnam(const char *, const char *);
-FILE	*tmpfile(void);
-char	*tmpnam(char *);
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stdio.template	Mon Mar 31 18:33:20 2014 +0900
@@ -0,0 +1,141 @@
+#ifndef __micro_c___
+#ifndef __ARM_ARCH_4__
+#include "/usr/include/stdio.h"
+#else /* __ARM_ARCH_4__ */
+#include "/home/zaurus/develop/include/stdio.h"
+#endif /* __ARM_ARCH_4__ */
+long long strtoll(const char *, char **, int);
+#ifndef __ARM_ARCH_4__
+void * malloc(size_t size);
+void * realloc(void *ptr, size_t size);
+#else /* __ARM_ARCH_4__ */
+char *malloc(int);
+void * realloc(void *ptr, int size);
+#endif /* __ARM_ARCH_4__ */
+#else
+
+// typedef int size_t;
+#define size_t int
+
+#ifndef __ARM_ARCH_4__
+void * malloc(size_t size);
+#endif /* ! __ARM_ARCH_4__ */
+long long strtoll(const char *, char **, int);
+void * realloc(void *ptr, size_t size);
+
+#ifdef __APPLE__
+
+typedef	struct {
+	/* char	pad[96];	 */
+	char	pad[88];	
+} FILE;
+extern FILE __sF[];
+#define stdin   (&__sF[0])
+#define stdout  (&__sF[1])
+#define stderr  (&__sF[2])
+
+#else
+typedef	struct {
+	/* this is all wrong, but so what? */
+	/* char	pad[96];	 */
+	char	pad[148];	
+} FILE;
+#ifdef bsd
+extern FILE __sstdin;
+extern FILE __sstdout;
+extern FILE __sstderr;
+
+#define	stdin	(&__sstdin)
+#define	stdout	(&__sstdout)
+#define	stderr	(&__sstderr)
+#else
+/* new Linux */
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+/*
+#define	stdin stdin
+#define	stdout stdout
+#define	stderr stderr
+ */
+#endif
+#endif
+
+#define	BUFSIZ	1024		/* size of buffer used by setbuf */
+#define	EOF	(-1)
+#define	NULL	0
+
+typedef int SIZE_T_;
+typedef /*long*/ int fpos_t;
+// typedef void *__gnuc_va_list;
+ 
+void	 clearerr(FILE *);
+int	 fclose(FILE *);
+int	 feof(FILE *);
+int	 ferror(FILE *);
+int	 fflush(FILE *);
+int	 fgetc(FILE *);
+int	 fgetpos(FILE *, fpos_t *);
+int	 fileno(FILE *);
+void	 flockfile();
+
+int	 fprintf(FILE *, const char *, ...);
+int	 fpurge();
+int	 fputc(int, FILE *);
+int	 fputs(const char *, FILE *);
+SIZE_T_	 fread(void *, size_t, size_t, FILE *);
+int	 fscanf(FILE *, const char *, ...);
+
+/* int	 fseek(FILE *, long int, int); */
+
+int	 fsetpos(FILE *, const fpos_t *);
+long	 ftell(FILE *);
+int	 ftrylockfile();
+void	 funlockfile();
+SIZE_T_	 fwrite(const void *, size_t, size_t, FILE *);
+int	 getc(FILE *);
+int	 getc_unlocked();
+int	 getchar(void);
+int	 getchar_unlocked();
+int	 getw(FILE *);
+int	 pclose(FILE *);
+void	 perror(const char *);
+int	 printf(const char *, ...);
+int	 putc(int, FILE *);
+int	 putc_unlocked();
+int	 putchar(int);
+int	 putchar_unlocked();
+int	 puts(const char *);
+int	 putw(int, FILE *);
+int	 remove(const char *);
+int	 rename (const char *, const char *);
+void	 rewind(FILE *);
+int	 scanf(const char *, ...);
+void	 setbuf(FILE *, char *);
+void	 setbuffer();
+int	 setlinebuf();
+int	 setvbuf(FILE *, char *, int, SIZE_T_);
+int	 snprintf();
+int	 sprintf(char *, const char *, ...);
+int	 sscanf(const char *, const char *, ...);
+int	 ungetc(int, FILE *);
+// int	 vfprintf(FILE *, const char *, __gnuc_va_list);
+int	 vfscanf();
+// int	 vprintf(const char *, __gnuc_va_list);
+int	 vscanf();
+int	 vsnprintf();
+// int	 vsprintf(char *, const char *, __gnuc_va_list);
+int	 vsscanf();
+char	*ctermid(char *);
+FILE	*fdopen(int, const char *);
+char	*fgetln();
+char	*fgets(char *, int, FILE *);
+FILE	*fopen(const char *, const char *);
+FILE	*freopen(const char *, const char *, FILE *);
+FILE	*funopen();
+char	*gets(char *);
+FILE	*popen(const char *, const char *);
+char	*tempnam(const char *, const char *);
+FILE	*tmpfile(void);
+char	*tmpnam(char *);
+#endif
--- a/tools/find-gcc-include-path	Mon Sep 16 18:02:58 2013 +0900
+++ b/tools/find-gcc-include-path	Mon Mar 31 18:33:20 2014 +0900
@@ -1,19 +1,45 @@
 #!/usr/bin/perl
 
 my $CC = $ARGV[1];
-my $gcc = `echo '#include <stddef.h>' | $CC -E - `;
+my $gcc = `echo '#include <stdio.h>' | $CC -E - `;
+
+$gcc =~ m=\"(/[^"]+/)stdio\.h"=;
+my $gcc_path = $1;
+
+my $gcc1 = `echo '#include <stddef.h>' | $CC -E - `;
+
+$gcc1 =~ m=\"(/[^"]+/)stddef\.h"=;
+my $gcc_path1 = $1;
 
-$gcc =~ m=\"(/[^"]+/)stddef\.h"=;
-my $gcc_path = $1;
+my $path = <<EOF;
+    "$gcc_path",
+EOF
+if ($gcc_path1 ne $gcc_path) {
+ $path = <<EOF;
+    "$gcc_path",
+    "$gcc_path1",
+EOF
+}
 
 if ($ARGV[0]=~/-l/) {
 print <<EOF
 char *l_include_path[] = {
-    "$gcc_path",
+$path
     "/usr/include/",
     0
 };
 EOF
+} elsif ($ARGV[0]=~/-s/) {
+   open my $fd, "<", "stdio.template" or die("can't open stdio.template");
+   my $repl = 1;
+   while(<$fd>) {
+      if ($repl && /\#include \"\/usr\/include\/stdio.h\"/) {
+          print "#include \"${gcc_path}stdio.h\"\n";
+          $repl = 0;
+          next;
+      }
+      print;
+   }
 } else {
 	print "$gcc_path\n";
 }