⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 call-ar-st.c

📁 lwip在ucos上的移植
💻 C
📖 第 1 页 / 共 3 页
字号:
     struct two_floats_t      f1,     struct two_floats_t      f2,     struct two_floats_t      f3)#elsevoid print_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{   print_bit_flags(flags);   print_bit_flags_combo(flags_combo);   print_three_chars(three_char);   print_five_chars(five_char);   print_int_char_combo(int_char_combo);   sum_struct_print(10, struct1, struct2, struct3, struct4);   print_struct_rep(struct1, struct2, struct3);   print_one_double(d1);   print_one_double(d2);   print_one_double(d3);   print_two_floats(f1);   print_two_floats(f2);   print_two_floats(f3);}/***************************************************************** * PRINT_LONG_ARG_LIST :  * This is a good function to call to test small structures. * The first two parameters ( the doubles ) go into registers. The * remaining arguments are pushed onto the stack. Depending on where * print_long_arg_list is called from, the size of the argument list  * may force more space to be pushed onto the stack as part of the callers * frame. ****************************************************************/#ifdef PROTOTYPESvoid print_long_arg_list (     double a,     double b,     int c,     int d,     int e,     int f,     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 print_long_arg_list ( a, b, c, d, e, f, struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1,d2,d3,f1, f2, f3 )     double a;     double b;     int c;     int d;     int e;     int f;     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{    printf("double : %f\n", a);    printf("double : %f\n", b);    printf("int : %d\n", c);    printf("int : %d\n", d);    printf("int : %d\n", e);    printf("int : %d\n", f);    print_small_structs( struct1, struct2, struct3, struct4, flags, flags_combo,			 three_char, five_char, int_char_combo, d1, d2, d3, 			 f1, f2, f3);}#ifdef PROTOTYPESvoid print_one_large_struct (struct array_rep_info_t linked_list1)#elsevoid print_one_large_struct( linked_list1 )     struct array_rep_info_t linked_list1;#endif{ /* printf("Contents of linked list1: \n\n");  printf("Element Value | Index of Next Element\n");  printf("-------------------------------------\n");  printf("              |                      \n");*/  /*for (index = 0; index < 10; index++) {*/      printf("%10d%10d\n", linked_list1.values[0], 			   linked_list1.next_index[0]);   /*}*/}/***************************************************************** * PRINT_ARRAY_REP :  * The three structure parameters should fit into registers.  * IN struct array_rep_info_t linked_list1 * IN struct array_rep_info_t linked_list2 * IN struct array_rep_info_t linked_list3 ****************************************************************/#ifdef PROTOTYPESvoid print_array_rep(     struct array_rep_info_t linked_list1,     struct array_rep_info_t linked_list2,     struct array_rep_info_t linked_list3)#elsevoid print_array_rep( linked_list1, linked_list2, linked_list3 )     struct array_rep_info_t linked_list1;     struct array_rep_info_t linked_list2;     struct array_rep_info_t linked_list3;#endif{  int index;  printf("Contents of linked list1: \n\n");  printf("Element Value | Index of Next Element\n");  printf("-------------------------------------\n");  printf("              |                      \n");  for (index = 0; index < 10; index++) {      printf("%10d%10d\n", linked_list1.values[index], 			   linked_list1.next_index[index]);   }  printf("Contents of linked list2: \n\n");  printf("Element Value | Index of Next Element\n");  printf("-------------------------------------\n");  printf("              |                      \n");  for (index = 0; index < 10; index++) {      printf("%10d%10d\n", linked_list2.values[index], 			   linked_list2.next_index[index]);   }  printf("Contents of linked list3: \n\n");  printf("Element Value | Index of Next Element\n");  printf("-------------------------------------\n");  printf("              |                      \n");  for (index = 0; index < 10; index++) {      printf("%10d%10d\n", linked_list3.values[index], 			   linked_list3.next_index[index]);   }}/***************************************************************** * SUM_ARRAY_PRINT :  * The last structure parameter must be pushed onto the stack  * IN int    seed * IN struct array_rep_info_t linked_list1 * IN struct array_rep_info_t linked_list2 * IN struct array_rep_info_t linked_list3 * IN struct array_rep_info_t linked_list4 ****************************************************************/#ifdef PROTOTYPESvoid sum_array_print (     int seed,     struct array_rep_info_t linked_list1,     struct array_rep_info_t linked_list2,     struct array_rep_info_t linked_list3,     struct array_rep_info_t linked_list4)#elsevoid sum_array_print ( seed, linked_list1, linked_list2, linked_list3,linked_list4)     int seed;     struct array_rep_info_t linked_list1;     struct array_rep_info_t linked_list2;     struct array_rep_info_t linked_list3;     struct array_rep_info_t linked_list4;#endif{     int index;     int sum;     printf("Sum of 4 arrays, by element (add in seed as well): \n\n");     printf("Seed: %d\n", seed);     printf("Element Index | Sum \n");     printf("-------------------------\n");     printf("              |          \n");     for (index = 0; index < 10; index++) {         sum = seed + linked_list1.values[index] + linked_list2.values[index] +	       linked_list3.values[index] + linked_list4.values[index];         printf("%10d%10d\n", index, sum);     }}/***************************************************************** * INIT_ARRAY_REP :  * IN struct array_rep_info_t *linked_list * IN int    seed ****************************************************************/#ifdef PROTOTYPESvoid init_array_rep(     struct array_rep_info_t *linked_list,     int    seed)#elsevoid init_array_rep( linked_list, seed )     struct array_rep_info_t *linked_list;     int    seed;#endif{  int index;  for (index = 0; index < 10; index++) {      linked_list->values[index] = (2*index) + (seed*2);       linked_list->next_index[index] = index + 1;  }  linked_list->head = 0; }int main ()  {  /* variables for array and enumerated type testing   */  char     char_array[121];  double   double_array[100];  float    float_array[15];  int      integer_array[50];   int      index;  id_int   student_id = 23;  colors   my_shirt = YELLOW;      /* variables for large structure testing   */  int number = 10;  struct array_rep_info_t *list1;  struct array_rep_info_t *list2;  struct array_rep_info_t *list3;  struct array_rep_info_t *list4;  /* variables for testing a very long argument list   */   double                    a;   double                    b;   int                       c;   int                       d;   int                       e;   int                       f;  /* variables for testing a small structures and a very long argument list   */   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;  /* Initialize arrays   */  for (index = 0; index < 120; index++) {      if ((index%2) == 0) char_array[index] = 'Z';	 else char_array[index] = 'a';  }  char_array[120] = '\0';  for (index = 0; index < 100; index++) {      double_array[index] = index*23.4567;  }  for (index = 0; index < 15; index++) {      float_array[index] = index/7.02;  }  for (index = 0; index < 50; index++) {      integer_array[index] = -index;  }  /* Print arrays   */  print_char_array(char_array);  print_double_array(double_array);  print_float_array(float_array);  print_student_id_shirt_color(student_id, my_shirt);   print_int_array(integer_array);  print_all_arrays(integer_array, char_array, float_array, double_array);  /* Allocate space for large structures    */  list1 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));  list2 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));  list3 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));  list4 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));  /* Initialize large structures    */  init_array_rep(list1, 2);  init_array_rep(list2, 4);  init_array_rep(list3, 5);  init_array_rep(list4, 10);  printf("HELLO WORLD\n");  printf("BYE BYE FOR NOW\n");  printf("VERY GREEN GRASS\n");  /* Print large structures    */  sum_array_print(10, *list1, *list2, *list3, *list4);  print_array_rep(*list1, *list2, *list3);  print_one_large_struct(*list1);  /* Allocate space for small structures    */  struct1     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));  struct2     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));  struct3     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));  struct4     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));  flags       = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));  flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));  three_char  = (struct three_char_t *)malloc(sizeof(struct three_char_t));  five_char   = (struct five_char_t *)malloc(sizeof(struct five_char_t));  int_char_combo = (struct int_char_combo_t *)malloc(sizeof(struct int_char_combo_t));  d1 = (struct one_double_t *)malloc(sizeof(struct one_double_t));  d2 = (struct one_double_t *)malloc(sizeof(struct one_double_t));  d3 = (struct one_double_t *)malloc(sizeof(struct one_double_t));  f1 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));  f2 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));  f3 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));  /* Initialize small structures    */  init_small_structs ( struct1, struct2, struct3, struct4, flags, 		       flags_combo, three_char, five_char, int_char_combo,		       d1, d2, d3, f1, f2, f3);  /* Print small structures    */  print_small_structs ( *struct1, *struct2, *struct3, *struct4, *flags, 			*flags_combo, *three_char, *five_char, *int_char_combo,			*d1, *d2, *d3, *f1, *f2, *f3);  /* Print a very long arg list    */  a = 22.25;  b = 33.375;  c = 0;  d = -25;  e = 100;  f = 2345;  print_long_arg_list ( a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, 			*flags, *flags_combo, *three_char, *five_char, *int_char_combo,			*d1, *d2, *d3, *f1, *f2, *f3);  /* Initialize small structures    */  init_one_double ( d1, 1.11111);   init_one_double ( d2, -345.34);   init_one_double ( d3, 546464.2);   init_two_floats ( f1, 0.234, 453.1);   init_two_floats ( f2, 78.345, 23.09);   init_two_floats ( f3, -2.345, 1.0);   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, 'x', 'y', 'z');  init_five_chars(five_char, 'h', 'e', 'l', 'l', 'o');  init_int_char_combo(int_char_combo, 13, '!');  init_struct_rep(struct1, 10);  init_struct_rep(struct2, 20);  init_struct_rep(struct3, 30);  init_struct_rep(struct4, 40);  compute_with_small_structs(35);  loop_count();  printf("HELLO WORLD\n");  printf("BYE BYE FOR NOW\n");  printf("VERY GREEN GRASS\n");  /* Print small structures    */  print_one_double(*d1);  print_one_double(*d2);  print_one_double(*d3);  print_two_floats(*f1);  print_two_floats(*f2);  print_two_floats(*f3);  print_bit_flags(*flags);  print_bit_flags_combo(*flags_combo);  print_three_chars(*three_char);  print_five_chars(*five_char);  print_int_char_combo(*int_char_combo);  sum_struct_print(10, *struct1, *struct2, *struct3, *struct4);  print_struct_rep(*struct1, *struct2, *struct3);  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -