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