diff mc-tree.c @ 711:35e6841ba01a

pointer fixes (partial)
author kono
date Sat, 27 Oct 2007 13:30:38 +0900
parents e16b34f2b386
children bf94c295d763
line wrap: on
line diff
--- a/mc-tree.c	Thu Oct 25 13:58:42 2007 +0900
+++ b/mc-tree.c	Sat Oct 27 13:30:38 2007 +0900
@@ -308,7 +308,7 @@
     if((tags=caddr(type))) {
 	fprintf(out,"{");
 	while(tags) {
-	    n=(NMTBL*)caddr(tags);
+	    n=ncaddr(tags);
 	    type_print(car(tags),n,out);
 	    fprintf(out,";");
 	    tags = cadr(tags);
@@ -494,7 +494,7 @@
     case LVAR:
     case RLVAR:
     case URLVAR:
-	if ((nptr = (NMTBL*)caddr(e))) {
+	if ((nptr = ncaddr(e))) {
 	    fprintf(vout,"%s",nptr->nm);
 	} else {
 	    // anonymous variable
@@ -504,7 +504,7 @@
     case GVAR:
     case RGVAR:
     case URGVAR:
-	if ((nptr = (NMTBL*)caddr(e))) {
+	if ((nptr = ncaddr(e))) {
 	    fprintf(vout,"%s",nptr->nm);
 	} else {
 	    // anonymous variable
@@ -517,7 +517,7 @@
 	}
         break;
     case REGISTER:
-	if ((nptr = (NMTBL*)caddr(e))) {
+	if ((nptr = ncaddr(e))) {
 	    fprintf(vout,"%s",nptr->nm);
 	} else {
 	    // anonymous register variable
@@ -552,7 +552,7 @@
     case STRING:
         { 
             int c; char *s; int i;
-            nptr = (NMTBL*)cadr(e); s = nptr->nm;i=nptr->dsp;
+            nptr = ncaddr(e); s = nptr->nm;i=nptr->dsp;
             fprintf(vout,"\"");
             while(--i>0) {
                 c=*s++;
@@ -576,12 +576,12 @@
         break;
     case PERIOD:
         print_expr(cadr(e),vout);
-        n = (NMTBL*)caddr(e);
+        n = ncaddr(e);
         fprintf(vout,".%s",n->nm);
 	break;
     case ARROW:
         print_expr(cadr(e),vout);
-        n = (NMTBL*)caddr(e);
+        n = ncaddr(e);
         fprintf(vout,"->%s",n->nm);
         break;
     case INDIRECT:
@@ -591,7 +591,7 @@
         print_expr(cadr(e),vout);
         break;
     case FNAME:
-        n = (NMTBL*)cadr(e);
+        n = ncaddr(e);
         fprintf(vout,"%s",n->nm);
         break;
     case FUNCTION:
@@ -638,7 +638,7 @@
 static void
 print_decl(int e, FILE *vout)
 {
-    NMTBL *n = (NMTBL*)caddr(e);
+    NMTBL *n = ncaddr(e);
     int e1 = cadddr(e);
     // int mode = car(e1);
     int stmode = cadr(e1);
@@ -713,14 +713,14 @@
 	case ST_ASM:
 	    fprintf(vout,"__asm__ "); break;
 	case ST_LABEL:
-	    n = (NMTBL*)(caddr(caddr(e)));
+	    n = ncaddr(caddr(e));
 	    fprintf(vout,"%s:", n->nm); break;
 	case ST_OP:
 	    e1 = caddr(e);
 	    print_expr(list3(cadr(e),car(e1),cadr(e1)),vout);
 	    break;
 	case ST_COMMENT:
-	    fprintf(vout,"\n# %s\n",(char*)caddr(e)); 
+	    fprintf(vout,"\n# %s\n",vcaddr(e)); 
 	    break;
 	default:
 	    fprintf(stderr,"Unknown Statement ID %d\n",car(e));
@@ -736,7 +736,7 @@
 
     e2 = cadr(e1);
     if (car(e2) == FNAME) {     
-        fn=(NMTBL *)cadr(e2);
+        fn=ncaddr(e2);
         fprintf(vout,"%s",fn->nm);
     } else {    
         if (car(e2)==INDIRECT) e2=cadr(e2); // (*func)(i) case