From 4a80c771f6a4e04fd4e7f7990e9d9a118ab2d689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 13 Nov 2012 09:29:57 +0100 Subject: Make the specialized decodes work with the 'nif' option --- lib/asn1/src/asn1ct_gen.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index 64a3555f62..4a7843166b 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -1131,7 +1131,7 @@ gen_decode_partial_incomplete(Erule) when Erule == ber;Erule==ber_bin; " {error,{asn1,Reason}};",nl, " Result ->",nl, " {ok,Result}",nl, - " end.",nl,nl]) + " end"]) end, emit(["decode_partial_incomplete(Type,Data0,", "Pattern) ->",nl]), @@ -1141,12 +1141,17 @@ gen_decode_partial_incomplete(Erule) when Erule == ber;Erule==ber_bin; " case catch decode_partial_inc_disp(Type,", "Data) of",nl]), EmitCaseClauses(), - emit(["decode_part(Type,Data0) ->",nl]), + emit([".",nl,nl]), + emit(["decode_part(Type, Data0) " + "when is_binary(Data0) ->",nl]), emit([" case catch decode_inc_disp(Type,element(1," "?RT_BER:decode(Data0",nif_parameter(),"))) of",nl]), -% " {Data,_RestBin} = ?RT_BER:decode(Data0),",nl, -% " case catch decode_inc_disp(Type,Data) of",nl]), - EmitCaseClauses(); + EmitCaseClauses(), + emit([";",nl]), + emit(["decode_part(Type, Data0) ->",nl]), + emit([" case catch decode_inc_disp(Type, Data0) of",nl]), + EmitCaseClauses(), + emit([".",nl,nl]); _ -> ok % add later end end; -- cgit v1.2.3