This commit is contained in:
Vitor Santos Costa 2018-07-31 22:13:30 +01:00
parent bf712034a9
commit 55b2325b2e
14 changed files with 361 additions and 365 deletions

View File

@ -984,6 +984,7 @@ void Yap_InitCPredBack_(const char *Name, arity_t Arity, arity_t Extra,
static void InitStdPreds(struct yap_boot_params *yapi)
{
CurrentModule = PROLOG_MODULE;
Yap_InitCPreds();
Yap_InitBackCPreds();
BACKUP_MACHINE_REGS();

View File

@ -1,6 +1,10 @@
site_name: 'YAP'
theme: 'readthedocs'
markdown_extensions:
- smarty
- toc:
permalink: True
- sane_lists
use_directory_urls: false
plugins:
- search

View File

@ -1551,11 +1551,7 @@ FILE *Yap_FileDescriptorFromStream(Term t) {
return rc;
}
void
Yap_InitBackIO (
void)
void Yap_InitBackIO(void)
{
Yap_InitCPredBack("stream_property", 2, 2, stream_property,
cont_stream_property, SafePredFlag | SyncPredFlag);

View File

@ -680,28 +680,13 @@ void Yap_MYDDAS_delete_all_myddas_structs(void) {
void init_myddas(void) {
CACHE_REGS
if (myddas_initialised)
{
return;
}
#if USE_MYDDAS
Term cm=CurrentModule;
CurrentModule = USER_MODULE;
if (myddas_initialised)
return;
#ifdef __ANDROID__
init_sqlite3();
#endif
#if defined MYDDAS_ODBC
Yap_InitBackMYDDAS_ODBCPreds();
#endif
#endif
#if defined MYDDAS_ODBC
Yap_InitMYDDAS_ODBCPreds();
#endif
#if defined USE_MYDDAS
Yap_InitMYDDAS_SharedPreds();
#endif
#if defined MYDDAS_TOP_LEVEL && \
defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE
Yap_InitMYDDAS_TopLevelPreds();
#endif
#if USE_MYDDAS
#define stringify(X) _stringify(X)
#define _stringify(X) #X
Yap_REGS.MYDDAS_GLOBAL_POINTER = NULL;
@ -709,12 +694,28 @@ void init_myddas(void) {
MkAtomTerm(Yap_LookupAtom(stringify(MYDDAS_VERSION))));
Yap_HaltRegisterHook((HaltHookFunc)Yap_MYDDAS_delete_all_myddas_structs,
NULL);
Yap_InitMYDDAS_SharedPreds();
Yap_InitBackMYDDAS_SharedPreds();
#undef stringify
#undef _stringify
Yap_MYDDAS_delete_all_myddas_structs();
#if defined MYDDAS_ODBC
Yap_InitBackMYDDAS_ODBCPreds();
#endif
#endif
#if defined MYDDAS_ODBC
Yap_InitMYDDAS_ODBCPreds();
#endif
#if defined MYDDAS_TOP_LEVEL && \
defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE
Yap_InitMYDDAS_TopLevelPreds();
#endif
c_db_initialize_myddas(PASS_REGS1);
myddas_initialised = TRUE;
#ifdef __ANDROiD__
init_sqlite3();
#endif
#endif
myddas_initialised = true;
CurrentModule = cm;
}

View File

@ -22,6 +22,7 @@
#ifdef DEBUG
:- yap_flag(single_var_warnings,on).
:- yap_flag(write_strings,on).
#endif
#define SWITCH(Contype, G) \
@ -181,7 +182,7 @@
member/2
]).
:- set(verbose,silent).
:- set_prolog_flag(verbose,silent).
@ -331,7 +332,7 @@ db_stats(Protocol,List):-
#ifdef DEBUG
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% db_stats_time(+,-)
% Reference is C pointer (memory reference)
% Reference is C puuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uuuuu;ointer (memory reference)
%
db_stats_time(Reference,Time):-
'$error_checks'(db_stats_time(Reference,Time)),
@ -449,7 +450,6 @@ db_assert(Connection,PredName):-
'$error_checks'(db_insert2(Connection,PredName,Code)),
'$get_values_for_insert'(Code,ValuesList,RelName),
'$make_atom'(['INSERT INTO `',RelName,'` VALUES '|ValuesList],SQL),
get_value(Connection,Con),
c_db_connection_type(Con,ConType),
'$write_or_not'(SQL),
@ -685,17 +685,18 @@ db_describe(Connection,Y,Z) :-
db_datalog_show_tables :-
db_datalog_show_tables(myddas).
db_show_tables :-
'$error_checks'(db_datalog_show_tables),
get_value(myddas,Con),
c_db_connection_type(Con,DBMS),
DBMS:datalog_show_tables.
db_datalog_show_tables(Connection) :-
'$error_checks'(db_datalog_show_tables(Connection) ),
get_value(Connection,Con),
c_db_connection_type(Con,DBMS),
switch( DBMS, datalog_show_tables(Connection) ).
db_datalog_show_tables :-
'$error_checks'(db_datalog_show_tables),
get_value(myddas,Con),
c_db_connection_type(Con,DBMS),
DBMS:datalog_show_tables.
/**
@pred db_show_tables(+,?).

View File

@ -230,7 +230,7 @@ db_abolish(PredName,Arity):-
%
db_listing:-
c_db_connection(Con),
c_db_preds_conn(Con,Module,Name,Arity),
user:c_db_preds_conn(Con,Module,Name,Arity),
listing(Module:Name/Arity),
fail.
db_listing.
@ -243,15 +243,15 @@ db_listing.
%
db_listing(Module:Name/Arity):-!,
c_db_connection(Con),
c_db_preds_conn(Con,Module,Name,Arity),
user:c_db_preds_conn(Con,Module,Name,Arity),
listing(Module:Name/Arity).
db_listing(Name/Arity):-!,
c_db_connection(Con),
c_db_preds_conn(Con,Module,Name,Arity),
user:c_db_preds_conn(Con,Module,Name,Arity),
listing(Module:Name/Arity).
db_listing(Name):-
c_db_connection(Con),
c_db_preds_conn(Con,Module,Name,Arity),
user:c_db_preds_conn(Con,Module,Name,Arity),
listing(Module:Name/Arity).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -260,13 +260,12 @@ db_listing(Name):-
%
table_arity( Con, ConType, RelationName, Arity ) :-
c_db_connection_type(Con,ConType),
writeln( ConType ),
% get relation arity
( ConType == mysql ->
c_db_my_number_of_fields(RelationName,Con,Arity)
;
ConType == postgres ->
c_postgres_number_of_fields(RelationName,Con,Arity)
c_postgres_number_of_fields(RelationName,Con,Arit)
;
ConType == odbc ->
c_odbc_number_of_fields(RelationName,Con,Arity)

View File

@ -28,7 +28,7 @@
#define NAME() 'YAPodbc'
#define MODULE() user
#define INIT() init_odbc
#elif defined( postgres )
#elif defined( postrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrs )
#undef postgres
#define DBMS(x) postgres_##x
#define c_DBMS(x) c_postgres_##x
@ -101,7 +101,6 @@ DBMS(result_set)(store_result):-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DBMS(db_datalog_describe)/2
%

View File

@ -14,6 +14,9 @@ main_ :-
fail.
main_ .
init :-
catch(db_open(sqlite3,'chinook.db',_,_), _, fail),
!.
init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
% db_open(sqlite3, 'chinook.db', _, _),

View File

@ -6,7 +6,9 @@
#define PY4YAP_H 1
#define PASS_REGS
#define USES_REGSg
#define USES_REGS
#include "Yap.h"
//@{

View File

@ -570,7 +570,7 @@ static int python_import(term_t mname, term_t mod) {
const char *sn, *as = NULL;
Term t = Deref(ARG1), sm;
if (IsApplTerm(t)) {
Functor f = FunctorOfTerm(t);
Functor f = (Functor)*RepAppl(t);
if (f != FunctorAs)
return false;
do_as = true;

View File

@ -54,7 +54,6 @@ endif()
COMMAND ${SWIG_EXECUTABLE} -c++ -python -O -py3 -module "yap" -addextern -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/H/generated -I${CMAKE_SOURCE_DIR}/include
-I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/utf8proc -I.././.. -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/packages/python
-outdir ${CMAKE_CURRENT_BINARY_DIR}/yap4py -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_CURRENT_BINARY_DIR}/yap4py/yap_wrap.cxx -oh ${CMAKE_CURRENT_BINARY_DIR}/yap4py/yap_wrap.hh ${SWIG_SOURCES}
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist ${bdist}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${SWIG_SOURCES} Py4YAP YAP++ yap4py/yapi.cpp YAP4PY_PY
)
@ -70,7 +69,9 @@ endif()
DEPENDS ${PYTHON_SOURCES}
)
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install ${PYTHON_USER_INSTALL} --ignore-installed .
install(CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist ${bdist}
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${PYTHON_USER_INSTALL} --ignore-installed .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${YAP_INSTALL_DLLDIR} )

View File

@ -84,8 +84,8 @@ native_sources = ["yap4py/yap_wrap.cxx","yap4py/yapi.cpp"]
extensions = [Extension('_yap', native_sources,
define_macros=[('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0'),
define_macros=[('MAJOR_VERSION', '@YAP_MAJOR_VERSION@'),
('MINOR_VERSION', '@YAP_MINOR_VERSION@'),
('_YAP_NOT_INSTALLED_', '1'),
('YAP_PYTHON', '1'),
('PYTHONSWIG', '1'),
@ -104,7 +104,7 @@ extensions = [Extension('_yap', native_sources,
'${CMAKE_SOURCE_DIR}/os',
'${CMAKE_SOURCE_DIR}/utf8proc',
'${CMAKE_SOURCE_DIR}/packages/python',
'../../..',
'${CMAKE_BINARY_DIR}',
'${CMAKE_SOURCE_DIR}/CXX' ]
)]

View File

@ -185,7 +185,6 @@ yap_ipython/sphinxext/ipython_console_highlighting.py
yap_ipython/sphinxext/ipython_directive.py
yap_ipython/nbformat.py
yap_ipython/paths.py
yap_ipython/_version.py
yap_ipython/nbconvert.py
yap_ipython/qt.py
yap_ipython/html.py
@ -413,23 +412,12 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kerne
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kernel.js
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/meta.js
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/meta.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/
DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/meta.js
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/yap.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/yap.js
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/mode.js
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/mode.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/
DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/mode.js
)
foreach(f ${FILES})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${f}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${f} ${CMAKE_CURRENT_BINARY_DIR}/${f}
@ -441,13 +429,13 @@ endforeach()
add_custom_target(YAP_KERNEL ALL
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/meta.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/mode.js ${OUTS} YAP4PY
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js ${OUTS} YAP4PY
)
install(CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${PYTHON_USER_INSTALL} --ignore-installed --no-deps .
COMMAND ${PYTHON_EXECUTABLE} -m yap_kernel.kernelspec
ERROR_VARIABLE setupErr

View File

@ -293,7 +293,7 @@ abolish(X0) :-
'$old_abolish'(X,M).
'$new_abolish'(V,M) :- var(V), !,
'$abolish_all'(M).
'$abolish_all_in_module'(M).
'$new_abolish'(A/V,M) :- atom(A), var(V), !,
'$abolish_all_atoms'(A,M).
'$new_abolish'(Na//Ar1, M) :-
@ -313,12 +313,12 @@ abolish(X0) :-
'$new_abolish'(T, M) :-
'$do_error'(type_error(predicate_indicator,T),abolish(M:T)).
'$abolish_all'(M) :-
'$abolish_all_in_module'(M) :-
'$current_predicate'(Na, M, S, _),
functor(S, Na, Ar),
'$new_abolish'(Na/Ar, M),
fail.
'$abolish_all'(_).
'$abolish_all_in_module'(_).
'$abolish_all_atoms'(Na, M) :-
'$current_predicate'(Na,M,S,_),
@ -817,3 +817,4 @@ clause_property(ClauseRef, predicate(PredicateIndicator)) :-
/**
@}
*/