call-ar-st.c revision 1.7 1 1.1 christos
2 1.1 christos #include <stdio.h>
3 1.1 christos #include <stdlib.h>
4 1.1 christos #include <string.h>
5 1.1 christos
6 1.7 christos #include "unbuffer_output.c"
7 1.6 christos
8 1.1 christos /**************************************************************************
9 1.1 christos * TESTS :
10 1.1 christos * -- function arguments that are enumerated types
11 1.1 christos * -- small structure arguments ( <= 64 bits )
12 1.1 christos * -- stored in registers
13 1.1 christos * -- stored on the stack
14 1.1 christos * -- large structure arguments ( > 64 bits )
15 1.1 christos * -- stored in registers
16 1.1 christos * -- stored on the stack
17 1.1 christos * -- array arguments
18 1.1 christos * -- caller is a leaf routine :
19 1.1 christos * -- use the call command from within an init routine (i.e.
20 1.1 christos * init_bit_flags, init_bit_flags_combo, init_array_rep)
21 1.1 christos * -- caller doesn't have enough space for all the function arguments :
22 1.1 christos * -- call print_long_arg_list from inside print_small_structs
23 1.1 christos ***************************************************************************/
24 1.1 christos
25 1.7 christos /* Some enumerated types -- used to test that the structural data type is
26 1.1 christos * retrieved for function arguments with typedef data types.
27 1.1 christos */
28 1.1 christos typedef int id_int;
29 1.1 christos
30 1.1 christos typedef enum {
31 1.1 christos BLACK,
32 1.1 christos BLUE,
33 1.1 christos BROWN,
34 1.1 christos ECRUE,
35 1.1 christos GOLD,
36 1.1 christos GRAY,
37 1.1 christos GREEN,
38 1.1 christos IVORY,
39 1.1 christos MAUVE,
40 1.1 christos ORANGE,
41 1.1 christos PINK,
42 1.1 christos PURPLE,
43 1.1 christos RED,
44 1.1 christos SILVER,
45 1.1 christos TAN,
46 1.1 christos VIOLET,
47 1.1 christos WHITE,
48 1.1 christos YELLOW} colors;
49 1.1 christos
50 1.1 christos /* A large structure (> 64 bits) used to test passing large structures as
51 1.1 christos * parameters
52 1.1 christos */
53 1.1 christos
54 1.1 christos struct array_rep_info_t {
55 1.1 christos int next_index[10];
56 1.1 christos int values[10];
57 1.1 christos int head;
58 1.1 christos };
59 1.1 christos
60 1.1 christos /*****************************************************************************
61 1.1 christos * Small structures ( <= 64 bits). These are used to test passing small
62 1.1 christos * structures as parameters and test argument size promotion.
63 1.1 christos *****************************************************************************/
64 1.1 christos
65 1.1 christos /* 64 bits
66 1.1 christos */
67 1.1 christos struct small_rep_info_t {
68 1.1 christos int value;
69 1.1 christos int head;
70 1.1 christos };
71 1.1 christos
72 1.1 christos /* 6 bits : really fits in 8 bits and is promoted to 32 bits
73 1.1 christos */
74 1.1 christos struct bit_flags_t {
75 1.1 christos unsigned alpha :1;
76 1.1 christos unsigned beta :1;
77 1.1 christos unsigned gamma :1;
78 1.1 christos unsigned delta :1;
79 1.1 christos unsigned epsilon :1;
80 1.1 christos unsigned omega :1;
81 1.1 christos };
82 1.1 christos
83 1.1 christos /* 22 bits : really fits in 40 bits and is promoted to 64 bits
84 1.1 christos */
85 1.1 christos struct bit_flags_combo_t {
86 1.1 christos unsigned alpha :1;
87 1.1 christos unsigned beta :1;
88 1.1 christos char ch1;
89 1.1 christos unsigned gamma :1;
90 1.1 christos unsigned delta :1;
91 1.1 christos char ch2;
92 1.1 christos unsigned epsilon :1;
93 1.1 christos unsigned omega :1;
94 1.1 christos };
95 1.1 christos
96 1.1 christos /* 64 bits
97 1.1 christos */
98 1.1 christos struct one_double_t {
99 1.1 christos double double1;
100 1.1 christos };
101 1.1 christos
102 1.1 christos /* 64 bits
103 1.1 christos */
104 1.1 christos struct two_floats_t {
105 1.1 christos float float1;
106 1.1 christos float float2;
107 1.1 christos };
108 1.1 christos
109 1.1 christos /* 16 bits : promoted to 32 bits
110 1.1 christos */
111 1.1 christos struct two_char_t {
112 1.1 christos char ch1;
113 1.1 christos char ch2;
114 1.1 christos };
115 1.1 christos
116 1.1 christos /* 24 bits : promoted to 32 bits
117 1.1 christos */
118 1.1 christos struct three_char_t {
119 1.1 christos char ch1;
120 1.1 christos char ch2;
121 1.1 christos char ch3;
122 1.1 christos };
123 1.1 christos
124 1.1 christos /* 40 bits : promoted to 64 bits
125 1.1 christos */
126 1.1 christos struct five_char_t {
127 1.1 christos char ch1;
128 1.1 christos char ch2;
129 1.1 christos char ch3;
130 1.1 christos char ch4;
131 1.1 christos char ch5;
132 1.1 christos };
133 1.1 christos
134 1.1 christos /* 40 bits : promoted to 64 bits
135 1.1 christos */
136 1.1 christos struct int_char_combo_t {
137 1.1 christos int int1;
138 1.1 christos char ch1;
139 1.1 christos };
140 1.1 christos
141 1.1 christos /*****************************************************************
142 1.1 christos * PRINT_STUDENT_ID_SHIRT_COLOR :
143 1.1 christos * IN id_int student -- enumerated type
144 1.1 christos * IN colors shirt -- enumerated type
145 1.1 christos *****************************************************************/
146 1.1 christos void print_student_id_shirt_color (id_int student, colors shirt)
147 1.1 christos {
148 1.1 christos
149 1.1 christos printf("student id : %d\t", student);
150 1.1 christos printf("shirt color : ");
151 1.1 christos switch (shirt) {
152 1.1 christos case BLACK : printf("BLACK\n");
153 1.1 christos break;
154 1.1 christos case BLUE : printf("BLUE\n");
155 1.1 christos break;
156 1.1 christos case BROWN : printf("BROWN\n");
157 1.1 christos break;
158 1.1 christos case ECRUE : printf("ECRUE\n");
159 1.1 christos break;
160 1.1 christos case GOLD : printf("GOLD\n");
161 1.1 christos break;
162 1.1 christos case GRAY : printf("GRAY\n");
163 1.1 christos break;
164 1.1 christos case GREEN : printf("GREEN\n");
165 1.1 christos break;
166 1.1 christos case IVORY : printf("IVORY\n");
167 1.1 christos break;
168 1.1 christos case MAUVE : printf("MAUVE\n");
169 1.1 christos break;
170 1.1 christos case ORANGE : printf("ORANGE\n");
171 1.1 christos break;
172 1.1 christos case PINK : printf("PINK\n");
173 1.1 christos break;
174 1.1 christos case PURPLE : printf("PURPLE\n");
175 1.1 christos break;
176 1.1 christos case RED : printf("RED\n");
177 1.1 christos break;
178 1.1 christos case SILVER : printf("SILVER\n");
179 1.1 christos break;
180 1.1 christos case TAN : printf("TAN\n");
181 1.1 christos break;
182 1.1 christos case VIOLET : printf("VIOLET\n");
183 1.1 christos break;
184 1.1 christos case WHITE : printf("WHITE\n");
185 1.1 christos break;
186 1.1 christos case YELLOW : printf("YELLOW\n");
187 1.1 christos break;
188 1.1 christos }
189 1.1 christos }
190 1.1 christos
191 1.1 christos /*****************************************************************
192 1.1 christos * PRINT_CHAR_ARRAY :
193 1.1 christos * IN char array_c[] -- character array
194 1.1 christos *****************************************************************/
195 1.1 christos void print_char_array (char array_c[])
196 1.1 christos {
197 1.1 christos
198 1.1 christos int index;
199 1.1 christos
200 1.1 christos printf("array_c :\n");
201 1.1 christos printf("=========\n\n");
202 1.1 christos for (index = 0; index < 120; index++) {
203 1.1 christos printf("%1c", array_c[index]);
204 1.1 christos if ((index%50) == 0) printf("\n");
205 1.1 christos }
206 1.1 christos printf("\n\n");
207 1.1 christos }
208 1.1 christos
209 1.1 christos /*****************************************************************
210 1.1 christos * PRINT_DOUBLE_ARRAY :
211 1.1 christos * IN double array_d[] -- array of doubles
212 1.1 christos *****************************************************************/
213 1.1 christos void print_double_array (double array_d[])
214 1.1 christos {
215 1.1 christos
216 1.1 christos int index;
217 1.1 christos
218 1.1 christos printf("array_d :\n");
219 1.1 christos printf("=========\n\n");
220 1.1 christos for (index = 0; index < 9; index++) {
221 1.1 christos printf("%f ", array_d[index]);
222 1.1 christos if ((index%8) == 0) printf("\n");
223 1.1 christos }
224 1.1 christos printf("\n\n");
225 1.1 christos }
226 1.1 christos
227 1.1 christos /*****************************************************************
228 1.1 christos * PRINT_FLOAT_ARRAY:
229 1.1 christos * IN float array_f[] -- array of floats
230 1.1 christos *****************************************************************/
231 1.1 christos void print_float_array (float array_f[])
232 1.1 christos {
233 1.1 christos
234 1.1 christos int index;
235 1.1 christos
236 1.1 christos printf("array_f :\n");
237 1.1 christos printf("=========\n\n");
238 1.1 christos for (index = 0; index < 15; index++) {
239 1.1 christos printf("%f ", array_f[index]);
240 1.1 christos if ((index%8) == 0) printf("\n");
241 1.1 christos
242 1.1 christos }
243 1.1 christos printf("\n\n");
244 1.1 christos }
245 1.1 christos
246 1.1 christos /*****************************************************************
247 1.1 christos * PRINT_INT_ARRAY:
248 1.1 christos * IN int array_i[] -- array of integers
249 1.1 christos *****************************************************************/
250 1.1 christos void print_int_array (int array_i[])
251 1.1 christos {
252 1.1 christos
253 1.1 christos int index;
254 1.1 christos
255 1.1 christos printf("array_i :\n");
256 1.1 christos printf("=========\n\n");
257 1.1 christos for (index = 0; index < 50; index++) {
258 1.1 christos printf("%d ", array_i[index]);
259 1.1 christos if ((index%8) == 0) printf("\n");
260 1.1 christos }
261 1.1 christos printf("\n\n");
262 1.1 christos
263 1.1 christos }
264 1.1 christos
265 1.1 christos /*****************************************************************
266 1.1 christos * PRINT_ALL_ARRAYS:
267 1.1 christos * IN int array_i[] -- array of integers
268 1.1 christos * IN char array_c[] -- array of characters
269 1.1 christos * IN float array_f[] -- array of floats
270 1.1 christos * IN double array_d[] -- array of doubles
271 1.1 christos *****************************************************************/
272 1.1 christos void print_all_arrays(int array_i[], char array_c[], float array_f[], double array_d[])
273 1.1 christos {
274 1.3 christos print_int_array(array_i); /* -step1- */
275 1.3 christos print_char_array(array_c); /* -next1- */
276 1.1 christos print_float_array(array_f);
277 1.1 christos print_double_array(array_d);
278 1.1 christos }
279 1.1 christos
280 1.1 christos /*****************************************************************
281 1.1 christos * LOOP_COUNT :
282 1.1 christos * A do nothing function. Used to provide a point at which calls can be made.
283 1.1 christos *****************************************************************/
284 1.1 christos void loop_count () {
285 1.1 christos
286 1.1 christos int index;
287 1.1 christos
288 1.1 christos for (index=0; index<4; index++);
289 1.1 christos }
290 1.1 christos
291 1.1 christos /*****************************************************************
292 1.1 christos * COMPUTE_WITH_SMALL_STRUCTS :
293 1.1 christos * A do nothing function. Used to provide a point at which calls can be made.
294 1.1 christos * IN int seed
295 1.1 christos *****************************************************************/
296 1.1 christos void compute_with_small_structs (int seed)
297 1.1 christos {
298 1.1 christos
299 1.1 christos struct small_rep_info_t array[4];
300 1.1 christos int index;
301 1.1 christos
302 1.1 christos for (index = 0; index < 4; index++) {
303 1.1 christos array[index].value = index*seed;
304 1.1 christos array[index].head = (index+1)*seed;
305 1.1 christos }
306 1.1 christos
307 1.1 christos for (index = 1; index < 4; index++) {
308 1.1 christos array[index].value = array[index].value + array[index-1].value;
309 1.1 christos array[index].head = array[index].head + array[index-1].head;
310 1.1 christos }
311 1.1 christos }
312 1.1 christos
313 1.1 christos /*****************************************************************
314 1.1 christos * INIT_BIT_FLAGS :
315 1.1 christos * Initializes a bit_flags_t structure. Can call this function see
316 1.1 christos * the call command behavior when integer arguments do not fit into
317 1.1 christos * registers and must be placed on the stack.
318 1.1 christos * OUT struct bit_flags_t *bit_flags -- structure to be filled
319 1.1 christos * IN unsigned a -- 0 or 1
320 1.1 christos * IN unsigned b -- 0 or 1
321 1.1 christos * IN unsigned g -- 0 or 1
322 1.1 christos * IN unsigned d -- 0 or 1
323 1.1 christos * IN unsigned e -- 0 or 1
324 1.1 christos * IN unsigned o -- 0 or 1
325 1.1 christos *****************************************************************/
326 1.1 christos void init_bit_flags (struct bit_flags_t *bit_flags, unsigned a, unsigned b, unsigned g, unsigned d, unsigned e, unsigned o)
327 1.1 christos {
328 1.1 christos
329 1.1 christos bit_flags->alpha = a;
330 1.1 christos bit_flags->beta = b;
331 1.1 christos bit_flags->gamma = g;
332 1.1 christos bit_flags->delta = d;
333 1.1 christos bit_flags->epsilon = e;
334 1.1 christos bit_flags->omega = o;
335 1.1 christos }
336 1.1 christos
337 1.1 christos /*****************************************************************
338 1.1 christos * INIT_BIT_FLAGS_COMBO :
339 1.1 christos * Initializes a bit_flags_combo_t structure. Can call this function
340 1.1 christos * to see the call command behavior when integer and character arguments
341 1.1 christos * do not fit into registers and must be placed on the stack.
342 1.1 christos * OUT struct bit_flags_combo_t *bit_flags_combo -- structure to fill
343 1.1 christos * IN unsigned a -- 0 or 1
344 1.1 christos * IN unsigned b -- 0 or 1
345 1.1 christos * IN char ch1
346 1.1 christos * IN unsigned g -- 0 or 1
347 1.1 christos * IN unsigned d -- 0 or 1
348 1.1 christos * IN char ch2
349 1.1 christos * IN unsigned e -- 0 or 1
350 1.1 christos * IN unsigned o -- 0 or 1
351 1.1 christos *****************************************************************/
352 1.1 christos void init_bit_flags_combo (struct bit_flags_combo_t *bit_flags_combo, unsigned a, unsigned b, char ch1, unsigned g, unsigned d, char ch2, unsigned e, unsigned o)
353 1.1 christos {
354 1.1 christos
355 1.3 christos bit_flags_combo->alpha = a; /* -step3- */
356 1.1 christos bit_flags_combo->beta = b;
357 1.1 christos bit_flags_combo->ch1 = ch1;
358 1.1 christos bit_flags_combo->gamma = g;
359 1.1 christos bit_flags_combo->delta = d;
360 1.1 christos bit_flags_combo->ch2 = ch2;
361 1.1 christos bit_flags_combo->epsilon = e;
362 1.1 christos bit_flags_combo->omega = o;
363 1.1 christos }
364 1.1 christos
365 1.1 christos
366 1.1 christos /*****************************************************************
367 1.1 christos * INIT_ONE_DOUBLE :
368 1.1 christos * OUT struct one_double_t *one_double -- structure to fill
369 1.1 christos * IN double init_val
370 1.1 christos *****************************************************************/
371 1.1 christos void init_one_double (struct one_double_t *one_double, double init_val)
372 1.1 christos {
373 1.1 christos
374 1.1 christos one_double->double1 = init_val;
375 1.1 christos }
376 1.1 christos
377 1.1 christos /*****************************************************************
378 1.1 christos * INIT_TWO_FLOATS :
379 1.1 christos * OUT struct two_floats_t *two_floats -- structure to be filled
380 1.1 christos * IN float init_val1
381 1.1 christos * IN float init_val2
382 1.1 christos *****************************************************************/
383 1.1 christos void init_two_floats (struct two_floats_t *two_floats, float init_val1, float init_val2)
384 1.1 christos {
385 1.1 christos two_floats->float1 = init_val1;
386 1.1 christos two_floats->float2 = init_val2;
387 1.1 christos }
388 1.1 christos
389 1.1 christos /*****************************************************************
390 1.1 christos * INIT_TWO_CHARS :
391 1.1 christos * OUT struct two_char_t *two_char -- structure to be filled
392 1.1 christos * IN char init_val1
393 1.1 christos * IN char init_val2
394 1.1 christos *****************************************************************/
395 1.1 christos void init_two_chars (struct two_char_t *two_char, char init_val1, char init_val2)
396 1.1 christos {
397 1.1 christos
398 1.1 christos two_char->ch1 = init_val1;
399 1.1 christos two_char->ch2 = init_val2;
400 1.1 christos }
401 1.1 christos
402 1.1 christos /*****************************************************************
403 1.1 christos * INIT_THREE_CHARS :
404 1.1 christos * OUT struct three_char_t *three_char -- structure to be filled
405 1.1 christos * IN char init_val1
406 1.1 christos * IN char init_val2
407 1.1 christos * IN char init_val3
408 1.1 christos *****************************************************************/
409 1.1 christos void init_three_chars (struct three_char_t *three_char, char init_val1, char init_val2, char init_val3)
410 1.1 christos {
411 1.1 christos
412 1.1 christos three_char->ch1 = init_val1;
413 1.1 christos three_char->ch2 = init_val2;
414 1.1 christos three_char->ch3 = init_val3;
415 1.1 christos }
416 1.1 christos
417 1.1 christos /*****************************************************************
418 1.1 christos * INIT_FIVE_CHARS :
419 1.1 christos * OUT struct five_char_t *five_char -- structure to be filled
420 1.1 christos * IN char init_val1
421 1.1 christos * IN char init_val2
422 1.1 christos * IN char init_val3
423 1.1 christos * IN char init_val4
424 1.1 christos * IN char init_val5
425 1.1 christos *****************************************************************/
426 1.1 christos void init_five_chars (struct five_char_t *five_char, char init_val1, char init_val2, char init_val3, char init_val4, char init_val5)
427 1.1 christos {
428 1.1 christos five_char->ch1 = init_val1;
429 1.1 christos five_char->ch2 = init_val2;
430 1.1 christos five_char->ch3 = init_val3;
431 1.1 christos five_char->ch4 = init_val4;
432 1.1 christos five_char->ch5 = init_val5;
433 1.1 christos }
434 1.1 christos
435 1.1 christos /*****************************************************************
436 1.1 christos * INIT_INT_CHAR_COMBO :
437 1.1 christos * OUT struct int_char_combo_t *combo -- structure to be filled
438 1.1 christos * IN int init_val1
439 1.1 christos * IN char init_val2
440 1.1 christos *****************************************************************/
441 1.1 christos void init_int_char_combo (struct int_char_combo_t *combo, int init_val1, char init_val2)
442 1.1 christos {
443 1.1 christos
444 1.1 christos combo->int1 = init_val1;
445 1.1 christos combo->ch1 = init_val2;
446 1.1 christos }
447 1.1 christos
448 1.1 christos /*****************************************************************
449 1.1 christos * INIT_STRUCT_REP :
450 1.1 christos * OUT struct small_rep_into_t *small_struct -- structure to be filled
451 1.1 christos * IN int seed
452 1.1 christos *****************************************************************/
453 1.1 christos void init_struct_rep(struct small_rep_info_t *small_struct, int seed)
454 1.1 christos {
455 1.1 christos
456 1.1 christos small_struct->value = 2 + (seed*2);
457 1.1 christos small_struct->head = 0;
458 1.1 christos }
459 1.1 christos
460 1.1 christos /*****************************************************************
461 1.1 christos * INIT_SMALL_STRUCTS :
462 1.1 christos * Takes all the small structures as input and calls the appropriate
463 1.1 christos * initialization routine for each structure
464 1.1 christos *****************************************************************/
465 1.1 christos void init_small_structs (
466 1.1 christos struct small_rep_info_t *struct1,
467 1.1 christos struct small_rep_info_t *struct2,
468 1.1 christos struct small_rep_info_t *struct3,
469 1.1 christos struct small_rep_info_t *struct4,
470 1.1 christos struct bit_flags_t *flags,
471 1.1 christos struct bit_flags_combo_t *flags_combo,
472 1.1 christos struct three_char_t *three_char,
473 1.1 christos struct five_char_t *five_char,
474 1.1 christos struct int_char_combo_t *int_char_combo,
475 1.1 christos struct one_double_t *d1,
476 1.1 christos struct one_double_t *d2,
477 1.1 christos struct one_double_t *d3,
478 1.1 christos struct two_floats_t *f1,
479 1.1 christos struct two_floats_t *f2,
480 1.1 christos struct two_floats_t *f3)
481 1.1 christos {
482 1.1 christos
483 1.1 christos init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
484 1.1 christos (unsigned)0, (unsigned)1, (unsigned)0 );
485 1.1 christos init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
486 1.1 christos (unsigned)1, (unsigned)0, 'n',
487 1.1 christos (unsigned)1, (unsigned)0 );
488 1.1 christos init_three_chars(three_char, 'a', 'b', 'c');
489 1.1 christos init_five_chars(five_char, 'l', 'm', 'n', 'o', 'p');
490 1.1 christos init_int_char_combo(int_char_combo, 123, 'z');
491 1.1 christos init_struct_rep(struct1, 2);
492 1.1 christos init_struct_rep(struct2, 4);
493 1.1 christos init_struct_rep(struct3, 5);
494 1.1 christos init_struct_rep(struct4, 6);
495 1.1 christos init_one_double ( d1, 10.5);
496 1.1 christos init_one_double ( d2, -3.375);
497 1.1 christos init_one_double ( d3, 675.09375);
498 1.1 christos init_two_floats ( f1, 45.234, 43.6);
499 1.1 christos init_two_floats ( f2, 78.01, 122.10);
500 1.1 christos init_two_floats ( f3, -1232.345, -199.21);
501 1.1 christos }
502 1.1 christos
503 1.1 christos /*****************************************************************
504 1.1 christos * PRINT_TEN_DOUBLES :
505 1.1 christos * ?????????????????????????????
506 1.1 christos ****************************************************************/
507 1.1 christos void print_ten_doubles (
508 1.1 christos double d1,
509 1.1 christos double d2,
510 1.1 christos double d3,
511 1.1 christos double d4,
512 1.1 christos double d5,
513 1.1 christos double d6,
514 1.1 christos double d7,
515 1.1 christos double d8,
516 1.1 christos double d9,
517 1.1 christos double d10)
518 1.1 christos {
519 1.1 christos
520 1.1 christos printf("Two Doubles : %f\t%f\n", d1, d2);
521 1.1 christos printf("Two Doubles : %f\t%f\n", d3, d4);
522 1.1 christos printf("Two Doubles : %f\t%f\n", d5, d6);
523 1.1 christos printf("Two Doubles : %f\t%f\n", d7, d8);
524 1.1 christos printf("Two Doubles : %f\t%f\n", d9, d10);
525 1.1 christos }
526 1.1 christos
527 1.1 christos /*****************************************************************
528 1.1 christos * PRINT_BIT_FLAGS :
529 1.1 christos * IN struct bit_flags_t bit_flags
530 1.1 christos ****************************************************************/
531 1.1 christos void print_bit_flags (struct bit_flags_t bit_flags)
532 1.1 christos {
533 1.1 christos
534 1.1 christos if (bit_flags.alpha) printf("alpha\n");
535 1.1 christos if (bit_flags.beta) printf("beta\n");
536 1.1 christos if (bit_flags.gamma) printf("gamma\n");
537 1.1 christos if (bit_flags.delta) printf("delta\n");
538 1.1 christos if (bit_flags.epsilon) printf("epsilon\n");
539 1.1 christos if (bit_flags.omega) printf("omega\n");
540 1.1 christos }
541 1.1 christos
542 1.1 christos /*****************************************************************
543 1.1 christos * PRINT_BIT_FLAGS_COMBO :
544 1.1 christos * IN struct bit_flags_combo_t bit_flags_combo
545 1.1 christos ****************************************************************/
546 1.1 christos void print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo)
547 1.1 christos {
548 1.1 christos
549 1.1 christos if (bit_flags_combo.alpha) printf("alpha\n");
550 1.1 christos if (bit_flags_combo.beta) printf("beta\n");
551 1.1 christos if (bit_flags_combo.gamma) printf("gamma\n");
552 1.1 christos if (bit_flags_combo.delta) printf("delta\n");
553 1.1 christos if (bit_flags_combo.epsilon) printf("epsilon\n");
554 1.1 christos if (bit_flags_combo.omega) printf("omega\n");
555 1.1 christos printf("ch1: %c\tch2: %c\n", bit_flags_combo.ch1, bit_flags_combo.ch2);
556 1.1 christos }
557 1.1 christos
558 1.1 christos /*****************************************************************
559 1.1 christos * PRINT_ONE_DOUBLE :
560 1.1 christos * IN struct one_double_t one_double
561 1.1 christos ****************************************************************/
562 1.1 christos void print_one_double (struct one_double_t one_double)
563 1.1 christos {
564 1.1 christos
565 1.1 christos printf("Contents of one_double_t: \n\n");
566 1.1 christos printf("%f\n", one_double.double1);
567 1.1 christos }
568 1.1 christos
569 1.1 christos /*****************************************************************
570 1.1 christos * PRINT_TWO_FLOATS :
571 1.1 christos * IN struct two_floats_t two_floats
572 1.1 christos ****************************************************************/
573 1.1 christos void print_two_floats (struct two_floats_t two_floats)
574 1.1 christos {
575 1.1 christos
576 1.1 christos printf("Contents of two_floats_t: \n\n");
577 1.1 christos printf("%f\t%f\n", two_floats.float1, two_floats.float2);
578 1.1 christos }
579 1.1 christos
580 1.1 christos /*****************************************************************
581 1.1 christos * PRINT_TWO_CHARS :
582 1.1 christos * IN struct two_char_t two_char
583 1.1 christos ****************************************************************/
584 1.1 christos void print_two_chars (struct two_char_t two_char)
585 1.1 christos {
586 1.1 christos
587 1.1 christos printf("Contents of two_char_t: \n\n");
588 1.1 christos printf("%c\t%c\n", two_char.ch1, two_char.ch2);
589 1.1 christos }
590 1.1 christos
591 1.1 christos /*****************************************************************
592 1.1 christos * PRINT_THREE_CHARS :
593 1.1 christos * IN struct three_char_t three_char
594 1.1 christos ****************************************************************/
595 1.1 christos void print_three_chars (struct three_char_t three_char)
596 1.1 christos {
597 1.1 christos
598 1.1 christos printf("Contents of three_char_t: \n\n");
599 1.1 christos printf("%c\t%c\t%c\n", three_char.ch1, three_char.ch2, three_char.ch3);
600 1.1 christos }
601 1.1 christos
602 1.1 christos /*****************************************************************
603 1.1 christos * PRINT_FIVE_CHARS :
604 1.1 christos * IN struct five_char_t five_char
605 1.1 christos ****************************************************************/
606 1.1 christos void print_five_chars (struct five_char_t five_char)
607 1.1 christos {
608 1.1 christos
609 1.1 christos printf("Contents of five_char_t: \n\n");
610 1.1 christos printf("%c\t%c\t%c\t%c\t%c\n", five_char.ch1, five_char.ch2,
611 1.1 christos five_char.ch3, five_char.ch4,
612 1.1 christos five_char.ch5);
613 1.1 christos }
614 1.1 christos
615 1.1 christos /*****************************************************************
616 1.1 christos * PRINT_INT_CHAR_COMBO :
617 1.1 christos * IN struct int_char_combo_t int_char_combo
618 1.1 christos ****************************************************************/
619 1.1 christos void print_int_char_combo (struct int_char_combo_t int_char_combo)
620 1.1 christos {
621 1.1 christos
622 1.1 christos printf("Contents of int_char_combo_t: \n\n");
623 1.1 christos printf("%d\t%c\n", int_char_combo.int1, int_char_combo.ch1);
624 1.1 christos }
625 1.1 christos
626 1.1 christos /*****************************************************************
627 1.1 christos * PRINT_STRUCT_REP :
628 1.1 christos * The last parameter must go onto the stack rather than into a register.
629 1.1 christos * This is a good function to call to test small structures.
630 1.1 christos * IN struct small_rep_info_t struct1
631 1.1 christos * IN struct small_rep_info_t struct2
632 1.1 christos * IN struct small_rep_info_t struct3
633 1.1 christos ****************************************************************/
634 1.1 christos void print_struct_rep(
635 1.1 christos struct small_rep_info_t struct1,
636 1.1 christos struct small_rep_info_t struct2,
637 1.1 christos struct small_rep_info_t struct3)
638 1.1 christos {
639 1.1 christos
640 1.1 christos
641 1.1 christos printf("Contents of struct1: \n\n");
642 1.1 christos printf("%10d%10d\n", struct1.value, struct1.head);
643 1.1 christos printf("Contents of struct2: \n\n");
644 1.1 christos printf("%10d%10d\n", struct2.value, struct2.head);
645 1.1 christos printf("Contents of struct3: \n\n");
646 1.1 christos printf("%10d%10d\n", struct3.value, struct3.head);
647 1.1 christos
648 1.1 christos }
649 1.1 christos
650 1.1 christos /*****************************************************************
651 1.1 christos * SUM_STRUCT_PRINT :
652 1.1 christos * The last two parameters must go onto the stack rather than into a register.
653 1.1 christos * This is a good function to call to test small structures.
654 1.1 christos * IN struct small_rep_info_t struct1
655 1.1 christos * IN struct small_rep_info_t struct2
656 1.1 christos * IN struct small_rep_info_t struct3
657 1.1 christos * IN struct small_rep_info_t struct4
658 1.1 christos ****************************************************************/
659 1.1 christos void sum_struct_print (
660 1.1 christos int seed,
661 1.1 christos struct small_rep_info_t struct1,
662 1.1 christos struct small_rep_info_t struct2,
663 1.1 christos struct small_rep_info_t struct3,
664 1.1 christos struct small_rep_info_t struct4)
665 1.1 christos {
666 1.1 christos int sum;
667 1.1 christos
668 1.1 christos printf("Sum of the 4 struct values and seed : \n\n");
669 1.1 christos sum = seed + struct1.value + struct2.value + struct3.value + struct4.value;
670 1.1 christos printf("%10d\n", sum);
671 1.1 christos }
672 1.1 christos
673 1.1 christos /*****************************************************************
674 1.1 christos * PRINT_SMALL_STRUCTS :
675 1.1 christos * This is a good function to call to test small structures.
676 1.1 christos * All of the small structures of odd sizes (40 bits, 8bits, etc.)
677 1.1 christos * are pushed onto the stack.
678 1.1 christos ****************************************************************/
679 1.1 christos void print_small_structs (
680 1.1 christos struct small_rep_info_t struct1,
681 1.1 christos struct small_rep_info_t struct2,
682 1.1 christos struct small_rep_info_t struct3,
683 1.1 christos struct small_rep_info_t struct4,
684 1.1 christos struct bit_flags_t flags,
685 1.1 christos struct bit_flags_combo_t flags_combo,
686 1.1 christos struct three_char_t three_char,
687 1.1 christos struct five_char_t five_char,
688 1.1 christos struct int_char_combo_t int_char_combo,
689 1.1 christos struct one_double_t d1,
690 1.1 christos struct one_double_t d2,
691 1.1 christos struct one_double_t d3,
692 1.1 christos struct two_floats_t f1,
693 1.1 christos struct two_floats_t f2,
694 1.1 christos struct two_floats_t f3)
695 1.1 christos {
696 1.1 christos print_bit_flags(flags);
697 1.1 christos print_bit_flags_combo(flags_combo);
698 1.1 christos print_three_chars(three_char);
699 1.1 christos print_five_chars(five_char);
700 1.1 christos print_int_char_combo(int_char_combo);
701 1.1 christos sum_struct_print(10, struct1, struct2, struct3, struct4);
702 1.1 christos print_struct_rep(struct1, struct2, struct3);
703 1.1 christos print_one_double(d1);
704 1.1 christos print_one_double(d2);
705 1.1 christos print_one_double(d3);
706 1.1 christos print_two_floats(f1);
707 1.1 christos print_two_floats(f2);
708 1.1 christos print_two_floats(f3);
709 1.1 christos }
710 1.1 christos
711 1.1 christos /*****************************************************************
712 1.1 christos * PRINT_LONG_ARG_LIST :
713 1.1 christos * This is a good function to call to test small structures.
714 1.1 christos * The first two parameters ( the doubles ) go into registers. The
715 1.1 christos * remaining arguments are pushed onto the stack. Depending on where
716 1.1 christos * print_long_arg_list is called from, the size of the argument list
717 1.1 christos * may force more space to be pushed onto the stack as part of the callers
718 1.1 christos * frame.
719 1.1 christos ****************************************************************/
720 1.1 christos void print_long_arg_list (
721 1.1 christos double a,
722 1.1 christos double b,
723 1.1 christos int c,
724 1.1 christos int d,
725 1.1 christos int e,
726 1.1 christos int f,
727 1.1 christos struct small_rep_info_t struct1,
728 1.1 christos struct small_rep_info_t struct2,
729 1.1 christos struct small_rep_info_t struct3,
730 1.1 christos struct small_rep_info_t struct4,
731 1.1 christos struct bit_flags_t flags,
732 1.1 christos struct bit_flags_combo_t flags_combo,
733 1.1 christos struct three_char_t three_char,
734 1.1 christos struct five_char_t five_char,
735 1.1 christos struct int_char_combo_t int_char_combo,
736 1.1 christos struct one_double_t d1,
737 1.1 christos struct one_double_t d2,
738 1.1 christos struct one_double_t d3,
739 1.1 christos struct two_floats_t f1,
740 1.1 christos struct two_floats_t f2,
741 1.1 christos struct two_floats_t f3)
742 1.1 christos {
743 1.3 christos printf("double : %f\n", a); /* -step2- */
744 1.1 christos printf("double : %f\n", b);
745 1.1 christos printf("int : %d\n", c);
746 1.1 christos printf("int : %d\n", d);
747 1.1 christos printf("int : %d\n", e);
748 1.1 christos printf("int : %d\n", f);
749 1.1 christos print_small_structs( struct1, struct2, struct3, struct4, flags, flags_combo,
750 1.1 christos three_char, five_char, int_char_combo, d1, d2, d3,
751 1.1 christos f1, f2, f3);
752 1.1 christos }
753 1.1 christos
754 1.1 christos
755 1.1 christos void print_one_large_struct (struct array_rep_info_t linked_list1)
756 1.1 christos {
757 1.1 christos
758 1.1 christos /* printf("Contents of linked list1: \n\n");
759 1.1 christos printf("Element Value | Index of Next Element\n");
760 1.1 christos printf("-------------------------------------\n");
761 1.1 christos printf(" | \n");*/
762 1.1 christos /*for (index = 0; index < 10; index++) {*/
763 1.1 christos
764 1.1 christos printf("%10d%10d\n", linked_list1.values[0],
765 1.1 christos linked_list1.next_index[0]);
766 1.1 christos /*}*/
767 1.1 christos }
768 1.1 christos
769 1.1 christos /*****************************************************************
770 1.1 christos * PRINT_ARRAY_REP :
771 1.1 christos * The three structure parameters should fit into registers.
772 1.1 christos * IN struct array_rep_info_t linked_list1
773 1.1 christos * IN struct array_rep_info_t linked_list2
774 1.1 christos * IN struct array_rep_info_t linked_list3
775 1.1 christos ****************************************************************/
776 1.1 christos void print_array_rep(
777 1.1 christos struct array_rep_info_t linked_list1,
778 1.1 christos struct array_rep_info_t linked_list2,
779 1.1 christos struct array_rep_info_t linked_list3)
780 1.1 christos {
781 1.1 christos
782 1.1 christos int index;
783 1.1 christos
784 1.1 christos printf("Contents of linked list1: \n\n");
785 1.1 christos printf("Element Value | Index of Next Element\n");
786 1.1 christos printf("-------------------------------------\n");
787 1.1 christos printf(" | \n");
788 1.1 christos for (index = 0; index < 10; index++) {
789 1.1 christos
790 1.1 christos printf("%10d%10d\n", linked_list1.values[index],
791 1.1 christos linked_list1.next_index[index]);
792 1.1 christos }
793 1.1 christos
794 1.1 christos printf("Contents of linked list2: \n\n");
795 1.1 christos printf("Element Value | Index of Next Element\n");
796 1.1 christos printf("-------------------------------------\n");
797 1.1 christos printf(" | \n");
798 1.1 christos for (index = 0; index < 10; index++) {
799 1.1 christos
800 1.1 christos printf("%10d%10d\n", linked_list2.values[index],
801 1.1 christos linked_list2.next_index[index]);
802 1.1 christos }
803 1.1 christos
804 1.1 christos printf("Contents of linked list3: \n\n");
805 1.1 christos printf("Element Value | Index of Next Element\n");
806 1.1 christos printf("-------------------------------------\n");
807 1.1 christos printf(" | \n");
808 1.1 christos for (index = 0; index < 10; index++) {
809 1.1 christos
810 1.1 christos printf("%10d%10d\n", linked_list3.values[index],
811 1.1 christos linked_list3.next_index[index]);
812 1.1 christos }
813 1.1 christos
814 1.1 christos }
815 1.1 christos
816 1.1 christos /*****************************************************************
817 1.1 christos * SUM_ARRAY_PRINT :
818 1.1 christos * The last structure parameter must be pushed onto the stack
819 1.1 christos * IN int seed
820 1.1 christos * IN struct array_rep_info_t linked_list1
821 1.1 christos * IN struct array_rep_info_t linked_list2
822 1.1 christos * IN struct array_rep_info_t linked_list3
823 1.1 christos * IN struct array_rep_info_t linked_list4
824 1.1 christos ****************************************************************/
825 1.1 christos void sum_array_print (
826 1.1 christos int seed,
827 1.1 christos struct array_rep_info_t linked_list1,
828 1.1 christos struct array_rep_info_t linked_list2,
829 1.1 christos struct array_rep_info_t linked_list3,
830 1.1 christos struct array_rep_info_t linked_list4)
831 1.1 christos {
832 1.1 christos int index;
833 1.1 christos int sum;
834 1.1 christos
835 1.1 christos printf("Sum of 4 arrays, by element (add in seed as well): \n\n");
836 1.1 christos printf("Seed: %d\n", seed);
837 1.1 christos printf("Element Index | Sum \n");
838 1.1 christos printf("-------------------------\n");
839 1.1 christos printf(" | \n");
840 1.1 christos
841 1.1 christos for (index = 0; index < 10; index++) {
842 1.1 christos
843 1.1 christos sum = seed + linked_list1.values[index] + linked_list2.values[index] +
844 1.1 christos linked_list3.values[index] + linked_list4.values[index];
845 1.1 christos printf("%10d%10d\n", index, sum);
846 1.1 christos }
847 1.1 christos }
848 1.1 christos
849 1.1 christos /*****************************************************************
850 1.1 christos * INIT_ARRAY_REP :
851 1.1 christos * IN struct array_rep_info_t *linked_list
852 1.1 christos * IN int seed
853 1.1 christos ****************************************************************/
854 1.1 christos void init_array_rep(
855 1.1 christos struct array_rep_info_t *linked_list,
856 1.1 christos int seed)
857 1.1 christos {
858 1.1 christos
859 1.1 christos int index;
860 1.1 christos
861 1.1 christos for (index = 0; index < 10; index++) {
862 1.1 christos
863 1.1 christos linked_list->values[index] = (2*index) + (seed*2);
864 1.1 christos linked_list->next_index[index] = index + 1;
865 1.1 christos }
866 1.1 christos linked_list->head = 0;
867 1.1 christos }
868 1.1 christos
869 1.1 christos
870 1.1 christos int main () {
871 1.1 christos
872 1.1 christos /* variables for array and enumerated type testing
873 1.1 christos */
874 1.1 christos static char char_array[121];
875 1.1 christos static double double_array[9];
876 1.1 christos static float float_array[15];
877 1.1 christos static int integer_array[50];
878 1.1 christos static int index;
879 1.1 christos static id_int student_id = 23;
880 1.1 christos static colors my_shirt = YELLOW;
881 1.1 christos
882 1.1 christos /* variables for large structure testing
883 1.1 christos */
884 1.1 christos static int number = 10;
885 1.1 christos static struct array_rep_info_t *list1;
886 1.1 christos static struct array_rep_info_t *list2;
887 1.1 christos static struct array_rep_info_t *list3;
888 1.1 christos static struct array_rep_info_t *list4;
889 1.1 christos
890 1.1 christos /* variables for testing a very long argument list
891 1.1 christos */
892 1.1 christos static double a;
893 1.1 christos static double b;
894 1.1 christos static int c;
895 1.1 christos static int d;
896 1.1 christos static int e;
897 1.1 christos static int f;
898 1.1 christos
899 1.1 christos /* variables for testing a small structures and a very long argument list
900 1.1 christos */
901 1.1 christos static struct small_rep_info_t *struct1;
902 1.1 christos static struct small_rep_info_t *struct2;
903 1.1 christos static struct small_rep_info_t *struct3;
904 1.1 christos static struct small_rep_info_t *struct4;
905 1.1 christos static struct bit_flags_t *flags;
906 1.1 christos static struct bit_flags_combo_t *flags_combo;
907 1.1 christos static struct three_char_t *three_char;
908 1.1 christos static struct five_char_t *five_char;
909 1.1 christos static struct int_char_combo_t *int_char_combo;
910 1.1 christos static struct one_double_t *d1;
911 1.1 christos static struct one_double_t *d2;
912 1.1 christos static struct one_double_t *d3;
913 1.1 christos static struct two_floats_t *f1;
914 1.1 christos static struct two_floats_t *f2;
915 1.1 christos static struct two_floats_t *f3;
916 1.1 christos
917 1.6 christos gdb_unbuffer_output ();
918 1.6 christos
919 1.1 christos /* Initialize arrays
920 1.1 christos */
921 1.1 christos for (index = 0; index < 120; index++) {
922 1.1 christos if ((index%2) == 0) char_array[index] = 'Z';
923 1.1 christos else char_array[index] = 'a';
924 1.1 christos }
925 1.1 christos char_array[120] = '\0';
926 1.1 christos
927 1.1 christos for (index = 0; index < 9; index++) {
928 1.1 christos double_array[index] = index*23.4567;
929 1.1 christos }
930 1.1 christos
931 1.1 christos for (index = 0; index < 15; index++) {
932 1.1 christos float_array[index] = index/7.02;
933 1.1 christos }
934 1.1 christos
935 1.3 christos for (index = 0; index < 50; index++) { /* -tbreak1- */
936 1.1 christos integer_array[index] = -index;
937 1.1 christos }
938 1.1 christos
939 1.1 christos /* Print arrays
940 1.1 christos */
941 1.1 christos print_char_array(char_array);
942 1.3 christos print_double_array(double_array); /* -tbreak2- */
943 1.1 christos print_float_array(float_array);
944 1.1 christos print_student_id_shirt_color(student_id, my_shirt);
945 1.1 christos print_int_array(integer_array);
946 1.3 christos print_all_arrays(integer_array, char_array, float_array, double_array); /* -tbreak3- */
947 1.1 christos
948 1.1 christos /* Allocate space for large structures
949 1.1 christos */
950 1.1 christos list1 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
951 1.1 christos list2 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
952 1.1 christos list3 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
953 1.1 christos list4 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
954 1.1 christos
955 1.1 christos /* Initialize large structures
956 1.1 christos */
957 1.1 christos init_array_rep(list1, 2);
958 1.1 christos init_array_rep(list2, 4);
959 1.1 christos init_array_rep(list3, 5);
960 1.1 christos init_array_rep(list4, 10);
961 1.1 christos printf("HELLO WORLD\n");
962 1.3 christos printf("BYE BYE FOR NOW\n"); /* -tbreak4- */
963 1.3 christos printf("VERY GREEN GRASS\n"); /* -next2- */
964 1.1 christos
965 1.1 christos /* Print large structures
966 1.1 christos */
967 1.3 christos sum_array_print(10, *list1, *list2, *list3, *list4); /* -tbreak5- */
968 1.1 christos print_array_rep(*list1, *list2, *list3);
969 1.1 christos print_one_large_struct(*list1);
970 1.1 christos
971 1.1 christos /* Allocate space for small structures
972 1.1 christos */
973 1.1 christos struct1 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
974 1.1 christos struct2 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
975 1.1 christos struct3 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
976 1.1 christos struct4 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
977 1.1 christos flags = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
978 1.1 christos flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
979 1.1 christos three_char = (struct three_char_t *)malloc(sizeof(struct three_char_t));
980 1.1 christos five_char = (struct five_char_t *)malloc(sizeof(struct five_char_t));
981 1.1 christos int_char_combo = (struct int_char_combo_t *)malloc(sizeof(struct int_char_combo_t));
982 1.1 christos
983 1.1 christos d1 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
984 1.1 christos d2 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
985 1.1 christos d3 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
986 1.1 christos
987 1.1 christos f1 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
988 1.1 christos f2 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
989 1.1 christos f3 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
990 1.1 christos
991 1.1 christos /* Initialize small structures
992 1.1 christos */
993 1.1 christos init_small_structs ( struct1, struct2, struct3, struct4, flags,
994 1.1 christos flags_combo, three_char, five_char, int_char_combo,
995 1.1 christos d1, d2, d3, f1, f2, f3);
996 1.1 christos
997 1.1 christos /* Print small structures
998 1.1 christos */
999 1.1 christos print_small_structs ( *struct1, *struct2, *struct3, *struct4, *flags,
1000 1.1 christos *flags_combo, *three_char, *five_char, *int_char_combo,
1001 1.1 christos *d1, *d2, *d3, *f1, *f2, *f3);
1002 1.1 christos
1003 1.1 christos /* Print a very long arg list
1004 1.1 christos */
1005 1.1 christos a = 22.25;
1006 1.1 christos b = 33.375;
1007 1.3 christos c = 0; /* -tbreak6- */
1008 1.1 christos d = -25;
1009 1.1 christos e = 100;
1010 1.1 christos f = 2345;
1011 1.1 christos
1012 1.3 christos print_long_arg_list ( a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, /* -tbreak7- */
1013 1.1 christos *flags, *flags_combo, *three_char, *five_char, *int_char_combo,
1014 1.1 christos *d1, *d2, *d3, *f1, *f2, *f3);
1015 1.1 christos
1016 1.1 christos /* Initialize small structures
1017 1.1 christos */
1018 1.1 christos init_one_double ( d1, 1.11111);
1019 1.1 christos init_one_double ( d2, -345.34);
1020 1.1 christos init_one_double ( d3, 546464.2);
1021 1.1 christos init_two_floats ( f1, 0.234, 453.1);
1022 1.1 christos init_two_floats ( f2, 78.345, 23.09);
1023 1.1 christos init_two_floats ( f3, -2.345, 1.0);
1024 1.1 christos init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
1025 1.1 christos (unsigned)0, (unsigned)1, (unsigned)0 );
1026 1.3 christos init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y', /* -tbreak8- */
1027 1.1 christos (unsigned)1, (unsigned)0, 'n',
1028 1.1 christos (unsigned)1, (unsigned)0 );
1029 1.1 christos init_three_chars(three_char, 'x', 'y', 'z');
1030 1.1 christos init_five_chars(five_char, 'h', 'e', 'l', 'l', 'o');
1031 1.3 christos init_int_char_combo(int_char_combo, 13, '!'); /* -tbreak9- */
1032 1.1 christos init_struct_rep(struct1, 10);
1033 1.1 christos init_struct_rep(struct2, 20);
1034 1.1 christos init_struct_rep(struct3, 30);
1035 1.1 christos init_struct_rep(struct4, 40);
1036 1.1 christos
1037 1.3 christos compute_with_small_structs(35); /* -tbreak10- */
1038 1.1 christos loop_count();
1039 1.1 christos printf("HELLO WORLD\n");
1040 1.1 christos printf("BYE BYE FOR NOW\n");
1041 1.1 christos printf("VERY GREEN GRASS\n");
1042 1.1 christos
1043 1.1 christos /* Print small structures
1044 1.1 christos */
1045 1.1 christos print_one_double(*d1);
1046 1.1 christos print_one_double(*d2);
1047 1.1 christos print_one_double(*d3);
1048 1.1 christos print_two_floats(*f1);
1049 1.1 christos print_two_floats(*f2);
1050 1.1 christos print_two_floats(*f3);
1051 1.1 christos print_bit_flags(*flags);
1052 1.1 christos print_bit_flags_combo(*flags_combo);
1053 1.1 christos print_three_chars(*three_char);
1054 1.1 christos print_five_chars(*five_char);
1055 1.1 christos print_int_char_combo(*int_char_combo);
1056 1.1 christos sum_struct_print(10, *struct1, *struct2, *struct3, *struct4);
1057 1.1 christos print_struct_rep(*struct1, *struct2, *struct3);
1058 1.1 christos
1059 1.1 christos return 0;
1060 1.1 christos }
1061 1.1 christos
1062 1.1 christos
1063 1.1 christos
1064 1.1 christos
1065 1.1 christos
1066