foreign files

This commit is contained in:
Vitor Santos Costa 2016-02-03 09:22:23 +00:00
parent e97eb4696e
commit 143684731e
15 changed files with 87 additions and 79 deletions

View File

@ -6,12 +6,16 @@
project(YAP) project(YAP)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required (VERSION 2.8)
# where we have most scripts # where we have most scripts
# set path to additional CMake modules # set path to additional CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include(disallow)
disallow_intree_builds()
# set(CMAKE_BUILD_TYPE Debug) # set(CMAKE_BUILD_TYPE Debug)
@ -113,8 +117,9 @@ add_library(libYap
${HEADERS} ${HEADERS}
$<TARGET_OBJECTS:libYAPOs> $<TARGET_OBJECTS:libYAPOs>
$<TARGET_OBJECTS:libOPTYap> $<TARGET_OBJECTS:libOPTYap>
$<TARGET_OBJECTS:myddas> $<TARGET_OBJECTS:myddas>
) $<TARGET_OBJECTS:libswi>
)
set_property(DIRECTORY PROPERTY CXX_STANDARD 11) set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
@ -411,7 +416,7 @@ add_subDIRECTORY (packages/raptor)
add_subDIRECTORY (packages/xml) add_subDIRECTORY (packages/xml)
add_subDIRECTORY (docs) # add_subDIRECTORY (docs)
# add_subDIRECTORY (packages/cuda) # add_subDIRECTORY (packages/cuda)

View File

@ -79,8 +79,6 @@ set (ENGINE_SOURCES
C/utilpreds.c C/utilpreds.c
C/yap-args.c C/yap-args.c
C/write.c C/write.c
library/dialect/swi/fli/swi.c
library/dialect/swi/fli/blobs.c
C/udi.c C/udi.c
#packages/udi/rtree.c #packages/udi/rtree.c
#packages/udi/rtree_udi.c #packages/udi/rtree_udi.c
@ -161,8 +159,7 @@ set(C_INTERFACE_SOURCES
CXX/yapdb.hh CXX/yapdb.hh
CXX/yapi.hh CXX/yapi.hh
BEAM/eam.h BEAM/eamamasm.h BEAM/eam.h BEAM/eamamasm.h
library/dialect/swi/fli/swi.h )
)

View File

@ -1913,7 +1913,15 @@ signal. */
/* library search variable */ /* library search variable */
#ifndef SO_PATH #ifndef SO_PATH
#define SO_PATH "${dlls}" #ifdef __APPLE__
#define SO_PATH "DYLD_LIBRARY_PATH"
#elif _WIN32
#define SO_PATH "PATH"
#elif __unix__
#define SO_PATH "LD_LIBRARY_PATH"
#else
#define SO_PATH NULL
#endif
#endif #endif
/* enable condor distributed execution, static compilation */ /* enable condor distributed execution, static compilation */

View File

@ -4,6 +4,7 @@ set (SDIALECTS_PL
syspred_options.pl syspred_options.pl
) )
add_SubDirectory( fli )
install(FILES ${SDIALECTS_PL} install(FILES ${SDIALECTS_PL}
DESTINATION ${libpl}/dialect/swi DESTINATION ${libpl}/dialect/swi

View File

@ -1,24 +1,25 @@
set (LIBSWIFLI_SOURCES set (LIBSWI_SOURCES
swi.c blobs.c) swi.c blobs.c)
set (POSITION_INDEPENDENT_CODE TRUE) set (POSITION_INDEPENDENT_CODE TRUE)
add_library (libSWIFLi OBJECT add_library (libswi OBJECT
${LIBSWIFLI_SOURCES}) ${LIBSWI_SOURCES})
set_target_properties(libSWIFLi set_target_properties(libswi
PROPERTIES PROPERTIES
# RPATH ${libdir} VERSION ${LIBYAPTAI_FULL_VERSION} # RPATH ${libdir} VERSION ${LIBYAPTAI_FULL_VERSION}
# SOVERSION ${LIBYAPTAI_MAJOR_VERSION}.${LIBYAPTAI_MINOR_VERSION} # SOVERSION ${LIBYAPTAI_MAJOR_VERSION}.${LIBYAPTAI_MINOR_VERSION}
POSITION_INDEPENDENT_CODE TRUE POSITION_INDEPENDENT_CODE ON
OUTPUT_NAME swiFLI
) )
include_directories (../../../H ../.../../include ../os ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIR}) include_directories (../../../H ../.../../include ../os ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIR})
target_link_libraries( libYap) target_link_libraries( libYap)
set (YAP_SWILIB $<TARGET_FILE_NAME:libswi> )
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIR} ) set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIR} )
#set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GMP_LIBRARIES} ) #set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GMP_LIBRARIES} )

