1:- module(logicmoo_xpce, []). 2
3:- set_prolog_flag(generate_debug_info, true).
16:- op(200, fy, user:(@)). 17:- op(250, yfx, user:(?)). 18:- op(990, xfx, user:(:=)). 19
20:- multifile
21 user:file_search_path/2. 22
23:- dynamic
24 pcehomestore_/1. 25:- volatile
26 pcehomestore_/1. 27
28pcehome_(Home) :-
29 pcehomestore_(Home), !.
30pcehome_(Home) :-
31 ( getenv('XPCEHOME', RawHome)
32 ; current_prolog_flag(home, PlHome),
33 ( current_prolog_flag(xpce_version, Version),
34 atom_concat('/xpce-', Version, Suffix)
35 ; Suffix = '/xpce'
36 ),
37 atom_concat(PlHome, Suffix, RawHome)
38 ),
39 exists_directory(RawHome), !,
40 absolute_file_name(RawHome, Home),
41 asserta(pcehomestore_(Home)).
42
43user:file_search_path(pce, PceHome) :-
44 pcehome_(PceHome).
45user:file_search_path(library, pce('prolog/lib')).
46user:file_search_path(foreign, pce(ArchLib)) :-
47 current_prolog_flag(arch, Arch),
48 atom_concat('lib/', Arch, ArchLib).
49
52:- reload_library_index. 53
54gui_setup_ :-
55 current_prolog_flag(gui, true), !.
56gui_setup_ :-
57 ( getenv('DISPLAY', D), D \== ''
58 ; current_prolog_flag(windows, true)
59 ), !,
60 create_prolog_flag(gui, true, []),
61 menu_setup_,
62 editor_setup,
63 load_files(user:library(swi_hooks), [silent(true)]). 64
:- 66 current_prolog_flag(console_menu, true),
67 load_files(user:library(win_menu), [silent(true)]).
68menu_setup_.
69
70editor_setup :-
71 current_prolog_flag(editor, default), !,
72 set_prolog_flag(editor, pce_emacs).
73editor_setup.
74
75pce_setup_ :-
76 current_prolog_flag(xpce, true), !.
77pce_setup_ :-
78 current_prolog_flag(argv, Argv),
79 \+ memberchk('--nopce', Argv), 80 pcehome_(PceHome),
81 exists_directory(PceHome),
82 gui_setup_,
83 ( memberchk('--pce', Argv)
84 ; current_prolog_flag(executable, Executable),
85 file_base_name(Executable, Base),
86 sub_atom_icasechk(Base, _, pce)
87 ), !,
88 load_files(user:library(pce), [silent(true)]).
89pce_setup_.
90
Associate XPCE with SWI-Prolog
This file initialises XPCE, the SWI-Prolog native GUI. XPCE is initialised only if it is detected.
The source-location of this file is packages/xpce/swipl/swipl-rc. It is installed as <plbase>/<exe-base>.rc, where <exe-base> is
swipl-win
to associate with the SWI-Prolog gui application on Windows andswipl
on Unix/X11 platforms. */