diff options
author | Kenneth Lundin <[email protected]> | 2012-04-25 16:46:21 +0200 |
---|---|---|
committer | Kenneth Lundin <[email protected]> | 2012-05-04 15:15:29 +0200 |
commit | be01ab6d2cad9d5b139b36c79b1c7addd57d5265 (patch) | |
tree | 90d172a680fb8c93b71f6a2e9831a6796792afdf /lib/asn1/src/asn1ct_gen_per.erl | |
parent | b0534e7f668f12b0d48e139c5ddbfcd85eaff4ce (diff) | |
download | otp-be01ab6d2cad9d5b139b36c79b1c7addd57d5265.tar.gz otp-be01ab6d2cad9d5b139b36c79b1c7addd57d5265.tar.bz2 otp-be01ab6d2cad9d5b139b36c79b1c7addd57d5265.zip |
Add support for multiple ExtensionAdditionGroups
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_gen_per.erl | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl index 59b4b3d261..5f42eacbdc 100644 --- a/lib/asn1/src/asn1ct_gen_per.erl +++ b/lib/asn1/src/asn1ct_gen_per.erl @@ -1405,19 +1405,21 @@ get_object_field(Name,ObjectFields) -> %% have been specified within a SEQUENCE, therefore we construct a fake sequence type here %% so that we can generate code for it extaddgroup2sequence(ExtList) -> - extaddgroup2sequence(ExtList,[]). + extaddgroup2sequence(ExtList,0,[]). -extaddgroup2sequence([{'ExtensionAdditionGroup',Number0}|T],Acc) -> +extaddgroup2sequence([{'ExtensionAdditionGroup',Number0}|T],ExtNum,Acc) -> Number = case Number0 of undefined -> 1; _ -> Number0 end, {ExtGroupComps,['ExtensionAdditionGroupEnd'|T2]} = lists:splitwith(fun(Elem) -> is_record(Elem,'ComponentType') end,T), - extaddgroup2sequence(T2,[#'ComponentType'{ - name='ExtAddGroup', - typespec=#type{def=#'SEQUENCE'{ - extaddgroup=Number, - components=ExtGroupComps}}, - prop='OPTIONAL'}|Acc]); -extaddgroup2sequence([C|T],Acc) -> - extaddgroup2sequence(T,[C|Acc]); -extaddgroup2sequence([],Acc) -> + extaddgroup2sequence(T2,ExtNum+1, + [#'ComponentType'{ + name=list_to_atom("ExtAddGroup"++ + integer_to_list(ExtNum+1)), + typespec=#type{def=#'SEQUENCE'{ + extaddgroup=Number, + components=ExtGroupComps}}, + prop='OPTIONAL'}|Acc]); +extaddgroup2sequence([C|T],ExtNum,Acc) -> + extaddgroup2sequence(T,ExtNum,[C|Acc]); +extaddgroup2sequence([],_,Acc) -> lists:reverse(Acc). |