ulvis.paste.net

Paste Search Dynamic
Recent pastes
instruction
  1. void exec_operation(instruction_type_t instruction_type, void *data)
  2. {
  3.     if (instruction_type == ADD_OPERATION) {
  4.         exec_add ((addition_t*)((instruction_t*)data)->operation);
  5.         if (((instruction_t*)data)->output_type == VERBOSE)
  6.             printf("%d\n", ((addition_t*) ((instruction_t*)data)->operation)->add_op.res);
  7.     } else {
  8.         exec_div((division_t*)((instruction_t*)data)->operation);
  9.     }
  10.     if (instruction_type == DIV_OPERATION &&
  11.     ((instruction_t*)data)->output_type == VERBOSE) {
  12.         if (((division_t*)((instruction_t*)data)->operation)->div_type
  13.         == DECIMALE) {
  14.             printf("%f\n", ((decimale_op_t*)((division_t*) ((instruction_t*)data)->operation)->div_op)->res);
  15.         } else {
  16.             printf("%d\n", ((integer_op_t*)((division_t*) ((instruction_t*)data)->operation)->div_op)->res);
  17.         }
  18.  
  19.     }
  20. }
  21.  
  22. void exec_instruction(instruction_type_t instruction_type, void *data)
  23. {
  24.     if (instruction_type == PRINT_INT) {
  25.         printf("%d\n", *(int*)data);
  26.     } else if (instruction_type == PRINT_FLOAT) {
  27.         printf("%f\n", *(float*)data);
  28.     } else {
  29.         exec_operation(instruction_type, data);
  30.     }
  31.  
  32. }
Parsed in 0.010 seconds