aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Lundin <[email protected]>2010-09-24 10:15:39 +0200
committerKenneth Lundin <[email protected]>2010-09-24 10:15:39 +0200
commit8afb42e86d7e4e5d5afcfe2545a7785697747493 (patch)
treee73218dab7b0ba3757af8853d94cd92b891790d8
parent556a098cd76aa850fb2e2ec1d75cabd6e8a84a98 (diff)
downloadotp-8afb42e86d7e4e5d5afcfe2545a7785697747493.tar.gz
otp-8afb42e86d7e4e5d5afcfe2545a7785697747493.tar.bz2
otp-8afb42e86d7e4e5d5afcfe2545a7785697747493.zip
correct the encoding of ExtensionAdditionGroup
-rw-r--r--lib/asn1/src/asn1ct_constructed_per.erl30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl
index c4e1ce47d9..5184986e65 100644
--- a/lib/asn1/src/asn1ct_constructed_per.erl
+++ b/lib/asn1/src/asn1ct_constructed_per.erl
@@ -66,9 +66,9 @@ gen_encode_constructed(Erule,Typename,D) when is_record(D,type) ->
end,
case Typename of
['EXTERNAL'] ->
- emit({{var,asn1ct_name:next(val)},
+ emit({{next,val},
" = asn1rt_check:transform_to_EXTERNAL1990(",
- {var,asn1ct_name:curr(val)},"),",nl}),
+ {curr,val},"),",nl}),
asn1ct_name:new(val);
_ ->
ok
@@ -95,21 +95,22 @@ gen_encode_constructed(Erule,Typename,D) when is_record(D,type) ->
case extgroup_pos_and_length(CompList) of
{extgrouppos,ExtGroupPos,ExtGroupLen} ->
Elements = make_elements(ExtGroupPos+1,
- "Val",lists:seq(1,ExtGroupLen)),
+ "Val1",lists:seq(1,ExtGroupLen)),
emit([
- {next,val}," = case [X || X <- [",
- {asis,Elements},
+ {next,val}," = case [X || X <- [",Elements,
"],X =/= asn1_NOVALUE] of",nl,
"[] -> ",{curr,val},";",nl,
- "_ -> setelement(",{asis,ExtGroupPos+1},{curr,val},
- "{extaddgroup,", {asis,Elements},"})",nl,
- "end,",nl]);
+ "_ -> setelement(",{asis,ExtGroupPos+1},",",
+ {curr,val},",",
+ "{extaddgroup,", Elements,"})",nl,
+ "end,",nl]),
+ asn1ct_name:new(val);
_ -> % no extensionAdditionGroup
ok
end,
asn1ct_name:new(tmpval),
- emit(["Extensions = ?RT_PER:fixextensions(",{asis,Ext},
- {curr,val},",),",nl]);
+ emit(["Extensions = ?RT_PER:fixextensions(",{asis,Ext},",",
+ {curr,val},"),",nl]);
_ -> true
end,
EncObj =
@@ -319,7 +320,7 @@ gen_decode_constructed(Erules,Typename,D) when is_record(D,type) ->
mkvlist(textual_order(to_encoding_order(CompList),asn1ct_name:all(term))),
emit("},")
end,
- emit({{var,asn1ct_name:curr(bytes)},"}"}),
+ emit({{curr,bytes},"}"}),
emit({".",nl,nl}).
textual_order([#'ComponentType'{textual_order=undefined}|_],TermList) ->
@@ -780,7 +781,7 @@ gen_enc_components_call1(_Erule,_TopType,[],Pos,_,_,_) ->
Pos.
gen_enc_component_default(Erule,TopType,Cname,Type,Pos,DynamicEnc,Ext,DefaultVal) ->
- Element = make_element(Pos+1,"Val1",Cname),
+ Element = make_element(Pos+1,asn1ct_gen:mk_var(asn1ct_name:curr(val)),Cname),
emit({"case ",Element," of",nl}),
% emit({"asn1_DEFAULT -> [];",nl}),
emit({"DFLT when DFLT == asn1_DEFAULT; DFLT == ",{asis,DefaultVal}," -> [];",nl}),
@@ -800,13 +801,12 @@ gen_enc_component_optional(Erule,TopType,Cname,
components=_ExtGroupCompList}},
Pos,DynamicEnc,Ext) when is_integer(Number) ->
- Element = make_element(Pos+1,"Val2",Cname),
+ Element = make_element(Pos+1,asn1ct_gen:mk_var(asn1ct_name:curr(val)),Cname),
emit({"case ",Element," of",nl}),
emit({"asn1_NOVALUE -> [];",nl}),
asn1ct_name:new(tmpval),
emit({{curr,tmpval}," ->",nl}),
- asn1ct_name:new(tmpval),
InnerType = asn1ct_gen:get_inner(Type#type.def),
emit({nl,"%% attribute number ",Pos," with type ",
InnerType,nl}),
@@ -814,7 +814,7 @@ gen_enc_component_optional(Erule,TopType,Cname,
gen_enc_line(Erule,TopType,Cname,Type,NextElement, Pos,DynamicEnc,Ext),
emit({nl,"end"});
gen_enc_component_optional(Erule,TopType,Cname,Type,Pos,DynamicEnc,Ext) ->
- Element = make_element(Pos+1,"Val1",Cname),
+ Element = make_element(Pos+1,asn1ct_gen:mk_var(asn1ct_name:curr(val)),Cname),
emit({"case ",Element," of",nl}),
emit({"asn1_NOVALUE -> [];",nl}),