changeset 854:f283fc68137f

intel64 on Lion conv.c conv1.c worked.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 22 Nov 2011 01:48:07 +0900
parents 280815f3111a
children 740b026e58b9
files mc-macro.c mc-parse.c
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mc-macro.c	Mon Nov 21 21:41:20 2011 +0900
+++ b/mc-macro.c	Tue Nov 22 01:48:07 2011 +0900
@@ -110,7 +110,7 @@
 
     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;) {
@@ -119,15 +119,17 @@
 		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
- if (1 && lsrc) {
-     printf("### %s\n",macropp);
+if (1 && lsrc) {
+     printf("\n### %s\n",macropp);
      if (t[-2]!='\n') putchar('\n');
- }
+}
         macrop=macro_eval(macrop,macropp,macro_history);
 	cheap = reset_cheap(&scheap);
 	macropp = cheap->ptr;
@@ -869,7 +871,8 @@
     sargs = args = cadr(nptr->dsp);
     values = macro_args(pchptr);
     if (pchptr==&chptr) {
-	ch = *chptr++;
+	getch();
+	// ch = *chptr++;
     }
     // do not eval argument here
     // define all arguments locally
@@ -904,6 +907,14 @@
     nptr0->nm = value;
 }
 
+static int
+string_mark(char **expand)
+{
+    mconcat = 1;
+    *cheap->ptr = STRING; //  special value for string
+    cheap = increment_cheap(cheap,expand);
+}
+
 /*
     Evaluate macro string.
 
@@ -954,8 +965,7 @@
 	} else if (!mconcat && c=='#' && alpha(*body)) {
 	    // turn into string next macro literal
 	    string_flag = 1;
-	    *cheap->ptr = '"';
-	    cheap = increment_cheap(cheap,expand);
+	    string_mark(expand);
             goto names;
 	} else if (alpha(c)) {
 	    // find a name
@@ -968,8 +978,7 @@
 		body--;
 		if (string_flag) {
 		    string_flag = 0;
-		    *cheap->ptr = '"';
-		    cheap = increment_cheap(cheap,expand);
+		    string_mark(expand);
 		}
 		continue;
 	    }
@@ -1005,8 +1014,7 @@
 		    if (macro[0]==0)  {
 			if (string_flag) {
 			    string_flag = 0;
-			    *cheap->ptr = '"';
-			    cheap = increment_cheap(cheap,expand);
+			    string_mark(expand);
 			}
 			continue;
 		    }
@@ -1026,8 +1034,7 @@
 	    }
 	    if (string_flag) {
 		string_flag = 0;
-		*cheap->ptr = '"';
-		cheap = increment_cheap(cheap,expand);
+		string_mark(expand);
 	    }
 	    continue;
 	}
--- a/mc-parse.c	Mon Nov 21 21:41:20 2011 +0900
+++ b/mc-parse.c	Tue Nov 22 01:48:07 2011 +0900
@@ -1006,9 +1006,9 @@
     checksym(LPAR);
     if (attr==ASM) {
 	//  int r __asm("r0") 
-	getsym(ATTRIBUTE);
 	if (sym==STRING) {
 	    attribute = list3n(ASM,attribute,nptr);
+	    getsym(0);
 	}
 	mode = smode;
 	checksym(RPAR);
@@ -1016,7 +1016,7 @@
     }
     while(sym!=RPAR) {
 	if (sym==LPAR) {
-	    attributes(0);
+	    attributes(0);   //     __attibte(())
 	} else if (sym==IDENT) {
 	    attribute = list3n(IDENT,attribute,nptr);
 	    getsym(ATTRIBUTE);