aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-02-17 15:42:42 +0000
committerErlang/OTP <[email protected]>2010-02-17 15:42:42 +0000
commitaf08a7bed65d6ea1f6bb3546aab44096e6910942 (patch)
treee84bd04aca6a07aa8e2914b3996d572ab333f000 /lib/asn1/src/asn1ct_gen.erl
parentf584be53357613c61987e280806483d49f04e36b (diff)
parent9d247b1f12dcec885e361d61a738463dae3237b0 (diff)
downloadotp-af08a7bed65d6ea1f6bb3546aab44096e6910942.tar.gz
otp-af08a7bed65d6ea1f6bb3546aab44096e6910942.tar.bz2
otp-af08a7bed65d6ea1f6bb3546aab44096e6910942.zip
Merge branch 'tj/asn1_macro_prefix' into ccase/r13b04_dev
* tj/asn1_macro_prefix: Add support for prefixing macro names generated by the compiler OTP-8453 tj/asn1_macro_prefix
Diffstat (limited to 'lib/asn1/src/asn1ct_gen.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index b8440094bc..b9f6c46b53 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -1357,7 +1357,8 @@ pgen_hrltypes(Erules,Module,[H|T],NumRecords) ->
%% Generates a macro for value Value defined in the ASN.1 module
gen_macro(Value) when is_record(Value,valuedef) ->
- emit({"-define('",Value#valuedef.name,"', ",
+ Prefix = get_macro_name_prefix(),
+ emit({"-define('",Prefix,Value#valuedef.name,"', ",
{asis,Value#valuedef.value},").",nl}).
%% Generate record functions **************
@@ -2064,3 +2065,11 @@ get_record_name_prefix() ->
{value,{_,Prefix}} ->
Prefix
end.
+
+get_macro_name_prefix() ->
+ case lists:keysearch(macro_name_prefix,1,get(encoding_options)) of
+ false ->
+ "";
+ {value,{_,Prefix}} ->
+ Prefix
+ end.