aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen_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_gen_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_gen_per.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen_per.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl
index 8313cf1b60..becd536967 100644
--- a/lib/asn1/src/asn1ct_gen_per.erl
+++ b/lib/asn1/src/asn1ct_gen_per.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -232,13 +232,18 @@ gen_encode_prim(Erules,D,DoTag,Value) when is_record(D,type) ->
emit(["?RT_PER:encode_open_type(", {asis,Constraint}, ",",
Value, ")"]);
'ASN1_OPEN_TYPE' ->
+ Nif = lists:member(nif,get(encoding_options)) andalso
+ lists:member(optimize,get(encoding_options)),
NewValue = case Constraint of
[#'Externaltypereference'{type=Tname}] ->
io_lib:format(
- "?RT_PER:complete(enc_~s(~s))",[Tname,Value]);
+ "?RT_PER:complete(enc_~s(~s)"++
+ [",nif" || Nif == true]++")",[Tname,Value]);
[#type{def=#'Externaltypereference'{type=Tname}}] ->
io_lib:format(
- "?RT_PER:complete(enc_~s(~s))",[Tname,Value]);
+ "?RT_PER:complete(enc_~s(~s)"++
+ [",nif" || Nif == true]++")",
+ [Tname,Value]);
_ -> Value
end,
emit(["?RT_PER:encode_open_type(", {asis,Constraint}, ",",