changeset 832:bc919d849346

arrow in parse mode
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 03 Dec 2010 13:29:19 +0900
parents a22aabb27786
children 15764443b058
files mc-code-i64.c mc-inline.c test/tmp11.c
diffstat 3 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-i64.c	Fri Dec 03 11:32:50 2010 +0900
+++ b/mc-code-i64.c	Fri Dec 03 13:29:19 2010 +0900
@@ -2774,8 +2774,10 @@
     case ADD:
 	printf("\tadd%s $%ld,%s\n",q,orn,crn);
 	break;
-    case SUB: case CMP:
+    case SUB: 
 	printf("\tsub%s $%ld,%s\n",q,orn,crn);
+    case CMP:
+	printf("\tcmp%s $%ld,%s\n",q,orn,crn);
 	break;
     case BAND: 
 	if (datareg&&(orn & ~255)==~255)
--- a/mc-inline.c	Fri Dec 03 11:32:50 2010 +0900
+++ b/mc-inline.c	Fri Dec 03 13:29:19 2010 +0900
@@ -1311,6 +1311,8 @@
 	type = caddr(e1);
         return strop(e2,0); 
     case ARROW:
+	type = caddr(e1);
+	e2 = rvalue(e2);
 	e2 = pexpr(e2);
         nptr = ncadddr(e1);
 	type = caddr(e1);
--- a/test/tmp11.c	Fri Dec 03 11:32:50 2010 +0900
+++ b/test/tmp11.c	Fri Dec 03 13:29:19 2010 +0900
@@ -4,6 +4,7 @@
         char *nm;
         int sc,ty,dsp; } NMTBL;
 NMTBL *a;
+NMTBL f;
 
 NMTBL *
 test2(char *n) {
@@ -24,13 +25,31 @@
     return test0(a,b,c);
 }
 
+int heap[10];
+
+#define ncaddr(e)   (*(NMTBL**)&heap[e+2])
+
 int
 main()
 {
     int d;
     NMTBL *b;
+    f.nm = "_name";
+    a = &f;
     b = test2("test");
     d = test1(1,2,3);
     printf("#0033:return %d\n",d);
+
+    NMTBL **p = (NMTBL**)&heap[2];
+    *p = &f;
+    b = &f;
+    int e = 0;
+    printf("f.nm          %s\n",f.nm);
+    printf("b->nm         %s\n",b->nm);
+    printf("(*p)->nm      %s\n",(*p)->nm);
+    printf("ncaddr(e)->nm %s\n",ncaddr(e)->nm);
+
     return d;
 }
+
+/* end */