annotate test/call.c @ 275:8f09f8bbc494

MIPS switch statement. basic.c passed.
author kono
date Fri, 21 May 2004 14:00:02 +0900
parents 096559f07a70
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
94
1ad7045741a7 float dbinop fix
kono
parents: 79
diff changeset
2 int
1ad7045741a7 float dbinop fix
kono
parents: 79
diff changeset
3 a0(int i);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
4
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
5 int (*conv)(int);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
6
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
7 a0(int i)
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
8 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
9 return i+3;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
10 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
11
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
12 a1(int i)
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
13 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
14 return i-3;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
15 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
16
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
17
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
18 a2(int i,int conv(int))
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
19 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
20 return conv(i);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
21 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
22
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
23 a3(int i,int (*conv)(int))
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
24 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
25 return conv(i);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
26 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
27
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
28 a4(int i,int conv(int))
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
29 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
30 return (*conv)(i);
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 a5(int i,int (*conv)(int))
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
34 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
35 return (*conv)(i);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
36 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
37
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
38 main(int ac,char *av[]) {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
39 int j,k;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
40 conv = a0;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
41 j = conv(3);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
42 k = a2(4,a1);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
43 printf("6 1 = %d %d\n",j,k);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
44 k = a3(4,a1);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
45 printf("6 1 = %d %d\n",j,k);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
46 k = a4(4,a1);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
47 printf("6 1 = %d %d\n",j,k);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
48 k = a5(4,a1);
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
49 printf("6 1 = %d %d\n",j,k);
172
096559f07a70 some check
kono
parents: 94
diff changeset
50 return 0;
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
51 }