Mercurial > hg > CbC > old > device
comparison 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 |
comparison
equal
deleted
inserted
replaced
831:a22aabb27786 | 832:bc919d849346 |
---|---|
2 | 2 |
3 typedef struct nametable { | 3 typedef struct nametable { |
4 char *nm; | 4 char *nm; |
5 int sc,ty,dsp; } NMTBL; | 5 int sc,ty,dsp; } NMTBL; |
6 NMTBL *a; | 6 NMTBL *a; |
7 NMTBL f; | |
7 | 8 |
8 NMTBL * | 9 NMTBL * |
9 test2(char *n) { | 10 test2(char *n) { |
10 printf("#0009:s %s\n",n); | 11 printf("#0009:s %s\n",n); |
11 return a; | 12 return a; |
22 int a,b;int c; | 23 int a,b;int c; |
23 { | 24 { |
24 return test0(a,b,c); | 25 return test0(a,b,c); |
25 } | 26 } |
26 | 27 |
28 int heap[10]; | |
29 | |
30 #define ncaddr(e) (*(NMTBL**)&heap[e+2]) | |
31 | |
27 int | 32 int |
28 main() | 33 main() |
29 { | 34 { |
30 int d; | 35 int d; |
31 NMTBL *b; | 36 NMTBL *b; |
37 f.nm = "_name"; | |
38 a = &f; | |
32 b = test2("test"); | 39 b = test2("test"); |
33 d = test1(1,2,3); | 40 d = test1(1,2,3); |
34 printf("#0033:return %d\n",d); | 41 printf("#0033:return %d\n",d); |
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 | |
35 return d; | 52 return d; |
36 } | 53 } |
54 | |
55 /* end */ |