anchor.diff:  top_cmd(next_solution, Db) ->
       {fail,fun (Cmd) -> top_cmd(Cmd, Db) end};
   top_cmd({consult,File}, Db0) ->
  -    case consult_file(File, Db0) of
  +    case erlog_consult:consult(File, Db0) of
   	{ok,Db1} -> {ok,fun (Cmd) -> top_cmd(Cmd, Db1) end};
   	{erlog_error,Error} ->
   	    {{error,Error},fun (Cmd) -> top_cmd(Cmd, Db0) end};
  
positive.code: %% get_db(Erlog) -> {ok,Database}.
  %% set_db(Erlog, Database) -> ok.
  %% halt(Erlog) -> ok.
  %% Interface functions to server.
  
  prove(Erl, Goal) ->
      send_request(Erl, {prove,Goal}),
      wait_reply().
  
  next_solution(Erl) ->
      send_request(Erl, next_solution),
      wait_reply().
  
  consult(Erl, File) ->
      send_request(Erl, {consult,File}),
      wait_reply().
  
  reconsult(Erl, File) ->
      send_request(Erl, {reconsult,File}),
      wait_reply().
  
  get_db(Erl) ->
      send_request(Erl, get_db),
      wait_reply().
  
  set_db(Erl, Db) ->
      send_request(Erl, {set_db,Db}),
      wait_reply().
  
  halt(Erl) ->
      send_request(Erl, halt),
      wait_reply().
  
  %% start()
  %% start_link()
  %% Start an Erlog server.
  
  start() ->
      spawn(fun () -> server_loop(new()) end).
  
  start_link() ->
      spawn_link(fun () -> server_loop(new()) end).
  
  server_loop(P0) ->
      receive
  	{erlog_request,From,Req} ->
  	    {Res,P1} = P0(Req),
  	    send_reply(From, Res),
  	    server_loop(P1)
      end.
  
  %% send_request(Erlog, Request)
  %% send_reply(To, Reply)
  %% wait_reply() -> Reply.
  
  send_request(Erl, Req) -> Erl ! {erlog_request,self(),Req}.
      
  send_reply(To, Rep) -> To ! {erlog_reply,Rep}.
  
  wait_reply() ->
      receive
  	{erlog_reply,Rep} -> Rep
      end.
  
  %% vars_in(Term) -> [{Name,Var}].
  %% Returns an ordered list of {VarName,Variable} pairs.
  
negative.code: vars_in_struct(Str, I, S, Vs) ->
      vars_in_struct(Str, I+1, S, vars_in(element(I, Str), Vs)).
  
  %% is_legal_term(Goal) -> true | false.
  %% Test if a goal is a legal Erlog term. Basically just check if
  %% tuples are used correctly as structures and variables.
  