changeset 35:fd18d440f5ee macro-function-if

macro function (works. but dirty. )
author kono
date Mon, 10 Feb 2003 08:09:43 +0900
parents 0756caa79167
children 9f89cef85b41
files mc-parse.c
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mc-parse.c	Mon Feb 10 07:38:09 2003 +0900
+++ b/mc-parse.c	Mon Feb 10 08:09:43 2003 +0900
@@ -2195,7 +2195,7 @@
 {
     NMTBL *nptr0,*nptr1,*nptrm;
     int i,slfree,macrop;
-    char c,*save_cheapp;
+    char c;
 
     if (alpha(skipspc())) {	
 	i = hash = 0;
@@ -2223,7 +2223,6 @@
 	    i = mode;
 	    mode = STAT;
 	    macrop = 0;
-	    save_cheapp = cheapp;
 	    slfree = lfree;
 	    macropp = macro_buf;
 	    if (nptrm->sc == FMACRO) {
@@ -2233,9 +2232,11 @@
 	    }
 	    macropp = macro_buf;
 	    append(reverse0(macrop));
-	    cheapp = save_cheapp;
+	    macropp[-1] ='\n';
+	    *macropp =0;
 	    lfree = slfree;
-fprintf(stderr,"#macro: %s => %s\n",nptrm->nm,macro_buf);
+	    if (lsrc && !asmf ) gen_comment(macro_buf);
+/* fprintf(stderr,"#macro: %s => %s\n",nptrm->nm,macro_buf); */
 	    chptrsave = chptr;
 	    chsave = ch = chptr[-1];
 	    chptr = macro_buf;
@@ -2753,7 +2754,7 @@
     mode=MDECL;
     ch= *chptr;
     getsym();
-fprintf(stderr,"macro def: %s =>",name);
+/* fprintf(stderr,"macro def: %s =>",name); */
     if (nptr->sc != EMPTY) { /* override exisiting macro */
     }
     args = 0;
@@ -2775,7 +2776,7 @@
     *cheapp++ = '\0';
     if (cheapp >= cheap+CHEAPSIZE) /* too late? */
 	error(STRERR);
-fprintf(stderr,"%s\n",(char *)car(nptr->dsp));
+/* fprintf(stderr,"%s\n",(char *)car(nptr->dsp)); */
     mode=i;
 }
 
@@ -2877,13 +2878,13 @@
     evalues = reverse0(evalues);
     while(args) {
 	local_define((char *)car(args),append(reverse0(car(evalues))));
-fprintf(stderr,"%s: %s => %s\n",nptr->nm,(char *)car(args),(char *)car(msearch0((char *)car(args))->dsp));
+/* fprintf(stderr,"%s: %s => %s\n",nptr->nm,(char *)car(args),(char *)car(msearch0((char *)car(args))->dsp)); */
 	args = cadr(args);
 	evalues = cadr(evalues);
     }
     macro = (char *)car(nptr->dsp);
     macrop = macro_eval(macrop,macro,list2((int)macro,history));
-fprintf(stderr,"%s: result %s => %s\n",nptr->nm,macro,(char *)car(macrop));
+/* fprintf(stderr,"%s: result %s => %s\n",nptr->nm,macro,(char *)car(macrop)); */
     args = sargs;
     while(args) {
 	local_undef((char *)car(args));
@@ -3055,7 +3056,7 @@
     char *result = macropp;
     while(lists) {
 	p = (char *)car(lists);
-	while((*macropp++=*p++));
+	while((*macropp++=*p++)) if (p[-1]=='\n') macropp[-1]=' ';
 	macropp--;
 	lists = cadr(lists);
     }