Mercurial > hg > CbC > old > device
view test/ret_check.c @ 746:f8ea174944f2
i64 continue... global table have to be fixed.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Nov 2010 22:19:55 +0900 |
parents | 3f1f6c0610c1 |
children | c2c709727221 |
line wrap: on
line source
#define __environment _CbC_environment #define __return _CbC_return extern int printf(char *,...); #ifdef __micro_c__ ____code(*f_incl_ret)(int,void *); 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 */