changeset 509:e58848f6ebc1

inline continue...
author kono
date Sun, 25 Dec 2005 16:07:45 +0900
parents d8102a46b78d
children 2bd6ff6ee9a8
files mc-inline.c mc-macro.c mc-parse.c mc.h
diffstat 4 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mc-inline.c	Sun Dec 25 10:52:54 2005 +0900
+++ b/mc-inline.c	Sun Dec 25 16:07:45 2005 +0900
@@ -397,9 +397,9 @@
 {
     int i;
     int pvartable = getfree(adisp-ldisp); // have to be local heap
-    pdisp = pvartable+adisp;
-    for(i=adisp-ldisp;i>=0;i--) {
-	heap[pvartable+i] = 0;
+    pdisp = pvartable-ldisp;
+    for(i=ldisp;i<0;i++) {
+	heap[pdisp+i] = 0;
     }
     return pvartable;
 }
@@ -980,7 +980,8 @@
 	if (is_const(e4) /* ||(is_memory(e3)&&is_readonly(e3)) */ ) {
 	    heap[pdisp+narg]=e4;
 	} else {
-	    arg = heap[pdisp+narg]=list3(LVAR,new_lvar(size(t)),cadddr(e3));
+	    arg = heap[pdisp+narg]=list3(LVAR,new_lvar(size(t)),0);
+	    //  should contain correct argument variable name
 	    g_expr_u(assign_expr0(arg,e4,t,t));
 	}
 	narg ++;
@@ -989,6 +990,8 @@
     e = pexpr(parse);
     pdisp = sdisp;
     pvartable = svartable;
+    // how to handle return value?
+    g_expr_u(e);
     return ret_type;
 }
 
--- a/mc-macro.c	Sun Dec 25 10:52:54 2005 +0900
+++ b/mc-macro.c	Sun Dec 25 16:07:45 2005 +0900
@@ -258,6 +258,8 @@
 		int c;
 		char *p = cheap->ptr;
 		sprintf(num,"%d: ",lineno);
+		parse = list3(ST_COMMENT,parse,(int)p);
+		// should contain file name
 		c = 0;
 		while((*cheap->ptr = num[c++])) 
 		    cheap = increment_cheap(cheap,&p);
@@ -266,8 +268,8 @@
 		    if (c=='\n') {
 			*cheap->ptr = 0;
 			cheap = increment_cheap(cheap,&p);
-			parse = list3(ST_COMMENT,parse,(int)p);
 			p = cheap->ptr;
+			// parse = list3(ST_COMMENT,parse,(int)p);
 			sprintf(num,"%d: ",lineno);
 			c = 0;
 			while((*cheap->ptr = num[c++])) 
--- a/mc-parse.c	Sun Dec 25 10:52:54 2005 +0900
+++ b/mc-parse.c	Sun Dec 25 16:07:45 2005 +0900
@@ -1700,7 +1700,8 @@
 	extrn_use(n);
 	retlabel=fwdlabel();
     } else {
-	if (parse && (car(parse)!=ST_DECL&&car(parse)!=ST_COMMENT)) error(-1);
+	if (parse && (car(parse)!=ST_DECL&&car(parse)!=ST_COMMENT))
+	    error(-1);  // What kind of error?
 	if (car(parse)==ST_COMMENT)
 	    cadr(parse)=0;
 	else
--- a/mc.h	Sun Dec 25 10:52:54 2005 +0900
+++ b/mc.h	Sun Dec 25 16:07:45 2005 +0900
@@ -425,7 +425,7 @@
 #define ST_LABEL	129
 #define ST_COMMENT	130
 
-#define IS_STATEMENT(i) (ST_DECL<=i&&i<=ST_COMMENT)
+#define IS_STATEMENT(i) (i==INLINE||(ST_DECL<=i&&i<=ST_COMMENT))
 
 /* statement end */