Mercurial > hg > CbC > old > device
annotate test/ret_check.c @ 928:96c53f76b360
fix
author | kono |
---|---|
date | Sun, 13 Apr 2014 10:21:40 +0900 |
parents | c2c709727221 |
children |
rev | line source |
---|---|
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
1 #define __environment _CbC_environment |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
2 #define __return _CbC_return |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
3 |
599 | 4 extern int printf(char *,...); |
5 | |
6 #ifdef __micro_c__ | |
7 | |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
8 ____code(*f_incl_ret)(int,void *); |
599 | 9 void *f_incl_env; |
10 | |
622 | 11 __code |
599 | 12 f_incl2(int a0) |
13 { // 正しいのはコッチ | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
14 printf("#0013:%d\n",a0); |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
15 goto f_incl_ret(a0,f_incl_env); |
599 | 16 } |
17 | |
622 | 18 __code |
599 | 19 f_incl2_test(float a0) |
20 { // ret先のinterface型が異なる | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
21 printf("#0020:%g\n",a0); |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
622
diff
changeset
|
22 goto f_incl_ret(a0,f_incl_env); |
599 | 23 } |
24 | |
622 | 25 __code |
26 f_incl1(int a0,__code(*ret)(int)) | |
599 | 27 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
28 printf("#0027:%d\n",a0); |
599 | 29 goto ret(a0*a0); |
30 } | |
31 | |
32 int | |
33 f_incl0(int a0) | |
34 { | |
35 f_incl_ret=return; | |
36 f_incl_env=environment; | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
37 printf("#0036:%d\n",a0); |
599 | 38 goto f_incl1(a0,f_incl2); |
39 } | |
40 | |
41 int | |
42 f_incl0_test(int a0) | |
43 { | |
44 f_incl_ret=return; | |
45 f_incl_env=environment; | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
46 printf("#0045:%d\n",a0); |
599 | 47 goto f_incl1(a0,f_incl2_test); |
48 } | |
49 | |
50 #else | |
51 | |
52 int | |
53 f_incl0(int a0) | |
54 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
55 printf("#0054:%d\n",a0); |
599 | 56 return a0; |
57 } | |
58 | |
59 int | |
60 f_incl0_test(int a0) | |
61 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
62 printf("#0061:%d\n",a0); |
599 | 63 return a0; |
64 } | |
65 | |
66 #endif | |
67 | |
68 int | |
69 g_incl2(int a0) | |
70 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
71 printf("#0070:%d\n",a0); |
599 | 72 return a0; |
73 } | |
74 | |
75 int | |
76 g_incl2_test(float a0) | |
77 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
78 printf("#0077:%g\n",a0); |
599 | 79 return (int) a0; |
80 } | |
81 | |
82 int | |
83 g_incl1(int a0,int (*ret)(int)) | |
84 { | |
85 return ret(a0); | |
86 } | |
87 | |
88 int | |
89 main() | |
90 { | |
91 int f0=f_incl0(10); | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
92 printf("#0091:%d\n",f0); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
93 printf("#0092:%d\n",f_incl0_test(11)); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
94 printf("#0093:%d\n",g_incl1(12,g_incl2)); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
95 printf("#0094:%d\n",g_incl1(13,g_incl2_test)); |
599 | 96 return 0; |
97 } | |
98 | |
99 /* end */ |