diff mc-macro.c @ 349:b74b580c10f6

name table debug continue...
author kono
date Fri, 02 Jul 2004 14:14:24 +0900
parents e77b3a7002ad
children 43099915f4c2
line wrap: on
line diff
--- a/mc-macro.c	Fri Jul 02 07:19:15 2004 +0900
+++ b/mc-macro.c	Fri Jul 02 14:14:24 2004 +0900
@@ -451,7 +451,6 @@
 	}
     }
     if (c=='\n') {
-	cheap->ptr--;
 	*cheap->ptr = '\0';
     }
     cheap = increment_cheap(cheap,body);
@@ -610,7 +609,8 @@
 static int
 macro_eval(int macrop,char *body0,int history)
 {
-    int c,len;
+    int c/*,len*/;
+    int sch; char *schptr;
     int in_quote = 0;
     int in_wquote = 0;
     char *macro;
@@ -642,9 +642,17 @@
 	    // name concatenation. skip ## and re-eval macro line.
 	    mconcat = 1; body++; continue;
 	} else if (alpha(c)) {
+#if 0
+	    body--; // ungetc
 	    nptrm = get_name(body,&len);
-	    body += len;
+	    c = *body;
+#else
+	    sch = ch; schptr = chptr; ch = c; chptr = body;
+	    nptrm = get_name_from_chptr();
+	    body = chptr; c = ch;
 	    body--; // ungetc
+	    ch = sch; chptr = schptr;
+#endif
 	    nptrm = name_space_search(nptrm,MACRO);
 	    macro = (char *)car(nptrm->dsp);
 	    switch(nptrm->sc) {
@@ -654,6 +662,7 @@
 		    body--;
 		}
 		if(c!='(') error(MCERR);
+		*cheap->ptr = 0;
 		cheap = increment_cheap(cheap,expand);
 		body++;
 		macrop = macro_function(macrop,&body,nptrm,
@@ -674,9 +683,8 @@
 	    default:
 		macro = nptrm->nm;
 	    case LMACRO:
-		while((*cheap->ptr = *macro++));
+		while((*cheap->ptr = *macro++)/* && len-- */)
 		    cheap = increment_cheap(cheap,expand);
-		cheap->ptr--;
 	    }
 	    continue;
 	}