comparison mc-tree.c @ 596:94d3a8c1b3e8

*** empty log message ***
author kono
date Mon, 23 Jan 2006 14:09:20 +0900
parents 25f431685d80
children df04bc5fd5fe
comparison
equal deleted inserted replaced
595:cfd1eba00ce6 596:94d3a8c1b3e8
2 /* $Id$ */ 2 /* $Id$ */
3 3
4 #include <stdio.h> 4 #include <stdio.h>
5 #include "mc.h" 5 #include "mc.h"
6 #include "mc-parse.h" 6 #include "mc-parse.h"
7 #include "mc-codegen.h"
7 8
8 typedef 9 typedef
9 struct tree_node { 10 struct tree_node {
10 int tree_type; 11 int tree_type;
11 char *tree_name; 12 char *tree_name;
371 if (!cont) { 372 if (!cont) {
372 fprintf(out,"%s ",tn->tree_name); 373 fprintf(out,"%s ",tn->tree_name);
373 struct_type_print(type,out); 374 struct_type_print(type,out);
374 } 375 }
375 } else if(t==CODE) { 376 } else if(t==CODE) {
376 if (!cont) { 377 // if (!cont) { fprintf(out,"%s ",tn->tree_name); }
377 fprintf(out,"%s ",tn->tree_name);
378 }
379 function_type_print1(type,n,out,cont); 378 function_type_print1(type,n,out,cont);
380 return; 379 return;
381 } else if(t==FUNCTION) { 380 } else if(t==FUNCTION) {
382 function_type_print1(type,n,out,cont); 381 function_type_print1(type,n,out,cont);
383 return; 382 return;
406 if (args) fprintf(out,","); 405 if (args) fprintf(out,",");
407 } 406 }
408 } 407 }
409 fprintf(out,")"); 408 fprintf(out,")");
410 return; 409 return;
410 } else if(car(t)==CODE) {
411 type_print1(cadr(t),0,out,cont);
412 fprintf(out,"(*");
413 if(n) fprintf(out,"%s",n->nm);
414 fprintf(out,")");
415 fprintf(out,"(");
416 if((args=caddr(t))) {
417 while (args) {
418 type_print(car(args),0,out);
419 args=cadr(args);
420 if (args) fprintf(out,",");
421 }
422 }
423 fprintf(out,")");
424 return;
411 } else if(car(t)==ARRAY) { 425 } else if(car(t)==ARRAY) {
412 fprintf(out,"(*"); 426 fprintf(out,"(*");
413 type_print(cadr(t),n,out); 427 type_print(cadr(t),n,out);
414 if (caddr(type)) 428 if (caddr(type))
415 fprintf(out,")[%d]",caddr(type)); 429 fprintf(out,")[%d]",caddr(type));