2:- multifile user:message_hook/3.    3:- dynamic user:message_hook/3.    4:- dynamic pdt_startup_error_message/1.    5:- dynamic collect_pdt_startup_error_messages/0.    6collect_pdt_startup_error_messages.
    7user:message_hook(_,Level,Lines):- 
    8    collect_pdt_startup_error_messages,
    9    (Level == error; Level == warning),
   10    prolog_load_context(term_position, T),
   11    (   T = '$stream_position'(_,Line,_,_,_)
   12    ->  true
   13    ;   T = '$stream_position'(_,Line,_,_)
   14    ),
   15    prolog_load_context(source, File),
   16    with_output_to(atom(Msg0), (current_output(O), print_message_lines(O, '', Lines))),
   17    format(atom(Msg), 'Location: ~w:~w~nMessage: ~w', [File, Line, Msg0]),
   18    assertz(pdt_startup_error_message(Msg)),
   19    fail.
   20write_pdt_startup_error_messages_to_file(_File) :-
   21    retractall(collect_pdt_startup_error_messages),
   22    \+ pdt_startup_error_message(_),
   23    !.
   24write_pdt_startup_error_messages_to_file(File) :-
   25    open(File, write, Stream),
   26    forall(pdt_startup_error_message(Msg),format(Stream, '~w~n', [Msg])),
   27    close(Stream).
   28
   29:- (current_prolog_flag(xpce_threaded, _) -> set_prolog_flag(xpce_threaded, true) ; true).   30%:- (current_prolog_flag(dialect, swi) -> guitracer ; true).
   31:- (  (current_prolog_flag(dialect, swi), current_prolog_flag(windows, true))  -> win_window_pos([show(false)]) ; true).   32:- (current_prolog_flag(windows,_T) -> set_pro(tty_control,false) ; true).   33:- ['./consult_server.pl'].   34
   35assertz_user_file_search_path(Name,Path):-
   36   %prolog_load_context(directory,Dir),
   37   source_location(Dir,_),
   38   must(absolute_file_name(Path,AbsPath,[access(exist),file_type(directory),relative_to(Dir)])),
   39   assertz(user:file_search_path(Name,AbsPath)),
   40   format('~N :-~q.~n',[assertz(user:file_search_path(Name,AbsPath))]),!.
   41
   42:- assertz_user_file_search_path(pdt_contextview_pl, './org.cs3.pdt.graphicalviews_3.1.2.201603251848/pl').   43:- assertz_user_file_search_path(pdt_common_pl, './org.cs3.pdt.common_3.1.2.201603251848/pl').   44:- assertz_user_file_search_path(pdt_prolog_library, './org.cs3.prolog.library_3.1.2.201603251848/pl').   45:- assertz_user_file_search_path(pdt_builder_analyzer, './org.cs3.pdt.builder_3.1.2.201603251848/prolog-src/analyzer').   46:- assertz_user_file_search_path(lib_pdt_console_pl, './org.cs3.pdt.console_3.1.2.201603251848/pl').   47:- assertz_user_file_search_path(prolog_connector_pl, './org.cs3.pdt.connector_3.1.2.201603251848/pl').   48:- assertz_user_file_search_path(pdt_pl, './org.cs3.pdt.editor_3.1.2.201603251848/pl').   49
   50:- [prolog_connector_pl(load)].   51:- [pdt_common_pl(load)].   52:- [pdt_contextview_pl(load)].   53:- [pdt_prolog_library('_load.pl')].   54:- [pdt_pl(load)].   55:- [lib_pdt_console_pl(loader)].   56:- ['./org.cs3.pdt.analysis_3.1.2.201603251848/pl/load.pl'].   57:- if(\+ thread_property(_,alias('consult_server@35421'))).   58:- must(consult_server(35421,'/tmp/fp_1522012126371_0.8230701758113668')).   59:- endif.   60:- must(write_pdt_startup_error_messages_to_file('/tmp/fp_1522012126371_0.6983157812319148')).