Mercurial > hg > CbC > old > device
annotate test/tmp11.c @ 832:bc919d849346
arrow in parse mode
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 03 Dec 2010 13:29:19 +0900 |
parents | a379da780856 |
children | d712ee10feb7 |
rev | line source |
---|---|
467 | 1 int printf(const char *format, ...); |
2 | |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
3 typedef struct nametable { |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
4 char *nm; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
5 int sc,ty,dsp; } NMTBL; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
6 NMTBL *a; |
832 | 7 NMTBL f; |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
8 |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
9 NMTBL * |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
10 test2(char *n) { |
491 | 11 printf("#0009:s %s\n",n); |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
12 return a; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
13 } |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
14 |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
15 int |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
16 test0(int a,int b,int c) { |
491 | 17 printf("#0015:a %d b %d c %d\n",a,b,c); |
172 | 18 return 0; |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
19 } |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
20 |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
21 int |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
22 test1(a,b,c) |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
23 int a,b;int c; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
24 { |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
25 return test0(a,b,c); |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
26 } |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
27 |
832 | 28 int heap[10]; |
29 | |
30 #define ncaddr(e) (*(NMTBL**)&heap[e+2]) | |
31 | |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
32 int |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
33 main() |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
34 { |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
35 int d; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
36 NMTBL *b; |
832 | 37 f.nm = "_name"; |
38 a = &f; | |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
39 b = test2("test"); |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
40 d = test1(1,2,3); |
491 | 41 printf("#0033:return %d\n",d); |
832 | 42 |
43 NMTBL **p = (NMTBL**)&heap[2]; | |
44 *p = &f; | |
45 b = &f; | |
46 int e = 0; | |
47 printf("f.nm %s\n",f.nm); | |
48 printf("b->nm %s\n",b->nm); | |
49 printf("(*p)->nm %s\n",(*p)->nm); | |
50 printf("ncaddr(e)->nm %s\n",ncaddr(e)->nm); | |
51 | |
46
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
52 return d; |
b1c8ac8c308d
fix cascading struct retrun. Now it should be compatible with gcc
kono
parents:
diff
changeset
|
53 } |
832 | 54 |
55 /* end */ |