Merge pull request #171 from ariel-anieli/pr-stacktrace
Removed unicode_str & fun_stacktrace
This commit is contained in:
commit
cb3983741e
5 changed files with 5 additions and 50 deletions
|
@ -8,11 +8,7 @@
|
||||||
{erl_first_files, ["ec_dictionary", "ec_vsn"]}.
|
{erl_first_files, ["ec_dictionary", "ec_vsn"]}.
|
||||||
|
|
||||||
%% Compiler Options ============================================================
|
%% Compiler Options ============================================================
|
||||||
{erl_opts,
|
{erl_opts, [debug_info, warnings_as_errors]}.
|
||||||
[{platform_define, "^2", unicode_str},
|
|
||||||
{platform_define, "^(R|1|20)", fun_stacktrace},
|
|
||||||
debug_info,
|
|
||||||
warnings_as_errors]}.
|
|
||||||
|
|
||||||
%% EUnit =======================================================================
|
%% EUnit =======================================================================
|
||||||
{eunit_opts, [verbose,
|
{eunit_opts, [verbose,
|
||||||
|
|
|
@ -101,7 +101,7 @@ parse(Date, Now) ->
|
||||||
do_parse(Date, Now, []).
|
do_parse(Date, Now, []).
|
||||||
|
|
||||||
do_parse(Date, Now, Opts) ->
|
do_parse(Date, Now, Opts) ->
|
||||||
case filter_hints(parse(tokenise(uppercase(Date), []), Now, Opts)) of
|
case filter_hints(parse(tokenise(string:uppercase(Date), []), Now, Opts)) of
|
||||||
{error, bad_date} ->
|
{error, bad_date} ->
|
||||||
erlang:throw({?MODULE, {bad_date, Date}});
|
erlang:throw({?MODULE, {bad_date, Date}});
|
||||||
{D1, T1} = {{Y, M, D}, {H, M1, S}}
|
{D1, T1} = {{Y, M, D}, {H, M1, S}}
|
||||||
|
@ -709,12 +709,6 @@ pad6(X) when is_integer(X) ->
|
||||||
ltoi(X) ->
|
ltoi(X) ->
|
||||||
list_to_integer(X).
|
list_to_integer(X).
|
||||||
|
|
||||||
-ifdef(unicode_str).
|
|
||||||
uppercase(Str) -> string:uppercase(Str).
|
|
||||||
-else.
|
|
||||||
uppercase(Str) -> string:to_upper(Str).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Tests
|
%%% Tests
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
|
|
|
@ -94,22 +94,11 @@ parse_tags(Pattern) ->
|
||||||
"fatal: " ++ _ ->
|
"fatal: " ++ _ ->
|
||||||
{undefined, ""};
|
{undefined, ""};
|
||||||
_ ->
|
_ ->
|
||||||
Vsn = slice(Tag, len(Pattern)),
|
Vsn = string:slice(Tag, string:length(Pattern)),
|
||||||
Vsn1 = trim(trim(Vsn, left, "v"), right, "\n"),
|
Vsn1 = string:trim(string:trim(Vsn, leading, "v"), trailing, "\n"),
|
||||||
{Tag, Vsn1}
|
{Tag, Vsn1}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-ifdef(unicode_str).
|
|
||||||
len(Str) -> string:length(Str).
|
|
||||||
trim(Str, right, Chars) -> string:trim(Str, trailing, Chars);
|
|
||||||
trim(Str, left, Chars) -> string:trim(Str, leading, Chars).
|
|
||||||
slice(Str, Len) -> string:slice(Str, Len).
|
|
||||||
-else.
|
|
||||||
len(Str) -> string:len(Str).
|
|
||||||
trim(Str, Dir, [Chars|_]) -> string:strip(Str, Dir, Chars).
|
|
||||||
slice(Str, Len) -> string:substr(Str, Len + 1).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
-ifdef(TEST).
|
-ifdef(TEST).
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
|
|
@ -858,21 +858,6 @@ cluster_runmany(_, _, [_Non|_Empty], []=_Nodes, []=_Running, _) ->
|
||||||
%% We have data, but no nodes either available or occupied
|
%% We have data, but no nodes either available or occupied
|
||||||
erlang:exit(allnodescrashed).
|
erlang:exit(allnodescrashed).
|
||||||
|
|
||||||
-ifdef(fun_stacktrace).
|
|
||||||
runmany_wrap(Fun, Parent) ->
|
|
||||||
try
|
|
||||||
Fun()
|
|
||||||
catch
|
|
||||||
exit:siblingdied ->
|
|
||||||
ok;
|
|
||||||
exit:Reason ->
|
|
||||||
Parent ! {erlang:self(), error, Reason};
|
|
||||||
error:R ->
|
|
||||||
Parent ! {erlang:self(), error, {R, erlang:get_stacktrace()}};
|
|
||||||
throw:R ->
|
|
||||||
Parent ! {erlang:self(), error, {{nocatch, R}, erlang:get_stacktrace()}}
|
|
||||||
end.
|
|
||||||
-else.
|
|
||||||
runmany_wrap(Fun, Parent) ->
|
runmany_wrap(Fun, Parent) ->
|
||||||
try
|
try
|
||||||
Fun()
|
Fun()
|
||||||
|
@ -886,7 +871,6 @@ runmany_wrap(Fun, Parent) ->
|
||||||
throw:R:Stacktrace ->
|
throw:R:Stacktrace ->
|
||||||
Parent ! {erlang:self(), error, {{nocatch, R}, Stacktrace}}
|
Parent ! {erlang:self(), error, {{nocatch, R}, Stacktrace}}
|
||||||
end.
|
end.
|
||||||
-endif.
|
|
||||||
|
|
||||||
delete_running(Pid, [{Pid, Node, List}|Running], Acc) ->
|
delete_running(Pid, [{Pid, Node, List}|Running], Acc) ->
|
||||||
{Running ++ Acc, Node, List};
|
{Running ++ Acc, Node, List};
|
||||||
|
|
|
@ -127,7 +127,7 @@ ask_convert(Prompt, TransFun, Type, Default) ->
|
||||||
Default ->
|
Default ->
|
||||||
[" (", io_lib:format("~p", [Default]) , ")"]
|
[" (", io_lib:format("~p", [Default]) , ")"]
|
||||||
end, "> "])),
|
end, "> "])),
|
||||||
Data = trim(trim(io:get_line(NewPrompt)), both, [$\n]),
|
Data = string:trim(string:trim(io:get_line(NewPrompt)), both, [$\n]),
|
||||||
Ret = TransFun(Data),
|
Ret = TransFun(Data),
|
||||||
case Ret of
|
case Ret of
|
||||||
no_data ->
|
no_data ->
|
||||||
|
@ -197,14 +197,6 @@ get_string(String) ->
|
||||||
no_clue
|
no_clue
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-ifdef(unicode_str).
|
|
||||||
trim(Str) -> string:trim(Str).
|
|
||||||
trim(Str, both, Chars) -> string:trim(Str, both, Chars).
|
|
||||||
-else.
|
|
||||||
trim(Str) -> string:strip(Str).
|
|
||||||
trim(Str, Dir, [Chars|_]) -> string:strip(Str, Dir, Chars).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
%%%====================================================================
|
%%%====================================================================
|
||||||
%%% tests
|
%%% tests
|
||||||
%%%====================================================================
|
%%%====================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue