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