annotate test/macro.c @ 236:7353a818858c

ia32 code creg fix done
author kono
date Thu, 29 Apr 2004 23:53:31 +0900
parents 1d80ad165831
children 9df8aa0497ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
1
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
2 int heap[100];
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
3
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
4 #define car(e) (heap[(int)(e)])
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
5 #define cadr(e) (heap[((int)(e))+1])
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
6
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
7 #define TEST
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
8 int i;
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
9 TEST
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
10
115
ebac635814dc fix nested macro function
kono
parents: 111
diff changeset
11 #define TEST0 33
ebac635814dc fix nested macro function
kono
parents: 111
diff changeset
12 #define TEST111 TEST0
ebac635814dc fix nested macro function
kono
parents: 111
diff changeset
13
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
14 #define c(a,b) g(a+1,b+1)
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
15 #define g(a,b) printf("%d %d\n",a+1,b+1);
180
f00e3bfa1b45 nkf.c compile (not correct)
kono
parents: 177
diff changeset
16 #define d(a,b) cadr(b)+3
183
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
17 /*
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
18
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
19 #define stdio stdio
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
20 #define f(a,b) aho+a+b
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
21 f (a,b)
1d80ad165831 recursive macros
kono
parents: 180
diff changeset
22 */
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
23
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
24 main() {
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
25 int a,b,e;
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
26
115
ebac635814dc fix nested macro function
kono
parents: 111
diff changeset
27 b = heap[TEST111];
180
f00e3bfa1b45 nkf.c compile (not correct)
kono
parents: 177
diff changeset
28 d(a,b);
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
29 a =1; b = 3;
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
30 #ifndef a
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
31 c(a,
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
32 b);
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
33 /* 3,5 expected */
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
34 #endif
111
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
35 e=50; heap[51]=3; heap[3]=4;
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
36 /* 5,4 expected */
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
37 #if 0
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
38 g(car(cadr(e)),cadr(e));
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
39 #endif
177
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
40 #if 0
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
41 printf("1\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
42 #elif (1)
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
43 printf("2\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
44 #elif (2)
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
45 printf("3\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
46 #else
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
47 printf("4\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
48 #endif
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
49 #if 0
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
50 printf("1\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
51 #elif (0)
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
52 printf("2\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
53 #elif (0)
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
54 printf("3\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
55 #else
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
56 printf("4\n");
352feeae4b0a macro else/ccout
kono
parents: 172
diff changeset
57 #endif
172
096559f07a70 some check
kono
parents: 115
diff changeset
58 return 0;
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
59 }
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
60