-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiplrc
438 lines (328 loc) · 12.4 KB
/
.swiplrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
%:- use_module(library(prolog_autoload)).
%:- use_module(library(prolog_pack)).
%:- user:[library('theme/auto.pl')].
%:- multifile(user:file_search_path/2).
%:- dynamic(user:file_search_path/2).
%user:file_search_path(library,'/opt/logicmoo_workspace/packs_sys/logicmoo_utils/prolog/legacy/').
%user:file_search_path(library,'/opt/logicmoo_workspace/packs_sys/logicmoo_utils/prolog/logicmoo').
%user:file_search_path(library,'/opt/logicmoo_workspace/packs_sys/logicmoo_utils/prolog/debuggery').
/*
:- if( \+ exists_source(library(sldnfdraw))).
%:- attach_packs('/opt/logicmoo_workspace/packs_lib').
:- endif.
:- if( \+ exists_source(library(pfc))).
%:- attach_packs('/opt/logicmoo_workspace/packs_sys').
:- endif.
:- if( \+ exists_source(library(lps_syntax))).
%:- attach_packs('/opt/logicmoo_workspace/packs_web').
:- endif.
*/
/*
:- if(current_prolog_flag(debug,false)).
:- set_prolog_flag(verbose_autoload,false).
:- set_prolog_flag(verbose,silent).
:- set_prolog_flag(verbose_load,silent).
:- endif.
*/
:- '$hide'('$toplevel':restore_debug/0).
:- '$hide'('$toplevel':save_debug/0).
:- '$hide'('$toplevel':residue_vars/2).
:- '$hide'('system':deterministic/1).
:- '$hide'(toplevel_call/2).
:- '$hide'('$toplevel':'$query_loop'/0).
%[5] [$toplevel] '$execute_goal2'(user:trace, [])
%[3] [$toplevel] '$query_loop'
%[2] [$toplevel] '$runtoplevel'
:- use_module(library(prolog_pack)).
%:- if( \+ prolog_pack:current_pack(logicmoo_base)).
:- multifile(user:file_search_path/2).
:- dynamic(user:file_search_path/2).
dir_from_rc(Rel,Y):-
((getenv('LOGICMOO_WS',Dir);
prolog_load_context(directory,Dir);
'~/logicmoo_workspace'=Dir;
'/home/dmiles/logicmoo_workspace'=Dir)),
absolute_file_name(Rel,Y,[relative_to(Dir),file_type(directory),file_errors(fail)]),
exists_directory(Y),!.
add_pack_path_rc(Rel):-
dir_from_rc(Rel,Y),
(( \+ user:file_search_path(pack,Y)) ->asserta(user:file_search_path(pack,Y));true).
:- add_pack_path_rc(packs_sys).
:- add_pack_path_rc(packs_usr).
:- add_pack_path_rc(packs_web).
:- add_pack_path_rc(packs_xtra).
:- initialization(attach_packs,now).
% :- break.
/*
:- if(current_prolog_flag(debug,false)).
:- set_prolog_flag(verbose_autoload,false).
:- set_prolog_flag(verbose,silent).
:- set_prolog_flag(verbose_load,silent).
:- endif.
*/
:- if(current_prolog_flag(os_argv,[_])).
% :- pack_list_installed.
:- endif.
:- if(current_prolog_flag(windows, false)).
:- if(exists_source(library(readline))).
:- use_module(library(readline)).
:- else.
:- if(exists_source(library(editline))).
:- use_module(library(editline)).
:- endif.
:- endif.
setup_hist0:- '$toplevel':setup_history.
:- setup_hist0.
:- endif.
:- set_prolog_flag(access_level,system).
:- load_files(library(prolog_stack)).
prolog_stack:stack_guard(none).
/*
:- use_module(library(base32)).
:- set_prolog_flag(report_error,true).
:- set_prolog_flag(fileerrors,false).
:- set_prolog_flag(debug_on_error,true).
:- set_prolog_flag(debug,true).
:- set_prolog_flag(optimise,false).
:- set_prolog_flag(last_call_optimisation,false).
:- debug.
:- nodebug(_).
:- Six = 6, set_prolog_stack(global, limit(Six*10**9)),set_prolog_stack(local, limit(Six*10**9)),set_prolog_stack(trail, limit(Six*10**9)).
:- set_prolog_flag(gc,true).
:- set_prolog_flag(gc,false).
% end_of_file.
:- use_module(library(prolog_history)).
:- '$toplevel':'$clean_history'.
:- '$toplevel':setup_history.
% :- prolog_ide(debug_monitor).
:- use_module(library(check)).
*/
/* -*- Prolog -*-
SWI-Prolog personalization file
*/
% :- multifile prolog_xref:xref_source_file/3.
:- set_prolog_flag(access_level,user).
% :- set_prolog_flag(scce,pure).
% :- set_prolog_flag(scce,scce_orig).
:- set_prolog_flag(scce,setup_call_cleanup).
% :- set_prolog_flag(access_level,system).
% :- set_prolog_flag(gc,false).
nopt
:- (initialization((set_prolog_flag(optimise,false),
set_prolog_flag(last_call_optimisation,false))),
use_module(library(pce)),
use_module(library(prolog_xref)),
use_module(library(pldoc/doc_access)),
assert((doc_access:can_edit(X):-nonvar(X))),
assert((doc_access:allow_from(X):-nonvar(X)))).
ds:- doc_server(3022,[allow(ip(_,_,_,_)),can_edit(true),workers(4)]).
%:- user:use_module(library(lists)).
sys :- set_prolog_flag(access_level,system).
usys :- set_prolog_flag(access_level,user).
mw:- use_module(library(prolog_modewalk)).
mp:-sys, meta_predicate(system: write(7)), meta_predicate(system: writeq(7)), meta_predicate(system:is(7,7)),meta_predicate(system: =:=(7,7)),usys.
lm :- use_module(library(logicmoo_utils)).
lmb :- use_module(library(logicmoo_base)).
lmu :- use_module(library(logicmoo_user)).
sf:- forall(source_file(SF), call(call,load_all(SF))).
dl:- use_module(library(pldoc/doc_library)),call(call,doc_load_library).
%:- use_module(library(make)).
%:- use_module(library(check)).
:- set_prolog_flag(access_level,user).
:- dynamic(user:type_modes/3).
% :- check.
% :- include(yyy).
sm:-
current_module(M),
catch(M:'$mode'(Head, Det),_,fail),
\+ user:type_modes(M,Head,Det),
asserta(user:type_modes(M,Head,Det)),fail.
sm:-
current_module(M),catch(M:'$pldoc'(F/A, _,_,Sum),_,fail), functor(Head,F,A),
\+ user:type_modes(M,Head,_Det),\+ user:type_modes(M,_:Head,_Det2),
format('~q.~n',[parse_modes(M:Head, Sum)]),fail.
sm:-
current_module(M),catch(M:'$pldoc'(F//Am2, _,_,Sum),_,fail), A is Am2+2, functor(Head,F,A),
\+ user:type_modes(M,Head,_Det),\+ user:type_modes(M,_:Head,_Det2),
format('~q.~n',[parse_modes(M:Head, Sum)]),fail.
:- multifile(check:predicate_name/2).
check:predicate_name(A, D):- prolog_clause:predicate_name(A, D).
:- attach_packs.
:- use_module(library(logicmoo_common)).
%:- attach_packs.
%end_of_file.
gm:- current_module(M), gm(M),fail.
gm.
gm(M):-
catch(M:'$pldoc'(F/A, Loc,Text,_),_,fail),
format('~q.~n',[M:'$pldoc'(F/A, Loc,Text)]),
functor(Head,F,A),
catch(M:'$mode'(Head,Det),_,fail),
format('~q.~n',[M:'$mode'(Head, Det)]),
fail.
gm(M):- catch(M:'$mode'(Head,Det),_,fail),
functor(Head,F,A),
\+ catch(M:'$pldoc'(F/A, _Loc, _Text,_),_,fail),
format('~q.~n',[M:'$mode'(Head, Det)]),
fail.
gm(_).
%:- gxref.
% current_module(M),catch(M:'$pldoc'(F//A, Det,O,I),_,fail),format('~q.~n',[M:'$pldoc'(F//A, Det,I)])
% ,fail.
% current_module(M),catch(M:'$mode'(Head, Det),_,fail),format('~q.~n',[M:'$mode'(Head, Det)]),fail.
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a sample user-initialisation file for SWI-Prolog. If you wish to
customise prolog, make a copy of this file and edit it to your
preferences.
Installation:
Unix/MacOS: ~/.swiplrc
Windows: <appdata>/swipl.ini (see win_folder(appdata, AppData))
More hints on useful things you can put into this file are in the
SWI-Prolog reference manual. Notably look at debugger settings, editor
hooks, file_search_path/2, set_prolog_flag/2 and portray/1.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*******************************
* IDE *
*******************************/
% By default, xpce (the graphics library) runs in a seperate
% thread. This allows editing and inspecting your program while it
% is running. All components of the Prolog development environment
% are aware of this. If you use your own xpce based applications
% and if you develop using xpce, it might be wise to disable this
% feature and keep xpce in the thread `main`.
% :- set_prolog_flag(xpce_threaded, false).
/*******************************
* EDITOR *
*******************************/
% Define the editor to use. Note that more advanced manipulation
% of this is defined in the SWI-Prolog reference manual, section
% "Listing and Editor Interface"
%
% The value pce_emacs (or built_in) causes the system to use the
% built-in editor PceEmacs if the environment provides for a GUI.
% pce_emacs is the default if XPCE is available.
%
% The second entry defines an arbitrary editor and how to tell
% SWI-Prolog to open a file with it on a specified line-number.
% :- set_prolog_flag(editor, pce_emacs).
% :- set_prolog_flag(editor, pico).
%:- multifile
% prolog_edit:edit_command/2.
%
%prolog_edit:edit_command(pico, '%e +%d "%f"').
%prolog_edit:edit_command(pico, '%e "%f"').
/*******************************
* DEBUGGING *
*******************************/
% If you prefer graphical tracing, add the line below.
% :- (current_prolog_flag(gui, true) -> guitracer ; true).
% Determine how terms are printed by the debugger and toplevel. The
% values here are defaults. max_depth(10) replaces all subterms at
% a greater depth with elipses (...). See write_term/3 for further
% explanation and more options.
% :- set_prolog_flag(answer_write_options,
% [quoted(true), portray(true), max_depth(10)]).
% :- set_prolog_flag(debugger_write_options,
% [quoted(true), portray(true), max_depth(10)]).
% If you want to suppress printing toplevel query variables
% starting with an `_'
% :- set_prolog_flag(toplevel_print_anon, false).
:- set_prolog_flag(toplevel_print_anon, true).
% If you do not want the tracer to stop at at the exit port.
% :- leash(-exit).
% Uncomment the two lines below to include a backtrace of the
% stack on an uncaught exception. This makes the system rather
% noisy on exceptions, but often allows you to discover why your
% program misbehaves without using the debugger.
:- load_files(library(prolog_stack)).
prolog_stack:stack_guard(none).
/*******************************
* CONSOLE FEEDBACK *
*******************************/
% Use the flag below to disable coloured output in all cases.
% Normally, coloured output is enabled if the output is a
% terminal.
% :- set_prolog_flag(color_term, false).
% Specify colors for the above, based on the message kind See
% ansi_format/3 for specifying visual effects. The table below
% duplicates the default behavior. Notably on terminals with a
% dark background, yellow might be a better choice for warnings
% and errors.
%:- multifile user:message_property/2.
%
%user:message_property(informational, color(fg(green))).
%user:message_property(information, color(fg(green))).
user:message_property(debug, color(fg(blue),bold)).
%user:message_property(warning, color(fg(red))).
%user:message_property(error, color([fg(red),bold])).
% Specify feedback for loading files. Values are `full` (feedback
% at start and end of each file), `normal` (feedback at end of
% each file), `brief` (feedback at end of toplevel file) and
% `silent` (no feedback).
% :- set_prolog_flag(verbose_load, silent).
% :- set_prolog_flag(verbose_autoload, true).
doc_load_library :-
set_prolog_flag(verbose_load, false),
absolute_file_name(swi(library), Dir, [file_type(directory)]),
load_all(Dir).
load_all([]) :- !.
load_all([H|T]) :-
load_all(H), !,
load_all(T).
load_all(Dir0) :-
atom(Dir0),
expand_file_name(Dir0, [Dir1]),
downcase_atom(Dir1, Dir), % Deal with Windows
\+ ( blocked(Blocked),
sub_atom(Dir, _, _, 0, Blocked)
),
exists_directory(Dir), !,
atom_concat(Dir, '/*', Pattern),
expand_file_name(Pattern, Contents),
load_all(Contents).
load_all(File) :-
atom(File),
file_name_extension(_, pl, File),
downcase_atom(File, LwrCase),
\+ ( blocked(Blocked),
sub_atom(LwrCase, _, _, 0, Blocked)
), !,
use_module(File, []).
load_all(Spec) :-
compound(Spec), !,
forall(absolute_file_name(Spec, Path,
[ access(read),
file_errors(fail)
]),
load_all(Path)).
load_all(_).
%% blocked(+Path) is semidet.
%
% True if file or directory should not be loaded. Note that file
% from the directory chr are already loaded by chr.pl. Similar
% arguments apply for a few others.
%
% @bug We force lowercase to make it also work on Windows
blocked('/chr').
blocked('/clpq').
blocked('/clpr').
blocked('/pldoc').
blocked('/ciao').
blocked('/checkselect.pl').
blocked('/checklast.pl').
blocked('/clp/clp_distinct.pl'). % deprecated file
%blocked('/jpl.pl'). % should be added
blocked('/pldoc.pl').
blocked('/index.pl').
blocked('/ciao.pl'). % is an include-file. We must
% find a more general solution here
blocked('/commons.pl').
blocked('/swipl-lfr.pl').
blocked('/dcg_basics.pl'). % deprecated file
blocked('/mkindex.pl').
blocked('/metaterm.pl').
blocked('/atts.pl').
:- prolog_debug('MSG_CALL').
:- prolog_debug('MSG_TRACE').
:- prolog_debug('MSG_VMI').
% sudo apt-get install libmysqlclient-dev unixodbc-dev