Mercurial > hg > CbC > old > device
annotate test/goto.c @ 775:a2a7b2835fa3
ia32 regression test
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 18 Nov 2010 21:25:30 +0900 |
parents | c2c709727221 |
children |
rev | line source |
---|---|
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
720
diff
changeset
|
1 #define __environment _CbC_environment |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
720
diff
changeset
|
2 #define __return _CbC_return |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
720
diff
changeset
|
3 |
720 | 4 extern int printf(const char *,...); |
79 | 5 |
622 | 6 __code (*conv)(int,__code (*)()); |
7 __code a2(int i,__code conv()); | |
8 __code a3(int i,__code conv()); | |
9 __code a4(int i,__code conv()); | |
10 __code a5(int i,__code conv()); | |
11 __code a6(); | |
12 __code a7(); | |
13 __code a8(); | |
14 __code a9(); | |
79 | 15 |
622 | 16 char* print_conv(__code conv()); |
193 | 17 |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
720
diff
changeset
|
18 __code (*exit0)(int,void*); |
79 | 19 void *env; |
20 | |
622 | 21 __code |
22 a2(int i,__code conv()) | |
79 | 23 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
24 printf("#0023:a2 %d %s\n",i,print_conv(conv)); |
79 | 25 goto conv(i+1,a4); |
26 } | |
27 | |
622 | 28 __code |
29 a3(int i,__code (*conv)()) | |
79 | 30 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
31 printf("#0030:a3 %d %s\n",i,print_conv(conv)); |
79 | 32 goto conv(i+1,a5); |
33 } | |
34 | |
622 | 35 __code |
36 a4(int i,__code conv()) | |
79 | 37 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
38 printf("#0037:a4 %d %s\n",i,print_conv(conv)); |
80 | 39 goto (*conv)(i+1,a6); |
79 | 40 } |
41 | |
622 | 42 __code |
43 a5(int i,__code (*conv)()) | |
79 | 44 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
45 printf("#0044:a5 %d %s\n",i,print_conv(conv)); |
80 | 46 goto (*conv)(i+1,i+2,i+3,a7); |
47 } | |
48 | |
622 | 49 __code |
50 a6(int i,int j,int k,__code conv()) | |
80 | 51 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
52 printf("#0051:a6 %d %s\n",i,print_conv(conv)); |
80 | 53 goto conv(i+1,j,k,a8); |
54 } | |
55 | |
622 | 56 __code |
720 | 57 a7(int i,int j,int k,__code (*conv)()) |
80 | 58 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
59 printf("#0058:a7 %d %s\n",i,print_conv(conv)); |
80 | 60 goto conv(i+1,j,k,a9); |
61 } | |
62 | |
622 | 63 __code |
64 a8(int i,int j,int k,__code conv()) | |
80 | 65 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
66 printf("#0065:a8 %d %s\n",i,print_conv(conv)); |
80 | 67 goto (*conv)(i+1,j,k,exit0); |
68 } | |
69 | |
622 | 70 __code |
71 a9(int i,int j,int k,__code (*conv)()) | |
80 | 72 { |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
73 printf("#0072:a9 %d %s\n",i,print_conv(conv)); |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
720
diff
changeset
|
74 goto (*conv)(0,env); |
79 | 75 } |
76 | |
77 main(int ac,char *av[]) { | |
720 | 78 exit0 = __return; |
79 env = __environment; | |
79 | 80 conv = a2; |
81 goto conv(1,a3); | |
82 } | |
572 | 83 |
84 char* | |
622 | 85 print_conv(__code conv()) |
572 | 86 { |
87 if(conv==a2) return "a2"; | |
88 if(conv==a3) return "a3"; | |
89 if(conv==a4) return "a4"; | |
90 if(conv==a5) return "a5"; | |
91 if(conv==a6) return "a6"; | |
92 if(conv==a7) return "a7"; | |
93 if(conv==a8) return "a8"; | |
94 if(conv==a9) return "a9"; | |
95 else return "xx"; | |
96 } |