anchor.diff:      ImportedGrpRecs = [{M, a_record(Prefix, fun grp_proj/1, Gs)}
                          || {M,Gs} <- get_value(import_groups, Spec)],
   
  -    {Prefix, MsgRecs, GrpRecs, ImportedGrpRecs}.
  +    {to_upper(Prefix), MsgRecs, GrpRecs, ImportedGrpRecs}.
   
   msg_proj({Name, _, _, _, Avps}) ->
       {Name, Avps}.
  
positive.code: get_value(Key, Plist) ->
      proplists:get_value(Key, Plist, []).
  
  write(Path, Str) ->
      w(Path, Str, "~s").
  
  write_term(Path, T) ->
      w(Path, T, "~p.").
  
  w(Path, T, Fmt) ->
      {ok, Fd} = file:open(Path, [write]),
      io:fwrite(Fd, Fmt ++ "~n", [T]),
      file:close(Fd).
  
  codegen(File, Spec, Outdir, Mode) ->
      Mod = mod(File, orddict:find(name, Spec)),
      Path = filename:join(Outdir, Mod),  %% minus extension
  
negative.code:      [{?clause, [], [], [?TERM([?VERSION | Spec])]}]}.
  
  %%% ------------------------------------------------------------------------
  %%% # gen_hrl/2
  %%% ------------------------------------------------------------------------
  
  gen_hrl(Mod, Spec) ->
      {Prefix, MsgRecs, GrpRecs, ImportedGrpRecs}
          = make_record_forms(Spec),
  
      [hrl_header(Mod),
       forms("Message records",     MsgRecs),
       forms("Grouped AVP records", GrpRecs),
       lists:map(fun({M,Fs}) ->
                         forms("Grouped AVP records from " ++ atom_to_list(M),
                               Fs)
                 end,
                 ImportedGrpRecs),
       format("ENUM Macros", m_enums(Prefix, false, get_value(enum, Spec))),
       format("DEFINE Macros", m_enums(Prefix, false, get_value(define, Spec))),
       lists:map(fun({M,Es}) ->
                         format("ENUM Macros from " ++ atom_to_list(M),
                                m_enums(Prefix, true, Es))
                 end,
                 get_value(import_enums, Spec))].
  
  forms(_, [] = No) ->
      No;
  forms(Banner, Forms) ->
      format(Banner, prettypr(Forms)).
  
  format(_, [] = No) ->
      No;
  format(Banner, Str) ->
      [banner(Banner), Str, $\n].
  
  prettypr(Forms) ->
      erl_prettypr:format(erl_syntax:form_list(Forms)).
  
  banner(Heading) ->
      ["\n\n"
       "%%% -------------------------------------------------------\n"
       "%%% ", Heading, ":\n"
       "%%% -------------------------------------------------------\n\n"].
  
  z(S) ->
      string:join(string:tokens(S, "\s\t"), "\s").
  