Mercurial > hg > CbC > old > device
changeset 599:df04bc5fd5fe
*** empty log message ***
author | kono |
---|---|
date | Thu, 26 Jan 2006 15:19:55 +0900 |
parents | e29ae2dab3c0 |
children | c6afbdf982f7 |
files | Changes Makefile Makefile.ia32 Makefile.linuxzaurus Makefile.mips Makefile.powerpc conv/cbc2c.c conv/cbc2c.h mc-code-arm.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h mc-inline.c mc-macro.c mc-parse.c mc-tree.c mc.h test/ret_check.c tools/conv_func.pl |
diffstat | 22 files changed, 672 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Tue Jan 24 10:55:00 2006 +0900 +++ b/Changes Thu Jan 26 15:19:55 2006 +0900 @@ -8592,4 +8592,23 @@ c2cbc,cbc2c が楽勝で書けるみたい。なんで 1 pass じゃだめだ と思ったんだろう? - +Wed Jan 25 12:42:57 JST 2006 + +c2cbc は、式の途中の関数呼び出しを分解しないといけないので、 +先読み抜きで変換するのは出来ない。だから、expr tree のprint +が必要。逆に言えば、それを作りさえすれば良い。 + +で、expr16 で、strop, binop とかやっているので、それを +parse tree に変更しないとダメ。ってことは、これようの、 +tree id が必要だってことか。逆に言えば、それだけか? + +cbc2c は、code 宣言、goto 文だけを変換すれば良いので、 +可能じゃないか? + +Wed Jan 25 19:58:40 JST 2006 + +cbc2c で、env 切替えはどうやってコンパイルするの? + + + +
--- a/Makefile Tue Jan 24 10:55:00 2006 +0900 +++ b/Makefile Thu Jan 26 15:19:55 2006 +0900 @@ -14,8 +14,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o conv/c2cbc.o -# conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c @@ -259,7 +258,7 @@ mc-tree.o: /usr/include/stdio.h /usr/include/_types.h mc-tree.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-tree.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-tree.o: mc-parse.h +mc-tree.o: mc-parse.h mc-codegen.h mc-switch.o: /usr/include/stdio.h /usr/include/_types.h mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h @@ -271,12 +270,15 @@ conv/c.o: /usr/include/stdio.h /usr/include/_types.h conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/c.o: mc-parse.h conv/conv.h conv/convdef.h conv/c.h +conv/c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c.h conv/c2cbc.o: /usr/include/stdio.h /usr/include/_types.h conv/c2cbc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h conv/c2cbc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/c2cbc.o: mc-parse.h conv/conv.h conv/convdef.h conv/c2cbc.h -conv/cbc2c.o: mc.h +conv/c2cbc.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c2cbc.h +conv/cbc2c.o: /usr/include/stdio.h /usr/include/_types.h +conv/cbc2c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h +conv/cbc2c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h +conv/cbc2c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/cbc2c.h conv/null.o: /usr/include/stdio.h /usr/include/_types.h conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
--- a/Makefile.ia32 Tue Jan 24 10:55:00 2006 +0900 +++ b/Makefile.ia32 Thu Jan 26 15:19:55 2006 +0900 @@ -14,8 +14,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o -# conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c
--- a/Makefile.linuxzaurus Tue Jan 24 10:55:00 2006 +0900 +++ b/Makefile.linuxzaurus Thu Jan 26 15:19:55 2006 +0900 @@ -13,8 +13,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o -# conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c
--- a/Makefile.mips Tue Jan 24 10:55:00 2006 +0900 +++ b/Makefile.mips Thu Jan 26 15:19:55 2006 +0900 @@ -13,8 +13,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o -# conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c
--- a/Makefile.powerpc Tue Jan 24 10:55:00 2006 +0900 +++ b/Makefile.powerpc Thu Jan 26 15:19:55 2006 +0900 @@ -14,8 +14,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o conv/c2cbc.o -# conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c
--- a/conv/cbc2c.c Tue Jan 24 10:55:00 2006 +0900 +++ b/conv/cbc2c.c Thu Jan 26 15:19:55 2006 +0900 @@ -1,50 +1,447 @@ #define EXTERN /**/ +#include <stdio.h> #include "mc.h" - -static void open(char *); -static void print(char *); -static void close(); -static void comment(char *s); +#include "mc-parse.h" +#include "mc-codegen.h" -Converter cbc2c_converter = { - &open, - &print, - &close, - &comment, -}; +#include "conv/conv.h" +#include "conv/convdef.h" +#include "conv/cbc2c.h" -static FILE *vout; +extern void type_print(int type,NMTBL *nptr,FILE *out); +extern void type_print1(int type,NMTBL *nptr,FILE *out,int cont); +extern void sym_print(int type,FILE *out); + +static FILE *vout,*svout; +static FILE *null; +static FILE *hout; static void -comment(char *s) +comment_(int c) { + fprintf(vout,"%c",c); } static void -open(char *s) +open_(char *s) { - char *p=cheapp; - while((*cheapp++ = *s++)) { - if (*s=='.') { - *cheapp++=*s++; *cheapp++='c'; - *cheapp++='c'; *cheapp++=0; - break; - } - } + char *p; + p = make_filename_with_extension(s,"cbc.c"); +#if 1 vout = fopen(p,"w"); - if(!vout) error(-1); +#else + vout = stderr;p=p; +#endif + p = make_filename_with_extension(s,"cbc.h"); + hout = fopen(p,"w"); + null=fopen("/dev/null","w"); + if (!vout) error(-1); } static void -print(char *s) +conv_() +{ + vout=svout; +} + +static void +noconv_(int c) +{ + svout=vout; + vout=c?null:vout; +} + +static void +print_(char *s) { fprintf(vout,"c: %s\n",s); } static void -close() +close_() { fclose(vout); } +void +case_begin_(int cases,int def){ + fprintf(vout,"case "); +} + +void +case_(int cases,int def){ + if (def) + fprintf(vout,"default:"); + else + fprintf(vout,"%d:",car(cases)); +} + +void +code_(NMTBL *n){ + int args; + args=n->dsp; + fprintf(vout,"code %s(",n->nm); + while(args) { + n=(NMTBL *)caddr(args); + type_print(n->ty,n,vout); + args=cadr(args); + if(args) fprintf(vout,","); + } + fprintf(vout,")"); +} + +void +code_end_(){ + fprintf(vout,"}"); +} + +void +comma_(){ + fprintf(vout,","); +} + +void +cond_(){ + +} + +void +cond1_(){ + fprintf(vout,"?"); +} + +void +cond2_(){ + fprintf(vout,":"); +} + +void +cond_end_(){ + +} + +void +decl_data_begin_(){ + +} + +void +decl_data_end_(){ + +} + +void +def_(NMTBL *n){ +} + +void +dowhile_(){ + fprintf(vout,"do"); +} + +void +dowhile_cond_(){ + fprintf(vout,"while("); +} + +void +dowhile_end_(){ + fprintf(vout,");"); +} + +int +error_(int n){ + return 0; +} + +void +extern_(){ + fprintf(vout,"extern "); +} + +void +for_(){ + fprintf(vout,"for("); +} + +void +for1_(){ + fprintf(vout,";"); +} + +void +for2_(){ + fprintf(vout,";"); +} + +void +for_body_(){ + fprintf(vout,")"); +} + +void +for_end_(){ + +} + +void +funcall_(int type){ + fprintf(vout,"("); +} + +void +funcall_args_(){ + fprintf(vout,")"); +} + +void +function_(NMTBL *n,int cont){ + int args; + type_print1(cadr(n->ty),0,vout,cont); + fprintf(vout,"%s(",n->nm); + args=n->dsp; + while(args) { + n=(NMTBL *)caddr(args); + if (n==&str_ret) { + args=cadr(args); continue; + } + type_print(n->ty,n,vout); + args=cadr(args); + if(args) { + /* if(caddr(args)==(int)&str_ret) break; */ + fprintf(vout,","); + } + } + fprintf(vout,")"); +} + +void +function_end_(){ + +} + +void +goto_(){ + fprintf(vout,"goto "); +} + +void +goto_label_(){ + +} + +void +id_(int sym,NMTBL *nptr){ + char *p = nptr->nm; + for(;*p && *p!='.';p++) fputc(*p,vout); +} + +void +string_(char *s,int len){ + int c; + fprintf(vout,"\""); + while((c=*s++)) { + if(c=='\n') fprintf(vout,"\\n"); + else if(c=='\r') fprintf(vout,"\\r"); + else if(c=='\t') fprintf(vout,"\\t"); + else if(c=='\e') fprintf(vout,"\\e"); + else if(c=='"') fprintf(vout,"\\\""); + else if(c=='\\') fprintf(vout,"\\\\"); + else if(!(' '<=c&&c<=0x7f)) fprintf(vout,"\\%03o",c); + else fprintf(vout,"%c",c); + } + fprintf(vout,"\""); +} + +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_(){ +} + +void +if_then_(){ + fprintf(vout,")"); +} + +void +jump_(int env){ + +} + +void +label_(){ + fprintf(vout,"%s:",nptr->nm); +} + +void +lpar_(){ + fprintf(vout,"("); +} + +void +rpar_(){ + fprintf(vout,")"); +} + +void +lbra_(int sym){ + fprintf(vout,"["); +} + +void +rbra_(int sym){ + fprintf(vout,"]"); +} + +void +lc_(){ + fprintf(vout,"{"); +} + +void +rc_(){ + fprintf(vout,"}"); +} + +void +localvar_end_(){ + +} + +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 +register_(){ + fprintf(vout,"register "); +} + +void +return_(){ + fprintf(vout,"return "); +} + +void +return_end_(){ + fprintf(vout,";"); +} + +void +return_type_(int t,NMTBL *nptr,int cont){ + type_print1(t,nptr,vout,cont); +} + +void +sm_(){ + fprintf(vout,";"); +} + +void +static_(){ + fprintf(vout,"static "); +} + +void +switch_(){ + fprintf(vout,"switch ("); +} + +void +switch_body_(){ + fprintf(vout,")"); +} + +void +switch_end_(){ +} + +void +typedef_(){ + fprintf(vout,"typedef "); +} + +void +type_(int t){ + type_print(t,0,vout); +} + +void +sdecl_(int s) +{ + fprintf(vout,s==UNION?"union ":"struct "); +} + +void +while_(){ + fprintf(vout,"while ("); +} + +void +while_body_(){ + fprintf(vout,")"); +} + +void +while_end_(){ +} + +void +decl_data_() +{ +} + +void +break_() +{ + fprintf(vout,"break;"); +} + +void +continue_() +{ + fprintf(vout,"continue;"); +} + +/* end */
--- a/conv/cbc2c.h Tue Jan 24 10:55:00 2006 +0900 +++ b/conv/cbc2c.h Thu Jan 26 15:19:55 2006 +0900 @@ -1,2 +1,82 @@ +/* Do not edit this file. This is automatically generated. */ extern Converter cbc2c_converter; + + + +Converter cbc2c_converter = { + &conv_, + &noconv_, + &comment_, + &open_, + &print_, + &close_, + &case_, + &case_begin_, + &code_, + &code_end_, + &comma_, + &cond_, + &cond1_, + &cond2_, + &cond_end_, + &decl_data_begin_, + &decl_data_end_, + &def_, + &dowhile_, + &dowhile_cond_, + &dowhile_end_, + &error_, + &extern_, + &for_, + &for1_, + &for2_, + &for_body_, + &for_end_, + &funcall_, + &funcall_args_, + &function_, + &function_end_, + &goto_, + &goto_label_, + &id_, + &string_, + &const_, + &return_f_, + &defined_, + &environment_, + &if_, + &if_else_, + &if_endif_, + &if_then_, + &jump_, + &label_, + &lbra_, + &lc_, + &localvar_end_, + &lpar_, + &op_, + &postfix_, + &prefix_, + &rbra_, + &rc_, + ®ister_, + &return_, + &return_end_, + &return_type_, + &rpar_, + &sm_, + &static_, + &switch_, + &switch_body_, + &switch_end_, + &typedef_, + &type_, + &while_, + &while_body_, + &while_end_, + &decl_data_, + &break_, + &continue_, + &sdecl_, +};
--- a/mc-code-arm.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-code-arm.c Thu Jan 26 15:19:55 2006 +0900 @@ -132,8 +132,6 @@ #define MIN_TMP_REG 1 #define MAX_TMP_REG 4 -#define PTRC_REG 3 /* mark for pointer cache */ - #define FREG_VAR_BASE 4 #define FREG_VAR_MIN 4 #define FREG_VAR_MAX 7
--- a/mc-code-ia32.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-code-ia32.c Thu Jan 26 15:19:55 2006 +0900 @@ -181,7 +181,6 @@ // static int MAX_FREGISTER=1; #define MAX_FPU_STACK 7 -#define REG_VAR 2 // static int MAX_INPUT_REGISTER_VAR = 0; int MAX_CODE_INPUT_REGISTER_VAR = 2; @@ -1580,7 +1579,7 @@ } int -tosop_operand_safe_p(op) +tosop_operand_safe_p(int op) { switch(op) { case ADD: case SUB: case CMP:
--- a/mc-code-mips.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-code-mips.c Thu Jan 26 15:19:55 2006 +0900 @@ -111,8 +111,6 @@ #define MIN_TMP_REG 4 #define MAX_TMP_REG 11 -#define PTRC_REG 3 - #define FREG_VAR_BASE 21 #define FREG_VAR_MIN 16 #define MIN_TMP_FREG 0
--- a/mc-code-powerpc.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-code-powerpc.c Thu Jan 26 15:19:55 2006 +0900 @@ -90,9 +90,6 @@ #define MIN_TMP_REG 3 #define MAX_TMP_REG 11 -#define PTRC_REG 3 -#define REG_VAR 2 - #define FREG_VAR_BASE 31 #define FREG_VAR_MIN 20 #define MIN_TMP_FREG 1 @@ -1308,6 +1305,8 @@ // printf("## 0x%08x\n",e2); if (-32768<e2&&e2<32768) printf("\tli %s,%d\n",crn,e2); + else if ((e2&0xffff)==0) + printf("\tlis %s,ha16(%d)\n",crn,e2); else { printf("\tlis %s,ha16(%d)\n",crn,e2); printf("\taddi %s,%s,lo16(%d)\n",crn,crn,e2);
--- a/mc-code.h Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-code.h Thu Jan 26 15:19:55 2006 +0900 @@ -4,12 +4,24 @@ #define MAX_MAX 50 /* architecture independent max registers */ + +/* + flag value for regs[] + */ + +#define USING_REG 1 /* unreusable register usage */ #define INPUT_REG 2 /* input register ( can be reused ) */ -#define USING_REG 1 /* unreusable register usage */ +#define REG_VAR 3 /* used as register variable */ +#define PTRC_REG 4 /* used as global variable pointer cache */ extern char *l_include_path[]; /* library including path */ extern int disp_offset; /* displacement offset in code and function */ + +/* + function arugment evaluation order + define compatiblity in inline function generation + */ #define NORMAL 0 #define REVERSE 1 extern int eval_order;
--- a/mc-codegen.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-codegen.c Thu Jan 26 15:19:55 2006 +0900 @@ -4180,7 +4180,7 @@ { int us; if (op>0) { - switch(op%200) { + switch(OP(op)) { case UMUL: case UDIV: case UMOD: case URSHIFT: case ULSHIFT: case ULT: case UCMP: case UCMPGE: case UGE: case UGT: case ULE: @@ -4194,7 +4194,7 @@ default: return 0; } - switch((op/200)*200 + us) { + switch(OP_TAG(op) + us) { case SOP: return SHORT; case SOP+US: return USHORT; case COP: return CHAR; @@ -4235,12 +4235,6 @@ return 0; } -extern int -op_of(int op) -{ - return (op%200); -} - /* coarse for function/code segments arguments */ extern int @@ -4265,16 +4259,29 @@ switch(car(t)) { case POINTER: if (cadr(t)>0 && car(cadr(t))==FUNCTION) { + // type でチェックするべきだよね? 本来... + // compatible(cadr(t),cadr(type)); + // ではあかんの? +#if 1 if (car(e)==FNAME) { NMTBL *n = (NMTBL*)cadr(e); int targ0 = caddr(cadr(t)); int targ1 = caddr(n->ty); if (is_function(n)) { + // return type compatible(cadr(cadr(t)),cadr(n->ty)); } - compatible(targ0,targ1); + // arguments + if (targ0) + compatible(targ0,targ1); } +#else + // なんかダメみたいだな... + compatible(cadr(t),cadr(type)); +#endif // type should be checked... + } else { + // compatible(cadr(t),cadr(type)); } break; case STRUCT: case UNION:
--- a/mc-codegen.h Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-codegen.h Thu Jan 26 15:19:55 2006 +0900 @@ -83,7 +83,6 @@ extern int reference(int e1); // recover lvalue from rvalue of memory or register extern int type_of_bop(int op); extern int type_of_conv(int op); -extern int op_of(int op); /* used by mc-code-* */
--- a/mc-inline.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-inline.c Thu Jan 26 15:19:55 2006 +0900 @@ -520,7 +520,7 @@ if (is_const(e1)&&is_const(e2)) { int t; if((t= type_of_bop(op))) - return binop(op_of(op),e1,e2,t,t); + return binop(OP(op),e1,e2,t,t); } return list3(op,e1,e2); }
--- a/mc-macro.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-macro.c Thu Jan 26 15:19:55 2006 +0900 @@ -392,9 +392,9 @@ static void macro_if() { - int i,stype=type; + int i,stype=type; // expr destroy type ch= *chptr; - in_macro_if = 1; + in_macro_if = 1; // makes undefined symbol==list2(CONST,0) check_macro_eof(); getsym(0); /* i=cexpr(expr(1)); #if allow undefined symbols.. */
--- a/mc-parse.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-parse.c Thu Jan 26 15:19:55 2006 +0900 @@ -727,15 +727,10 @@ set_converter(char *s) { chptr = s; -#if 0 if (macroeq("c2cbc")) conv=&c2cbc_converter; else if (macroeq("cbc2c")) conv=&cbc2c_converter; else if (macroeq("c")) conv=&c_converter; -#else - if (macroeq("c2cbc")) conv=&c2cbc_converter; - else if (macroeq("c")) conv=&c_converter; else conv=&null_converter; -#endif } /* @@ -3672,7 +3667,9 @@ if (!is_function(fnptr)) { error(STERR); } - type=list2(POINTER,CODE); + // this is wrong... should be + // code (*)(return_type); + type=list2(POINTER,CODE); e1=list2(RETURN,(int)fnptr); getsym(0); break;
--- a/mc-tree.c Tue Jan 24 10:55:00 2006 +0900 +++ b/mc-tree.c Thu Jan 26 15:19:55 2006 +0900 @@ -248,7 +248,7 @@ int first=0; int last=sizeof(tree_nodes)/sizeof(tree_node_type); // e2=-1; - e2=e%200; + e2=OP(e); e1=0; while (first!=last) { #if 0
--- a/mc.h Tue Jan 24 10:55:00 2006 +0900 +++ b/mc.h Thu Jan 26 15:19:55 2006 +0900 @@ -123,6 +123,8 @@ /* tree node tags start */ #define LIST_ARGS(i) (i==FUNCTION||i==CODE||i==ASM) +#define OP(i) (i%SOP) /* tag value without attribute */ +#define OP_TAG(i) (((i)/SOP)*SOP) /* attribute of tag */ /* nullary argments */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/ret_check.c Thu Jan 26 15:19:55 2006 +0900 @@ -0,0 +1,96 @@ +extern int printf(char *,...); + +#ifdef __micro_c__ + +code(*f_incl_ret)(int); +void *f_incl_env; + +code +f_incl2(int a0) +{ // 罩c潟 + printf("#0010:%d\n",a0); + goto f_incl_ret(a0),f_incl_env; +} + +code +f_incl2_test(float a0) +{ // retinterface違 + printf("#0017:%g\n",a0); + goto f_incl_ret(a0),f_incl_env; +} + +code +f_incl1(int a0,code(*ret)(int)) +{ + printf("#0024:%d\n",a0); + goto ret(a0*a0); +} + +int +f_incl0(int a0) +{ + f_incl_ret=return; + f_incl_env=environment; + printf("#0033:%d\n",a0); + goto f_incl1(a0,f_incl2); +} + +int +f_incl0_test(int a0) +{ + f_incl_ret=return; + f_incl_env=environment; + printf("#0033:%d\n",a0); + goto f_incl1(a0,f_incl2_test); +} + +#else + +int +f_incl0(int a0) +{ + printf("#0042:%d\n",a0); + return a0; +} + +int +f_incl0_test(int a0) +{ + printf("#0042:%d\n",a0); + return a0; +} + +#endif + +int +g_incl2(int a0) +{ + printf("#0051:%d\n",a0); + return a0; +} + +int +g_incl2_test(float a0) +{ + printf("#0058:%g\n",a0); + return (int) a0; +} + +int +g_incl1(int a0,int (*ret)(int)) +{ + return ret(a0); +} + +int +main() +{ + int f0=f_incl0(10); + printf("#0066:%d\n",f0); + printf("#0066:%d\n",f_incl0_test(11)); + printf("#0067:%d\n",g_incl1(12,g_incl2)); + printf("#0068:%d\n",g_incl1(13,g_incl2_test)); + return 0; +} + +/* end */
--- a/tools/conv_func.pl Tue Jan 24 10:55:00 2006 +0900 +++ b/tools/conv_func.pl Thu Jan 26 15:19:55 2006 +0900 @@ -40,7 +40,7 @@ print OUT "} Converter;\n"; -foreach $def ('conv/c.h','conv/null.h' ) { +foreach $def ('conv/c.h','conv/c2cbc.h','conv/cbc2c.h','conv/null.h' ) { $def =~ m-conv/(.*)\.h-; $m = $1; open(DEF,">$def") or die("can't open $def"); print DEF "/* Do not edit this file. This is automatically generated. */\n";