aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_constructed_per.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-07-05 11:21:21 +0200
committerLukas Larsson <[email protected]>2011-08-01 16:37:59 +0200
commit3788f9e739b8468e35a772c501f990f7d8309adb (patch)
treeacee1460bd7fcc00bba24288a62428afc3d8d65d /lib/asn1/src/asn1ct_constructed_per.erl
parent43cb29816f5b4d3b67ef83644f2ea30fa5cadac5 (diff)
downloadotp-3788f9e739b8468e35a772c501f990f7d8309adb.tar.gz
otp-3788f9e739b8468e35a772c501f990f7d8309adb.tar.bz2
otp-3788f9e739b8468e35a772c501f990f7d8309adb.zip
Add support for nif option to optimized PER asn1 compilation
Diffstat (limited to 'lib/asn1/src/asn1ct_constructed_per.erl')
-rw-r--r--lib/asn1/src/asn1ct_constructed_per.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl
index b7c481547f..a1c852b846 100644
--- a/lib/asn1/src/asn1ct_constructed_per.erl
+++ b/lib/asn1/src/asn1ct_constructed_per.erl
@@ -935,6 +935,8 @@ gen_enc_line(Erule,TopType, Cname, Type, [], Pos,DynamicEnc,Ext) ->
gen_enc_line(Erule,TopType,Cname,Type,Element, _Pos,DynamicEnc,Ext) ->
Ctgenmod = list_to_atom(lists:concat(["asn1ct_gen_",per,
asn1ct_gen:rt2ct_suffix()])),
+ Nif = lists:member(nif,get(encoding_options)) andalso
+ lists:member(optimize,get(encoding_options)),
Atype =
case Type of
#type{def=#'ObjectClassFieldType'{type=InnerType}} ->
@@ -958,7 +960,9 @@ gen_enc_line(Erule,TopType,Cname,Type,Element, _Pos,DynamicEnc,Ext) ->
{Name,RestFieldNames} when is_atom(Name) ->
emit({"?RT_PER:encode_open_type([],?RT_PER:complete(",nl}),
emit({" ",Fun,"(",{asis,Name},", ",
- Element,", ",{asis,RestFieldNames},")))"});
+ Element,", ",{asis,RestFieldNames},")",
+ [",nif" || Nif == true],
+ "))"});
Other ->
throw({asn1,{'internal error',Other}})
end
@@ -969,7 +973,9 @@ gen_enc_line(Erule,TopType,Cname,Type,Element, _Pos,DynamicEnc,Ext) ->
emit({"?RT_PER:encode_open_type([],"
"?RT_PER:complete(",nl}),
emit({" ",Fun,"(",{asis,PrimFieldName1},
- ", ",Element,", ",{asis,PFNList},")))"})
+ ", ",Element,", ",{asis,PFNList},")",
+ [",nif" || Nif == true],
+ "))"})
end;
_ ->
CurrMod = get(currmod),
@@ -1020,7 +1026,8 @@ gen_enc_line(Erule,TopType,Cname,Type,Element, _Pos,DynamicEnc,Ext) ->
end,
case Ext of
{ext,_Ep2,_} ->
- emit(["))"]);
+ emit([[",nif" || Nif == true],
+ "))"]);
_ -> true
end.
gen_dec_components_call(Erule,TopType,{Root1,ExtList,Root2},MaybeComma,DecInfObj,Ext,NumberOfOptionals) ->