aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/src/asn1ct_gen.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index fefb92bb34..b9f6c46b53 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -1,26 +1,26 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%
-module(asn1ct_gen).
-include("asn1_records.hrl").
-%%-compile(export_all).
+
-export([pgen_exports/3,
pgen_hrl/4,
gen_head/3,
@@ -1301,8 +1301,8 @@ put_chars(undefined,X) ->
put_chars(Y,X) ->
io:put_chars(Y,X).
-fopen(F, Mode) ->
- case file:open(F, Mode) of
+fopen(F, ModeList) ->
+ case file:open(F, ModeList) of
{ok, Fd} ->
Fd;
{error, Reason} ->
@@ -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.