anchor.diff:      lists:reverse(Acc).
   
   
  -wrap_gen_dec_line(Erule,C,TopType,Cname,Type,Pos,DIO,Ext) ->
  +wrap_gen_dec_line(Erule,C,TopType,_Cname,_Type,Pos,DIO,Ext) ->
       put(component_type,{true,C}),
  -    gen_dec_line(Erule,TopType,Cname,Type,Pos,DIO,Ext,mandatory),
  +    gen_dec_line(Erule, TopType, C#'ComponentType'{prop=mandatory},
  +		 Pos, DIO, Ext),
       erase(component_type).
  -
  -get_components_prop() ->
  -    case get(component_type) of
  -	undefined ->
  -	    mandatory;
  -	{true,#'ComponentType'{prop=Prop}} -> Prop
  -    end.
   
   			  
   value_match(Index,Value) when is_atom(Value) ->
  
positive.code: 		asn1ct_gen:get_inner(Def)
  	end,
  
      case InnerType of
  	#'Externaltypereference'{type=T} ->
  	    emit({nl,"%%  attribute number ",TextPos," with type ",
  		  T,nl});
  	IT when is_tuple(IT) ->
  	    emit({nl,"%%  attribute number ",TextPos," with type ",
  		  element(2,IT),nl});
  	_ ->
  	    emit({nl,"%% attribute number ",TextPos," with type ",
  		  InnerType,nl})
      end,
  
      IsMandatoryAndPredefinedTableC =
  	fun(noext,mandatory,{"got objfun through args","ObjFun"}) ->
  		true;
  	   (_,_,{"got objfun through args","ObjFun"}) ->
  		false;
  	   (_,_,_) ->
  		true
  	end,
      case {InnerType,IsMandatoryAndPredefinedTableC(Ext,Prop,DecInfObj)} of
  %%	{typefield,_} when Ext == noext, Prop == mandatory ->
  	{{typefield,_},true}  ->
  	    %% DecInfObj /= {"got objfun through args","ObjFun"} |
  	    %% (DecInfObj == {"got objfun through args","ObjFun"} &
  	    %% Ext == noext & Prop == mandatory)
  	    asn1ct_name:new(term),
  	    asn1ct_name:new(tmpterm),
  	    emit({"{",{curr,tmpterm},", ",{next,bytes},"} = "});
  	%%{objectfield,_,_} when Ext == noext, Prop == mandatory ->
  	{{objectfield,_,_},true} ->
  	    asn1ct_name:new(term),
  	    asn1ct_name:new(tmpterm),
  	    emit({"{",{curr,tmpterm},", ",{next,bytes},"} = "});
  	_ ->
  	    case Type of
  		#type{def=#'SEQUENCE'{
  			extaddgroup=Number1,
  			components=ExtGroupCompList1}} when is_integer(Number1)->
  		    emit({"{{_,"}),
  		    emit_extaddgroupTerms(term,ExtGroupCompList1),
  		    emit({"}"});
  		_ ->
  		    asn1ct_name:new(term),
  		    emit({"{",{curr,term}})
  	    end,
  	    emit({",",{next,bytes},"} = "})
      end,
  
      case {Ext,Prop,is_optimized(Erule)} of
  	{noext,mandatory,_} -> ok; % generate nothing
  	{noext,_,_} -> %% OPTIONAL or DEFAULT
  	    OptPos = get_optionality_pos(TextPos,OptTable),
  	    Element = io_lib:format("Opt band (1 bsl ~w)",[NumberOfOptionals - OptPos]),
  	    emit(["case ",Element," of",nl]),
  	    emit(["  _Opt",TextPos," when _Opt",TextPos," > 0 ->"]);
  	{_,_,false} -> %% extension element, not bitstring
  	    emit(["case Extensions of",nl]),
  	    emit(["  _ when size(Extensions) >= ",Pos,",element(",Pos,",Extensions) == 1 ->",nl]);
  	_ ->
  	    emit(["case Extensions of",nl]),
  	    emit(["  <<_:",Pos-1,",1:1,_/bitstring>> when bit_size(Extensions) >= ",Pos," ->",nl])
      end,
      put(component_type,{true,C}),
      {TermVar,BytesVar} = gen_dec_line(Erule,TopType,Cname,Type,Tpos,DecInfObj,Ext,Prop),
      erase(component_type),
      case {Ext,Prop} of
  	{noext,mandatory} -> true; % generate nothing
  	{noext,_} ->
  	    emit([";",nl,"0 ->"]),
  	    emit(["{"]),
  	    gen_dec_component_no_val(Ext,Prop),
  	    emit({",",{curr,bytes},"}",nl}),
  	    emit([nl,"end"]);
  	_ ->
  	    emit([";",nl,"_  ->",nl]),
  	    emit(["{"]),
  	    case Type of
  		#type{def=#'SEQUENCE'{
  			extaddgroup=Number2,
  			components=ExtGroupCompList2}} when is_integer(Number2)->
  		    emit({"{extAddGroup,"}),
  		    gen_dec_extaddGroup_no_val(Ext,ExtGroupCompList2),
  		    emit({"}"});
  		_ ->
  		    gen_dec_component_no_val(Ext,Prop)
  	    end,
  	    emit({",",{curr,bytes},"}",nl}),
  	    emit([nl,"end"])
      end,    
      asn1ct_name:new(bytes),
      case Rest of
  	[] ->
  	    {Tpos+1,AccTerm++TermVar,AccBytes++BytesVar};
  	_ ->
  	    emit({com,nl}),
  	    gen_dec_components_call1(Erule,TopType,Rest,Tpos+1,OptTable,
  				     "",DecInfObj,Ext, AccTerm++TermVar,
  				     AccBytes++BytesVar,NumberOfOptionals)
      end;
  
  gen_dec_components_call1(_,_TopType,[],Pos,_OptTable,_,_,_,AccTerm,AccBytes,_NumberOfOptionals) ->
      {Pos,AccTerm,AccBytes}.
  
  gen_dec_extaddGroup_no_val(Ext,[#'ComponentType'{prop=Prop}])->
      gen_dec_component_no_val(Ext,Prop),
  
negative.code: 	    emit("))");
  	_ -> true
      end.
  
  gen_dec_components_call(Erule, TopType, {Root,ExtList},
  			DecInfObj, Ext, NumberOfOptionals) ->
      gen_dec_components_call(Erule,TopType,{Root,ExtList,[]},
  			    DecInfObj,Ext,NumberOfOptionals);
  gen_dec_components_call(Erule,TopType,CL={Root1,ExtList,Root2},
  			DecInfObj,Ext,NumberOfOptionals) ->
      %% The type has extensionmarker
      OptTable = create_optionality_table(Root1++Root2),
      Init = {ignore,fun(_) -> {[],[]} end},
      {EmitRoot,Tpos} =
  	gen_dec_comp_calls(Root1++Root2, Erule, TopType, OptTable,
  			   DecInfObj, noext, NumberOfOptionals,
  			   1, []),
      EmitGetExt = fun(St) ->
  			 emit(["{Extensions,",{next,bytes},"} = "]),
  			 emit(["?RT_PER:getextension(Ext,",
  			       {curr,bytes},")"]),
  			 asn1ct_name:new(bytes),
  			 St
  		 end,
      {extgrouppos,ExtGroupPosLen}  = extgroup_pos_and_length(CL),
      NewExtList = wrap_extensionAdditionGroups(ExtList, ExtGroupPosLen),
      {EmitExts,_} = gen_dec_comp_calls(NewExtList, Erule, TopType, OptTable,
  				      DecInfObj, Ext, NumberOfOptionals,
  				      Tpos, []),
      Finish =
  	fun(St) ->
  		emit([{next,bytes},"= ?RT_PER:skipextensions(",{curr,bytes},",",
  		      length(ExtList)+1,",Extensions)"]),
  		asn1ct_name:new(bytes),
  		St
  	end,
      [Init] ++ EmitRoot ++ [EmitGetExt|EmitExts] ++ [Finish];
  gen_dec_components_call(Erule, TopType, CompList, DecInfObj,
  			Ext, NumberOfOptionals) ->
      %% The type has no extensionmarker
      OptTable = create_optionality_table(CompList),
      Init = {ignore,fun(_) -> {[],[]} end},
      {Cs,_} = gen_dec_comp_calls(CompList, Erule, TopType, OptTable,
  				DecInfObj, Ext, NumberOfOptionals,
  				1, []),
      [Init|Cs].
  
  gen_dec_comp_calls([C|Cs], Erule, TopType, OptTable, DecInfObj,
  		   Ext, NumberOfOptionals, Tpos, Acc) ->
      L = gen_dec_comp_call(C, Erule, TopType, Tpos, OptTable, DecInfObj,
  			  Ext, NumberOfOptionals),
      gen_dec_comp_calls(Cs, Erule, TopType, OptTable, DecInfObj,
  		       Ext, NumberOfOptionals, Tpos+1, [L|Acc]);
  gen_dec_comp_calls([], _, _, _, _, _, _, Tpos, Acc) ->
      {lists:append(lists:reverse(Acc)),Tpos}.
  
  gen_dec_comp_call(Comp, Erule, TopType, Tpos, OptTable, DecInfObj,
  		  Ext, NumberOfOptionals) ->
      #'ComponentType'{typespec=Type,prop=Prop,textual_order=TextPos} = Comp,
      Pos = case Ext of
  	      noext -> Tpos;
  	      {ext,Epos,_Enum} -> Tpos - Epos + 1
  	  end,
      InnerType = 
  	case Type#type.def of
  	    #'ObjectClassFieldType'{type=InType} ->
  