anchor.diff:      HrlGenerated = pgen_hrl(Erules,Module,TypeOrVal,Options,Indent),
       asn1ct_name:start(),
       ErlFile = lists:concat([OutFile,".erl"]),
  -    Fid = fopen(ErlFile),
  -    put(gen_file_out,Fid),
  +    open_output_file(ErlFile),
       asn1ct_func:start_link(),
       gen_head(Erules,Module,HrlGenerated),
       pgen_exports(Erules,Module,TypeOrVal),
  
positive.code: 
  -export([demit/1,
  	 emit/1,
  	 get_inner/1,type/1,def_to_tag/1,prim_bif/1,
  	 list2name/1,
  	 list2rname/1,
  
negative.code:     [Sep,do_emit(A)|call_args(As, ", ")];
  call_args([], _) -> [].
  
  open_output_file(F) ->
      case file:open(F, [write,raw,delayed_write]) of
  	{ok,Fd} ->
  	    put(gen_file_out, Fd),
  	    Fd;
  	{error, Reason} ->
  	    io:format("** Can't open file ~p ~n", [F]),
  	    exit({error,Reason})
      end.
  
  close_output_file() ->
      ok = file:close(erase(gen_file_out)).
  
  pgen_hrl(Erules,Module,TypeOrVal,Options,_Indent) ->
      put(currmod,Module),
  