1%% -*- erlang-indent-level: 2 -*-
2%%
3%% Licensed under the Apache License, Version 2.0 (the "License");
4%% you may not use this file except in compliance with the License.
5%% You may obtain a copy of the License at
6%%
7%%     http://www.apache.org/licenses/LICENSE-2.0
8%%
9%% Unless required by applicable law or agreed to in writing, software
10%% distributed under the License is distributed on an "AS IS" BASIS,
11%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12%% See the License for the specific language governing permissions and
13%% limitations under the License.
14
15%%%-------------------------------------------------------------------
16%%% File    : dialyzer_explanation.erl
17%%% Author  : Elli Fragkaki <ellifrag@gmail.com>
18%%% Description :
19%%%-------------------------------------------------------------------
20
21-module(dialyzer_explanation).
22
23-export([expl_loop/3]).
24
25-include("dialyzer.hrl").
26
27-spec expl_loop(pid(), dialyzer_codeserver:codeserver(), dialyzer_plt:plt()) ->
28	no_return().
29
30expl_loop(Parent, CServer, Plt) ->
31  receive
32    {Parent, warning, _Warning} ->
33      send_explanation(Parent, none),
34      expl_loop(Parent, CServer, Plt);
35    {Parent, further, _Explanation} ->
36      Parent ! {self(), further, none},
37      expl_loop(Parent, CServer, Plt);
38    Other ->
39      io:format("Unknown message: ~p\n", [Other]),
40      expl_loop(Parent, CServer, Plt)
41  end.
42
43send_explanation(Parent, Expl) ->
44  Parent ! {self(), explanation, Expl},
45  ok.
46