Commit | Line | Data |
---|---|---|
ef44eed1 SS |
1 | main (argc, argv, envp) |
2 | int argc; | |
3 | char **argv; | |
4 | char **envp; | |
5 | { | |
6 | extern void dummy(); | |
7 | dummy(); | |
8 | } | |
9 | ||
10 | /* We put main() right up front so its line number doesn't keep changing. */ | |
11 | ||
12 | /* | |
13 | * Test file with lots of different types, for testing the | |
14 | * "whatis" command. | |
15 | */ | |
16 | ||
17 | /* | |
18 | * First the basic C types. | |
19 | */ | |
20 | ||
21 | #if !defined (__STDC__) && !defined (_AIX) | |
22 | #define signed /**/ | |
23 | #endif | |
24 | ||
25 | char v_char; | |
26 | signed char v_signed_char; | |
27 | unsigned char v_unsigned_char; | |
28 | ||
29 | short v_short; | |
30 | signed short v_signed_short; | |
31 | unsigned short v_unsigned_short; | |
32 | ||
33 | int v_int; | |
34 | signed int v_signed_int; | |
35 | unsigned int v_unsigned_int; | |
36 | ||
37 | long v_long; | |
38 | signed long v_signed_long; | |
39 | unsigned long v_unsigned_long; | |
40 | ||
41 | float v_float; | |
42 | double v_double; | |
43 | ||
44 | /* | |
45 | * Now some derived types, which are arrays, functions-returning, | |
46 | * pointers, structures, unions, and enumerations. | |
47 | */ | |
48 | ||
49 | /**** arrays *******/ | |
50 | ||
51 | char v_char_array[2]; | |
52 | signed char v_signed_char_array[2]; | |
53 | unsigned char v_unsigned_char_array[2]; | |
54 | ||
55 | short v_short_array[2]; | |
56 | signed short v_signed_short_array[2]; | |
57 | unsigned short v_unsigned_short_array[2]; | |
58 | ||
59 | int v_int_array[2]; | |
60 | signed int v_signed_int_array[2]; | |
61 | unsigned int v_unsigned_int_array[2]; | |
62 | ||
63 | long v_long_array[2]; | |
64 | signed long v_signed_long_array[2]; | |
65 | unsigned long v_unsigned_long_array[2]; | |
66 | ||
67 | float v_float_array[2]; | |
68 | double v_double_array[2]; | |
69 | ||
70 | /**** pointers *******/ | |
71 | ||
72 | char *v_char_pointer; | |
73 | signed char *v_signed_char_pointer; | |
74 | unsigned char *v_unsigned_char_pointer; | |
75 | ||
76 | short *v_short_pointer; | |
77 | signed short *v_signed_short_pointer; | |
78 | unsigned short *v_unsigned_short_pointer; | |
79 | ||
80 | int *v_int_pointer; | |
81 | signed int *v_signed_int_pointer; | |
82 | unsigned int *v_unsigned_int_pointer; | |
83 | ||
84 | long *v_long_pointer; | |
85 | signed long *v_signed_long_pointer; | |
86 | unsigned long *v_unsigned_long_pointer; | |
87 | ||
88 | float *v_float_pointer; | |
89 | double *v_double_pointer; | |
90 | ||
91 | /**** structs *******/ | |
92 | ||
93 | struct t_struct { | |
94 | char v_char_member; | |
95 | short v_short_member; | |
96 | int v_int_member; | |
97 | long v_long_member; | |
98 | float v_float_member; | |
99 | double v_double_member; | |
100 | } v_struct1; | |
101 | ||
102 | struct { | |
103 | char v_char_member; | |
104 | short v_short_member; | |
105 | int v_int_member; | |
106 | long v_long_member; | |
107 | float v_float_member; | |
108 | double v_double_member; | |
109 | } v_struct2; | |
110 | ||
111 | /**** unions *******/ | |
112 | ||
113 | union t_union { | |
114 | char v_char_member; | |
115 | short v_short_member; | |
116 | int v_int_member; | |
117 | long v_long_member; | |
118 | float v_float_member; | |
119 | double v_double_member; | |
120 | } v_union; | |
121 | ||
122 | union { | |
123 | char v_char_member; | |
124 | short v_short_member; | |
125 | int v_int_member; | |
126 | long v_long_member; | |
127 | float v_float_member; | |
128 | double v_double_member; | |
129 | } v_union2; | |
130 | ||
131 | /*** Functions returning type ********/ | |
132 | ||
133 | char v_char_func () { return(0); } | |
134 | signed char v_signed_char_func () { return (0); } | |
135 | unsigned char v_unsigned_char_func () { return (0); } | |
136 | ||
137 | short v_short_func () { return (0); } | |
138 | signed short v_signed_short_func () { return (0); } | |
139 | unsigned short v_unsigned_short_func () { return (0); } | |
140 | ||
141 | int v_int_func () { return (0); } | |
142 | signed int v_signed_int_func () { return (0); } | |
143 | unsigned int v_unsigned_int_func () { return (0); } | |
144 | ||
145 | long v_long_func () { return (0); } | |
146 | signed long v_signed_long_func () { return (0); } | |
147 | unsigned long v_unsigned_long_func () { return (0); } | |
148 | ||
149 | float v_float_func () { return (0.0); } | |
150 | double v_double_func () { return (0.0); } | |
151 | ||
152 | /**** Some misc more complicated things *******/ | |
153 | ||
154 | struct link { | |
155 | struct link *next; | |
156 | #ifdef __STDC__ | |
157 | struct link *(*linkfunc) (struct link *this, int flags); | |
158 | #else | |
159 | struct link *(*linkfunc) (); | |
160 | #endif | |
161 | struct t_struct stuff[1][2][3]; | |
162 | } *s_link; | |
163 | ||
164 | union tu_link { | |
165 | struct link *next; | |
166 | #ifdef __STDC__ | |
167 | struct link *(*linkfunc) (struct link *this, int flags); | |
168 | #else | |
169 | struct link *(*linkfunc) (); | |
170 | #endif | |
171 | struct t_struct stuff[1][2][3]; | |
172 | } u_link; | |
173 | ||
174 | /**** Enumerations *******/ | |
175 | ||
176 | enum colors {red, green, blue} color; | |
177 | enum cars {chevy, ford, porsche} clunker; | |
178 | ||
179 | void dummy() | |
180 | { | |
181 | /* Some linkers (e.g. on AIX) remove unreferenced variables, | |
182 | so make sure to reference them. */ | |
183 | v_char = 0; | |
184 | v_signed_char = 1; | |
185 | v_unsigned_char = 2; | |
186 | ||
187 | v_short = 3; | |
188 | v_signed_short = 4; | |
189 | v_unsigned_short = 5; | |
190 | ||
191 | v_int = 6; | |
192 | v_signed_int = 7; | |
193 | v_unsigned_int = 8; | |
194 | ||
195 | v_long = 9; | |
196 | v_signed_long = 10; | |
197 | v_unsigned_long = 11; | |
198 | ||
199 | v_float = 100.0; | |
200 | v_double = 200.0; | |
201 | ||
202 | ||
203 | v_char_array[0] = v_char; | |
204 | v_signed_char_array[0] = v_signed_char; | |
205 | v_unsigned_char_array[0] = v_unsigned_char; | |
206 | ||
207 | v_short_array[0] = v_short; | |
208 | v_signed_short_array[0] = v_signed_short; | |
209 | v_unsigned_short_array[0] = v_unsigned_short; | |
210 | ||
211 | v_int_array[0] = v_int; | |
212 | v_signed_int_array[0] = v_signed_int; | |
213 | v_unsigned_int_array[0] = v_unsigned_int; | |
214 | ||
215 | v_long_array[0] = v_long; | |
216 | v_signed_long_array[0] = v_signed_long; | |
217 | v_unsigned_long_array[0] = v_unsigned_long; | |
218 | ||
219 | v_float_array[0] = v_float; | |
220 | v_double_array[0] = v_double; | |
221 | ||
222 | v_char_pointer = &v_char; | |
223 | v_signed_char_pointer = &v_signed_char; | |
224 | v_unsigned_char_pointer = &v_unsigned_char; | |
225 | ||
226 | v_short_pointer = &v_short; | |
227 | v_signed_short_pointer = &v_signed_short; | |
228 | v_unsigned_short_pointer = &v_unsigned_short; | |
229 | ||
230 | v_int_pointer = &v_int; | |
231 | v_signed_int_pointer = &v_signed_int; | |
232 | v_unsigned_int_pointer = &v_unsigned_int; | |
233 | ||
234 | v_long_pointer = &v_long; | |
235 | v_signed_long_pointer = &v_signed_long; | |
236 | v_unsigned_long_pointer = &v_unsigned_long; | |
237 | ||
238 | v_float_pointer = &v_float; | |
239 | v_double_pointer = &v_double; | |
240 | ||
241 | color = red; | |
242 | clunker = porsche; | |
243 | ||
244 | u_link.next = s_link; | |
245 | ||
246 | v_struct2.v_int_member = v_struct1.v_int_member; | |
247 | v_union2.v_short_member = v_union.v_short_member; | |
248 | } |