18
19:- module(logicmoo_swilib,[logicmoo_goal/0,logicmoo_run_goal/0,logicmoo_toplevel/0,add_history_ideas/0,start_x_ide/0]). 20
24 25 26 27:- set_prolog_flag(double_quotes,string). 28:- set_prolog_flag(autoload_logicmoo,false). 29
30:- if( \+ current_module(prolog_stack)). 31:- use_module(library(prolog_stack)). 32 prolog_stack:stack_guard(none).
33:- endif. 34
35
36:- if(current_prolog_flag(xpce,true) ). 37
38:- if(current_prolog_flag(xpce,false)). 39:- set_prolog_flag(xpce,true). 40:- use_module(library(gui_tracer)). 41:- use_module(library(swi_ide)). 42:- use_module(library(pce)). 43:- set_prolog_flag(xpce,false). 44:- else. 45:- use_module(library(gui_tracer)). 46:- use_module(library(swi_ide)). 47:- use_module(library(pce)). 48:- endif. 49
50:- endif. 51
52:- if( (current_prolog_flag(xpce,false); current_prolog_flag(logicmoo_headless, true); ( \+ getenv('DISPLAY',_)) ; ((app_argv(List), (member('--nopce',List) ; member('--nogui',List)) )))). 53:- set_prolog_flag(logicmoo_headless,true). 54:- set_prolog_flag(xpce,false). 55:- unsetenv('DISPLAY'). 56:- endif. 57
62
63:- user:use_module(library(base32)). 90
94:- user:use_module(library(logicmoo_common)). 95
99setup_for_debug :-
100 set_prolog_flag(report_error,true),
101 set_prolog_flag(debugger_show_context,true),
102 set_prolog_flag(debug_on_error,true),
103 104 set_prolog_flag(generate_debug_info,true).
105
107
108
112
114add_history_ideas:- app_argv('--no-history'),!.
116add_history_ideas:- has_ran_once(add_history_ideas),!.
117add_history_ideas:-
118 asserta(lmcache:added_history_ideas_once),
119 120 use_module(library(prolog_history)),
121
122 add_history(start_telnet),
123 add_history(help(match_regex/2)),
124 add_history(list_undefined),
125 add_history(listing(lmconf:at_restore_goal/2)),
126 add_history(ensure_loaded(run_mud_game)),
127 add_history(statistics),
128 add_history(qsave_lm(lm_repl)),
129 add_history(make),
130 add_history(mmake),
131 add_history(login_and_run),
132 forall(lmconf:at_restore_goal(_,G),add_history(G)),
133 add_history(loadSumo),
134 add_history(loadTinyKB),
135 add_history(threads),
136 add_history(run_pending_inits),
137 add_history(use_module(library(sexpr_reader))),
138 add_history(input_to_forms("( #\\a #\\u0009 . #\\bell )",'$VAR'('O'),'$VAR'('Vs'))),
139 add_history(tstl),
140 add_history(qconsult_kb7166),
141 add_history(ensure_loaded(library(logicmoo_user))),
142 add_history(ensure_loaded(library(logicmoo_clif))),
143 add_history(ensure_loaded(library(logicmoo_sumo))),
144 add_history(ensure_loaded(library(logicmoo_webbot))),
145 add_history(ensure_loaded(library(logicmoo_repl))),
146 add_history(user:load_library_system(library(logicmoo_planner))),
147 add_history([user:init_mud_server]),
148 add_history([user:run_mud_server]),
149 add_history(consult(library(prologmud_sample_games/run_mud_server))),
150 !.
151
152:- before_boot(add_history_ideas). 153
157logicmoo_goal:- dmsg("logicmoo_goal"),logicmoo_toplevel.
158
159logicmoo_run_goal:- has_ran_once(logicmoo_run_goal),!.
160logicmoo_run_goal:-
161 162 dmsg("logicmoo_run_goal"),
163 nb_setval('$oo_stack',[]),
164 run_pending_inits.
165
166logicmoo_toplevel:- has_ran_once(logicmoo_toplevel),!.
167logicmoo_toplevel:- dmsg("logicmoo_toplevel"),
168 169 add_history_ideas,
170 dmsg(" [logicmoo_repl]."),
171 dmsg(" [user:init_mud_server]."),
172 dmsg(" [user:run_mud_server]."),!,
173 dmsg("?- make:make_no_trace."),
174 175 listing(lmconf:at_restore_goal/2),
176 logicmoo_run_goal,
177 dmsg("Press Ctrl-D to Start"),
178 prolog.
179
180
181
185start_x_ide:- !.
186start_x_ide:- current_prolog_flag(logicmoo_headless,true),!.
187start_x_ide:-
188 quietly((prolog_ide(thread_monitor),prolog_ide(debug_monitor),
189 190 guitracer,
191 use_module(library(pce_prolog_xref)),
192 noguitracer)).
193
194:- after_boot(dmsg(start_x_ide)). 195
196:- fixup_exports.