split docs and user pred
This commit is contained in:
parent
4477350d08
commit
77335f2ea0
30
packages/swig/python/setup.py.cmake
Normal file
30
packages/swig/python/setup.py.cmake
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
from setuptools import setup, Extension
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name = "yap",
|
||||||
|
version = "0.1",
|
||||||
|
ext_modules=[Extension('_yap', [ 'yapPYTHON_wrap.cxx',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/pl2py.c',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/python.c',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/py2pl.c',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/pl2pl.c',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/pypreds.c',
|
||||||
|
'${CMAKE_SOURCE_DIR}/packages/python/pybips.c'],
|
||||||
|
define_macros = [('MAJOR_VERSION', '1'),
|
||||||
|
('MINOR_VERSION', '0'),
|
||||||
|
('_YAP_NOT_INSTALLED_', '1')],
|
||||||
|
swig_opts=['-py3', '-c++','-I${CMAKE_SOURCE_DIR}/CXX'],
|
||||||
|
runtime_library_dirs=['/usr/local/lib'],
|
||||||
|
library_dirs=['../../..','../../../CXX'],
|
||||||
|
libraries=['Yap++','Yap'],
|
||||||
|
include_dirs=['../../..',
|
||||||
|
'${CMAKE_SOURCE_DIR}/H',
|
||||||
|
'${CMAKE_SOURCE_DIR}/H/generated',
|
||||||
|
'${CMAKE_SOURCE_DIR}/OPTYap',
|
||||||
|
'${CMAKE_SOURCE_DIR}/os',
|
||||||
|
'${CMAKE_SOURCE_DIR}/include',
|
||||||
|
'${CMAKE_SOURCE_DIR}/CXX', '.']
|
||||||
|
)],
|
||||||
|
py_modules = ['yap']
|
||||||
|
)
|
||||||
|
\
|
173
pl/absf.yap
173
pl/absf.yap
@ -542,176 +542,3 @@ remove_from_path(New) :- '$check_path'(New,Path),
|
|||||||
'$check_path'([Ch],[Ch,A]) :- !, integer(Ch), '$dir_separator'(A).
|
'$check_path'([Ch],[Ch,A]) :- !, integer(Ch), '$dir_separator'(A).
|
||||||
'$check_path'([N|S],[N|SN]) :- integer(N), '$check_path'(S,SN).
|
'$check_path'([N|S],[N|SN]) :- integer(N), '$check_path'(S,SN).
|
||||||
|
|
||||||
/**
|
|
||||||
@defgroup pathconf Configuration of the Prolog file search path
|
|
||||||
@ingroup AbsoluteFileName
|
|
||||||
|
|
||||||
Prolog systems search follow a complex search on order to track down files.
|
|
||||||
|
|
||||||
@{
|
|
||||||
**/
|
|
||||||
|
|
||||||
/**
|
|
||||||
@pred user:library_directory(?Directory:atom) is nondet, dynamic
|
|
||||||
|
|
||||||
Dynamic, multi-file predicate that succeeds when _Directory_ is a
|
|
||||||
current library directory name. Asserted in the user module.
|
|
||||||
|
|
||||||
Library directories are the places where files specified in the form
|
|
||||||
`library( _File_ )` are searched by the predicates consult/1,
|
|
||||||
reconsult/1, use_module/1, ensure_loaded/1, and load_files/2.
|
|
||||||
|
|
||||||
This directory is initialized by a rule that calls the system predicate
|
|
||||||
system_library/1.
|
|
||||||
*/
|
|
||||||
:- multifile user:library_directory/1.
|
|
||||||
|
|
||||||
:- dynamic user:library_directory/1.
|
|
||||||
%% Specifies the set of directories where
|
|
||||||
% one can find Prolog libraries.
|
|
||||||
%
|
|
||||||
% 1. honor YAPSHAREDIR
|
|
||||||
user:library_directory( Dir ) :-
|
|
||||||
getenv( 'YAPSHAREDIR', Dir).
|
|
||||||
%% 2. honor user-library
|
|
||||||
user:library_directory( '~/share/Yap' ).
|
|
||||||
%% 3. honor current directory
|
|
||||||
user:library_directory( '.' ).
|
|
||||||
%% 4. honor default location.
|
|
||||||
user:library_directory( Dir ) :-
|
|
||||||
system_library( Dir ).
|
|
||||||
|
|
||||||
/**
|
|
||||||
@pred user:commons_directory(? _Directory_:atom) is nondet, dynamic
|
|
||||||
|
|
||||||
State the location of the Commons Prolog Initiative.
|
|
||||||
|
|
||||||
This directory is initialized as a rule that calls the system predicate
|
|
||||||
library_directories/2.
|
|
||||||
:- dynamic user:commons_directory/1.
|
|
||||||
|
|
||||||
|
|
||||||
user:commons_directory( Path ):-
|
|
||||||
system_commons( Path ).
|
|
||||||
|
|
||||||
/**
|
|
||||||
@pred user:foreign_directory(? _Directory_:atom) is nondet, dynamic
|
|
||||||
|
|
||||||
State the location of the Foreign Prolog Initiative.
|
|
||||||
|
|
||||||
This directory is initialized as a rule that calls the system predicate
|
|
||||||
library_directories/2.
|
|
||||||
*/
|
|
||||||
|
|
||||||
:- multifile user:foreign_directory/1.
|
|
||||||
|
|
||||||
:- dynamic user:foreign_directory/1.
|
|
||||||
|
|
||||||
user:foreign_directory( Path ):-
|
|
||||||
system_foreign( Path ).
|
|
||||||
|
|
||||||
/**
|
|
||||||
@pred user:prolog_file_type(?Suffix:atom, ?Handler:atom) is nondet, dynamic
|
|
||||||
|
|
||||||
This multifile/dynamic predicate relates a file extension _Suffix_
|
|
||||||
to a language or file type _Handler_. By
|
|
||||||
default, it supports the extensions yap, pl, and prolog for prolog files and
|
|
||||||
uses one of dll, so, or dylib for shared objects. Initial definition is:
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog
|
|
||||||
prolog_file_type(yap, prolog).
|
|
||||||
prolog_file_type(pl, prolog).
|
|
||||||
prolog_file_type(prolog, prolog).
|
|
||||||
prolog_file_type(qly, prolog).
|
|
||||||
prolog_file_type(qly, qly).
|
|
||||||
prolog_file_type(A, prolog) :-
|
|
||||||
current_prolog_flag(associate, A),
|
|
||||||
A \== prolog,
|
|
||||||
A \==pl,
|
|
||||||
A \== yap.
|
|
||||||
prolog_file_type(A, executable) :-
|
|
||||||
current_prolog_flag(shared_object_extension, A).
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
:- multifile user:prolog_file_type/2.
|
|
||||||
|
|
||||||
:- dynamic user:prolog_file_type/2.
|
|
||||||
|
|
||||||
user:prolog_file_type(yap, prolog).
|
|
||||||
user:prolog_file_type(pl, prolog).
|
|
||||||
user:prolog_file_type(prolog, prolog).
|
|
||||||
user:prolog_file_type(A, prolog) :-
|
|
||||||
current_prolog_flag(associate, A),
|
|
||||||
A \== prolog,
|
|
||||||
A \== pl,
|
|
||||||
A \== yap.
|
|
||||||
user:prolog_file_type(qly, qly).
|
|
||||||
user:prolog_file_type(A, executable) :-
|
|
||||||
current_prolog_flag(shared_object_extension, A).
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@pred user:file_search_path(+Name:atom, -Directory:atom) is nondet
|
|
||||||
|
|
||||||
Allows writing file names as compound terms. The _Name_ and
|
|
||||||
_DIRECTORY_ must be atoms. The predicate may generate multiple
|
|
||||||
solutions. The predicate is originally defined as follows:
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog
|
|
||||||
file_search_path(library, Dir) :-
|
|
||||||
library_directory(Dir).
|
|
||||||
file_search_path(commons, Dir) :-
|
|
||||||
commons_directory(Dir).
|
|
||||||
file_search_path(swi, Home) :-
|
|
||||||
current_prolog_flag(home, Home).
|
|
||||||
file_search_path(yap, Home) :-
|
|
||||||
current_prolog_flag(home, Home).
|
|
||||||
file_search_path(system, Dir) :-
|
|
||||||
prolog_flag(host_type, Dir).
|
|
||||||
file_search_path(foreign, Dir) :-
|
|
||||||
foreign_directory(Dir).
|
|
||||||
file_search_path(path, C) :-
|
|
||||||
( getenv('PATH', A),
|
|
||||||
( current_prolog_flag(windows, true)
|
|
||||||
-> atomic_list_concat(B, ;, A)
|
|
||||||
; atomic_list_concat(B, :, A)
|
|
||||||
),
|
|
||||||
lists:member(C, B)
|
|
||||||
).
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Thus, `compile(library(A))` will search for a file using
|
|
||||||
library_directory/1 to obtain the prefix,
|
|
||||||
whereas 'compile(system(A))` would look at the `host_type` flag.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
:- multifile user:file_search_path/2.
|
|
||||||
|
|
||||||
:- dynamic user:file_search_path/2.
|
|
||||||
|
|
||||||
user:file_search_path(library, Dir) :-
|
|
||||||
user:library_directory(Dir).
|
|
||||||
user:file_search_path(commons, Dir) :-
|
|
||||||
user:commons_directory(Dir).
|
|
||||||
user:file_search_path(swi, Home) :-
|
|
||||||
current_prolog_flag(home, Home).
|
|
||||||
user:file_search_path(yap, Home) :-
|
|
||||||
current_prolog_flag(home, Home).
|
|
||||||
user:file_search_path(system, Dir) :-
|
|
||||||
prolog_flag(host_type, Dir).
|
|
||||||
user:file_search_path(foreign, '.').
|
|
||||||
user:file_search_path(foreign, yap('lib/Yap')).
|
|
||||||
user:file_search_path(path, C) :-
|
|
||||||
( getenv('PATH', A),
|
|
||||||
( current_prolog_flag(windows, true)
|
|
||||||
-> atomic_list_concat(B, ;, A)
|
|
||||||
; atomic_list_concat(B, :, A)
|
|
||||||
),
|
|
||||||
lists:member(C, B)
|
|
||||||
).
|
|
||||||
|
|
||||||
%% @}
|
|
||||||
|
Reference in New Issue
Block a user