anchor.diff:              end
       end.
   
  -%% Returns the process to be run next.
  +%% Stores states for later exploration and returns the process to be run next.
   search(#context{active = Active, state = State}) ->
       case state:is_empty(State) of
   	%% Handle first call to search (empty state, one active process).
  
positive.code: 	State -> State
      end.
  
  %% Add a state to the `state` table.
  state_save(State) ->
      ets:insert(?NT_STATE2, {State}).
  
  %% Initialize state tables.
  state_start() ->
  
negative.code: 	    %% If that process is in the `active` set (i.e. has not blocked),
  	    %% remove it from the actives and make it next-to-run, else do
  	    %% that for another process from the actives.
  	    %% In the former case, all other possible successor states are
  	    %% stored in the next state queue to be explored on the next
  	    %% preemption bound.
  	    %% In the latter case, all other possible successor states are
  	    %% stored in the current state queue, because a non-preemptive
  	    %% context switch is happening (the last process either exited
  	    %% or blocked).
  	    case sets:is_element(LastLid, Active) of
  		true ->
  		    NewActive = sets:del_element(LastLid, Active),
  		    Fun = fun(L, Acc) ->
  				  state_save_next(state:extend(State, L)),
  				  Acc
  			  end,
  		    sets:fold(Fun, unused, NewActive),
  		    LastLid;
  		false ->
  		    [Next|NewActive] = sets:to_list(Active),
  		    [state_save(state:extend(State, L)) || L <- NewActive],
  		    Next
  	    end
      end.
  
  %%%----------------------------------------------------------------------
  