6 #include "../lib/unbuffer_output.c"
8 /**************************************************************************
10 * -- function arguments that are enumerated types
11 * -- small structure arguments ( <= 64 bits )
12 * -- stored in registers
13 * -- stored on the stack
14 * -- large structure arguments ( > 64 bits )
15 * -- stored in registers
16 * -- stored on the stack
18 * -- caller is a leaf routine :
19 * -- use the call command from within an init routine (i.e.
20 * init_bit_flags, init_bit_flags_combo, init_array_rep)
21 * -- caller doesn't have enough space for all the function arguments :
22 * -- call print_long_arg_list from inside print_small_structs
23 ***************************************************************************/
25 /* Some enumerated types -- used to test that the structureal data type is
26 * retrieved for function arguments with typedef data types.
50 /* A large structure (> 64 bits) used to test passing large structures as
54 struct array_rep_info_t {
60 /*****************************************************************************
61 * Small structures ( <= 64 bits). These are used to test passing small
62 * structures as parameters and test argument size promotion.
63 *****************************************************************************/
67 struct small_rep_info_t {
72 /* 6 bits : really fits in 8 bits and is promoted to 32 bits
83 /* 22 bits : really fits in 40 bits and is promoted to 64 bits
85 struct bit_flags_combo_t {
104 struct two_floats_t {
109 /* 16 bits : promoted to 32 bits
116 /* 24 bits : promoted to 32 bits
118 struct three_char_t {
124 /* 40 bits : promoted to 64 bits
134 /* 40 bits : promoted to 64 bits
136 struct int_char_combo_t {
141 /*****************************************************************
142 * PRINT_STUDENT_ID_SHIRT_COLOR :
143 * IN id_int student -- enumerated type
144 * IN colors shirt -- enumerated type
145 *****************************************************************/
146 void print_student_id_shirt_color (id_int student, colors shirt)
149 printf("student id : %d\t", student);
150 printf("shirt color : ");
152 case BLACK : printf("BLACK\n");
154 case BLUE : printf("BLUE\n");
156 case BROWN : printf("BROWN\n");
158 case ECRUE : printf("ECRUE\n");
160 case GOLD : printf("GOLD\n");
162 case GRAY : printf("GRAY\n");
164 case GREEN : printf("GREEN\n");
166 case IVORY : printf("IVORY\n");
168 case MAUVE : printf("MAUVE\n");
170 case ORANGE : printf("ORANGE\n");
172 case PINK : printf("PINK\n");
174 case PURPLE : printf("PURPLE\n");
176 case RED : printf("RED\n");
178 case SILVER : printf("SILVER\n");
180 case TAN : printf("TAN\n");
182 case VIOLET : printf("VIOLET\n");
184 case WHITE : printf("WHITE\n");
186 case YELLOW : printf("YELLOW\n");
191 /*****************************************************************
193 * IN char array_c[] -- character array
194 *****************************************************************/
195 void print_char_array (char array_c[])
200 printf("array_c :\n");
201 printf("=========\n\n");
202 for (index = 0; index < 120; index++) {
203 printf("%1c", array_c[index]);
204 if ((index%50) == 0) printf("\n");
209 /*****************************************************************
210 * PRINT_DOUBLE_ARRAY :
211 * IN double array_d[] -- array of doubles
212 *****************************************************************/
213 void print_double_array (double array_d[])
218 printf("array_d :\n");
219 printf("=========\n\n");
220 for (index = 0; index < 9; index++) {
221 printf("%f ", array_d[index]);
222 if ((index%8) == 0) printf("\n");
227 /*****************************************************************
229 * IN float array_f[] -- array of floats
230 *****************************************************************/
231 void print_float_array (float array_f[])
236 printf("array_f :\n");
237 printf("=========\n\n");
238 for (index = 0; index < 15; index++) {
239 printf("%f ", array_f[index]);
240 if ((index%8) == 0) printf("\n");
246 /*****************************************************************
248 * IN int array_i[] -- array of integers
249 *****************************************************************/
250 void print_int_array (int array_i[])
255 printf("array_i :\n");
256 printf("=========\n\n");
257 for (index = 0; index < 50; index++) {
258 printf("%d ", array_i[index]);
259 if ((index%8) == 0) printf("\n");
265 /*****************************************************************
267 * IN int array_i[] -- array of integers
268 * IN char array_c[] -- array of characters
269 * IN float array_f[] -- array of floats
270 * IN double array_d[] -- array of doubles
271 *****************************************************************/
272 void print_all_arrays(int array_i[], char array_c[], float array_f[], double array_d[])
274 print_int_array(array_i); /* -step1- */
275 print_char_array(array_c); /* -next1- */
276 print_float_array(array_f);
277 print_double_array(array_d);
280 /*****************************************************************
282 * A do nothing function. Used to provide a point at which calls can be made.
283 *****************************************************************/
288 for (index=0; index<4; index++);
291 /*****************************************************************
292 * COMPUTE_WITH_SMALL_STRUCTS :
293 * A do nothing function. Used to provide a point at which calls can be made.
295 *****************************************************************/
296 void compute_with_small_structs (int seed)
299 struct small_rep_info_t array[4];
302 for (index = 0; index < 4; index++) {
303 array[index].value = index*seed;
304 array[index].head = (index+1)*seed;
307 for (index = 1; index < 4; index++) {
308 array[index].value = array[index].value + array[index-1].value;
309 array[index].head = array[index].head + array[index-1].head;
313 /*****************************************************************
315 * Initializes a bit_flags_t structure. Can call this function see
316 * the call command behavior when integer arguments do not fit into
317 * registers and must be placed on the stack.
318 * OUT struct bit_flags_t *bit_flags -- structure to be filled
319 * IN unsigned a -- 0 or 1
320 * IN unsigned b -- 0 or 1
321 * IN unsigned g -- 0 or 1
322 * IN unsigned d -- 0 or 1
323 * IN unsigned e -- 0 or 1
324 * IN unsigned o -- 0 or 1
325 *****************************************************************/
326 void init_bit_flags (struct bit_flags_t *bit_flags, unsigned a, unsigned b, unsigned g, unsigned d, unsigned e, unsigned o)
329 bit_flags->alpha = a;
331 bit_flags->gamma = g;
332 bit_flags->delta = d;
333 bit_flags->epsilon = e;
334 bit_flags->omega = o;
337 /*****************************************************************
338 * INIT_BIT_FLAGS_COMBO :
339 * Initializes a bit_flags_combo_t structure. Can call this function
340 * to see the call command behavior when integer and character arguments
341 * do not fit into registers and must be placed on the stack.
342 * OUT struct bit_flags_combo_t *bit_flags_combo -- structure to fill
343 * IN unsigned a -- 0 or 1
344 * IN unsigned b -- 0 or 1
346 * IN unsigned g -- 0 or 1
347 * IN unsigned d -- 0 or 1
349 * IN unsigned e -- 0 or 1
350 * IN unsigned o -- 0 or 1
351 *****************************************************************/
352 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)
355 bit_flags_combo->alpha = a; /* -step3- */
356 bit_flags_combo->beta = b;
357 bit_flags_combo->ch1 = ch1;
358 bit_flags_combo->gamma = g;
359 bit_flags_combo->delta = d;
360 bit_flags_combo->ch2 = ch2;
361 bit_flags_combo->epsilon = e;
362 bit_flags_combo->omega = o;
366 /*****************************************************************
368 * OUT struct one_double_t *one_double -- structure to fill
370 *****************************************************************/
371 void init_one_double (struct one_double_t *one_double, double init_val)
374 one_double->double1 = init_val;
377 /*****************************************************************
379 * OUT struct two_floats_t *two_floats -- structure to be filled
382 *****************************************************************/
383 void init_two_floats (struct two_floats_t *two_floats, float init_val1, float init_val2)
385 two_floats->float1 = init_val1;
386 two_floats->float2 = init_val2;
389 /*****************************************************************
391 * OUT struct two_char_t *two_char -- structure to be filled
394 *****************************************************************/
395 void init_two_chars (struct two_char_t *two_char, char init_val1, char init_val2)
398 two_char->ch1 = init_val1;
399 two_char->ch2 = init_val2;
402 /*****************************************************************
404 * OUT struct three_char_t *three_char -- structure to be filled
408 *****************************************************************/
409 void init_three_chars (struct three_char_t *three_char, char init_val1, char init_val2, char init_val3)
412 three_char->ch1 = init_val1;
413 three_char->ch2 = init_val2;
414 three_char->ch3 = init_val3;
417 /*****************************************************************
419 * OUT struct five_char_t *five_char -- structure to be filled
425 *****************************************************************/
426 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)
428 five_char->ch1 = init_val1;
429 five_char->ch2 = init_val2;
430 five_char->ch3 = init_val3;
431 five_char->ch4 = init_val4;
432 five_char->ch5 = init_val5;
435 /*****************************************************************
436 * INIT_INT_CHAR_COMBO :
437 * OUT struct int_char_combo_t *combo -- structure to be filled
440 *****************************************************************/
441 void init_int_char_combo (struct int_char_combo_t *combo, int init_val1, char init_val2)
444 combo->int1 = init_val1;
445 combo->ch1 = init_val2;
448 /*****************************************************************
450 * OUT struct small_rep_into_t *small_struct -- structure to be filled
452 *****************************************************************/
453 void init_struct_rep(struct small_rep_info_t *small_struct, int seed)
456 small_struct->value = 2 + (seed*2);
457 small_struct->head = 0;
460 /*****************************************************************
461 * INIT_SMALL_STRUCTS :
462 * Takes all the small structures as input and calls the appropriate
463 * initialization routine for each structure
464 *****************************************************************/
465 void init_small_structs (
466 struct small_rep_info_t *struct1,
467 struct small_rep_info_t *struct2,
468 struct small_rep_info_t *struct3,
469 struct small_rep_info_t *struct4,
470 struct bit_flags_t *flags,
471 struct bit_flags_combo_t *flags_combo,
472 struct three_char_t *three_char,
473 struct five_char_t *five_char,
474 struct int_char_combo_t *int_char_combo,
475 struct one_double_t *d1,
476 struct one_double_t *d2,
477 struct one_double_t *d3,
478 struct two_floats_t *f1,
479 struct two_floats_t *f2,
480 struct two_floats_t *f3)
483 init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
484 (unsigned)0, (unsigned)1, (unsigned)0 );
485 init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
486 (unsigned)1, (unsigned)0, 'n',
487 (unsigned)1, (unsigned)0 );
488 init_three_chars(three_char, 'a', 'b', 'c');
489 init_five_chars(five_char, 'l', 'm', 'n', 'o', 'p');
490 init_int_char_combo(int_char_combo, 123, 'z');
491 init_struct_rep(struct1, 2);
492 init_struct_rep(struct2, 4);
493 init_struct_rep(struct3, 5);
494 init_struct_rep(struct4, 6);
495 init_one_double ( d1, 10.5);
496 init_one_double ( d2, -3.375);
497 init_one_double ( d3, 675.09375);
498 init_two_floats ( f1, 45.234, 43.6);
499 init_two_floats ( f2, 78.01, 122.10);
500 init_two_floats ( f3, -1232.345, -199.21);
503 /*****************************************************************
504 * PRINT_TEN_DOUBLES :
505 * ?????????????????????????????
506 ****************************************************************/
507 void print_ten_doubles (
520 printf("Two Doubles : %f\t%f\n", d1, d2);
521 printf("Two Doubles : %f\t%f\n", d3, d4);
522 printf("Two Doubles : %f\t%f\n", d5, d6);
523 printf("Two Doubles : %f\t%f\n", d7, d8);
524 printf("Two Doubles : %f\t%f\n", d9, d10);
527 /*****************************************************************
529 * IN struct bit_flags_t bit_flags
530 ****************************************************************/
531 void print_bit_flags (struct bit_flags_t bit_flags)
534 if (bit_flags.alpha) printf("alpha\n");
535 if (bit_flags.beta) printf("beta\n");
536 if (bit_flags.gamma) printf("gamma\n");
537 if (bit_flags.delta) printf("delta\n");
538 if (bit_flags.epsilon) printf("epsilon\n");
539 if (bit_flags.omega) printf("omega\n");
542 /*****************************************************************
543 * PRINT_BIT_FLAGS_COMBO :
544 * IN struct bit_flags_combo_t bit_flags_combo
545 ****************************************************************/
546 void print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo)
549 if (bit_flags_combo.alpha) printf("alpha\n");
550 if (bit_flags_combo.beta) printf("beta\n");
551 if (bit_flags_combo.gamma) printf("gamma\n");
552 if (bit_flags_combo.delta) printf("delta\n");
553 if (bit_flags_combo.epsilon) printf("epsilon\n");
554 if (bit_flags_combo.omega) printf("omega\n");
555 printf("ch1: %c\tch2: %c\n", bit_flags_combo.ch1, bit_flags_combo.ch2);
558 /*****************************************************************
560 * IN struct one_double_t one_double
561 ****************************************************************/
562 void print_one_double (struct one_double_t one_double)
565 printf("Contents of one_double_t: \n\n");
566 printf("%f\n", one_double.double1);
569 /*****************************************************************
571 * IN struct two_floats_t two_floats
572 ****************************************************************/
573 void print_two_floats (struct two_floats_t two_floats)
576 printf("Contents of two_floats_t: \n\n");
577 printf("%f\t%f\n", two_floats.float1, two_floats.float2);
580 /*****************************************************************
582 * IN struct two_char_t two_char
583 ****************************************************************/
584 void print_two_chars (struct two_char_t two_char)
587 printf("Contents of two_char_t: \n\n");
588 printf("%c\t%c\n", two_char.ch1, two_char.ch2);
591 /*****************************************************************
592 * PRINT_THREE_CHARS :
593 * IN struct three_char_t three_char
594 ****************************************************************/
595 void print_three_chars (struct three_char_t three_char)
598 printf("Contents of three_char_t: \n\n");
599 printf("%c\t%c\t%c\n", three_char.ch1, three_char.ch2, three_char.ch3);
602 /*****************************************************************
604 * IN struct five_char_t five_char
605 ****************************************************************/
606 void print_five_chars (struct five_char_t five_char)
609 printf("Contents of five_char_t: \n\n");
610 printf("%c\t%c\t%c\t%c\t%c\n", five_char.ch1, five_char.ch2,
611 five_char.ch3, five_char.ch4,
615 /*****************************************************************
616 * PRINT_INT_CHAR_COMBO :
617 * IN struct int_char_combo_t int_char_combo
618 ****************************************************************/
619 void print_int_char_combo (struct int_char_combo_t int_char_combo)
622 printf("Contents of int_char_combo_t: \n\n");
623 printf("%d\t%c\n", int_char_combo.int1, int_char_combo.ch1);
626 /*****************************************************************
628 * The last parameter must go onto the stack rather than into a register.
629 * This is a good function to call to test small structures.
630 * IN struct small_rep_info_t struct1
631 * IN struct small_rep_info_t struct2
632 * IN struct small_rep_info_t struct3
633 ****************************************************************/
634 void print_struct_rep(
635 struct small_rep_info_t struct1,
636 struct small_rep_info_t struct2,
637 struct small_rep_info_t struct3)
641 printf("Contents of struct1: \n\n");
642 printf("%10d%10d\n", struct1.value, struct1.head);
643 printf("Contents of struct2: \n\n");
644 printf("%10d%10d\n", struct2.value, struct2.head);
645 printf("Contents of struct3: \n\n");
646 printf("%10d%10d\n", struct3.value, struct3.head);
650 /*****************************************************************
652 * The last two parameters must go onto the stack rather than into a register.
653 * This is a good function to call to test small structures.
654 * IN struct small_rep_info_t struct1
655 * IN struct small_rep_info_t struct2
656 * IN struct small_rep_info_t struct3
657 * IN struct small_rep_info_t struct4
658 ****************************************************************/
659 void sum_struct_print (
661 struct small_rep_info_t struct1,
662 struct small_rep_info_t struct2,
663 struct small_rep_info_t struct3,
664 struct small_rep_info_t struct4)
668 printf("Sum of the 4 struct values and seed : \n\n");
669 sum = seed + struct1.value + struct2.value + struct3.value + struct4.value;
670 printf("%10d\n", sum);
673 /*****************************************************************
674 * PRINT_SMALL_STRUCTS :
675 * This is a good function to call to test small structures.
676 * All of the small structures of odd sizes (40 bits, 8bits, etc.)
677 * are pushed onto the stack.
678 ****************************************************************/
679 void print_small_structs (
680 struct small_rep_info_t struct1,
681 struct small_rep_info_t struct2,
682 struct small_rep_info_t struct3,
683 struct small_rep_info_t struct4,
684 struct bit_flags_t flags,
685 struct bit_flags_combo_t flags_combo,
686 struct three_char_t three_char,
687 struct five_char_t five_char,
688 struct int_char_combo_t int_char_combo,
689 struct one_double_t d1,
690 struct one_double_t d2,
691 struct one_double_t d3,
692 struct two_floats_t f1,
693 struct two_floats_t f2,
694 struct two_floats_t f3)
696 print_bit_flags(flags);
697 print_bit_flags_combo(flags_combo);
698 print_three_chars(three_char);
699 print_five_chars(five_char);
700 print_int_char_combo(int_char_combo);
701 sum_struct_print(10, struct1, struct2, struct3, struct4);
702 print_struct_rep(struct1, struct2, struct3);
703 print_one_double(d1);
704 print_one_double(d2);
705 print_one_double(d3);
706 print_two_floats(f1);
707 print_two_floats(f2);
708 print_two_floats(f3);
711 /*****************************************************************
712 * PRINT_LONG_ARG_LIST :
713 * This is a good function to call to test small structures.
714 * The first two parameters ( the doubles ) go into registers. The
715 * remaining arguments are pushed onto the stack. Depending on where
716 * print_long_arg_list is called from, the size of the argument list
717 * may force more space to be pushed onto the stack as part of the callers
719 ****************************************************************/
720 void print_long_arg_list (
727 struct small_rep_info_t struct1,
728 struct small_rep_info_t struct2,
729 struct small_rep_info_t struct3,
730 struct small_rep_info_t struct4,
731 struct bit_flags_t flags,
732 struct bit_flags_combo_t flags_combo,
733 struct three_char_t three_char,
734 struct five_char_t five_char,
735 struct int_char_combo_t int_char_combo,
736 struct one_double_t d1,
737 struct one_double_t d2,
738 struct one_double_t d3,
739 struct two_floats_t f1,
740 struct two_floats_t f2,
741 struct two_floats_t f3)
743 printf("double : %f\n", a); /* -step2- */
744 printf("double : %f\n", b);
745 printf("int : %d\n", c);
746 printf("int : %d\n", d);
747 printf("int : %d\n", e);
748 printf("int : %d\n", f);
749 print_small_structs( struct1, struct2, struct3, struct4, flags, flags_combo,
750 three_char, five_char, int_char_combo, d1, d2, d3,
755 void print_one_large_struct (struct array_rep_info_t linked_list1)
758 /* printf("Contents of linked list1: \n\n");
759 printf("Element Value | Index of Next Element\n");
760 printf("-------------------------------------\n");
762 /*for (index = 0; index < 10; index++) {*/
764 printf("%10d%10d\n", linked_list1.values[0],
765 linked_list1.next_index[0]);
769 /*****************************************************************
771 * The three structure parameters should fit into registers.
772 * IN struct array_rep_info_t linked_list1
773 * IN struct array_rep_info_t linked_list2
774 * IN struct array_rep_info_t linked_list3
775 ****************************************************************/
776 void print_array_rep(
777 struct array_rep_info_t linked_list1,
778 struct array_rep_info_t linked_list2,
779 struct array_rep_info_t linked_list3)
784 printf("Contents of linked list1: \n\n");
785 printf("Element Value | Index of Next Element\n");
786 printf("-------------------------------------\n");
788 for (index = 0; index < 10; index++) {
790 printf("%10d%10d\n", linked_list1.values[index],
791 linked_list1.next_index[index]);
794 printf("Contents of linked list2: \n\n");
795 printf("Element Value | Index of Next Element\n");
796 printf("-------------------------------------\n");
798 for (index = 0; index < 10; index++) {
800 printf("%10d%10d\n", linked_list2.values[index],
801 linked_list2.next_index[index]);
804 printf("Contents of linked list3: \n\n");
805 printf("Element Value | Index of Next Element\n");
806 printf("-------------------------------------\n");
808 for (index = 0; index < 10; index++) {
810 printf("%10d%10d\n", linked_list3.values[index],
811 linked_list3.next_index[index]);
816 /*****************************************************************
818 * The last structure parameter must be pushed onto the stack
820 * IN struct array_rep_info_t linked_list1
821 * IN struct array_rep_info_t linked_list2
822 * IN struct array_rep_info_t linked_list3
823 * IN struct array_rep_info_t linked_list4
824 ****************************************************************/
825 void sum_array_print (
827 struct array_rep_info_t linked_list1,
828 struct array_rep_info_t linked_list2,
829 struct array_rep_info_t linked_list3,
830 struct array_rep_info_t linked_list4)
835 printf("Sum of 4 arrays, by element (add in seed as well): \n\n");
836 printf("Seed: %d\n", seed);
837 printf("Element Index | Sum \n");
838 printf("-------------------------\n");
841 for (index = 0; index < 10; index++) {
843 sum = seed + linked_list1.values[index] + linked_list2.values[index] +
844 linked_list3.values[index] + linked_list4.values[index];
845 printf("%10d%10d\n", index, sum);
849 /*****************************************************************
851 * IN struct array_rep_info_t *linked_list
853 ****************************************************************/
855 struct array_rep_info_t *linked_list,
861 for (index = 0; index < 10; index++) {
863 linked_list->values[index] = (2*index) + (seed*2);
864 linked_list->next_index[index] = index + 1;
866 linked_list->head = 0;
872 /* variables for array and enumerated type testing
874 static char char_array[121];
875 static double double_array[9];
876 static float float_array[15];
877 static int integer_array[50];
879 static id_int student_id = 23;
880 static colors my_shirt = YELLOW;
882 /* variables for large structure testing
884 static int number = 10;
885 static struct array_rep_info_t *list1;
886 static struct array_rep_info_t *list2;
887 static struct array_rep_info_t *list3;
888 static struct array_rep_info_t *list4;
890 /* variables for testing a very long argument list
899 /* variables for testing a small structures and a very long argument list
901 static struct small_rep_info_t *struct1;
902 static struct small_rep_info_t *struct2;
903 static struct small_rep_info_t *struct3;
904 static struct small_rep_info_t *struct4;
905 static struct bit_flags_t *flags;
906 static struct bit_flags_combo_t *flags_combo;
907 static struct three_char_t *three_char;
908 static struct five_char_t *five_char;
909 static struct int_char_combo_t *int_char_combo;
910 static struct one_double_t *d1;
911 static struct one_double_t *d2;
912 static struct one_double_t *d3;
913 static struct two_floats_t *f1;
914 static struct two_floats_t *f2;
915 static struct two_floats_t *f3;
917 gdb_unbuffer_output ();
921 for (index = 0; index < 120; index++) {
922 if ((index%2) == 0) char_array[index] = 'Z';
923 else char_array[index] = 'a';
925 char_array[120] = '\0';
927 for (index = 0; index < 9; index++) {
928 double_array[index] = index*23.4567;
931 for (index = 0; index < 15; index++) {
932 float_array[index] = index/7.02;
935 for (index = 0; index < 50; index++) { /* -tbreak1- */
936 integer_array[index] = -index;
941 print_char_array(char_array);
942 print_double_array(double_array); /* -tbreak2- */
943 print_float_array(float_array);
944 print_student_id_shirt_color(student_id, my_shirt);
945 print_int_array(integer_array);
946 print_all_arrays(integer_array, char_array, float_array, double_array); /* -tbreak3- */
948 /* Allocate space for large structures
950 list1 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
951 list2 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
952 list3 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
953 list4 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
955 /* Initialize large structures
957 init_array_rep(list1, 2);
958 init_array_rep(list2, 4);
959 init_array_rep(list3, 5);
960 init_array_rep(list4, 10);
961 printf("HELLO WORLD\n");
962 printf("BYE BYE FOR NOW\n"); /* -tbreak4- */
963 printf("VERY GREEN GRASS\n"); /* -next2- */
965 /* Print large structures
967 sum_array_print(10, *list1, *list2, *list3, *list4); /* -tbreak5- */
968 print_array_rep(*list1, *list2, *list3);
969 print_one_large_struct(*list1);
971 /* Allocate space for small structures
973 struct1 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
974 struct2 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
975 struct3 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
976 struct4 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
977 flags = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
978 flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
979 three_char = (struct three_char_t *)malloc(sizeof(struct three_char_t));
980 five_char = (struct five_char_t *)malloc(sizeof(struct five_char_t));
981 int_char_combo = (struct int_char_combo_t *)malloc(sizeof(struct int_char_combo_t));
983 d1 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
984 d2 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
985 d3 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
987 f1 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
988 f2 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
989 f3 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
991 /* Initialize small structures
993 init_small_structs ( struct1, struct2, struct3, struct4, flags,
994 flags_combo, three_char, five_char, int_char_combo,
995 d1, d2, d3, f1, f2, f3);
997 /* Print small structures
999 print_small_structs ( *struct1, *struct2, *struct3, *struct4, *flags,
1000 *flags_combo, *three_char, *five_char, *int_char_combo,
1001 *d1, *d2, *d3, *f1, *f2, *f3);
1003 /* Print a very long arg list
1007 c = 0; /* -tbreak6- */
1012 print_long_arg_list ( a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, /* -tbreak7- */
1013 *flags, *flags_combo, *three_char, *five_char, *int_char_combo,
1014 *d1, *d2, *d3, *f1, *f2, *f3);
1016 /* Initialize small structures
1018 init_one_double ( d1, 1.11111);
1019 init_one_double ( d2, -345.34);
1020 init_one_double ( d3, 546464.2);
1021 init_two_floats ( f1, 0.234, 453.1);
1022 init_two_floats ( f2, 78.345, 23.09);
1023 init_two_floats ( f3, -2.345, 1.0);
1024 init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
1025 (unsigned)0, (unsigned)1, (unsigned)0 );
1026 init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y', /* -tbreak8- */
1027 (unsigned)1, (unsigned)0, 'n',
1028 (unsigned)1, (unsigned)0 );
1029 init_three_chars(three_char, 'x', 'y', 'z');
1030 init_five_chars(five_char, 'h', 'e', 'l', 'l', 'o');
1031 init_int_char_combo(int_char_combo, 13, '!'); /* -tbreak9- */
1032 init_struct_rep(struct1, 10);
1033 init_struct_rep(struct2, 20);
1034 init_struct_rep(struct3, 30);
1035 init_struct_rep(struct4, 40);
1037 compute_with_small_structs(35); /* -tbreak10- */
1039 printf("HELLO WORLD\n");
1040 printf("BYE BYE FOR NOW\n");
1041 printf("VERY GREEN GRASS\n");
1043 /* Print small structures
1045 print_one_double(*d1);
1046 print_one_double(*d2);
1047 print_one_double(*d3);
1048 print_two_floats(*f1);
1049 print_two_floats(*f2);
1050 print_two_floats(*f3);
1051 print_bit_flags(*flags);
1052 print_bit_flags_combo(*flags_combo);
1053 print_three_chars(*three_char);
1054 print_five_chars(*five_char);
1055 print_int_char_combo(*int_char_combo);
1056 sum_struct_print(10, *struct1, *struct2, *struct3, *struct4);
1057 print_struct_rep(*struct1, *struct2, *struct3);