aboutsummaryrefslogblamecommitdiffstats
path: root/lib/compiler/test/compilation_SUITE_data/otp_5436.erl
blob: 4df8d5064713d29a3325b452b88dc5051244640f (plain) (tree)








































































































































































































                                                                                                                                                                                                       
%%
%% %CopyrightBegin%
%% 
%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
%% 
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%% 
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%% 
%% %CopyrightEnd%
%%
-module(otp_5436).
-compile(export_all).

?MODULE() ->
    ok.

-record(readerState, {action_index,
                      log_index,
                      log_name,
                      time_period,
                      rec_id_period,
                      result_format,
                      action_status,
                      filter_type,
                      event_list,
                      sender_list,
                      read_status}).

handle_call(delete,_From,State) ->
    case catch debug:filter(console,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,306,console,self(),sysAssert:format_time2(erlang:now())])|"delete, State: ~p ~n"],[State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["delete, State: ~p ~n",[State]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,306,console,self(),sysAssert:format_time2(erlang:now())])|"delete, State: ~p ~n"],[State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["delete, State: ~p ~n",[State]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(console,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[console,logReader]},debug:filter(console,logReader)}})
    end,
    ?MODULE:clean_result(State),
    {stop,normal,ok,State};
handle_call(die,_,State) ->
    {stop,normal,ok,State};
handle_call(_Action,_From,#readerState{action_status = 2} = State) ->
    {reply,error,State};
handle_call(update_action_attr,_From,State) ->
    NewState = ?MODULE:handle_update_action_attr(State),
    case catch debug:filter(console,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,317,console,self(),sysAssert:format_time2(erlang:now())])|"update_action_attr, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_action_attr, State: ~p ~n",[NewState]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,317,console,self(),sysAssert:format_time2(erlang:now())])|"update_action_attr, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_action_attr, State: ~p ~n",[NewState]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(console,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[console,logReader]},debug:filter(console,logReader)}})
    end,
    {reply,ok,NewState};
handle_call(update_event_filter,_From,State) ->
    NewState = State#readerState{event_list = ?MODULE:get_event_list(State#readerState.action_index)},
    case catch debug:filter(console,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,323,console,self(),sysAssert:format_time2(erlang:now())])|"update_event_filter, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_event_filter, State: ~p ~n",[NewState]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,323,console,self(),sysAssert:format_time2(erlang:now())])|"update_event_filter, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_event_filter, State: ~p ~n",[NewState]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(console,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[console,logReader]},debug:filter(console,logReader)}})
    end,
    {reply,ok,NewState};
handle_call(update_sender_filter,_From,State) ->
    NewState = State#readerState{sender_list = ?MODULE:get_sender_list(State#readerState.action_index)},
    case catch debug:filter(console,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,329,console,self(),sysAssert:format_time2(erlang:now())])|"update_sender_filter, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_sender_filter, State: ~p ~n",[NewState]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,329,console,self(),sysAssert:format_time2(erlang:now())])|"update_sender_filter, State: ~p ~n"],[NewState]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["update_sender_filter, State: ~p ~n",[NewState]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(console,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[console,logReader]},debug:filter(console,logReader)}})
    end,
    {reply,ok,NewState};
handle_call(Request,_From,State) ->
    case catch debug:filter(console,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,332,console,self(),sysAssert:format_time2(erlang:now())])|"Call ~p, State: ~p ~n"],[Request,State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["Call ~p, State: ~p ~n",[Request,State]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,332,console,self(),sysAssert:format_time2(erlang:now())])|"Call ~p, State: ~p ~n"],[Request,State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["Call ~p, State: ~p ~n",[Request,State]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(console,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[console,logReader]},debug:filter(console,logReader)}})
    end,
    {stop,{error,unknown,Request},State}.

handle_info(Request,State) ->
    case catch debug:filter(readlog,logReader) of
        true ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,345,readlog,self(),sysAssert:format_time2(erlang:now())])|"Info ~p, State: ~p ~n"],[Request,State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["Info ~p, State: ~p ~n",[Request,State]]),
                    ok
            end;
        false ->
            disabled;
        {'EXIT',{undef,_}} ->
            case io:format([io_lib:format("~nSYS_DBG {~p,~p,~p}, ~w ~s:~n-- ",[logReader,345,readlog,self(),sysAssert:format_time2(erlang:now())])|"Info ~p, State: ~p ~n"],[Request,State]) of
                ok ->
                    ok;
                _ ->
                    io:format("*** Bad format (~p, ~p) ***~n",["Info ~p, State: ~p ~n",[Request,State]]),
                    ok
            end;
        {'EXIT',_} ->
            debug:filter(readlog,logReader);
        _ ->
            exit({badmatch,{{debug,filter,[readlog,logReader]},debug:filter(readlog,logReader)}})
    end,
    {stop,{error,unknown,Request},State}.