changeset 539:00da98433e63

macro arg continuation
author kono
date Sat, 31 Dec 2005 19:24:19 +0900
parents f9c6976ba270
children fe37f32b552b
files mc-macro.c mc-parse.c
diffstat 2 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mc-macro.c	Sat Dec 31 17:28:49 2005 +0900
+++ b/mc-macro.c	Sat Dec 31 19:24:19 2005 +0900
@@ -139,8 +139,7 @@
     if (fp) {
 	p = name; 
     } else {
-	for(pp=(end=='>'||filep->inc=='>') ?l_include_path:include_path;
-		*pp;pp++) {
+	for(pp=include_path; *pp;pp++) {  // "" and <> case
 	    p = expand_file_name(*pp,name);
 	    if ((fp = fopen(p,"r"))) {
 		if (next) {
@@ -150,6 +149,18 @@
 		    break ;
 	    }
 	}
+        if (!fp && (end=='>'||filep->inc=='>')) {  // <> case only
+	    for(pp=l_include_path; *pp;pp++) {
+		p = expand_file_name(*pp,name);
+		if ((fp = fopen(p,"r"))) {
+		    if (next) {
+			fclose(fp); fp=0; next=0; 
+			continue;
+		    } else
+			break ;
+		}
+	    }
+	}
     }
     if(!fp) { error(FILERR); return filep->fcb; }
     copy_current_file_dir(s=p);
@@ -578,6 +589,14 @@
     for(;;) {
         *cheap->ptr = c = *chptr++;
 	cheap = increment_cheap(cheap,body);
+	if (c=='\\') {
+	    if (*chptr=='\n') {
+		cheap->ptr--;
+		getline();
+		chptr = *pchptr;
+		continue;
+	    }
+	}
 	if (!c)  {
 	    chptr--;
 	    error(MCERR);
@@ -591,6 +610,7 @@
 		    cheap = increment_cheap(cheap,body);
 		} else {
 		    getline();
+		    chptr = *pchptr;
 		}
 	    } else if (c=='\'') {
 		in_quote = 0;
@@ -603,6 +623,7 @@
 		} else {
 		    *cheap->ptr = '\n';
 		    getline();
+		    chptr = *pchptr;
 		}
 	    } else if (c=='"') {
 		in_wquote = 0;
@@ -625,6 +646,7 @@
 		if (*chptr=='\n') {
 		    cheap->ptr--;
 		    getline();
+		    chptr = *pchptr;
 		}
 //	    } else if (c==' '||c=='\t') {
 //		cheap->ptr--;
--- a/mc-parse.c	Sat Dec 31 17:28:49 2005 +0900
+++ b/mc-parse.c	Sat Dec 31 19:24:19 2005 +0900
@@ -765,6 +765,7 @@
     if(sym==LC || ( sym!=SM && sym!=COMMA && sym!=ASS)) {
 	/* function body */
 	if (mode!=GDECL) error(DCERR);
+	if (type<0) error(DCERR);
         stypedecl=sd;
 	if (car(type)==CODE) {
 	    code_decl(n); return;
@@ -4399,6 +4400,7 @@
 	chsave = j;
 	return ch;
     }
+    if (!filep) return ch=0; // command line case;
     getline();
     if (in_macro_if) check_macro_eof();
     return getch();