aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-12-08 00:33:58 +0100
committerAnders Svensson <[email protected]>2011-12-08 00:42:18 +0100
commite2c8662b4fd5d6100ab301cd6c21f9a8d34b7f71 (patch)
tree29d2db302b554956d1113d01e2fdf24fd47ed6ff /lib/diameter/src/compiler
parentf5d9f4ca2d32fe935cc8a476577c2fa7b3b4c6ee (diff)
downloadotp-e2c8662b4fd5d6100ab301cd6c21f9a8d34b7f71.tar.gz
otp-e2c8662b4fd5d6100ab301cd6c21f9a8d34b7f71.tar.bz2
otp-e2c8662b4fd5d6100ab301cd6c21f9a8d34b7f71.zip
Minor codegen/debug fix
Writing a dictionary to file failed.
Diffstat (limited to 'lib/diameter/src/compiler')
-rw-r--r--lib/diameter/src/compiler/diameter_codegen.erl18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl
index 6763e06140..2c011376ad 100644
--- a/lib/diameter/src/compiler/diameter_codegen.erl
+++ b/lib/diameter/src/compiler/diameter_codegen.erl
@@ -98,15 +98,15 @@ file(F, Outdir, Mode) ->
get_value(Key, Plist) ->
proplists:get_value(Key, Plist, []).
-write(Path, [C|_] = Spec)
- when is_integer(C) ->
- w(Path, Spec, "~s");
-write(Path, Spec) ->
- w(Path, Spec, "~p.").
+write(Path, Str) ->
+ w(Path, Str, "~s").
-w(Path, Spec, Fmt) ->
+write_term(Path, T) ->
+ w(Path, T, "~p.").
+
+w(Path, T, Fmt) ->
{ok, Fd} = file:open(Path, [write]),
- io:fwrite(Fd, Fmt ++ "~n", [Spec]),
+ io:fwrite(Fd, Fmt ++ "~n", [T]),
file:close(Fd).
codegen(File, Spec, Outdir, Mode) ->
@@ -121,7 +121,7 @@ mod(_, {ok, Mod}) ->
Mod.
gen(spec, Spec, _Mod, Path) ->
- write(Path ++ ".spec", [?VERSION | Spec]);
+ write_term(Path ++ ".spec", [?VERSION | Spec]);
gen(hrl, Spec, Mod, Path) ->
gen_hrl(Path ++ ".hrl", Mod, Spec);
@@ -173,7 +173,7 @@ gen(erl, Spec, Mod, Path) ->
gen_erl(Path, insert_hrl_forms(Spec, Forms)).
gen_erl(Path, Forms) ->
- getr(debug) andalso write(Path ++ ".forms", Forms),
+ getr(debug) andalso write_term(Path ++ ".forms", Forms),
write(Path ++ ".erl",
header() ++ erl_prettypr:format(erl_syntax:form_list(Forms))).