anchor.diff:  %%  The default output dir is the current directory unless an
   %%  explicit one has been given in the options.
   
  -filenames(File, St0) ->
  +filenames(File, St) ->
  +    %% Test for explicit outdir.
  +    Odir = case keysearch(outdir, 1, St#comp.opts) of
  +	       {value,{outdir,D}} -> D;
  +	       false -> "."
  +	   end,
       Dir = filename:dirname(File),
       Base = filename:basename(File, ".lfe"),
       Lfile = filename:join(Dir, Base ++ ".lfe"),
       Bfile = Base ++ ".beam",
       Cfile = Base ++ ".core",
  -    St1 = St0#comp{lfile=Lfile},
  -    %% Test for explicit out dir.
  -    case keysearch(outdir, 1, St1#comp.opts) of
  -	{value,{outdir,D}} ->
  -	    St1#comp{bfile=filename:join(D, Bfile),
  -		     cfile=filename:join(D, Cfile)};
  -	_ ->
  -	    St1#comp{bfile=Bfile,cfile=Cfile}
  -    end.
  +    St#comp{base=Base,
  +	    lfile=Lfile,
  +	    odir=Odir,
  +	    bfile=filename:join(Odir, Bfile),
  +	    cfile=filename:join(Odir, Cfile)}.
   
   %% lfe_comp_opts(Opts, State) -> {Opts,State}.
  -%%  Check options for return type (dcore/tcore/binary), trim options
  -%%  and set options in state.
  +%%  Check options for target and return type
  +%%  (to_core0/to_core/binary), trim options and set options in state.
   
   lfe_comp_opts(Opts, St) ->
  -    foldr(fun(dcore, {Os,S}) -> {Os,S#comp{ret=dcore}};
  -	     (to_core, {Os,S}) -> {Os,S#comp{ret=to_core}};
  -	     (binary, {Os,S}) -> {Os,S#comp{ret=binary}};
  +    foldr(fun(to_core0, {Os,S}) -> {Os,S#comp{target=to_core0}};
  +	     (to_core, {Os,S}) -> {Os,S#comp{target=to_core}};
  +	     (binary, {Os,S}) -> {Os,S#comp{ret=value}};
  +	     (value, {Os,S}) -> {Os,S#comp{ret=value}};
   	     (file, {Os,S}) -> {Os,S#comp{ret=file}};
  +	     (beam, {Os,S}) -> {Os,S#comp{target=beam}};
  +	     %% Some options we don't want here.
  +	     ('P', Acc) -> Acc;
  +	     ('E', Acc) -> Acc;
  +	     %% These we pass through.
   	     (Opt, {Os,S}) -> {[Opt|Os],S}
  -	  end, {[],St#comp{ret=file}}, Opts).
  +	  end, {[],St#comp{target=beam,ret=file}}, Opts).
   
   %% do_forms(Forms, State) ->
   %%      {ok,Core,Warnings,State} | {error,Errors,Warnings,State}.
  
positive.code: 
  %% erl_comp_opts(Options) -> Options.
  %%  Strip out report options and make sure erlang compiler returns
  %%  errors and warnings.
  
  erl_comp_opts([report|Os]) -> erl_comp_opts(Os);
  erl_comp_opts([report_warnings|Os]) -> erl_comp_opts(Os);
  erl_comp_opts([report_errors|Os]) -> erl_comp_opts(Os);
  erl_comp_opts([O|Os]) -> [O|erl_comp_opts(Os)];
  erl_comp_opts([]) -> [return].			%Ensure return!
  
  %% do_ok_return(Ret, Warnings, State) -> {ok,Mod,...}.
  %% do_error_return(Errors, Warnings, State) -> {error,...} | error.
  
negative.code: 			    Warns ++ fix_erl_errors(Ews1), St)
      end.
  
  do_save_ret(Val, File, Format, St) ->
      case St#comp.ret of
  	file ->
  	    ok = file:write_file(File, Format(Val)),
  	    [];					%No return here
  	value -> [Val]				%Return value
      end.
  
  %% fix_erl_errors([{File,Errors}]) -> Errors.
  
  fix_erl_errors([{_,Es}|Fes]) -> Es ++ fix_erl_errors(Fes);
  