# HG changeset patch # User Shinji KONO # Date 1321894087 -32400 # Node ID f283fc68137fe8213ef290b97e29dc6f36fd070f # Parent 280815f3111aa5a7f004a60f276cd90f8f25e428 intel64 on Lion conv.c conv1.c worked. diff -r 280815f3111a -r f283fc68137f mc-macro.c --- 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; } diff -r 280815f3111a -r f283fc68137f mc-parse.c --- 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);