From 6b1fb34e5d3dacf432fe6785c3455a363543574f Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Mon, 17 Mar 2014 10:39:42 +0100 Subject: [ic] Fix latin-1 characters in generated erl file --- lib/ic/src/ic.erl | 2 +- lib/ic/src/ic_codegen.erl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ic/src/ic.erl b/lib/ic/src/ic.erl index c0742cf7bd..4f3e8d180c 100644 --- a/lib/ic/src/ic.erl +++ b/lib/ic/src/ic.erl @@ -250,7 +250,7 @@ make_erl_options(Opts) -> Optimize = Opts#options.optimize, PreProc = lists:flatten( - lists:map(fun(D) -> io_lib:format("-I\"~s\" ", [ic_util:to_list(D)]) end, + lists:map(fun(D) -> io_lib:format("-I\"~ts\" ", [ic_util:to_list(D)]) end, Includes1)++ lists:map( fun ({Name, Value}) -> diff --git a/lib/ic/src/ic_codegen.erl b/lib/ic/src/ic_codegen.erl index f611c69bea..82431b79a2 100644 --- a/lib/ic/src/ic_codegen.erl +++ b/lib/ic/src/ic_codegen.erl @@ -216,12 +216,14 @@ exp_to_string({F,N}) -> io_lib:format("~p/~p", [ic_util:to_atom(F), N]). %%-------------------------------------------------------------------- emit_stub_head(_G, ignore, _Name, _) -> ignore; emit_stub_head(G, F1, Name, erlang) -> + comment(F1, " coding: latin-1", []), mcomment(F1, stub_header(G, Name)), nl(F1), emit(F1, "-module(~p).\n", [list_to_atom(Name)]), emit(F1, "-ic_compiled(~p).\n", [compiler_vsn(?COMPILERVSN)]), emit(F1, "\n\n"), F1; emit_stub_head(G, F1, Name, erlang_template) -> + comment(F1, " coding: latin-1", []), ic_erl_template:emit_header(G, F1, Name), F1; emit_stub_head(_G, F1, _Name, erlang_template_no_gen) -> @@ -259,6 +261,7 @@ compiler_vsn(Vsn) -> %% Name is Fully scoped (undescore) name of interface or module emit_hrl_head(_G, ignore, _Name, _) -> ignore; emit_hrl_head(G, Fd, Name, erlang) -> + comment(Fd, " coding: latin-1", []), mcomment(Fd, ["Erlang header file" | hrl_header(G, Name)]), nl(Fd), -- cgit v1.2.3 From ec9b79ee48192d3ec4e74ad0985182f9e01df48c Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Tue, 18 Mar 2014 14:37:40 +0100 Subject: [ic] Fix unicode in erlang install path --- lib/ic/src/ic_pp.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ic/src/ic_pp.erl b/lib/ic/src/ic_pp.erl index 54701f7438..e54304ebaa 100644 --- a/lib/ic/src/ic_pp.erl +++ b/lib/ic/src/ic_pp.erl @@ -257,15 +257,15 @@ run_include(FileName, FileList, _Out, Defs, Err, War, IncLine, IncFile, IncDir, tokenise(File, FileName) -> {Result, _L} = token(File, 2, [], not_set, 0), - FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 ~p~n",[FileName]))), + FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 \"~ts\"~n",[FileName]))), FileInfoStart = {file_info, FI_start}, [FileInfoStart | Result]. tokenise(File, FileName, IncLine, PrevFile) -> {Result, _L} = token(File, 2, [], not_set, 0), - FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 ~p 1~n",[FileName]))), + FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 \"~ts\" 1~n",[FileName]))), FileInfoStart = {file_info, FI_start}, - FI_end = lists:reverse(lists:flatten(io_lib:format("# ~p ~p 2~n~n",[IncLine-1,PrevFile]))), + FI_end = lists:reverse(lists:flatten(io_lib:format("# ~p \"~ts\" 2~n~n",[IncLine-1,PrevFile]))), FileInfoEnd = [{file_info, FI_end}], {Result, FileInfoStart, FileInfoEnd}. % [FileInfoStart | Result] ++ FileInfoEnd. @@ -1942,7 +1942,7 @@ read_inc_file(FileName, IncDir, Mio) -> FileList = binary_to_list(Bin), {ok, AbsFile, FileList}; {error, Text} -> - {error, Text} + {error, Text} end; true -> skip -- cgit v1.2.3 From ae64b80ba7dd01b24b89836060151879502fcd96 Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Tue, 18 Mar 2014 14:54:04 +0100 Subject: [ic] Fix unicode option to io:format in java test --- lib/ic/test/java_client_erl_server_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ic/test/java_client_erl_server_SUITE.erl b/lib/ic/test/java_client_erl_server_SUITE.erl index 9e49305c3c..cbcf32515e 100644 --- a/lib/ic/test/java_client_erl_server_SUITE.erl +++ b/lib/ic/test/java_client_erl_server_SUITE.erl @@ -288,7 +288,7 @@ classpath(Dir) -> cmd(Cmd) -> PortOpts = [{line,80},eof,exit_status,stderr_to_stdout], - io:format(" ~s~n", [Cmd]), + io:format(" ~ts~n", [Cmd]), case catch open_port({spawn,Cmd}, PortOpts) of Port when is_port(Port) -> Result = cmd_loop(Port, []), -- cgit v1.2.3 From e10e918f3c08245949297e5ff1483752dd196e88 Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Thu, 20 Mar 2014 14:59:48 +0100 Subject: Remove orber/cos*/ic files from encoding test These applications contains generated code with the latin1 directivce. --- erts/test/otp_SUITE.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl index 1fb452501f..cd5cfcbab4 100644 --- a/erts/test/otp_SUITE.erl +++ b/erts/test/otp_SUITE.erl @@ -328,7 +328,9 @@ erl_file_encoding(_Config) -> Wc = filename:join([Root,"**","*.erl"]), ErlFiles = ordsets:subtract(ordsets:from_list(filelib:wildcard(Wc)), release_files(Root, "*.erl")), + {ok, MP} = re:compile(".*lib/(ic)|(orber)|(cos).*", [unicode]), Fs = [F || F <- ErlFiles, + filter_use_latin1_coding(F, MP), case epp:read_encoding(F) of none -> false; _ -> true @@ -342,6 +344,14 @@ erl_file_encoding(_Config) -> ?t:fail() end. +filter_use_latin1_coding(F, MP) -> + case re:run(F, MP) of + nomatch -> + true; + {match, _} -> + false + end. + xml_file_encoding(_Config) -> XmlFiles = xml_files(), Fs = [F || F <- XmlFiles, is_bad_encoding(F)], -- cgit v1.2.3