📄 call-ar-st.c
字号:
* IN float init_val2 *****************************************************************/#ifdef PROTOTYPESvoid init_two_floats (struct two_floats_t *two_floats, float init_val1, float init_val2)#elsevoid init_two_floats ( two_floats, init_val1, init_val2 ) struct two_floats_t *two_floats; float init_val1; float init_val2;#endif{ two_floats->float1 = init_val1; two_floats->float2 = init_val2;}/***************************************************************** * INIT_TWO_CHARS : * OUT struct two_char_t *two_char -- structure to be filled * IN char init_val1 * IN char init_val2 *****************************************************************/#ifdef PROTOTYPESvoid init_two_chars (struct two_char_t *two_char, char init_val1, char init_val2)#elsevoid init_two_chars ( two_char, init_val1, init_val2 ) struct two_char_t *two_char; char init_val1; char init_val2; #endif{ two_char->ch1 = init_val1; two_char->ch2 = init_val2;}/***************************************************************** * INIT_THREE_CHARS : * OUT struct three_char_t *three_char -- structure to be filled * IN char init_val1 * IN char init_val2 * IN char init_val3 *****************************************************************/#ifdef PROTOTYPESvoid init_three_chars (struct three_char_t *three_char, char init_val1, char init_val2, char init_val3)#elsevoid init_three_chars ( three_char, init_val1, init_val2, init_val3 ) struct three_char_t *three_char; char init_val1; char init_val2; char init_val3;#endif{ three_char->ch1 = init_val1; three_char->ch2 = init_val2; three_char->ch3 = init_val3;}/***************************************************************** * INIT_FIVE_CHARS : * OUT struct five_char_t *five_char -- structure to be filled * IN char init_val1 * IN char init_val2 * IN char init_val3 * IN char init_val4 * IN char init_val5 *****************************************************************/#ifdef PROTOTYPESvoid init_five_chars (struct five_char_t *five_char, char init_val1, char init_val2, char init_val3, char init_val4, char init_val5)#elsevoid init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init_val5 ) struct five_char_t *five_char; char init_val1; char init_val2; char init_val3; char init_val4; char init_val5;#endif{ five_char->ch1 = init_val1; five_char->ch2 = init_val2; five_char->ch3 = init_val3; five_char->ch4 = init_val4; five_char->ch5 = init_val5;}/***************************************************************** * INIT_INT_CHAR_COMBO : * OUT struct int_char_combo_t *combo -- structure to be filled * IN int init_val1 * IN char init_val2 *****************************************************************/#ifdef PROTOTYPESvoid init_int_char_combo (struct int_char_combo_t *combo, int init_val1, char init_val2)#elsevoid init_int_char_combo ( combo, init_val1, init_val2 ) struct int_char_combo_t *combo; int init_val1; char init_val2; #endif{ combo->int1 = init_val1; combo->ch1 = init_val2;}/***************************************************************** * INIT_STRUCT_REP : * OUT struct small_rep_into_t *small_struct -- structure to be filled * IN int seed *****************************************************************/#ifdef PROTOTYPESvoid init_struct_rep(struct small_rep_info_t *small_struct, int seed)#elsevoid init_struct_rep( small_struct, seed ) struct small_rep_info_t *small_struct; int seed;#endif{ small_struct->value = 2 + (seed*2); small_struct->head = 0; }/***************************************************************** * INIT_SMALL_STRUCTS : * Takes all the small structures as input and calls the appropriate * initialization routine for each structure *****************************************************************/#ifdef PROTOTYPESvoid init_small_structs ( struct small_rep_info_t *struct1, struct small_rep_info_t *struct2, struct small_rep_info_t *struct3, struct small_rep_info_t *struct4, struct bit_flags_t *flags, struct bit_flags_combo_t *flags_combo, struct three_char_t *three_char, struct five_char_t *five_char, struct int_char_combo_t *int_char_combo, struct one_double_t *d1, struct one_double_t *d2, struct one_double_t *d3, struct two_floats_t *f1, struct two_floats_t *f2, struct two_floats_t *f3)#elsevoid init_small_structs (struct1, struct2, struct3,struct4,flags,flags_combo,three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) struct small_rep_info_t *struct1; struct small_rep_info_t *struct2; struct small_rep_info_t *struct3; struct small_rep_info_t *struct4; struct bit_flags_t *flags; struct bit_flags_combo_t *flags_combo; struct three_char_t *three_char; struct five_char_t *five_char; struct int_char_combo_t *int_char_combo; struct one_double_t *d1; struct one_double_t *d2; struct one_double_t *d3; struct two_floats_t *f1; struct two_floats_t *f2; struct two_floats_t *f3;#endif{ init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, (unsigned)0, (unsigned)1, (unsigned)0 ); init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y', (unsigned)1, (unsigned)0, 'n', (unsigned)1, (unsigned)0 ); init_three_chars(three_char, 'a', 'b', 'c'); init_five_chars(five_char, 'l', 'm', 'n', 'o', 'p'); init_int_char_combo(int_char_combo, 123, 'z'); init_struct_rep(struct1, 2); init_struct_rep(struct2, 4); init_struct_rep(struct3, 5); init_struct_rep(struct4, 6); init_one_double ( d1, 10.5); init_one_double ( d2, -3.375); init_one_double ( d3, 675.09375); init_two_floats ( f1, 45.234, 43.6); init_two_floats ( f2, 78.01, 122.10); init_two_floats ( f3, -1232.345, -199.21); }/***************************************************************** * PRINT_TEN_DOUBLES : * ????????????????????????????? ****************************************************************/#ifdef PROTOTYPESvoid print_ten_doubles ( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10)#elsevoid print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) double d1; double d2; double d3; double d4; double d5; double d6; double d7; double d8; double d9; double d10; #endif{ printf("Two Doubles : %f\t%f\n", d1, d2); printf("Two Doubles : %f\t%f\n", d3, d4); printf("Two Doubles : %f\t%f\n", d5, d6); printf("Two Doubles : %f\t%f\n", d7, d8); printf("Two Doubles : %f\t%f\n", d9, d10);}/***************************************************************** * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/#ifdef PROTOTYPESvoid print_bit_flags (struct bit_flags_t bit_flags)#elsevoid print_bit_flags ( bit_flags )struct bit_flags_t bit_flags;#endif{ if (bit_flags.alpha) printf("alpha\n"); if (bit_flags.beta) printf("beta\n"); if (bit_flags.gamma) printf("gamma\n"); if (bit_flags.delta) printf("delta\n"); if (bit_flags.epsilon) printf("epsilon\n"); if (bit_flags.omega) printf("omega\n");}/***************************************************************** * PRINT_BIT_FLAGS_COMBO : * IN struct bit_flags_combo_t bit_flags_combo ****************************************************************/#ifdef PROTOTYPESvoid print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo)#elsevoid print_bit_flags_combo ( bit_flags_combo ) struct bit_flags_combo_t bit_flags_combo;#endif{ if (bit_flags_combo.alpha) printf("alpha\n"); if (bit_flags_combo.beta) printf("beta\n"); if (bit_flags_combo.gamma) printf("gamma\n"); if (bit_flags_combo.delta) printf("delta\n"); if (bit_flags_combo.epsilon) printf("epsilon\n"); if (bit_flags_combo.omega) printf("omega\n"); printf("ch1: %c\tch2: %c\n", bit_flags_combo.ch1, bit_flags_combo.ch2);}/***************************************************************** * PRINT_ONE_DOUBLE : * IN struct one_double_t one_double ****************************************************************/#ifdef PROTOTYPESvoid print_one_double (struct one_double_t one_double)#elsevoid print_one_double ( one_double )struct one_double_t one_double;#endif{ printf("Contents of one_double_t: \n\n"); printf("%f\n", one_double.double1);}/***************************************************************** * PRINT_TWO_FLOATS : * IN struct two_floats_t two_floats ****************************************************************/#ifdef PROTOTYPESvoid print_two_floats (struct two_floats_t two_floats)#elsevoid print_two_floats ( two_floats )struct two_floats_t two_floats; #endif{ printf("Contents of two_floats_t: \n\n"); printf("%f\t%f\n", two_floats.float1, two_floats.float2);}/***************************************************************** * PRINT_TWO_CHARS : * IN struct two_char_t two_char ****************************************************************/#ifdef PROTOTYPESvoid print_two_chars (struct two_char_t two_char)#elsevoid print_two_chars ( two_char )struct two_char_t two_char; #endif{ printf("Contents of two_char_t: \n\n"); printf("%c\t%c\n", two_char.ch1, two_char.ch2);}/***************************************************************** * PRINT_THREE_CHARS : * IN struct three_char_t three_char ****************************************************************/#ifdef PROTOTYPESvoid print_three_chars (struct three_char_t three_char)#elsevoid print_three_chars ( three_char )struct three_char_t three_char;#endif{ printf("Contents of three_char_t: \n\n"); printf("%c\t%c\t%c\n", three_char.ch1, three_char.ch2, three_char.ch3);}/***************************************************************** * PRINT_FIVE_CHARS : * IN struct five_char_t five_char ****************************************************************/#ifdef PROTOTYPESvoid print_five_chars (struct five_char_t five_char)#elsevoid print_five_chars ( five_char ) struct five_char_t five_char; #endif{ printf("Contents of five_char_t: \n\n"); printf("%c\t%c\t%c\t%c\t%c\n", five_char.ch1, five_char.ch2, five_char.ch3, five_char.ch4, five_char.ch5);}/***************************************************************** * PRINT_INT_CHAR_COMBO : * IN struct int_char_combo_t int_char_combo ****************************************************************/#ifdef PROTOTYPESvoid print_int_char_combo (struct int_char_combo_t int_char_combo)#elsevoid print_int_char_combo ( int_char_combo )struct int_char_combo_t int_char_combo;#endif{ printf("Contents of int_char_combo_t: \n\n"); printf("%d\t%c\n", int_char_combo.int1, int_char_combo.ch1);} /***************************************************************** * PRINT_STRUCT_REP : * The last parameter must go onto the stack rather than into a register. * This is a good function to call to test small structures. * IN struct small_rep_info_t struct1 * IN struct small_rep_info_t struct2 * IN struct small_rep_info_t struct3 ****************************************************************/#ifdef PROTOTYPESvoid print_struct_rep( struct small_rep_info_t struct1, struct small_rep_info_t struct2, struct small_rep_info_t struct3)#elsevoid print_struct_rep( struct1, struct2, struct3) struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3;#endif{ printf("Contents of struct1: \n\n"); printf("%10d%10d\n", struct1.value, struct1.head); printf("Contents of struct2: \n\n"); printf("%10d%10d\n", struct2.value, struct2.head); printf("Contents of struct3: \n\n"); printf("%10d%10d\n", struct3.value, struct3.head); }/***************************************************************** * SUM_STRUCT_PRINT : * The last two parameters must go onto the stack rather than into a register. * This is a good function to call to test small structures. * IN struct small_rep_info_t struct1 * IN struct small_rep_info_t struct2 * IN struct small_rep_info_t struct3 * IN struct small_rep_info_t struct4 ****************************************************************/#ifdef PROTOTYPESvoid sum_struct_print ( int seed, struct small_rep_info_t struct1, struct small_rep_info_t struct2, struct small_rep_info_t struct3, struct small_rep_info_t struct4)#elsevoid sum_struct_print ( seed, struct1, struct2, struct3, struct4) int seed; struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3; struct small_rep_info_t struct4; #endif{ int sum; printf("Sum of the 4 struct values and seed : \n\n"); sum = seed + struct1.value + struct2.value + struct3.value + struct4.value; printf("%10d\n", sum);}/***************************************************************** * PRINT_SMALL_STRUCTS : * This is a good function to call to test small structures. * All of the small structures of odd sizes (40 bits, 8bits, etc.) * are pushed onto the stack. ****************************************************************/#ifdef PROTOTYPESvoid print_small_structs ( struct small_rep_info_t struct1, struct small_rep_info_t struct2, struct small_rep_info_t struct3, struct small_rep_info_t struct4, struct bit_flags_t flags, struct bit_flags_combo_t flags_combo, struct three_char_t three_char, struct five_char_t five_char, struct int_char_combo_t int_char_combo, struct one_double_t d1, struct one_double_t d2, struct one_double_t d3,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -