docs & compilation
This commit is contained in:
parent
27b540b72b
commit
9ea75834ff
@ -556,10 +556,9 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPError(LOCAL_CommittedError).text()
|
||||
<< ").\n Forwarded...\n\n";
|
||||
YAP_LeaveGoal(result, &q);
|
||||
|
||||
// free(LOCAL_CommittedError);
|
||||
LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
|
||||
LOCAL_ActiveError->errorNo = YAP_NO_ERROR;
|
||||
LOCAL_CommittedError = nullptr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
1163
H/YapGFlagInfo.h
1163
H/YapGFlagInfo.h
File diff suppressed because it is too large
Load Diff
@ -66,10 +66,12 @@ if(R_COMMAND)
|
||||
find_library(R_LIBRARY_READLINE readline
|
||||
DOC "(Optional) system readline library. Only required if the R libraries were built with readline support.")
|
||||
|
||||
|
||||
# Note: R_LIBRARY_BASE is added to R_LIBRARIES twice; this may be due to circular linking dependencies; needs further investigation
|
||||
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
|
||||
if(R_LIBRARY_READLINE)
|
||||
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "FindR.cmake requires the following variables to be set: R_COMMAND")
|
||||
endif()
|
||||
|
||||
# Note: R_LIBRARY_BASE is added to R_LIBRARIES twice; this may be due to circular linking dependencies; needs further investigation
|
||||
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
|
||||
if(R_LIBRARY_READLINE)
|
||||
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
||||
endif()
|
||||
|
@ -892,14 +892,14 @@ EXCLUDE =
|
||||
# The default value is: NO.
|
||||
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
|
||||
# certain files from those directories.
|
||||
#
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
|
||||
EXCLUDE_PATTERNS = @DOCS_EXCLUDE@
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
@ -2109,20 +2109,20 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = #
|
||||
# YAP_FLAG(ITEM,NAME,WRITABLE,DEF,INIT,HELPER)=ITEM \
|
||||
# START_LOCAL_FLAGS="enum THREAD_LOCAL_FLAGS {" \
|
||||
# END_LOCAL_FLAGS=" };"\
|
||||
# START_GLOBAL_FLAGS="enum GLOBAL_FLAGS {" \
|
||||
# END_GLOBAL_FLAGS="};" \
|
||||
# LOCAL(A, B)="A B" \
|
||||
# LOCAL_INIT(A, B, C)="A B;B = C" \
|
||||
# LOCAL_ARRAY(A, B, C)="A B[C]" \
|
||||
# LOCAL_ARRAY_ARRAY(A, B, C,D)="A B[C][D]"\
|
||||
# LOCAL_INIT(A, B, C, D)="A B[C][D]"\
|
||||
# LOCAL_INITF(A, B, C)=" A B; C"\
|
||||
# LOCAL_INIT_RESTORE(A,B,C,D)="A B; C; D;"\
|
||||
# PREG=Yap_REGS.P_
|
||||
PREDEFINED = \
|
||||
YAP_FLAG(ITEM,NAME,WRITABLE,DEF,INIT,HELPER):=NAME \
|
||||
START_LOCAL_FLAGS:="enum THREAD_LOCAL_FLAGS {" \
|
||||
END_LOCAL_FLAGS:=" };"\
|
||||
START_GLOBAL_FLAGS:="enum GLOBAL_FLAGS {" \
|
||||
END_GLOBAL_FLAGS:="};" \
|
||||
LOCAL(A, B):="A B" \
|
||||
LOCAL_INIT(A, B, C):="A B;B := C" \
|
||||
LOCAL_ARRAY(A, B, C):="A B[C]" \
|
||||
LOCAL_ARRAY_ARRAY(A, B, C,D):="A B[C][D]"\
|
||||
LOCAL_INIT(A, B, C, D):="A B[C][D]"\
|
||||
LOCAL_INITF(A, B, C):=" A B; C"\
|
||||
LOCAL_INIT_RESTORE(A,B,C,D):="A B; C; D;"\
|
||||
PREG:=Yap_REGS.P_
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@ -2131,7 +2131,7 @@ PREDEFINED = #
|
||||
# definition found in the source code.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||
# remove all references to function-like macros that are alone on a line, have
|
||||
|
@ -19,231 +19,24 @@
|
||||
#
|
||||
# Variable search order:
|
||||
# 1. Attempt to locate and set R_COMMAND
|
||||
# - If unsuccessful, generate error and prompt user to manually set R_COMMAND
|
||||
# If unsuccessful, generate error and prompt user to manually set R_COMMAND
|
||||
# 2. Use R_COMMAND to set R_HOME
|
||||
# 3. Locate other libraries in the priority:
|
||||
# 1. Within a user-built instance of R at R_HOME
|
||||
# 2. Within an installed instance of R
|
||||
# 3. Within external system libraries
|
||||
#
|
||||
|
||||
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
||||
set_package_properties(R PROPERTIES
|
||||
DESCRIPTION "The R Project for Statistical Computing."
|
||||
URL "https://www.r-project.org/")
|
||||
|
||||
find_program (
|
||||
R_COMMAND
|
||||
NAMES R r
|
||||
)
|
||||
|
||||
if (R_COMMAND)
|
||||
# find the R binary
|
||||
|
||||
MESSAGE(STATUS "Looking for R executable")
|
||||
IF(NOT R_EXECUTABLE)
|
||||
FIND_PROGRAM(R_EXECUTABLE R)
|
||||
IF(R_EXECUTABLE-NOTFOUND)
|
||||
MESSAGE(FATAL_ERROR "Could NOT find R (TODO: name option)")
|
||||
ELSE(R_EXECUTABLE-NOTFOUND)
|
||||
MESSAGE(STATUS "Using R at ${R_EXECUTABLE}")
|
||||
ENDIF(R_EXECUTABLE-NOTFOUND)
|
||||
|
||||
ENDIF(NOT R_EXECUTABLE)
|
||||
|
||||
|
||||
# find R_HOME
|
||||
|
||||
MESSAGE(STATUS "Looking for R_HOME")
|
||||
IF(NOT R_HOME)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${R_EXECUTABLE} "--slave" "--no-save" "-e" "cat(R.home())"
|
||||
OUTPUT_VARIABLE R_HOME)
|
||||
ENDIF(NOT R_HOME)
|
||||
IF(NOT R_HOME)
|
||||
MESSAGE(FATAL_ERROR "Could NOT determine R_HOME (probably you misspecified the location of R)")
|
||||
ELSE(NOT R_HOME)
|
||||
MESSAGE(STATUS "R_HOME is ${R_HOME}")
|
||||
ENDIF(NOT R_HOME)
|
||||
|
||||
# find R include dir
|
||||
|
||||
MESSAGE(STATUS "Looking for R include files")
|
||||
IF(NOT R_INCLUDEDIR)
|
||||
IF(WIN32 OR APPLE) # This version of the test will not work with R < 2.9.0, but the other version (in the else part) will not work on windows or apple (but we do not really need to support ancient versions of R, there).
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${R_EXECUTABLE} "--slave" "--no-save" "-e" "cat(R.home('include'))"
|
||||
OUTPUT_VARIABLE R_INCLUDEDIR)
|
||||
ELSE(WIN32 OR APPLE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${R_EXECUTABLE} CMD sh -c "echo -n $R_INCLUDE_DIR"
|
||||
OUTPUT_VARIABLE R_INCLUDEDIR)
|
||||
ENDIF(WIN32 OR APPLE)
|
||||
ELSE(NOT R_INCLUDEDIR)
|
||||
MESSAGE(STATUS "Location specified by user")
|
||||
ENDIF(NOT R_INCLUDEDIR)
|
||||
|
||||
IF(NOT R_INCLUDEDIR)
|
||||
SET(R_INCLUDEDIR ${R_HOME}/include)
|
||||
MESSAGE(STATUS "Not findable via R. Guessing")
|
||||
ENDIF(NOT R_INCLUDEDIR)
|
||||
MESSAGE(STATUS "Include files should be at ${R_INCLUDEDIR}. Checking for R.h")
|
||||
|
||||
IF(NOT R_H)
|
||||
FIND_FILE(R_H
|
||||
R.h
|
||||
PATHS ${R_INCLUDEDIR}
|
||||
NO_DEFAULT_PATH)
|
||||
ENDIF(NOT R_H)
|
||||
|
||||
IF(NOT R_H)
|
||||
MESSAGE(FATAL_ERROR "Not found")
|
||||
ELSE(NOT R_H)
|
||||
MESSAGE(STATUS "Found at ${R_H}")
|
||||
GET_FILENAME_COMPONENT(R_INCLUDEDIR ${R_H}
|
||||
PATH)
|
||||
ENDIF(NOT R_H)
|
||||
|
||||
# check for existence of libR.so
|
||||
|
||||
IF(NOT LIBR_SO)
|
||||
MESSAGE(STATUS "Checking for existence of R shared library")
|
||||
FIND_LIBRARY(LIBR_SO
|
||||
R
|
||||
PATHS ${R_HOME}/lib ${R_SHAREDLIBDIR} ${R_HOME}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
endif(NOT LIBR_SO)
|
||||
|
||||
|
||||
IF(NOT LIBR_SO)
|
||||
MESSAGE(FATAL_ERROR "Not found. Make sure the location of R was detected correctly, above, and R was compiled with the --enable-shlib option")
|
||||
ELSE(NOT LIBR_SO)
|
||||
MESSAGE(STATUS "Exists at ${LIBR_SO}")
|
||||
GET_FILENAME_COMPONENT(R_SHAREDLIBDIR ${LIBR_SO}
|
||||
PATH)
|
||||
SET(R_USED_LIBS R)
|
||||
ENDIF(NOT LIBR_SO)
|
||||
|
||||
|
||||
# for at least some versions of R, we seem to have to link against -lRlapack. Else loading some
|
||||
# R packages will fail due to unresolved symbols, or we can't link against -lR.
|
||||
# However, we can't do this unconditionally,
|
||||
# as this is not available in some configurations of R
|
||||
|
||||
MESSAGE(STATUS "Checking whether we should link against Rlapack library")
|
||||
FIND_LIBRARY(LIBR_LAPACK
|
||||
Rlapack
|
||||
PATHS ${R_SHAREDLIBDIR}
|
||||
NO_DEFAULT_PATH)
|
||||
IF(NOT LIBR_LAPACK)
|
||||
MESSAGE(STATUS "No, it does not exist in ${R_SHAREDLIBDIR}")
|
||||
ELSE(NOT LIBR_LAPACK)
|
||||
MESSAGE(STATUS "Yes, ${LIBR_LAPACK} exists")
|
||||
SET(R_USED_LIBS ${R_USED_LIBS} Rlapack)
|
||||
IF(WIN32 OR APPLE)
|
||||
ELSE(WIN32 OR APPLE)
|
||||
# needed when linking to Rlapack on linux for some unknown reason.
|
||||
# apparently not needed on windows (let's see, when it comes back to bite us, though)
|
||||
# and compiling on windows is hard enough even without requiring libgfortran, too.
|
||||
SET(R_USED_LIBS ${R_USED_LIBS} gfortran)
|
||||
ENDIF(WIN32 OR APPLE)
|
||||
ENDIF(NOT LIBR_LAPACK)
|
||||
|
||||
# for at least some versions of R, we seem to have to link against -lRlapack. Else loading some
|
||||
# R packages will fail due to unresolved symbols, or we can't link against -lR.
|
||||
# However, we can't do this unconditionally,
|
||||
# as this is not available in some configurations of R
|
||||
|
||||
MESSAGE(STATUS "Checking whether we should link against Rblas library")
|
||||
FIND_LIBRARY(LIBR_BLAS
|
||||
Rblas
|
||||
PATHS ${R_SHAREDLIBDIR}
|
||||
NO_DEFAULT_PATH)
|
||||
IF(NOT LIBR_BLAS)
|
||||
MESSAGE(STATUS "No, it does not exist in ${R_SHAREDLIBDIR}")
|
||||
ELSE(NOT LIBR_BLAS)
|
||||
MESSAGE(STATUS "Yes, ${LIBR_BLAS} exists")
|
||||
SET(R_USED_LIBS ${R_USED_LIBS} Rblas)
|
||||
ENDIF(NOT LIBR_BLAS)
|
||||
|
||||
# find R package library location
|
||||
IF(WIN32)
|
||||
SET(PATH_SEP ";")
|
||||
ELSE(WIN32)
|
||||
SET(PATH_SEP ":")
|
||||
ENDIF(WIN32)
|
||||
|
||||
MESSAGE(STATUS "Checking for R package library location to use")
|
||||
IF(NOT R_LIBDIR)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${R_EXECUTABLE} "--slave" "--no-save" "-e" "cat(paste(unique (c(.Library.site, .Library)), collapse='${PATH_SEP}'))"
|
||||
OUTPUT_VARIABLE R_LIBDIR)
|
||||
ELSE(NOT R_LIBDIR)
|
||||
MESSAGE(STATUS "Location specified by user")
|
||||
ENDIF(NOT R_LIBDIR)
|
||||
|
||||
# strip whitespace
|
||||
STRING(REGEX REPLACE "[ \n]+"
|
||||
"" R_LIBDIR
|
||||
"${R_LIBDIR}")
|
||||
|
||||
# strip leading colon(s)
|
||||
STRING(REGEX REPLACE "^${PATH_SEP}+"
|
||||
"" R_LIBDIR
|
||||
"${R_LIBDIR}")
|
||||
|
||||
# strip trailing colon(s)
|
||||
STRING(REGEX REPLACE "${PATH_SEP}+$"
|
||||
"" R_LIBDIR
|
||||
"${R_LIBDIR}")
|
||||
|
||||
# find first path
|
||||
STRING(REGEX REPLACE "${PATH_SEP}"
|
||||
" " R_LIBDIR
|
||||
"${R_LIBDIR}")
|
||||
|
||||
IF(NOT R_LIBDIR)
|
||||
MESSAGE(STATUS "Not reliably determined or specified. Guessing.")
|
||||
SET(R_LIBDIR ${R_HOME}/library)
|
||||
ENDIF(NOT R_LIBDIR)
|
||||
|
||||
SET(R_LIBDIRS ${R_LIBDIR})
|
||||
SEPARATE_ARGUMENTS(R_LIBDIRS)
|
||||
|
||||
SET(R_LIBDIR)
|
||||
FOREACH(CURRENTDIR ${R_LIBDIRS})
|
||||
IF(NOT USE_R_LIBDIR)
|
||||
IF(EXISTS ${CURRENTDIR})
|
||||
SET(R_LIBDIR ${CURRENTDIR})
|
||||
SET(USE_R_LIBDIR 1)
|
||||
ELSE(EXISTS ${CURRENTDIR})
|
||||
MESSAGE(STATUS "${CURRENTDIR} does not exist. Skipping")
|
||||
ENDIF(EXISTS ${CURRENTDIR})
|
||||
ENDIF(NOT USE_R_LIBDIR)
|
||||
ENDFOREACH(CURRENTDIR ${R_LIBDIRS})
|
||||
|
||||
IF(NOT EXISTS ${R_LIBDIR})
|
||||
MESSAGE(FATAL_ERROR "No existing library location found")
|
||||
ELSE(NOT EXISTS ${R_LIBDIR})
|
||||
MESSAGE(STATUS "Will use ${R_LIBDIR}")
|
||||
ENDIF(NOT EXISTS ${R_LIBDIR})
|
||||
endif()
|
||||
#macro_optional_find_package (R ON)
|
||||
|
||||
if (R_INCLUDEDIR AND R_LIBDIR)
|
||||
add_feature_info(R yes "Real")
|
||||
|
||||
set (REAL_SOURCES
|
||||
real.c
|
||||
)
|
||||
|
||||
set (REAL_PL
|
||||
real.pl
|
||||
)
|
||||
|
||||
add_to_group( REAL_PL pl_library)
|
||||
|
||||
|
||||
URL "https://www.r-project.org/")
|
||||
add_lib(real ${REAL_SOURCES})
|
||||
target_link_libraries (real ${R_LIBRARIES} libYap)
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${R_INCLUDEDIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${R_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
list (APPEND CMAKE_REQUIRED_INCLUDES
|
||||
@ -251,12 +44,8 @@ include_directories (
|
||||
${R_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_lib(real ${REAL_SOURCES})
|
||||
|
||||
target_link_libraries (real ${LIBR_SO} libYap)
|
||||
|
||||
check_include_files( "stdio.h;R.h" HAVE_R_H )
|
||||
check_include_files( "R.h;Rembedded.h" HAVE_R_EMBEDDED_H )
|
||||
check_include_files( "R.h,;Rembedded.h" HAVE_R_EMBEDDED_H )
|
||||
check_include_files( "Rembedded.h;Rinterface.h" HAVE_R_INTERFACE_H )
|
||||
|
||||
configure_file ("rconfig.h.cmake" "rconfig.h" )
|
||||
|
@ -82,11 +82,12 @@
|
||||
|
||||
|
||||
@addtogroup YAPControl
|
||||
|
||||
%% @{
|
||||
@ingroup builtins
|
||||
|
||||
*/
|
||||
|
||||
%% @{
|
||||
|
||||
/** @pred forall(: _Cond_,: _Action_)
|
||||
|
||||
|
||||
@ -618,13 +619,13 @@ break :-
|
||||
'$break'( false ).
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred at_halt( G )
|
||||
*
|
||||
* Hook predicate: _G_ must be called on exit.
|
||||
*
|
||||
* @param _G_: the hook
|
||||
*
|
||||
*
|
||||
* @param _G_: the hook
|
||||
*
|
||||
* @return succeeds with side-effect.
|
||||
*/at_halt(G) :-
|
||||
recorda('$halt', G, _),
|
||||
@ -657,16 +658,16 @@ halt(X) :-
|
||||
set_value('$live','$false'),
|
||||
'$halt'(X).
|
||||
|
||||
/**
|
||||
/**
|
||||
* @pred prolog_current_frame(-Env)
|
||||
*
|
||||
* reports a reference to the last execution environment _Env_.
|
||||
* YAP creates an enviroment when a clause contains several sub-goals.
|
||||
* Facts and simple recursion do not need an environment,
|
||||
*
|
||||
* @param Env
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @param Env
|
||||
*
|
||||
* @return
|
||||
*/prolog_current_frame(Env) :-
|
||||
Env is '$env'.
|
||||
|
||||
|
Reference in New Issue
Block a user