anchor.diff:                  optional -> "undefined"
               end] || #field{occurrence = Occurrence} <- MsgDef].
   
  -format_msg_decoders(Defs, Opts) ->
  -    [format_msg_decoder(MsgName, MsgDef, Opts)
  +format_msg_decoders(Defs, AnRes, Opts) ->
  +    [format_msg_decoder(MsgName, MsgDef, AnRes, Opts)
        || {{msg, MsgName}, MsgDef} <- Defs].
   
  -format_msg_decoder(MsgName, MsgDef, Opts) ->
  -    [format_msg_decoder_read_field(MsgName, MsgDef),
  -     format_msg_decoder_reverse_toplevel(MsgName, MsgDef),
  -     format_field_decoders(MsgName, MsgDef, Opts),
  -     format_field_adders(MsgName, MsgDef),
  -     format_field_skippers(MsgName, length(MsgDef))].
  -
  -%% FIXME: case for when num fields == 0??
  -format_msg_decoder_read_field(MsgName, MsgDef) when length(MsgDef) =< 250 ->
  +format_msg_decoder(MsgName, MsgDef, AnRes, Opts) ->
  +    [format_msg_decoder_read_field(MsgName, MsgDef, AnRes),
  +     format_msg_decoder_reverse_toplevel(MsgName, MsgDef, AnRes),
  +     format_field_decoders(MsgName, MsgDef, AnRes, Opts),
  +     format_field_adders(MsgName, MsgDef, AnRes),
  +     format_field_skippers(MsgName, AnRes)].
  +
  +format_msg_decoder_read_field(MsgName, MsgDef, AnRes) ->
  +    case get_field_pass(MsgName, AnRes) of
  +        pass_as_params -> format_msg_decoder_read_field_pap(MsgName, MsgDef);
  +        pass_as_record -> format_msg_decoder_read_field_par(MsgName, MsgDef)
  +    end.
  +
  +format_msg_decoder_read_field_pap(MsgName, MsgDef) ->
       FieldVars = [f(", F~w", [I]) || I <- lists:seq(1,length(MsgDef))],
  -    ReadFieldCases = format_read_field_cases(MsgName, MsgDef, FieldVars),
  +    ReadFieldCases = format_read_field_cases(MsgName, MsgDef, pass_as_params,
  +                                             FieldVars),
       MsgIndent = flength("    #~p{", [MsgName]),
       FieldSets = string:join([case Occurrence of
                                    required -> f("~p = F~w", [FName, I]);
  
positive.code:      f("    ~p(Rest2, 0, 0, NewMsg).~n~n", [mk_fn(d_read_field_def_, MsgName)]),
       format_packed_field_seq_decoder(MsgName, FieldDef, Opts)].
  
  format_vi_based_field_decoder(MsgName, FieldDef, NF, Opts) when NF =< 250 ->
      #field{type=Type, rnum=RNum, name=FName}=FieldDef,
      Merge = classify_field_merge_action(FieldDef),
      PassFieldVars = [[", ", f("F~w", [I])] || I <- lists:seq(1, NF)],
  
negative.code:                 MsgName, FieldVars])
       end,
       f("~p(<<>>, 0, 0~s) ->~n", [mk_fn(d_read_field_def_, MsgName), FieldVars]),
       f("    #~p{~s}.~n~n", [MsgName, FieldSets])].
  
  format_msg_decoder_read_field_par(MsgName, MsgDef) ->
      ReadFieldCases = format_read_field_cases(MsgName, MsgDef, pass_as_record, x),
      [f("~p(Bin) ->~n", [mk_fn(d_msg_, MsgName)]),
       indent(4, f("Msg0 = ~s(),~n", [mk_fn(msg0_, MsgName)])),
       indent(4, f("~p(Bin, 0, 0, Msg0).~n", [mk_fn(d_read_field_def_, MsgName)])),
  