|
|
1.1 root 1: static char sccsid[] = "@(#)t.c 2.10";
2:
3: #include <stdio.h>
4: /* this is a toy file used for testing cdb */
5:
6: typedef enum {
7: red, orange, yellow, green=10, blue, violet}
8: COLORE;
9:
10:
11: typedef union {
12: struct {
13: int s11;
14: }
15: s1;
16: struct {
17: int s21;
18: int s22;
19: }
20: s2;
21: struct {
22: int s31;
23: int s32;
24: int s33;
25: }
26: s3;
27: COLORE color;
28: }
29: U1U, *pU1U;
30: U1U vu;
31:
32: typedef struct {
33: short a;
34: char b[9];
35: long c;
36: unsigned foo1 :
37: 1;
38: unsigned foo2 :
39: 2;
40: unsigned foo3 :
41: 3;
42: unsigned foo4 :
43: 4;
44: COLORE color;
45: }
46: MOMR, *pMOMR;
47: MOMR vamom = {
48: 12, "Apple Pie", -34, 1, 2, 4, 8, green};
49:
50: typedef union {
51: long lng;
52: float fl;
53: struct {
54: short shortLo;
55: short shortHi;
56: }
57: shorts;
58: struct {
59: char chLoLo;
60: char chLoHi;
61: char chHiLo;
62: char chHiHi;
63: }
64: chars;
65: }
66: STUFFU;
67:
68: STUFFU vstuff;
69:
70: int arI1[10];
71: int arI2[5][6];
72: char arC1[10];
73: char arC2[5][6];
74: MOMR vrgMom[4];
75: char *mumble[5] = {
76: "0", "1", "2", "3", "4"
77: };
78:
79: int k;
80:
81: bar(a, b, c)
82: int a, b, c;
83: {
84: printf("in bar\n");
85: baz(++a, -1L, "Hi, Mom!");
86: }
87:
88:
89: baz(d, e, f)
90: register int d;
91: long e;
92: char *f;
93: {
94: int x, y, z;
95: register float fl;
96: MOMR amom;
97: pMOMR mom;
98:
99: mom = &amom;
100: fl = 1.3;
101: d = 2;
102: e = d + e;
103: switch (d) {
104: case 0:
105: printf("0\n");
106: break;
107: case 1:
108: printf("1\n");
109: break;
110: case 2:
111: printf("2\n");
112: break;
113: case 3:
114: printf("3\n");
115: break;
116: case 4:
117: printf("4\n");
118: break;
119: default:
120: printf("default\n");
121: break;
122: }
123: printf("in baz %s %g\n",f, fl);
124: }
125:
126: foo(i)
127: register int i;
128: {
129: printf("in foo\n");
130: bar(++i, ++i, ++i);
131: }
132:
133: int foo2(i, d)
134: int i;
135: int d;
136: {
137: int e;
138: int x;
139: long q;
140: int y;
141:
142: printf("in foo2\n");
143: bar(++i, ++i, ++i);
144: return(i);
145: }
146:
147: foo3(i, d, h, z)
148: int i;
149: long d;
150: int h;
151: int z;
152: {
153: int e;
154: long f;
155: int m, n, o, p, q, r;
156:
157: printf("in foo3\n");
158: bar(++i, ++i, ++i);
159: return(i+d+h);
160: }
161:
162:
163: main(argc, argv)
164: int argc;
165: char *argv[];
166: {
167: char ch;
168: char *mumble[5];
169:
170: mumble[0] = "a";
171: mumble[1] = "b";
172: mumble[2] = "c";
173: mumble[3] = "d";
174: mumble[4] = "e";
175:
176: vstuff.lng = 0x12345678;
177: vu.s3.s31 = 1;
178: vu.s3.s32 = 2;
179: vu.s3.s33 = 3;
180:
181: while (*argv)
182: printf("%s\n",*(argv++));
183:
184: for (k=1; k != 0; k++) {
185: foo(k);
186: }
187: printf("done\n");
188: exit(0);
189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.