Mercurial > hg > CbC > old > device
diff test/ret_check.c @ 599:df04bc5fd5fe
*** empty log message ***
author | kono |
---|---|
date | Thu, 26 Jan 2006 15:19:55 +0900 |
parents | |
children | 682c8ec38d45 |
line wrap: on
line diff
--- /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) +{ // 正しいのはコッチ + printf("#0010:%d\n",a0); + goto f_incl_ret(a0),f_incl_env; +} + +code +f_incl2_test(float a0) +{ // ret先のinterface型が異なる + 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 */