diff conv/c.c @ 68:0266905063b5

*** empty log message ***
author kono
date Mon, 24 Feb 2003 02:15:15 +0900
parents 254a0c576114
children dba8d111b7a0
line wrap: on
line diff
--- a/conv/c.c	Mon Feb 24 00:59:30 2003 +0900
+++ b/conv/c.c	Mon Feb 24 02:15:15 2003 +0900
@@ -4,6 +4,9 @@
 
 #include "conv/convdef.h"
 
+extern void type_print(int type,NMTBL *nptr,FILE *out);
+extern void sym_print(int type,FILE *out);
+
 static FILE *vout;
 
 static void
@@ -53,8 +56,15 @@
 }
 
 void
-code_(NMTBL *fnptr,int arglist){
-
+code_(NMTBL *n,int arglist){
+    fprintf(vout,"code %s(",n->nm);
+    while(args) {
+	n=(NMTBL *)car(args);
+	type_print(n->ty,n,vout);
+	args=cadr(args);
+	if(args) fprintf(vout,",");
+    }
+    fprintf(vout,")");
 }
 
 void
@@ -128,22 +138,22 @@
 
 void
 for_(){
-
+    fprintf(vout,"for(");
 }
 
 void
 for1_(){
-
+    fprintf(vout,";");
 }
 
 void
 for2_(){
-
+    fprintf(vout,";");
 }
 
 void
 for3_(){
-
+    fprintf(vout,")");
 }
 
 void
@@ -158,17 +168,25 @@
 
 void
 funcall_(int type){
-
+    fprintf(vout,"(");
 }
 
 void
 funcall_args_(){
-
+    fprintf(vout,")");
 }
 
 void
-function_(){
-
+function_(NMTBL *n,int args){
+    type_print(n->ty,0,vout);
+    fprintf(vout,"%s(",n->nm);
+    while(args) {
+	n=(NMTBL *)car(args);
+	type_print(n->ty,n,vout);
+	args=cadr(args);
+	if(args) fprintf(vout,",");
+    }
+    fprintf(vout,")");
 }
 
 void
@@ -187,28 +205,53 @@
 }
 
 void
-id_(int sy,NMTBL *nptr){
+id_(int sym,NMTBL *nptr){
+    fprintf(vout," %s ",nptr->nm);
+}
+
+void
+string_(char *s){
+    fprintf(vout,"\"%s\"",s);
+}
+
+void
+const_(int symval){
+    fprintf(vout,"%d",symval);
+}
 
+void
+return_f_(){
+    fprintf(vout,"return");
+}
+
+void
+defined_(char *s){
+    fprintf(vout,"defined(%s)",s);
+}
+
+void
+environment_(){
+    fprintf(vout,"environment");
 }
 
 void
 if_(){
-
+    fprintf(vout,"if (");
 }
 
 void
 if_else_(){
-
+    fprintf(vout,"} else {");
 }
 
 void
 if_endif_(){
-
+    fprintf(vout,"}");
 }
 
 void
 if_then_(){
-
+    fprintf(vout,") {");
 }
 
 void
@@ -258,17 +301,17 @@
 
 void
 op_(int sym){
-
+    sym_print(sym,vout);
 }
 
 void
 postfix_(int sym){
-
+    /* sym_print(sym,vout); */
 }
 
 void
 prefix_(int sym){
-
+    /* sym_print(sym,vout); */
 }
 
 void
@@ -278,15 +321,14 @@
 
 void
 return_(){
-
+    fprintf(vout,"return (");
 }
 
 void
 return_end_(){
-
+    fprintf(vout,")");
 }
 
-extern void type_print(int type,NMTBL *nptr,FILE *out);
 
 void
 return_type_(int t,NMTBL *nptr,int cont){
@@ -315,17 +357,17 @@
 
 void
 switch_(){
-
+    fprintf(vout,"switch (");
 }
 
 void
 switch_body_(){
-
+    fprintf(vout,") {");
 }
 
 void
 switch_end_(){
-
+    fprintf(vout,"}");
 }
 
 void
@@ -335,17 +377,17 @@
 
 void
 while_(){
-
+    fprintf(vout,"while (");
 }
 
 void
 while_body_(){
-
+    fprintf(vout,") {");
 }
 
 void
 while_end_(){
-
+    fprintf(vout,"}");
 }
 
 /* end */