Esempio n. 1
0
static void insert_counter_at_goal(slice_index si, stip_structure_traversal *st)
{
  insertion_struct * const insertion = st->param;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  stip_traverse_structure_children(si,st);

  if (st->context==stip_traversal_context_help && !insertion->inserted)
  {
    slice_index const prototype = alloc_maxsolutions_counter_slice(insertion->incomplete);
    help_branch_insert_slices_behind_proxy(SLICE_NEXT2(si),&prototype,1,si);
    insertion->inserted = true;
  }

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Esempio n. 2
0
static void spin_off_measuring_branch(slice_index si, stip_structure_traversal *st)
{
  instrumentation_state_type const * const state = st->param;

  stip_deep_copies_type copies;
  stip_structure_traversal st_nested;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  if (SLICE_NEXT2(si)==no_slice)
  {
    SLICE_NEXT2(si) = alloc_proxy_slice();

    init_deep_copy(&st_nested,st,&copies);
    stip_structure_traversal_override_single(&st_nested,
                                             STMummerDeadend,
                                             &stop_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STRestartGuard,
                                             &skip_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STDeadEndGoal,
                                             &skip_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STGoalReachableGuardFilterMate,
                                             &skip_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STGoalReachableGuardFilterStalemate,
                                             &skip_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STGoalReachableGuardFilterProof,
                                             &skip_copying);
    stip_structure_traversal_override_single(&st_nested,
                                             STGoalReachableGuardFilterProofFairy,
                                             &skip_copying);
    stip_structure_traversal_override_by_function(&st_nested,
                                                  slice_function_move_removing_optimiser,
                                                  &skip_copying);
    if (mummer_strictness[state->current_side]!=mummer_strictness_regular)
    {
      stip_structure_traversal_override_single(&st_nested,
                                               STEndOfBranchGoal,
                                               &skip_copying);
      stip_structure_traversal_override_single(&st_nested,
                                               STSelfCheckGuard,
                                               &skip_copying);
    }
    else
    {
      regular_deep_copy_end_of_branch_goal = st_nested.map.visitors[STEndOfBranchGoal];
      stip_structure_traversal_override_single(&st_nested,
                                               STEndOfBranchGoal,
                                               &copy_end_of_branch_goal_if_necessary);
      stip_structure_traversal_override_single(&st_nested,
                                               STEndOfBranchGoalImmobile,
                                               &copy_end_of_branch_goal_if_necessary);
    }

    stip_traverse_structure(SLICE_NEXT1(si),&st_nested);

    link_to_branch(SLICE_NEXT2(si),copies[SLICE_NEXT1(si)]);

    {
      slice_index const prototype = alloc_pipe(STMummerBookkeeper);
      switch (st->context)
      {
        case stip_traversal_context_attack:
          attack_branch_insert_slices_behind_proxy(SLICE_NEXT2(si),&prototype,1,si);
          break;

        case stip_traversal_context_defense:
          defense_branch_insert_slices_behind_proxy(SLICE_NEXT2(si),&prototype,1,si);
          break;

        case stip_traversal_context_help:
          help_branch_insert_slices_behind_proxy(SLICE_NEXT2(si),&prototype,1,si);
          break;

        default:
          assert(0);
          break;
      }
    }

    if (mummer_strictness[state->current_side]!=mummer_strictness_regular)
    {
      slice_index const prototype = alloc_pipe(STUltraMummerMeasurerDeadend);
      slice_insertion_insert_contextually(copies[SLICE_NEXT1(si)],st->context,&prototype,1);
    }
  }

  stip_traverse_structure_children(si,st);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}