This commit is contained in:
Vitor Santoss Costa 2017-02-22 21:28:05 +00:00
parent 477772e703
commit f3b0e962a7
8 changed files with 32 additions and 20 deletions

View File

@ -43,11 +43,10 @@ void *
Yap_LoadForeignFile(char *file, int flags)
{
char *buf = malloc(1024);
printf("file=%s\n" , file );
void *ptr= (void *)LoadLibrary(file);
if (!ptr) {
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 1023,
NULL);
}
@ -76,12 +75,20 @@ Yap_CloseForeignFile(void *handle)
*/
static Int
LoadForeign(StringList ofiles, StringList libs,
char *proc_name, YapInitProc *init_proc)
const char *proc_name, YapInitProc *init_proc)
{
CACHE_REGS
while (ofiles) {
HINSTANCE handle;
if (*init_proc == NULL &&
(*init_proc = (YapInitProc)GetProcAddress((HMODULE)handle, proc_name)))
{
YapInitProc f = *init_proc;
f();
return true;
}
const char *file = AtomName(ofiles->name);
if (Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true, true) &&
(handle=LoadLibrary(LOCAL_FileNameBuf)) != 0)
@ -90,9 +97,9 @@ LoadForeign(StringList ofiles, StringList libs,
if (*init_proc == NULL)
*init_proc = (YapInitProc)GetProcAddress((HMODULE)handle, proc_name);
} else {
char *buf = malloc(1024);
char *buf = malloc(1024);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 1023,
NULL);
//fprintf(stderr,"WinError: %s\n", LOCAL_ErrorSay);
@ -139,7 +146,7 @@ Yap_LoadForeign(StringList ofiles, StringList libs,
return LoadForeign(ofiles, libs, proc_name, init_proc);
}
void
void
Yap_ShutdownLoadForeign(void)
{
}
@ -152,4 +159,3 @@ Yap_ReLoadForeign(StringList ofiles, StringList libs,
}
#endif

View File

@ -7,7 +7,7 @@ set ( REGEX_INCLUDES
yapregex.h
engine.c
)
set ( REGEX_SOURCES
regcomp.c
regerror.c
@ -15,19 +15,17 @@ set ( REGEX_SOURCES
regfree.c
)
INCLUDE_DIRECTORIES(BEFORE
.
)
add_library (regexp SHARED regexp.c ${REGEX_SOURCES})
target_link_libraries(regexp libYap)
set_target_properties (regexp PROPERTIES PREFIX "")
set_target_properties (regexp PROPERTIES INCLUDE_DIRECTORIES ".")
set_target_properties (regexp PROPERTIES INCLUDE_DIRECTORIES "${CURRENT_BINARY}")
TARGET_INCLUDE_DIRECTORIES (regexp PUBLIC BEFORE
${CMAKE_TOP_SOURCE_DIR}/include;${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR} )
install(TARGETS regexp
LIBRARY DESTINATION ${libdir}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )

View File

@ -46,7 +46,7 @@ static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include "c_interface.h"
#include "YapInterface.h"
#include "yapregex.h"
#include "utils.h"

View File

@ -44,7 +44,6 @@ static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "c_interface.h"
#include "yapregex.h"
#include "utils.h"

View File

@ -93,6 +93,8 @@ typedef struct {
#define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */
#include "YapInterface.h"
int yap_regcomp(regex_t *, const char *, int);
size_t yap_regerror(int, const regex_t *, char *, size_t);
int yap_regexec(const regex_t *, const char *, size_t, regmatch_t [], int);

View File

@ -406,7 +406,7 @@ LeafNode::weight() const
// ancester that is not set. This can only
// happen when calculating the weights
// for the edge labels in graphviz
return nan(NULL);
return nan("SetOrNode::isSet() == false");
}
}
double weight = clause_->literals()[0].isPositive()
@ -1580,4 +1580,3 @@ LiftedKc::printSolverFlags() const
}
} // namespace Horus

View File

@ -23,4 +23,3 @@ class LiftedKc : public LiftedSolver {
} // namespace Horus
#endif // YAP_PACKAGES_CLPBN_HORUS_LIFTEDKC_H_

View File

@ -42,9 +42,18 @@ add_subdirectory(yap_kernel)
ENDIF()
IF(WIN32)
install(TARGETS YAPPython
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
RUNTIME DESTINATION ${bindir}
ARCHIVE DESTINATION ${dlls} )
else()
install(TARGETS YAPPython
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
endif()
endif (PYTHONLIBS_FOUND)