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