annotate test/macro.c @ 172:096559f07a70

some check
author kono
date Tue, 25 Nov 2003 11:47:41 +0900
parents ebac635814dc
children 352feeae4b0a
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);
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
16
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
17 main() {
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
18 int a,b,e;
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
19
115
ebac635814dc fix nested macro function
kono
parents: 111
diff changeset
20 b = heap[TEST111];
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
21 a =1; b = 3;
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
22 #ifndef a
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
23 c(a,
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
24 b);
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
25 /* 3,5 expected */
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
26 #endif
111
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
27 e=50; heap[51]=3; heap[3]=4;
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
28 /* 5,4 expected */
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
29 #if 0
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
30 g(car(cadr(e)),cadr(e));
7aa449aff3e6 floating point
kono
parents: 36
diff changeset
31 #endif
172
096559f07a70 some check
kono
parents: 115
diff changeset
32 return 0;
36
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
33 }
9f89cef85b41 *** empty log message ***
kono
parents:
diff changeset
34