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
|
|
|
|
otherwise.
|
|
|
|
fail :- fail.
|
2002-05-14 19:24:34 +01:00
|
|
|
false :- fail.
|
2001-04-09 20:54:03 +01:00
|
|
|
!.
|
|
|
|
(:- G) :- '$execute'(G), !.
|
|
|
|
'$$!'(CP) :- '$cut_by'(CP).
|
2001-12-11 04:35:31 +00:00
|
|
|
[] :- true.
|
2003-02-12 13:20:52 +00:00
|
|
|
','(A,B) :- '$current_module'(Module), '$meta_call'((A,B),Module).
|
|
|
|
';'(A,B) :- '$current_module'(Module), '$meta_call'((A;B),Module).
|
|
|
|
'|'(A,B) :- '$current_module'(Module), '$meta_call'((A;B),Module).
|
|
|
|
'->'(A,B) :- '$current_module'(Module), '$meta_call'((A->B),Module).
|
|
|
|
\+(G) :- '$current_module'(Module), '$meta_call'(\+(G),Module).
|
|
|
|
not(G) :- '$current_module'(Module), '$meta_call'(not(G),Module).
|
2001-12-11 16:40:51 +00:00
|
|
|
|
2003-01-30 18:00:26 +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'(_,_,_), !.
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- ['errors.yap',
|
|
|
|
'utils.yap',
|
|
|
|
'arith.yap'].
|
|
|
|
|
|
|
|
:- compile_expressions.
|
|
|
|
|
|
|
|
:- [ 'yio.yap',
|
|
|
|
'debug.yap',
|
|
|
|
'consult.yap',
|
|
|
|
'checker.yap',
|
|
|
|
'depth_bound.yap',
|
|
|
|
'directives.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',
|
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',
|
|
|
|
'sockets.yap',
|
|
|
|
'sort.yap',
|
|
|
|
'setof.yap',
|
|
|
|
'strict_iso.yap',
|
|
|
|
'tabling.yap',
|
|
|
|
'yapor.yap'].
|
|
|
|
|
|
|
|
:- ['protect.yap'].
|
|
|
|
|
|
|
|
version(yap,[4,1]).
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
:- ['corout.yap',
|
|
|
|
'arrays.yap'].
|
|
|
|
|
|
|
|
:- '$change_type_of_char'(36,7). % Make $ a symbol character
|
|
|
|
|
|
|
|
:- default_sequential(off).
|
|
|
|
|
|
|
|
:- '$set_pred_module'(get_att(_,_,_), attributes),
|
|
|
|
'$set_pred_module'(get_all_atts(_,_), attributes),
|
|
|
|
'$set_pred_module'(free_att(_,_), attributes),
|
|
|
|
'$set_pred_module'(put_att(_,_,_), attributes),
|
|
|
|
'$set_pred_module'(rm_att(_,_), attributes),
|
|
|
|
'$set_pred_module'(inc_n_of_atts(_), attributes),
|
|
|
|
'$set_pred_module'(n_of_atts(_), attributes),
|
2002-05-17 02:01:07 +01:00
|
|
|
'$set_pred_module'(bind_attvar(_), attributes),
|
|
|
|
'$set_pred_module'(all_attvars(_), attributes).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2003-01-29 14:47:17 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- '$set_pred_module'(open_mem_read_stream(_,_), charsio),
|
|
|
|
'$set_pred_module'(open_mem_write_stream(_), charsio),
|
|
|
|
'$set_pred_module'(peek_mem_write_stream(_,_,_), charsio).
|
|
|
|
|
|
|
|
:- '$set_pred_module'(term_hash(_,_,_,_), terms),
|
|
|
|
'$set_pred_module'(term_hash(_,_), terms),
|
|
|
|
'$set_pred_module'(term_variables(_,_), terms),
|
|
|
|
'$set_pred_module'(variant(_,_), terms),
|
|
|
|
'$set_pred_module'(subsumes(_,_), terms),
|
|
|
|
'$set_pred_module'(cyclic_term(_), terms),
|
2002-03-07 05:13:21 +00:00
|
|
|
'$set_pred_module'(acyclic_term(_,_), terms),
|
|
|
|
'$set_pred_module'(variable_in_term(_,_), terms).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
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
|
|
|
|
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).
|
|
|
|
|
|
|
|
:- system_mode(verbose,on).
|
|
|
|
|
|
|
|
:- module(user).
|
|
|
|
|
|
|
|
:- multifile goal_expansion/3.
|
|
|
|
|
|
|
|
:- dynamic_predicate(goal_expansion/3, logical).
|
|
|
|
|
2001-11-15 00:01:43 +00:00
|
|
|
:- multifile term_expansion/2.
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2001-11-15 00:01:43 +00:00
|
|
|
:- dynamic_predicate(term_expansion/2, logical).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-02-08 22:19:24 +00:00
|
|
|
:- multifile file_search_path/2.
|
|
|
|
|
|
|
|
:- dynamic_predicate(file_search_path/2, logical).
|
|
|
|
|
|
|
|
file_search_path(library, Dir) :-
|
|
|
|
library_directory(Dir).
|
|
|
|
file_search_path(system, Dir) :-
|
|
|
|
prolog_flag(host_type, Dir).
|
|
|
|
|
|
|
|
:- multifile library_directory/1.
|
|
|
|
|
|
|
|
:- dynamic_predicate(library_directory/1, logical).
|
|
|
|
|
2002-06-03 17:13:49 +01:00
|
|
|
library_directory(D) :-
|
|
|
|
getenv('YAPSHAREDIR', D).
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
:- get_value(system_library_directory,D), assert(library_directory(D)).
|
|
|
|
|
2002-06-03 17:13:49 +01:00
|
|
|
|