diff options
author | Anders Svensson <[email protected]> | 2011-12-01 02:46:20 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2011-12-02 16:10:28 +0100 |
commit | 0499cca4817c677a4b75a1280d7d51c10263c224 (patch) | |
tree | 19ec20640425c6a0b30fd938ab80b1689766d658 /lib/diameter | |
parent | 34c0b1642a49626efb90762f69bdf195ff9197bd (diff) | |
download | otp-0499cca4817c677a4b75a1280d7d51c10263c224.tar.gz otp-0499cca4817c677a4b75a1280d7d51c10263c224.tar.bz2 otp-0499cca4817c677a4b75a1280d7d51c10263c224.zip |
Adapt diameterc
Diffstat (limited to 'lib/diameter')
-rwxr-xr-x | lib/diameter/bin/diameterc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/diameter/bin/diameterc b/lib/diameter/bin/diameterc index c0e83ea1a4..a72ba2d75c 100755 --- a/lib/diameter/bin/diameterc +++ b/lib/diameter/bin/diameterc @@ -73,24 +73,30 @@ gen(Args) -> end. compile(#argv{file = File, options = Opts} = A) -> - try - Spec = diameter_spec_util:parse(File, Opts), - maybe_output(A, Spec, Opts, spec), %% the spec file - maybe_output(A, Spec, Opts, erl), %% the erl file - maybe_output(A, Spec, Opts, hrl), %% The hrl file - 0 + try diameter_dict_util:parse({path, File}, Opts) of + {ok, Spec} -> + maybe_output(A, Spec, Opts, spec), %% the spec file + maybe_output(A, Spec, Opts, erl), %% the erl file + maybe_output(A, Spec, Opts, hrl), %% The hrl file + 0; + {error, Reason} -> + error_msg(diameter_dict_util:format_error(Reason), []), + 1 catch error: Reason -> - error_msg({"ERROR: ~p~n ~p", [Reason, erlang:get_stacktrace()]}), + error_msg("ERROR: ~p~n ~p", [Reason, erlang:get_stacktrace()]), 2 end. maybe_output(#argv{file = File, output = Output}, Spec, Opts, Mode) -> lists:member(Mode, Output) - andalso diameter_codegen:from_spec(File, Spec, Opts, Mode). + andalso diameter_codegen:from_dict(File, Spec, Opts, Mode). error_msg({Fmt, Args}) -> - io:format(standard_error, Fmt ++ "~n", Args). + error_msg(Fmt, Args). + +error_msg(Fmt, Args) -> + io:format(standard_error, "** " ++ Fmt ++ "~n", Args). norm({_,_} = T) -> T; |