Merge ssh://ssh.dcc.fc.up.pt:31064//home/vsc/yap

This commit is contained in:
Vitor Santos Costa
2018-09-30 00:12:13 +01:00
9 changed files with 191 additions and 156 deletions

View File

@@ -1,15 +1,20 @@
# set(CMAKE_MACOSX_RPATH 1)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_lib(jplYap jpl.h jpl.c hacks.h)
include_directories (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_PATH} )
target_link_libraries(jplYap libYap ${JAVA_JVM_LIBRARY} ${JAVA_AWT_LIBRARY})
if (APPLE)
get_filename_component ( JAVA_AWT_DIR ${JAVA_AWT_LIBRARY} DIRECTORY)
find_library (JLI jli ${JAVA_AWT_DIR}/jli)
endif()
target_link_libraries(jplYap libYap ${JLI} ${JNI_LIBRARIES})
set_target_properties(jplYap PROPERTIES
OUTPUT_NAME jpl
INSTALL_RPATH_USE_LINK_PATH TRUE )
INSTALL_RPATH_USE_LINK_PATH TRUE
)
# set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
install(TARGETS jplYap

View File

@@ -73,7 +73,7 @@ static lbfgsfloatval_t evaluate(
if (result==FALSE) {
printf("ERROR: the evaluate call failed in YAP.\n");
// Goal did not succeed
YAP_ShutdownGoal( TRUE );
YAP_ShutdownGoal( false );
return FALSE;
}
@@ -90,7 +90,7 @@ static lbfgsfloatval_t evaluate(
}
YAP_ShutdownGoal( TRUE );
YAP_ShutdownGoal( false );
return rc;
}
@@ -112,7 +112,7 @@ static int progress(
YAP_Bool result;
YAP_Int s1;
YAP_Term t[9],t2[2], v;
YAP_Term t[10],t2[2], v;
t[0] = YAP_MkFloatTerm(fx);
t[1] = YAP_MkIntTerm((YAP_Int)local_x);
t[1] = YAP_MkApplTerm(ffloats, 1, t+1);
@@ -137,21 +137,19 @@ static int progress(
//optimizer_status=OPTIMIZER_STATUS_RUNNING;
YAP_Term o = YAP_GetFromSlot( s1 );
YAP_ShutdownGoal( false );
if (result==FALSE) {
printf("ERROR: the progress call failed in YAP.\n");
// Goal did not succeed
YAP_ShutdownGoal( TRUE );
return -1;
}
if (YAP_IsIntTerm(o)) {
int v = YAP_IntOfTerm(o);
//YAP_ShutdownGoal( TRUE );
return (int)v;
}
YAP_ShutdownGoal( TRUE );
fprintf(stderr, "ERROR: The progress call back function did not return an integer as last argument\n");
return 1;
}