View File

@ -27,7 +27,7 @@
:- module( operating_system_support, :- module(operating_system_support,
[ [
datime/1, datime/1,
delete_file/1, delete_file/1,
@ -35,8 +35,7 @@
directory_files/2, directory_files/2,
environ/2, environ/2,
exec/3, exec/3,
file_exists/1, file_exists/2,
file_exists/2,
file_property/2, file_property/2,
host_id/1, host_id/1,
host_name/1, host_name/1,
@ -46,7 +45,7 @@
mktemp/2, mktemp/2,
make_directory/1, make_directory/1,
popen/3, popen/3,
rename_file/2, rename_file/2,
shell/0, shell/0,
shell/1, shell/1,
shell/2, shell/2,
@ -142,7 +141,7 @@ recursively, and `ignore` if errors are not to be reported.
This example is equivalent to using the delete_file/1 predicate: This example is equivalent to using the delete_file/1 predicate:
~~~~~ ~~~~~
?- delete_file(x, [recursive]). ?- delete_file(x, [recursive]).
~~~~~ ~~~~~
@ -266,7 +265,7 @@ tmpnam/1 instead.
The `mktime/2` procedure receives a term of the form _datime(+ _Year_, The `mktime/2` procedure receives a term of the form _datime(+ _Year_,
+ _Month_, + _DayOfTheMonth_, + _Hour_, + _Minute_, + _Second_)_ and + _Month_, + _DayOfTheMonth_, + _Hour_, + _Minute_, + _Second_)_ and
returns the number of _Seconds_ elapsed since 00:00:00 on January 1, returns the number of _Seconds_ elapsed since 00:00:00 on January 1,
1970, Coordinated Universal Time (UTC). The user provides information 1970, Coordinated Universal Time (UTC). The user provides information
on _Year_, _Month_, _DayOfTheMonth_, _Hour_, _Minute_, and on _Year_, _Month_, _DayOfTheMonth_, _Hour_, _Minute_, and
_Second_. The _Hour_ is given on local time. This function uses the _Second_. The _Hour_ is given on local time. This function uses the
@ -558,7 +557,7 @@ file_property(File, Type, Size, Date, Permissions, LinkName) :-
file_property(File, Type, Size, Date, Permissions, LinkName, Error), file_property(File, Type, Size, Date, Permissions, LinkName, Error),
handle_system_internal(Error, off, file_property(File)). handle_system_internal(Error, off, file_property(File)).
file_exists(File, Permissions) :- file_exists(File, Permissions) :-
var(File), !, var(File), !,
throw(error(instantiation_error,file_exists(File, Permissions))). throw(error(instantiation_error,file_exists(File, Permissions))).

View File

@ -1433,10 +1433,10 @@ static Int open4(USES_REGS1) { /* '$open'(+File,+Mode,?Stream,-ReturnCode) */
static Int p_file_expansion(USES_REGS1) { /* '$file_expansion'(+File,-Name) */ static Int p_file_expansion(USES_REGS1) { /* '$file_expansion'(+File,-Name) */
Term file_name = Deref(ARG1); Term file_name = Deref(ARG1);
/* we know file_name is bound */ /* we know file_name is bound */
if (!IsAtomTerm(file_name)) { if (IsVarTerm(file_name)) {
PlIOError(TYPE_ERROR_ATOM, file_name, "absolute_file_name/3"); PlIOError(INSTANTIATION_ERROR, file_name, "absolute_file_name/3");
return (FALSE); return (FALSE);
} }
if (!Yap_TrueFileName(RepAtom(AtomOfTerm(file_name))->StrOfAE, if (!Yap_TrueFileName(RepAtom(AtomOfTerm(file_name))->StrOfAE,

View File

@ -11,31 +11,31 @@ macro_log_feature (Java_Development_FOUND "Java"
"http://www.java.org" FALSE) "http://www.java.org" FALSE)
if (Java_Development_FOUND) if (Java_Development_FOUND)
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler find_package(JNI)
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator include(UseJava)
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
# Java_JAR_EXECUTABLE = the full path to the Java archiver
# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
# Java_VERSION_MAJOR = The major version of the package found.
# Java_VERSION_MINOR = The minor version of the package found.
# Java_VERSION_PATCH = The patch version of the package found.
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
# JAVA_LIBRARIES - path to the java library
# JAVA_INCLUDE_PATH - path to where Java.h is found (deprecated)
# JAVA_INCLUDE_DIRS - path to where Java.h is found
# JAVA_DEBUG_LIBRARIES - path to the debug library (deprecated)
# JAVALIBS_VERSION_STRING - version of the Java libs found (since CMake 2.8.8)
#
# #
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
# Java_JAR_EXECUTABLE = the full path to the Java archiver
# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
# Java_VERSION_MAJOR = The major version of the package found.
# Java_VERSION_MINOR = The minor version of the package found.
# Java_VERSION_PATCH = The patch version of the package found.
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
# #
# The Java_ADDITIONAL_VERSIONS variable can be used to specify a list # The Java_ADDITIONAL_VERSIONS variable can be used to specify a list
# of version numbers that should be taken into account when searching # of version numbers that should be taken into account when searching
# for Java. You need to set this variable before calling # for Java. You need to set this variable before calling
# find_package(JavaLibs). # find_package(JavaLibs).
# #
macro_optional_find_package(JNI ON) #macro_optional_find_package(JNI ON)
# JNI_INCLUDE_DIRS = the include dirs to use # JNI_INCLUDE_DIRS = the include dirs to use
# JNI_LIBRARIES = the libraries to use # JNI_LIBRARIES = the libraries to use
# JNI_FOUND = TRUE if JNI headers and libraries were found. # JNI_FOUND = TRUE if JNI headers and libraries were found.
@ -45,23 +45,10 @@ if (Java_Development_FOUND)
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h # JAVA_INCLUDE_PATH2 = the include path to jni_md.h
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h # JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
add_library (jplYap SHARED src/c/jpl.c) add_subdirectory (src/c)
add_subdirectory (src/java) add_subdirectory (src/java)
include_directories (${JAVA_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS})
target_link_libraries(jplYap libYap ${JAVA_LIBRARIES} ${JNI_LIBRARIES})
set_target_properties(jplYap PROPERTIES
OUTPUT_NAME jpl )
set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
install(TARGETS jplYap
LIBRARY DESTINATION ${dlls}
)
install(FILES jpl.pl install(FILES jpl.pl
DESTINATION ${libpl} DESTINATION ${libpl}
) )

View File

@ -4488,8 +4488,8 @@ search_path_separator(:).
% we do not check for that. % we do not check for that.
check_java_environment :- check_java_environment :-
check_lib(java), check_lib(jvm),
check_lib(jvm). check_lib(java).
check_lib(Name) :- check_lib(Name) :-
check_shared_object(Name, File, EnvVar, Absolute), check_shared_object(Name, File, EnvVar, Absolute),
@ -4666,13 +4666,17 @@ java_home(Home) :-
atomic_list_concat([Key0, Version], /, Key), atomic_list_concat([Key0, Version], /, Key),
win_registry_get_value(Key, 'JavaHome', WinHome), win_registry_get_value(Key, 'JavaHome', WinHome),
prolog_to_os_filename(Home, WinHome), prolog_to_os_filename(Home, WinHome),
exists_directory(Home), !. exists_directory(Home).
:- else. :- else.
java_home(Home) :- java_home(Home) :-
member(Home, [ '/usr/lib/java', member(Home, [ '/usr/lib/java',
'/usr/local/lib/java' '/usr/lib/jvm',
'/usr/lib/jvm/jre',
'/usr/local/lib/java',
'/usr/local/lib/jvm',
'/usr/local/lib/jvm/jre'
]), ]),
exists_directory(Home), !. exists_directory(Home).
:- endif. :- endif.
:- dynamic :- dynamic

View File

@ -6,10 +6,10 @@ include_directories (${JAVA_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS} )
target_link_libraries(jplYap libYap ${JNI_LIBRARIES} ${JAVA_LIBRARIES}) target_link_libraries(jplYap libYap ${JNI_LIBRARIES} ${JAVA_LIBRARIES})
set_target_properties(jplYap PROPERTIES set_target_properties(jplYap PROPERTIES
OUTPUT_NAME jpl ) OUTPUT_NAME jpl
INSTALL_RPATH_USE_LINK_PATH TRUE )
set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
# set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
install(TARGETS jplYap install(TARGETS jplYap
LIBRARY DESTINATION ${dlls} LIBRARY DESTINATION ${dlls}
) )

View File

@ -1969,7 +1969,7 @@ jni_ensure_jvm_plc(void)
#if __YAP_PROLOG__ #if __YAP_PROLOG__
#include "hacks.c" #include "hacks.h"
#endif #endif
/* NB after any JNI call which clearly indicates success, */ /* NB after any JNI call which clearly indicates success, */

View File

@ -1,7 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Nicos Angelopoulos, Vitor Santos Costa, Jan Wielemaker % Author: Nicos Angelopoulos, Vitor Santos Costa, Jan Wielemaker
% E-mail: Nicos Angelopoulos <nicos@gmx.co.uk> % E-mail: Nicos Angelopoulos <nicos@gmx.co.uk>
% Copyright (C): Nicos Angelopoulos, Universidade do Porto, VU University Amsterdam % Copyright (C): Nicos Angelopoulos, Universidade do Porto, VU University Amsterdam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% This file is part of real % This file is part of real
@ -49,12 +49,12 @@
op(100, fy, '.') op(100, fy, '.')
]). ]).
:- use_module(library(shlib)). :- use_module(library(shlib)).
:- use_module(library(lists)). :- use_module(library(lists)).
:- use_module(library(apply_macros)). :- use_module(library(apply_macros)).
:- use_module(library(charsio)). :- use_module(library(charsio)).
:- use_module(library(readutil)). :- use_module(library(readutil)).
:- use_module(library(debug)).
:- dynamic( real:r_started/1 ). :- dynamic( real:r_started/1 ).

View File

@ -604,11 +604,11 @@ Defines the relation: _P_ is a currently defined predicate whose name is the at
*/ */
current_predicate(A,T0) :- current_predicate(A,T0) :-
'$yap_strip_module'(T0, M, T), '$yap_strip_module'(T0, M, T),
( (
'$current_predicate'(A,M, T, user) '$current_predicate'(A,M, T, user)
; ;
'$imported_predicate'(T, M, T1, M1), '$imported_predicate'(T, M, T1, M1),
\+ '$is_system_predicate'(T1,M1) \+ '$is_system_predicate'(T1,M1)
). ).
/** @pred system_predicate( ?_P_ ) /** @pred system_predicate( ?_P_ )
@ -661,9 +661,9 @@ system_predicate(P0) :-
current_predicate(F0) :- current_predicate(F0) :-
'$yap_strip_module'(F0, M, F), '$yap_strip_module'(F0, M, F),
(var(F) -> (var(F) ->
F = A/N, F = A/N,
current_predicate(A, M:S), current_predicate(A, M:S),
functor(S, A, N) functor(S, A, N)
; ;
( (
functor(F,AN,2) functor(F,AN,2)

View File

@ -20,7 +20,7 @@ xc/*************************************************************************
% This protects all code from further changes % This protects all code from further changes
% and also makes it impossible from some predicates to be seen % and also makes it impossible from some predicates to be seen
'$protect' :- '$protect' :-
'$current_predicate'(Name,M,P,_),riteln(P), '$current_predicate'(Name,M,P,_),
M \= user, M \= user,
functor(P,Name,Arity), functor(P,Name,Arity),
'$new_system_predicate'(Name,Arity,M), '$new_system_predicate'(Name,Arity,M),

View File

@ -318,6 +318,9 @@ qend_program :-
prompt(_,'| '), prompt(_,'| '),
catch(once(user:G),Error,user:'$Error'(Error)), catch(once(user:G),Error,user:'$Error'(Error)),
fail. fail.
'$init_from_saved_state_and_args' :-
'$protect',
fail.
'$init_from_saved_state_and_args'. '$init_from_saved_state_and_args'.
'$init_path_extensions' :- '$init_path_extensions' :-
@ -371,6 +374,9 @@ qend_program :-
call(db_open(mysql,myddas,Host/Db,User,Pass)), call(db_open(mysql,myddas,Host/Db,User,Pass)),
'$myddas_import_all', '$myddas_import_all',
fail. fail.
'$startup_goals' :-
'$protect',
fail.
'$startup_goals'. '$startup_goals'.
% %
@ -475,7 +481,7 @@ qsave_module(Mod) :-
qsave_module(Mod, OF). qsave_module(Mod, OF).
/** /**
@pred restore(+ _F_) @pred restore(+ _F_)
Restores a previously saved state of YAP from file _F_. Restores a previously saved state of YAP from file _F_.
*/ */