annotate test/goto.c @ 275:8f09f8bbc494

MIPS switch statement. basic.c passed.
author kono
date Fri, 21 May 2004 14:00:02 +0900
parents ce0c38b6c85e
children 0c256ea2a97e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
1
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
2
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
3 code (*conv)(int,code (*)());
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
4 code a2(int i,code conv());
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
5 code a3(int i,code conv());
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
6 code a4(int i,code conv());
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
7 code a5(int i,code conv());
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
8
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
9 char*
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
10 print_conv(code conv())
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
11 {
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
12 if(conv==a2) return "a2";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
13 if(conv==a3) return "a3";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
14 if(conv==a4) return "a4";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
15 if(conv==a5) return "a5";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
16 if(conv==a6) return "a6";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
17 if(conv==a7) return "a7";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
18 if(conv==a8) return "a8";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
19 if(conv==a9) return "a9";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
20 else return "xx";
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
21 }
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
22
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
23 code (*exit0)(int);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
24 void *env;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
25
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
26 code
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
27 a2(int i,code conv())
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
28 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
29 printf("a2 %d %s\n",i,print_conv(conv));
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
30 goto conv(i+1,a4);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
31 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
32
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
33 code
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
34 a3(int i,code (*conv)())
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
35 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
36 printf("a3 %d %s\n",i,print_conv(conv));
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
37 goto conv(i+1,a5);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
38 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
39
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
40 code
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
41 a4(int i,code conv())
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
42 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
43 printf("a4 %d %s\n",i,print_conv(conv));
80
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
44 goto (*conv)(i+1,a6);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
45 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
46
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
47 code
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
48 a5(int i,code (*conv)())
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
49 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
50 printf("a5 %d %s\n",i,print_conv(conv));
80
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
51 goto (*conv)(i+1,i+2,i+3,a7);
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
52 }
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
53
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
54 code
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
55 a6(int i,int j,int k,code conv())
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
56 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
57 printf("a6 %d %s\n",i,print_conv(conv));
80
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
58 goto conv(i+1,j,k,a8);
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
59 }
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
60
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
61 code
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
62 a7(int i,,int j,int k,code (*conv)())
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
63 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
64 printf("a7 %d %s\n",i,print_conv(conv));
80
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
65 goto conv(i+1,j,k,a9);
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
66 }
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
67
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
68 code
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
69 a8(int i,int j,int k,code conv())
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
70 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
71 printf("a8 %d %s\n",i,print_conv(conv));
80
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
72 goto (*conv)(i+1,j,k,exit0);
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
73 }
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
74
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
75 code
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
76 a9(int i,int j,int k,code (*conv)())
83d901658ce9 *** empty log message ***
kono
parents: 79
diff changeset
77 {
193
ce0c38b6c85e try long long
kono
parents: 172
diff changeset
78 printf("a9 %d %s\n",i,print_conv(conv));
172
096559f07a70 some check
kono
parents: 80
diff changeset
79 goto (*conv)(0),env;
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
80 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
81
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
82 main(int ac,char *av[]) {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
83 exit0 = return;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
84 env = environment;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
85 conv = a2;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
86 goto conv(1,a3);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
87 }