2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog *
|
|
|
|
* *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: init.yap *
|
|
|
|
* Last rev: *
|
|
|
|
* mods: *
|
|
|
|
* comments: initializing the full prolog system *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
% This is yap's init file
|
|
|
|
% should be consulted first step after booting
|
|
|
|
|
|
|
|
% These are pseudo declarations
|
|
|
|
% so that the user will get a redefining system predicate
|
|
|
|
fail :- fail.
|
2005-02-08 04:05:39 +00:00
|
|
|
|
2002-05-14 19:24:34 +01:00
|
|
|
false :- fail.
|
2005-02-08 04:05:39 +00:00
|
|
|
|
|
|
|
otherwise.
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
!.
|
2005-02-08 04:05:39 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
(:- G) :- '$execute'(G), !.
|
2005-02-08 04:05:39 +00:00
|
|
|
|
2010-05-25 16:15:09 +01:00
|
|
|
(?- G) :- '$execute'(G).
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
'$$!'(CP) :- '$cut_by'(CP).
|
2005-02-08 04:05:39 +00:00
|
|
|
|
2001-12-11 04:35:31 +00:00
|
|
|
[] :- true.
|
2001-12-11 16:40:51 +00:00
|
|
|
|
2003-08-27 14:37:10 +01:00
|
|
|
:- set_value('$doindex',true).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2003-11-26 18:36:35 +00:00
|
|
|
% force having indexing code for throw.
|
|
|
|
:- '$handle_throw'(_,_,_), !.
|
|
|
|
|
2005-10-19 02:47:43 +01:00
|
|
|
:- bootstrap('errors.yap').
|
|
|
|
:- bootstrap('consult.yap').
|
|
|
|
|
|
|
|
:- [ 'utils.yap',
|
2009-08-20 16:38:33 +01:00
|
|
|
'control.yap',
|
2004-06-23 18:24:20 +01:00
|
|
|
'arith.yap',
|
2010-02-28 01:11:05 +00:00
|
|
|
'directives.yap',
|
|
|
|
'flags.yap'].
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
:- compile_expressions.
|
|
|
|
|
2008-12-05 16:08:44 +00:00
|
|
|
:- [
|
2010-06-17 00:23:03 +01:00
|
|
|
% lists is often used.
|
|
|
|
'lists.yap',
|
2008-12-04 23:37:25 +00:00
|
|
|
'yio.yap',
|
2001-04-09 20:54:03 +01:00
|
|
|
'debug.yap',
|
|
|
|
'checker.yap',
|
|
|
|
'depth_bound.yap',
|
|
|
|
'grammar.yap',
|
|
|
|
'ground.yap',
|
|
|
|
'listing.yap',
|
|
|
|
'preds.yap',
|
|
|
|
% modules must be after preds, otherwise we will have trouble
|
|
|
|
% with meta-predicate expansion being invoked
|
|
|
|
'modules.yap',
|
2008-12-05 16:08:44 +00:00
|
|
|
% must follow grammar
|
|
|
|
'eval.yap',
|
2004-01-23 02:23:51 +00:00
|
|
|
'signals.yap',
|
2002-03-12 15:09:27 +00:00
|
|
|
'profile.yap',
|
2002-09-03 15:28:09 +01:00
|
|
|
'callcount.yap',
|
2001-04-09 20:54:03 +01:00
|
|
|
'load_foreign.yap',
|
2010-11-29 18:44:39 +00:00
|
|
|
'save.yap',
|
2001-04-09 20:54:03 +01:00
|
|
|
'sockets.yap',
|
|
|
|
'sort.yap',
|
|
|
|
'setof.yap',
|
2004-03-02 16:44:58 +00:00
|
|
|
'statistics.yap',
|
2001-04-09 20:54:03 +01:00
|
|
|
'strict_iso.yap',
|
|
|
|
'tabling.yap',
|
2004-01-23 02:23:51 +00:00
|
|
|
'threads.yap',
|
2006-04-06 12:18:37 +01:00
|
|
|
'eam.yap',
|
2007-12-29 12:26:41 +00:00
|
|
|
'chtypes.yap',
|
2009-02-20 11:42:48 +00:00
|
|
|
'yapor.yap',
|
|
|
|
'udi.yap'].
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2009-12-04 00:06:11 +00:00
|
|
|
:- dynamic prolog:'$user_defined_flag'/4.
|
2008-02-12 17:03:59 +00:00
|
|
|
|
2009-12-04 11:00:13 +00:00
|
|
|
:- dynamic prolog:'$parent_module'/2.
|
|
|
|
|
2008-03-31 23:56:22 +01:00
|
|
|
:- multifile prolog:debug_action_hook/1.
|
|
|
|
|
|
|
|
:- source.
|
2008-02-12 17:03:59 +00:00
|
|
|
|
2008-03-31 23:56:22 +01:00
|
|
|
:- no_source.
|
|
|
|
|
2008-03-12 17:05:04 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- ['protect.yap'].
|
|
|
|
|
2010-03-05 08:33:40 +00:00
|
|
|
version(yap,[6,0]).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2003-08-27 14:37:10 +01:00
|
|
|
system_mode(verbose,on) :- set_value('$verbose',on).
|
|
|
|
system_mode(verbose,off) :- set_value('$verbose',off).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
:- op(1150,fx,(mode)).
|
|
|
|
|
|
|
|
:- dynamic 'extensions_to_present_answer'/1.
|
|
|
|
|
2010-03-12 14:26:35 +00:00
|
|
|
:- ['arrays.yap'].
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-02-22 15:08:37 +00:00
|
|
|
:- use_module('messages.yap').
|
|
|
|
:- use_module('hacks.yap').
|
2010-03-12 14:26:35 +00:00
|
|
|
:- use_module('attributes.yap').
|
|
|
|
:- use_module('corout.yap').
|
2010-04-22 12:16:37 +01:00
|
|
|
:- use_module('dialect.yap').
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2009-03-10 18:07:50 +00:00
|
|
|
'$system_module'('$messages').
|
2008-02-22 15:08:37 +00:00
|
|
|
'$system_module'('$hacks').
|
2010-03-12 14:26:35 +00:00
|
|
|
'$system_module'('$attributes').
|
|
|
|
'$system_module'('$coroutining').
|
2008-02-22 15:08:37 +00:00
|
|
|
|
2006-12-27 01:32:38 +00:00
|
|
|
yap_hacks:cut_by(CP) :- '$$cut_by'(CP).
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- '$change_type_of_char'(36,7). % Make $ a symbol character
|
|
|
|
|
|
|
|
:- default_sequential(off).
|
|
|
|
|
2006-11-18 01:40:42 +00:00
|
|
|
:- multifile user:library_directory/1.
|
|
|
|
|
|
|
|
:- dynamic user:library_directory/1.
|
|
|
|
|
2009-02-16 12:25:03 +00:00
|
|
|
:- multifile user:commons_directory/1.
|
|
|
|
|
|
|
|
:- dynamic user:commons_directory/1.
|
|
|
|
|
2009-03-13 19:40:27 +00:00
|
|
|
:- recorda('$dialect',yap,_).
|
|
|
|
|
2002-05-24 04:57:20 +01:00
|
|
|
%
|
|
|
|
% cleanup ensure loaded and recover some data-base space.
|
|
|
|
%
|
2003-11-29 23:41:28 +00:00
|
|
|
:- ( recorded('$loaded','$loaded'(_,_,_),R), erase(R), fail ; true ).
|
2002-05-24 04:57:20 +01:00
|
|
|
|
2010-05-11 13:57:52 +01:00
|
|
|
:- dynamic autoloader:autoload/0.
|
|
|
|
|
2003-08-27 14:37:10 +01:00
|
|
|
:- set_value('$user_module',user), '$protect'.
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
:- style_check([]).
|
|
|
|
|
|
|
|
%
|
|
|
|
% moved this to init_gc in gc.c to separate the alpha
|
|
|
|
%
|
|
|
|
% :- yap_flag(gc,on).
|
|
|
|
|
|
|
|
% :- yap_flag(gc_trace,verbose).
|
|
|
|
|
2005-10-19 02:47:43 +01:00
|
|
|
:- system_mode(verbose,on).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-02-22 15:08:37 +00:00
|
|
|
:- multifile prolog:message/3.
|
|
|
|
|
|
|
|
:- dynamic prolog:message/3.
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- module(user).
|
|
|
|
|
|
|
|
:- multifile goal_expansion/3.
|
|
|
|
|
2006-08-30 02:06:30 +01:00
|
|
|
:- dynamic goal_expansion/3.
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2009-05-25 01:18:52 +01:00
|
|
|
:- multifile goal_expansion/2.
|
|
|
|
|
|
|
|
:- dynamic goal_expansion/2.
|
|
|
|
|
2001-11-15 00:01:43 +00:00
|
|
|
:- multifile term_expansion/2.
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2006-08-30 02:06:30 +01:00
|
|
|
:- dynamic term_expansion/2.
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-02-08 22:19:24 +00:00
|
|
|
:- multifile file_search_path/2.
|
|
|
|
|
2006-08-30 02:06:30 +01:00
|
|
|
:- dynamic file_search_path/2.
|
2002-02-08 22:19:24 +00:00
|
|
|
|
2008-02-22 15:08:37 +00:00
|
|
|
:- multifile generate_message_hook/3.
|
|
|
|
|
|
|
|
:- dynamic generate_message_hook/3.
|
|
|
|
|
2008-03-12 19:18:29 +00:00
|
|
|
:- multifile swi:swi_predicate_table/4.
|
|
|
|
|
2008-09-30 11:44:48 +01:00
|
|
|
:- multifile user:message_hook/3.
|
|
|
|
|
2009-11-02 12:53:51 +00:00
|
|
|
:- dynamic user:message_hook/3.
|
|
|
|
|
2008-09-30 11:44:48 +01:00
|
|
|
:- multifile user:portray_message/2.
|
|
|
|
|
2010-03-01 22:32:40 +00:00
|
|
|
:- multifile user:exception/3.
|
|
|
|
|
2010-03-01 23:02:37 +00:00
|
|
|
:- dynamic user:exception/3.
|
|
|
|
|
2002-02-08 22:19:24 +00:00
|
|
|
file_search_path(library, Dir) :-
|
2007-09-27 16:25:34 +01:00
|
|
|
library_directory(Dir).
|
2009-02-16 12:25:03 +00:00
|
|
|
file_search_path(commons, Dir) :-
|
|
|
|
commons_directory(Dir0).
|
2007-09-27 16:25:34 +01:00
|
|
|
file_search_path(swi, Home) :-
|
|
|
|
current_prolog_flag(home, Home).
|
|
|
|
file_search_path(yap, Home) :-
|
|
|
|
current_prolog_flag(home, Home).
|
2002-02-08 22:19:24 +00:00
|
|
|
file_search_path(system, Dir) :-
|
2007-09-27 16:25:34 +01:00
|
|
|
prolog_flag(host_type, Dir).
|
|
|
|
file_search_path(foreign, yap('lib/Yap')).
|
2002-02-08 22:19:24 +00:00
|
|
|
|
2009-05-05 00:08:12 +01:00
|
|
|
%:- yap_flag(unknown,error).
|
|
|
|
|